FreeCalypso > hg > fc-magnetite
comparison src/aci2/bmi/mmiBookDetailsWindow.c @ 120:3c2acfa1a72f
src/aci2/bmi: file renames to make filename case consistent
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 07 Oct 2016 03:46:05 +0000 |
parents | src/aci2/bmi/MmiBookDetailsWindow.c@93999a60b835 |
children |
comparison
equal
deleted
inserted
replaced
119:b92a33c204b6 | 120:3c2acfa1a72f |
---|---|
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: PhoneBook | |
15 $File: MmiBookDetailsWindow.h | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 Provides the details handlig for the phone book | |
26 | |
27 | |
28 ******************************************************************************** | |
29 $History: MmiBookDetailsWindow.h | |
30 | |
31 25/10/00 Original Condat(UK) BMI version. | |
32 | |
33 $End | |
34 | |
35 *******************************************************************************/ | |
36 | |
37 | |
38 | |
39 | |
40 /******************************************************************************* | |
41 | |
42 Include Files | |
43 | |
44 *******************************************************************************/ | |
45 #define ENTITY_MFW | |
46 | |
47 /* includes */ | |
48 #include <string.h> | |
49 #include <stdio.h> | |
50 #include <stdlib.h> | |
51 | |
52 #if defined (NEW_FRAME) | |
53 | |
54 #include "typedefs.h" | |
55 #include "vsi.h" | |
56 #include "pei.h" | |
57 #include "custom.h" | |
58 #include "gsm.h" | |
59 | |
60 #else | |
61 | |
62 #include "STDDEFS.H" | |
63 #include "custom.h" | |
64 #include "gsm.h" | |
65 #include "vsi.h" | |
66 | |
67 #endif | |
68 | |
69 #include "mfw_sys.h" | |
70 | |
71 #include "mfw_mfw.h" | |
72 #include "mfw_win.h" | |
73 #include "mfw_kbd.h" | |
74 #include "mfw_lng.h" | |
75 /* SPR#1428 - SH - New Editor changes */ | |
76 #ifndef NEW_EDITOR | |
77 #include "mfw_edt.h" | |
78 #endif | |
79 #include "mfw_icn.h" | |
80 #include "mfw_mnu.h" | |
81 #include "mfw_tim.h" | |
82 | |
83 #include "mfw_sim.h" | |
84 #include "mfw_cm.h" | |
85 #include "mfw_nm.h" | |
86 #include "mfw_phb.h" | |
87 #include "mfw_mme.h" | |
88 #include "mfw_sat.h" | |
89 #include "mfw_sms.h" | |
90 | |
91 #include "dspl.h" | |
92 | |
93 #include "ksd.h" | |
94 #include "psa.h" | |
95 | |
96 #include "MmiMain.h" | |
97 #include "MmiBookController.h" | |
98 #include "MmiDummy.h" | |
99 #include "MmiDialogs.h" | |
100 #include "MmiLists.h" | |
101 | |
102 | |
103 | |
104 #include "MmiMenu.h" | |
105 #include "mmiCall.h" | |
106 #include "Mmiicons.h" | |
107 #include "MmiIdle.h" | |
108 | |
109 #include "MmiSoftKeys.h" | |
110 #include "MmiSounds.h" | |
111 #include "MmiIdle.h" | |
112 #include "MmiNetwork.h" | |
113 #include "mmiSat_i.h" | |
114 #include "MmiAoc.h" | |
115 | |
116 #include "gdi.h" | |
117 #include "audio.h" | |
118 | |
119 #include "cus_aci.h" | |
120 #include "mfw_ffs.h" | |
121 #include "MmiTimers.h" | |
122 | |
123 #include "MmiBookShared.h" | |
124 | |
125 #include "mmiColours.h" | |
126 | |
127 | |
128 | |
129 /******************************************************************************* | |
130 | |
131 Private Methods | |
132 | |
133 *******************************************************************************/ | |
134 | |
135 | |
136 /******************************************************************************* | |
137 | |
138 $Function: bookDetailsDialog | |
139 | |
140 $Description: Dialog function for the details window, doesn't currently do | |
141 anything | |
142 | |
143 $Returns: None | |
144 | |
145 $Arguments: win, window handle | |
146 event, event to be handled | |
147 value, not used | |
148 parameter, not used | |
149 | |
150 *******************************************************************************/ | |
151 | |
152 static void bookDetailsDialog ( T_MFW_HND win, USHORT event, SHORT value, void *parameter ) | |
153 { | |
154 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
155 tBookStandard *data = (tBookStandard *)win_data->user; | |
156 T_MFW_PHB_ENTRY *entry; | |
157 /* SPR#1428 - SH - New Editor changes | |
158 * Insert the ascii or unicode name into the buffer */ | |
159 #ifdef NEW_EDITOR | |
160 T_ATB_TEXT nameText; | |
161 T_ATB_TEXT numberText; | |
162 | |
163 TRACE_FUNCTION("bookDetailsDialog"); | |
164 | |
165 entry = &data->phbk->current.entry[ data->phbk->current.selectedName ]; | |
166 /*SPR 2175, no need to do any GSM->ASCII conversions, removed conversion code*/ | |
167 | |
168 | |
169 numberText.dcs = ATB_DCS_ASCII; | |
170 numberText.data = entry->number; | |
171 ATB_string_Length(&numberText); | |
172 | |
173 if ( entry->name.data[0] ==0x80) | |
174 { | |
175 | |
176 /* UNICODE */ | |
177 TRACE_EVENT("***UNICODE OUTPUT***"); | |
178 nameText.dcs = ATB_DCS_UNICODE; | |
179 nameText.data = &entry->name.data[2]; | |
180 } | |
181 else | |
182 { | |
183 nameText.dcs = ATB_DCS_ASCII; | |
184 nameText.data = entry->name.data; | |
185 } | |
186 | |
187 ATB_string_Length(&nameText); | |
188 | |
189 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
190 ATB_edit_InsertString(data->editor, &nameText); /* Insert name string */ | |
191 ATB_edit_Char(data->editor, ctrlEnter, FALSE); /* Insert carriage return */ | |
192 ATB_edit_InsertString(data->editor, &numberText); /* Insert number string */ | |
193 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
194 | |
195 /* Text has changed, so refresh word wrap */ | |
196 ATB_edit_Refresh(data->editor); | |
197 | |
198 win_show(data->win); | |
199 | |
200 #endif /* NEW_EDITOR */ | |
201 | |
202 } | |
203 | |
204 | |
205 | |
206 | |
207 /******************************************************************************* | |
208 | |
209 $Function: bookDetailsWindowCB | |
210 | |
211 $Description: Window event handler | |
212 | |
213 $Returns: MFW_EVENT_CONSUMED for the window visible event, | |
214 MFW_EVENT_PASSED otherwise | |
215 | |
216 $Arguments: e, event, w, window handle | |
217 | |
218 *******************************************************************************/ | |
219 | |
220 static int bookDetailsWindowCB ( MfwEvt e, MfwWin *w ) | |
221 { | |
222 tBookStandard *data = (tBookStandard *)w->user; | |
223 T_MFW_PHB_ENTRY *ptr; // dat; | |
224 // char debug[50]; // RAVI | |
225 | |
226 TRACE_FUNCTION("bookDetailsWindowCB"); | |
227 switch( e ) | |
228 { | |
229 case MfwWinVisible: | |
230 { | |
231 /* handle the visible event, start by shoing the default information | |
232 */ | |
233 MmiBookShowDefault(); | |
234 | |
235 /* SPR#1428 - SH - New Editor: display editor here rather than filling up the information. Do that in | |
236 * dialog function above. */ | |
237 | |
238 #ifdef NEW_EDITOR | |
239 ATB_edit_Show(data->editor); | |
240 resources_setTitleColour(COLOUR_EDITOR); | |
241 | |
242 /* TITLE */ | |
243 | |
244 dspl_Clear(0,0, SCREEN_SIZE_X-1, data->editor->attr->win_size.py-1); | |
245 PROMPT(0,0,0,TxtDetails); | |
246 #else /* NEW_EDITOR */ | |
247 /* Build and show the editor | |
248 */ | |
249 ptr = &data->phbk->current.entry[ data->phbk->current.selectedName ]; | |
250 #ifdef NO_ASCIIZ | |
251 | |
252 #ifdef EASY_TEXT_ENABLED | |
253 /*MC SPR 1242, changed macros to function calls e.g FIRST_LINE_CHINESE->Mmi_layout_first_line()*/ | |
254 if ( ptr->name.data[0] ==0x80)//if unicode | |
255 { | |
256 TRACE_EVENT("***UNICODE OUTPUT***"); | |
257 dspl_TextOut(0,0,DSPL_TXTATTR_UNICODE,(char *)&ptr->name.data[2]); | |
258 if ((ptr->name.data[MAX_LINE+2] != 0) && ptr->name.data[MAX_LINE+3] != 0) | |
259 dspl_TextOut(0,Mmi_layout_line(1),DSPL_TXTATTR_UNICODE,(char *)&(ptr->name.data[MAX_LINE+2])); | |
260 dspl_TextOut(0,Mmi_layout_line(2),0,(char *)ptr->number); | |
261 if (strlen((char*)ptr->number) > MAX_LINE) | |
262 dspl_TextOut(0,Mmi_layout_line(1)+numberLineHeight(),0, (char*)&ptr->number[MAX_LINE]); | |
263 } | |
264 else | |
265 #endif /* EASY_TEXT_ENABLED */ | |
266 { | |
267 // convert from GSM to Alpha characters | |
268 bookGsm2Alpha( (UBYTE *) ptr->name.data ); | |
269 | |
270 sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name.data, "\n", (char *) ptr->number); | |
271 edtShow(data->edt); | |
272 } | |
273 #else /* NO_ASCIIZ */ | |
274 { | |
275 sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name, "\n", (char *) ptr->number); | |
276 edtShow(data->edt); | |
277 } | |
278 #endif /* NO_ASCIIZ */ | |
279 #endif /* NEW_EDITOR */ | |
280 /* pop up the soft keys | |
281 */ | |
282 displaySoftKeys( TxtSoftCall, /* TxtSoftOptions */ TxtSoftBack ); | |
283 } | |
284 break; | |
285 | |
286 default: | |
287 { | |
288 /* default handler just indicate event not handled | |
289 */ | |
290 return MFW_EVENT_PASSED; | |
291 } | |
292 } | |
293 | |
294 return MFW_EVENT_CONSUMED; | |
295 } | |
296 | |
297 | |
298 /******************************************************************************* | |
299 | |
300 $Function: bookDetailsKbdCB | |
301 | |
302 $Description: Keyboard handler | |
303 | |
304 $Returns: MFW_EVENT_CONSUMED always | |
305 | |
306 $Arguments: e, event, k, key handle | |
307 | |
308 *******************************************************************************/ | |
309 | |
310 static int bookDetailsKbdCB ( MfwEvt e, MfwKbd *k ) | |
311 { | |
312 T_MFW_HND win = mfwParent( mfw_header() ); | |
313 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; | |
314 tBookStandard *data = (tBookStandard *) win_data->user; | |
315 tMmiPhbData *Current = &data->phbk->current; | |
316 | |
317 TRACE_FUNCTION("bookDetailsKbdCB()"); | |
318 | |
319 /* Handle the key events | |
320 */ | |
321 switch (k->code) | |
322 { | |
323 case KCD_MNUUP: | |
324 break; | |
325 | |
326 case KCD_MNUDOWN: | |
327 break; | |
328 | |
329 case KCD_MNUSELECT: | |
330 case KCD_CALL: | |
331 case KCD_LEFT: | |
332 { | |
333 /* select to make the call | |
334 */ | |
335 callNumber( Current->entry[ Current->selectedName ].number ); | |
336 bookPhonebookDestroy( data->phbk->win ); | |
337 } | |
338 break; | |
339 | |
340 case KCD_RIGHT: | |
341 { | |
342 /* start up the options menu | |
343 */ | |
344 //Cancel this screen | |
345 bookDetailsDestroy( data->win ); | |
346 } | |
347 break; | |
348 | |
349 case KCD_HUP: | |
350 { | |
351 /* Cancel this menu | |
352 */ | |
353 bookDetailsDestroy( data->win ); | |
354 } | |
355 break; | |
356 | |
357 default: | |
358 { | |
359 /* default handling is to get us out of here | |
360 */ | |
361 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) ); | |
362 sprintf( data->edtBuf, "%s%c", (char *) Current->entry[ Current->selectedName ].number, editControls[ k->code ] ); | |
363 idleDialBuffer( data->edtBuf ); | |
364 bookPhonebookDestroy( data->phbk->win ); | |
365 } | |
366 break; | |
367 } | |
368 | |
369 return MFW_EVENT_CONSUMED; | |
370 } | |
371 | |
372 | |
373 /******************************************************************************* | |
374 | |
375 $Function: bookDetailsKbdLongCB | |
376 | |
377 $Description: Keyboard Long Press event handler | |
378 | |
379 $Returns: MFW_EVENT_CONSUMED always | |
380 | |
381 $Arguments: e, event, k, keyboard handle | |
382 | |
383 *******************************************************************************/ | |
384 | |
385 static int bookDetailsKbdLongCB( MfwEvt e, MfwKbd *k ) | |
386 { | |
387 T_MFW_HND win = mfwParent( mfw_header() ); | |
388 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
389 tBookStandard *data = (tBookStandard *) win_data->user; | |
390 | |
391 /* hand a long clear event only | |
392 */ | |
393 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) ) | |
394 bookDetailsDestroy( data->win ); | |
395 | |
396 return MFW_EVENT_CONSUMED; | |
397 } | |
398 | |
399 | |
400 | |
401 | |
402 /******************************************************************************* | |
403 | |
404 $Function: bookDetailsCreate | |
405 | |
406 $Description: create an instance of the details window | |
407 | |
408 $Returns: handle of newly created window, or NULL if we fail to create | |
409 | |
410 $Arguments: parent, handle of parent window | |
411 | |
412 *******************************************************************************/ | |
413 | |
414 static T_MFW_HND bookDetailsCreate(MfwHnd parent) | |
415 { | |
416 T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data; | |
417 T_phbk *phbk = (T_phbk *)parent_win_data->user; | |
418 T_MFW_WIN *win_data; | |
419 tBookStandard *data; | |
420 | |
421 TRACE_FUNCTION ("bookDetailsCreate()"); | |
422 | |
423 /* allocate memory for our control block | |
424 */ | |
425 if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL ) | |
426 return NULL; | |
427 | |
428 /* Create the window if we can | |
429 */ | |
430 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookDetailsWindowCB ) ) == NULL ) | |
431 { | |
432 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) ); | |
433 return NULL; | |
434 } | |
435 | |
436 /* Okay, we have created the control block and the window, so | |
437 we now need to configure the dialog and data pointers | |
438 */ | |
439 data->mmi_control.dialog = (T_DIALOG_FUNC) bookDetailsDialog; | |
440 data->mmi_control.data = data; | |
441 win_data = ((T_MFW_HDR *)data->win)->data; | |
442 win_data->user = (void *) data; | |
443 data->phbk = phbk; | |
444 data->parent_win = parent; | |
445 | |
446 /* create keyboards and menus for our window | |
447 */ | |
448 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookDetailsKbdCB ); | |
449 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookDetailsKbdLongCB ); | |
450 | |
451 /* 1945 MZ Initialise the edtBuf */ | |
452 memset(data->edtBuf,'\0', STANDARD_EDITOR_SIZE ); | |
453 | |
454 /* SPR#1428 - SH - New Editor changes */ | |
455 #ifdef NEW_EDITOR | |
456 AUI_edit_SetAttr( &data->editor_attr, BOOKDETAILS_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_UNICODE/*SPR1752*/, (UBYTE *)data->edtBuf, STANDARD_EDITOR_SIZE); | |
457 data->editor = ATB_edit_Create( &data->editor_attr, 0 ); | |
458 SEND_EVENT(data->win, 0, 0, 0); | |
459 ATB_edit_Init(data->editor); | |
460 #else /*NEW_EDITOR*/ | |
461 // API - 08-01-03 - 1540 - change edtCurBar1 to edtCurNone | |
462 bookSetEditAttributes( BOOKDETAILS_EDITOR, COLOUR_EDITOR_XX, 0, edtCurNone, 0, data->edtBuf, STANDARD_EDITOR_SIZE, &data->attr ); | |
463 data->edt = edtCreate( data->win, &data->attr, 0, 0 ); | |
464 edtUnhide( data->edt ); | |
465 #endif /*NEW_EDITOR*/ | |
466 | |
467 /* allow the window and menu to be created | |
468 */ | |
469 mnuUnhide(data->menu); | |
470 winShow(data->win); | |
471 | |
472 /* And return the handle of the newly created window | |
473 */ | |
474 return data->win; | |
475 } | |
476 | |
477 | |
478 | |
479 | |
480 /******************************************************************************* | |
481 | |
482 Public Methods | |
483 | |
484 *******************************************************************************/ | |
485 | |
486 | |
487 /******************************************************************************* | |
488 | |
489 $Function: bookDetailsStart | |
490 | |
491 $Description: Start routine for the phonebook details window | |
492 | |
493 $Returns: None, assigns the window handle to the name_details_win | |
494 hook in the current phone book | |
495 | |
496 $Arguments: m, menu, i, menu item | |
497 | |
498 *******************************************************************************/ | |
499 | |
500 void bookDetailsStart( MfwMnu* m, MfwMnuItem* i ) | |
501 { | |
502 T_MFW_HND win = mfwParent(mfw_header()); | |
503 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
504 tBookStandard *data = (tBookStandard *)win_data->user; | |
505 | |
506 TRACE_FUNCTION ("bookDetailsStart()"); | |
507 | |
508 data->phbk->name_details_win = bookDetailsCreate( data->phbk->win ); | |
509 } | |
510 | |
511 | |
512 | |
513 | |
514 /******************************************************************************* | |
515 | |
516 $Function: bookDetailsDestroy | |
517 | |
518 $Description: Destroy the phone book details window | |
519 | |
520 $Returns: None | |
521 | |
522 $Arguments: window, handle of window to close | |
523 | |
524 *******************************************************************************/ | |
525 | |
526 void bookDetailsDestroy( MfwHnd window ) | |
527 { | |
528 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data; | |
529 tBookStandard *data = (tBookStandard *)win->user; | |
530 | |
531 TRACE_FUNCTION ("bookDetailsdestroy()"); | |
532 | |
533 /* Only need to do this if the data is valid | |
534 */ | |
535 if ( data ) | |
536 { | |
537 /* SPR#1428 - SH - New Editor changes */ | |
538 #ifdef NEW_EDITOR | |
539 /* New editor no longer destroyed with winDelete, | |
540 * so destroy it here */ | |
541 if (data->editor) | |
542 { | |
543 ATB_edit_Destroy(data->editor); | |
544 } | |
545 #endif /* NEW_EDITOR */ | |
546 data->phbk->name_details_win = 0; | |
547 winDelete( data->win ); | |
548 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) ); | |
549 } | |
550 } | |
551 | |
552 | |
553 | |
554 | |
555 /******************************************************************************* | |
556 | |
557 End of File | |
558 | |
559 *******************************************************************************/ |