FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiBand.c @ 92:c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 08 Nov 2020 06:39:16 +0000 |
parents | 67bfe9f274f6 |
children | 63dffa10b00a |
comparison
equal
deleted
inserted
replaced
91:c3d28a37caad | 92:c0052fe355d3 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 | 2 |
3 CONDAT (UK) | 3 CONDAT (UK) |
4 | 4 |
5 ******************************************************************************** | 5 ******************************************************************************** |
6 | 6 |
7 This software product is the property of Condat (UK) Ltd and may not be | 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. | 8 disclosed to any third party without the express permission of the owner. |
9 | 9 |
10 ******************************************************************************** | 10 ******************************************************************************** |
11 | 11 |
12 $Project name: Basic MMI | 12 $Project name: Basic MMI |
13 $Project code: BMI | 13 $Project code: BMI |
14 $Module: Frequency band selection | 14 $Module: Frequency band selection |
15 $File: MmiBand.c | 15 $File: MmiBand.c |
16 $Revision: 1.0 | 16 $Revision: 1.0 |
17 | 17 |
18 $Author: Condat(UK) | 18 $Author: Condat(UK) |
19 $Date: 03/04/02 | 19 $Date: 03/04/02 |
20 | 20 |
21 ******************************************************************************** | 21 ******************************************************************************** |
22 | 22 |
23 Description: | 23 Description: |
24 | 24 |
25 This provides the functionality for menu options to select and display the current | 25 This provides the functionality for menu options to select and display the current |
26 band used. | 26 band used. |
27 | 27 |
28 ******************************************************************************** | 28 ******************************************************************************** |
29 $History: MmiBand.c | 29 $History: MmiBand.c |
30 | 30 |
31 03/04/02 Original Condat(UK) BMI version. | 31 03/04/02 Original Condat(UK) BMI version. |
32 | 32 |
33 $End | 33 $End |
34 | 34 |
35 *******************************************************************************/ | 35 *******************************************************************************/ |
36 | 36 |
37 | 37 |
38 | 38 |
39 | 39 |
40 /******************************************************************************* | 40 /******************************************************************************* |
41 | 41 |
42 Include files | 42 Include files |
43 | 43 |
44 *******************************************************************************/ | 44 *******************************************************************************/ |
45 #define ENTITY_MFW | 45 #define ENTITY_MFW |
46 | 46 |
47 /* includes */ | 47 /* includes */ |
48 #include <string.h> | 48 #include <string.h> |
138 COLOUR_LIST_SMS, | 138 COLOUR_LIST_SMS, |
139 TxtNull, | 139 TxtNull, |
140 MNUATTRSPARE}; | 140 MNUATTRSPARE}; |
141 | 141 |
142 /* List of all possible frequencies */ | 142 /* List of all possible frequencies */ |
143 | 143 |
144 static const int band_list[MAX_NUMBER_OF_FREQS] = { | 144 static const int band_list[MAX_NUMBER_OF_FREQS] = { |
145 MFW_BAND_GSM_900, | 145 MFW_BAND_GSM_900, |
146 MFW_BAND_DCS_1800, | 146 MFW_BAND_DCS_1800, |
147 MFW_BAND_PCS_1900, | 147 MFW_BAND_PCS_1900, |
148 MFW_BAND_E_GSM, | 148 MFW_BAND_E_GSM, |
149 MFW_BAND_GSM_850 | 149 MFW_BAND_GSM_850 |
150 }; | 150 }; |
151 | 151 |
152 /* SPR#998 - SH - Static handle to allow callback functions to access data */ | 152 /* SPR#998 - SH - Static handle to allow callback functions to access data */ |
153 static T_FREQ_INFO *current_data = NULL; | 153 static T_FREQ_INFO *current_data = NULL; |
154 | 154 |
155 /*********************************Function Prototypes*****************************/ | 155 /*********************************Function Prototypes*****************************/ |
175 /************************************************************************* | 175 /************************************************************************* |
176 | 176 |
177 $Function: mmi_band_radio_mode_change_auto | 177 $Function: mmi_band_radio_mode_change_auto |
178 | 178 |
179 $Description: Changes multiband mode to automatic. Selected from menu. | 179 $Description: Changes multiband mode to automatic. Selected from menu. |
180 | 180 |
181 $Returns: status int | 181 $Returns: status int |
182 | 182 |
183 $Arguments: menu and menu item (not used) | 183 $Arguments: menu and menu item (not used) |
184 | 184 |
185 | 185 |
186 *******************************************************************************/ | 186 *******************************************************************************/ |
187 | 187 |
188 int mmi_band_radio_mode_change_auto(MfwMnu* m, MfwMnuItem* i) | 188 int mmi_band_radio_mode_change_auto(MfwMnu* m, MfwMnuItem* i) |
189 { | 189 { |
190 T_MFW_HND parent = mfwParent( mfw_header()); | 190 T_MFW_HND parent = mfwParent( mfw_header()); |
191 // T_MFW_BAND_MODE mode; // RAVI | 191 // T_MFW_BAND_MODE mode; // RAVI |
192 | 192 |
193 TRACE_FUNCTION("mmi_band_radio_mode_change_auto"); | 193 TRACE_FUNCTION("mmi_band_radio_mode_change_auto"); |
194 | 194 |
195 if (band_radio_mode_switch(MFW_BAND_MODE_Auto, 0) >= MFW_BAND_OK) | 195 if (band_radio_mode_switch(MFW_BAND_MODE_Auto, 0) >= MFW_BAND_OK) |
196 { | 196 { |
197 ShowMessage(parent, TxtDone, TxtNull); | 197 ShowMessage(parent, TxtDone, TxtNull); |
198 } | 198 } |
199 else | 199 else |
200 ShowMessage(parent, TxtFailed, TxtNull); | 200 ShowMessage(parent, TxtFailed, TxtNull); |
201 | 201 |
202 return MFW_EVENT_CONSUMED; | 202 return MFW_EVENT_CONSUMED; |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 /******************************************************************************* | 206 /******************************************************************************* |
207 | 207 |
208 $Function: mmi_band_radio_mode_change_manual | 208 $Function: mmi_band_radio_mode_change_manual |
209 | 209 |
210 $Description: Gets a list of available manual bands. Selected from menu. | 210 $Description: Gets a list of available manual bands. Selected from menu. |
211 | 211 |
212 $Returns: status int | 212 $Returns: status int |
213 | 213 |
214 $Arguments: menu and menu item (not used) | 214 $Arguments: menu and menu item (not used) |
215 | 215 |
216 | 216 |
217 *******************************************************************************/ | 217 *******************************************************************************/ |
218 | 218 |
219 int mmi_band_radio_mode_change_manual(MfwMnu* m, MfwMnuItem* i) | 219 int mmi_band_radio_mode_change_manual(MfwMnu* m, MfwMnuItem* i) |
220 { | 220 { |
221 T_MFW_HND parent = mfwParent( mfw_header()); | 221 T_MFW_HND parent = mfwParent( mfw_header()); |
222 T_MFW_BAND_MODE maxMode; | 222 T_MFW_BAND_MODE maxMode; |
223 UBYTE available_freqs; | 223 UBYTE available_freqs; |
224 T_MFW_HND win; | 224 T_MFW_HND win; |
225 | 225 |
226 if (band_get_radio_modes(&maxMode, &available_freqs) >= MFW_BAND_OK) | 226 if (band_get_radio_modes(&maxMode, &available_freqs) >= MFW_BAND_OK) |
227 { | 227 { |
228 if (maxMode >= MFW_BAND_MODE_Manual) /* Make sure manual is an accepted mode */ | 228 if (maxMode >= MFW_BAND_MODE_Manual) /* Make sure manual is an accepted mode */ |
229 { | 229 { |
230 win = mmi_band_build_freq_list(parent, available_freqs); | 230 win = mmi_band_build_freq_list(parent, available_freqs); |
234 } | 234 } |
235 else | 235 else |
236 ShowMessage(parent, TxtManual, TxtNotSupported); | 236 ShowMessage(parent, TxtManual, TxtNotSupported); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 return MFW_EVENT_CONSUMED; | 240 return MFW_EVENT_CONSUMED; |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 /******************************************************************************* | 244 /******************************************************************************* |
245 | 245 |
246 $Function: mmi_band_radio_mode_info | 246 $Function: mmi_band_radio_mode_info |
247 | 247 |
248 $Description: Get current band setting | 248 $Description: Get current band setting |
249 | 249 |
250 $Returns: status int | 250 $Returns: status int |
251 | 251 |
252 $Arguments: menu and menu item (not used) | 252 $Arguments: menu and menu item (not used) |
253 | 253 |
254 | 254 |
255 *******************************************************************************/ | 255 *******************************************************************************/ |
256 | 256 |
257 int mmi_band_radio_mode_info(MfwMnu* m, MfwMnuItem* i) | 257 int mmi_band_radio_mode_info(MfwMnu* m, MfwMnuItem* i) |
258 { T_MFW_HND parent = mfwParent( mfw_header()); | 258 { T_MFW_HND parent = mfwParent( mfw_header()); |
259 | 259 |
260 mmi_band_display_status(parent); | 260 mmi_band_display_status(parent); |
261 | 261 |
262 return MFW_EVENT_CONSUMED; | 262 return MFW_EVENT_CONSUMED; |
263 } | 263 } |
264 | 264 |
265 | 265 |
266 /*******************************Private Functions**********************************/ | 266 /*******************************Private Functions**********************************/ |
270 /******************************************************************************* | 270 /******************************************************************************* |
271 | 271 |
272 $Function: Freq2Str | 272 $Function: Freq2Str |
273 | 273 |
274 $Description: Converts the band enum into an appropraite string | 274 $Description: Converts the band enum into an appropraite string |
275 | 275 |
276 $Returns: string | 276 $Returns: string |
277 | 277 |
278 $Arguments: Band (integer) | 278 $Arguments: Band (integer) |
279 | 279 |
280 | 280 |
281 *******************************************************************************/ | 281 *******************************************************************************/ |
282 | 282 |
283 char* Freq2Str(int freq) | 283 char* Freq2Str(int freq) |
284 { | 284 { |
285 switch (freq) | 285 switch (freq) |
297 /******************************************************************************* | 297 /******************************************************************************* |
298 | 298 |
299 $Function: Freq2Str | 299 $Function: Freq2Str |
300 | 300 |
301 $Description: Converts the band enum into an appropraite string ID | 301 $Description: Converts the band enum into an appropraite string ID |
302 | 302 |
303 $Returns: string ID | 303 $Returns: string ID |
304 | 304 |
305 $Arguments: Band (integer) | 305 $Arguments: Band (integer) |
306 | 306 |
307 | 307 |
308 *******************************************************************************/ | 308 *******************************************************************************/ |
309 | 309 |
310 int Freq2StrID(int freq) | 310 int Freq2StrID(int freq) |
311 { | 311 { |
312 switch (freq) | 312 switch (freq) |
325 | 325 |
326 $Function: mmi_band_display_status | 326 $Function: mmi_band_display_status |
327 $Description: Displays the current band status | 327 $Description: Displays the current band status |
328 $Returns: none | 328 $Returns: none |
329 $Arguments: parent - parent window | 329 $Arguments: parent - parent window |
330 | 330 |
331 *******************************************************************************/ | 331 *******************************************************************************/ |
332 | 332 |
333 static int mmi_band_display_status(T_MFW_HND parent) | 333 static int mmi_band_display_status(T_MFW_HND parent) |
334 { | 334 { |
335 /* SPR#998 - SH - Now store mode in data->mode */ | 335 /* SPR#998 - SH - Now store mode in data->mode */ |
336 T_MFW_WIN *win_data = ((T_MFW_HDR *) parent)->data; | 336 T_MFW_WIN *win_data = ((T_MFW_HDR *) parent)->data; |
337 T_FREQ_INFO *data = (T_FREQ_INFO *)win_data->user; | 337 T_FREQ_INFO *data = (T_FREQ_INFO *)win_data->user; |
338 | 338 |
339 if (band_get_current_radio_mode(&data->mode, &data->selected_freqs) >= MFW_BAND_OK) | 339 if (band_get_current_radio_mode(&data->mode, &data->selected_freqs) >= MFW_BAND_OK) |
340 { | 340 { |
341 if (data->mode == MFW_BAND_MODE_Auto) | 341 if (data->mode == MFW_BAND_MODE_Auto) |
342 { | 342 { |
343 ShowMessage(parent, TxtAutomatic, TxtNull); | 343 ShowMessage(parent, TxtAutomatic, TxtNull); |
349 } | 349 } |
350 else | 350 else |
351 { | 351 { |
352 ShowMessage(parent, TxtReadError, TxtNull); | 352 ShowMessage(parent, TxtReadError, TxtNull); |
353 } | 353 } |
354 | 354 |
355 return 1; // RAVI - Changed return to return 1. | 355 return 1; // RAVI - Changed return to return 1. |
356 } | 356 } |
357 | 357 |
358 #if(0) /* x0039298 - Lint warning fix */ | 358 #if(0) /* x0039298 - Lint warning fix */ |
359 /******************************************************************************* | 359 /******************************************************************************* |
362 $Description: Callback for status list window - currently does nothing | 362 $Description: Callback for status list window - currently does nothing |
363 $Returns: none | 363 $Returns: none |
364 $Arguments: parent - parent window | 364 $Arguments: parent - parent window |
365 identifier - length of status string | 365 identifier - length of status string |
366 reason - not used | 366 reason - not used |
367 | 367 |
368 *******************************************************************************/ | 368 *******************************************************************************/ |
369 | 369 |
370 static int mmi_band_display_status_cb(T_MFW_HND parent, USHORT identifier, USHORT reason) | 370 static int mmi_band_display_status_cb(T_MFW_HND parent, USHORT identifier, USHORT reason) |
371 { | 371 { |
372 return 1; // RAVI - Changed return to return 1. | 372 return 1; // RAVI - Changed return to return 1. |
377 | 377 |
378 $Function: mmi_band_build_freq_list | 378 $Function: mmi_band_build_freq_list |
379 $Description: Creates window for frequency list | 379 $Description: Creates window for frequency list |
380 $Returns: window created | 380 $Returns: window created |
381 $Arguments: parent window | 381 $Arguments: parent window |
382 | 382 |
383 *******************************************************************************/ | 383 *******************************************************************************/ |
384 | 384 |
385 static T_MFW_HND mmi_band_build_freq_list( MfwHnd parent_window, UBYTE available_freqs) | 385 static T_MFW_HND mmi_band_build_freq_list( MfwHnd parent_window, UBYTE available_freqs) |
386 { | 386 { |
387 T_FREQ_INFO *data = (T_FREQ_INFO *)ALLOC_MEMORY (sizeof (T_FREQ_INFO)); | 387 T_FREQ_INFO *data = (T_FREQ_INFO *)ALLOC_MEMORY (sizeof (T_FREQ_INFO)); |
398 { | 398 { |
399 return NULL; | 399 return NULL; |
400 } | 400 } |
401 | 401 |
402 current_data = data; /* SPR#998 - SH - Store handle for data; used by callbacks */ | 402 current_data = data; /* SPR#998 - SH - Store handle for data; used by callbacks */ |
403 | 403 |
404 /* | 404 /* |
405 * connect the dialog data to the MFW-window | 405 * connect the dialog data to the MFW-window |
406 */ | 406 */ |
407 | 407 |
408 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_band_freq_exec_cb; | 408 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_band_freq_exec_cb; |
409 data->mmi_control.data = data; | 409 data->mmi_control.data = data; |
410 win = ((T_MFW_HDR *)data->freq_win)->data; | 410 win = ((T_MFW_HDR *)data->freq_win)->data; |
411 win->user = (void *)data; | 411 win->user = (void *)data; |
412 data->parent = parent_window; | 412 data->parent = parent_window; |
413 data->available_freqs = available_freqs; | 413 data->available_freqs = available_freqs; |
414 | 414 |
415 winShow(data->freq_win); | 415 winShow(data->freq_win); |
416 /* | 416 /* |
417 * return window handle | 417 * return window handle |
418 */ | 418 */ |
419 | 419 |
424 /******************************************************************************* | 424 /******************************************************************************* |
425 | 425 |
426 $Function: mmi_band_freq_exec_cb | 426 $Function: mmi_band_freq_exec_cb |
427 | 427 |
428 $Description: Exec callback function of the information Numbers window | 428 $Description: Exec callback function of the information Numbers window |
429 | 429 |
430 $Returns: none | 430 $Returns: none |
431 | 431 |
432 $Arguments: win - window handler | 432 $Arguments: win - window handler |
433 event - mfw event | 433 event - mfw event |
434 parameter - optional data. | 434 parameter - optional data. |
435 | 435 |
436 *******************************************************************************/ | 436 *******************************************************************************/ |
437 | 437 |
438 void mmi_band_freq_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | 438 void mmi_band_freq_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) |
439 { | 439 { |
440 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; | 440 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; |
443 int index; | 443 int index; |
444 T_MFW_BAND_MODE maxMode; | 444 T_MFW_BAND_MODE maxMode; |
445 // char *menuItem; // RAVI | 445 // char *menuItem; // RAVI |
446 /* SPR#998 - SH - Remove code that implements custom checkbox implementaton, | 446 /* SPR#998 - SH - Remove code that implements custom checkbox implementaton, |
447 * as checkboxes now handled by mfw */ | 447 * as checkboxes now handled by mfw */ |
448 | 448 |
449 TRACE_FUNCTION ("mmi_band_freq_exec_cb()"); | 449 TRACE_FUNCTION ("mmi_band_freq_exec_cb()"); |
450 | 450 |
451 switch (event) | 451 switch (event) |
452 { | 452 { |
453 case BAND_INIT: | 453 case BAND_INIT: |
454 | 454 |
455 TRACE_EVENT("mmi_band_freq_exec_cb() Event:BAND_INIT"); | 455 TRACE_EVENT("mmi_band_freq_exec_cb() Event:BAND_INIT"); |
467 band_get_radio_modes(&maxMode, &data->available_freqs); | 467 band_get_radio_modes(&maxMode, &data->available_freqs); |
468 | 468 |
469 /* Run through the list of possible frequencies first to obtain | 469 /* Run through the list of possible frequencies first to obtain |
470 the number of frequencies permitted (how many will be in the menu) */ | 470 the number of frequencies permitted (how many will be in the menu) */ |
471 /* SPR#998 - SH - Removed custom checkbox implementation */ | 471 /* SPR#998 - SH - Removed custom checkbox implementation */ |
472 | 472 |
473 numberOfEntries = 0; | 473 numberOfEntries = 0; |
474 | 474 |
475 for (index=0; index<MAX_NUMBER_OF_FREQS; index++) | 475 for (index=0; index<MAX_NUMBER_OF_FREQS; index++) |
476 { | 476 { |
477 if (data->available_freqs & band_list[index]) | 477 if (data->available_freqs & band_list[index]) |
478 { | 478 { |
479 data->type[numberOfEntries] = band_list[index]; | 479 data->type[numberOfEntries] = band_list[index]; |
480 numberOfEntries++; | 480 numberOfEntries++; |
481 } | 481 } |
482 } | 482 } |
483 | 483 |
484 /* If there are no entries, show "Empty List" message and exit */ | 484 /* If there are no entries, show "Empty List" message and exit */ |
485 | 485 |
486 if (numberOfEntries==0) | 486 if (numberOfEntries==0) |
487 { | 487 { |
488 ShowMessage(data->parent, TxtEmptyList, TxtNull); | 488 ShowMessage(data->parent, TxtEmptyList, TxtNull); |
489 mmi_band_freq_list_destroy(win); | 489 mmi_band_freq_list_destroy(win); |
490 return; | 490 return; |
491 } | 491 } |
492 | 492 |
493 /* Get the status of all the frequencies */ | 493 /* Get the status of all the frequencies */ |
494 /* SPR#998 - SH - Use data->mode */ | 494 /* SPR#998 - SH - Use data->mode */ |
495 | 495 |
496 if (band_get_current_radio_mode(&data->mode, &data->selected_freqs) >= MFW_BAND_OK) | 496 if (band_get_current_radio_mode(&data->mode, &data->selected_freqs) >= MFW_BAND_OK) |
497 { | 497 { |
498 /* If we're not in manual choose manual */ | 498 /* If we're not in manual choose manual */ |
499 | 499 |
500 if (data->mode!=MFW_BAND_MODE_Manual) | 500 if (data->mode!=MFW_BAND_MODE_Manual) |
501 { | 501 { |
502 data->selected_freqs = data->available_freqs; /* SH - default when choosing manual is all */ | 502 data->selected_freqs = data->available_freqs; /* SH - default when choosing manual is all */ |
503 band_radio_mode_switch(MFW_BAND_MODE_Manual, data->selected_freqs); | 503 band_radio_mode_switch(MFW_BAND_MODE_Manual, data->selected_freqs); |
504 } | 504 } |
505 | 505 |
506 /* Allocate the memory for the list structure */ | 506 /* Allocate the memory for the list structure */ |
507 | 507 |
508 data->no_of_entries = numberOfEntries; | 508 data->no_of_entries = numberOfEntries; |
509 | 509 |
510 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( numberOfEntries * sizeof(T_MFW_MNU_ITEM) ); | 510 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( numberOfEntries * sizeof(T_MFW_MNU_ITEM) ); |
511 | 511 |
512 if(!data->menu_list_data->List) | 512 if(!data->menu_list_data->List) |
513 { | 513 { |
514 TRACE_EVENT("Failed memory alloc 2"); | 514 TRACE_EVENT("Failed memory alloc 2"); |
515 return; | 515 return; |
516 } | 516 } |
517 | 517 |
518 /* Allocate memory for the menu texts, and populate the list structure */ | 518 /* Allocate memory for the menu texts, and populate the list structure */ |
519 | 519 |
520 numberOfEntries = 0; | 520 numberOfEntries = 0; |
521 | 521 |
522 for (index=0; index<MAX_NUMBER_OF_FREQS; index++) | 522 for (index=0; index<MAX_NUMBER_OF_FREQS; index++) |
523 { | 523 { |
524 if (data->available_freqs & band_list[index]) | 524 if (data->available_freqs & band_list[index]) |
525 { | 525 { |
526 /* SPR#998 - SH - Removed code, checkboxes now handled by MFW */ | 526 /* SPR#998 - SH - Removed code, checkboxes now handled by MFW */ |
527 mnuInitDataItem(&data->menu_list_data->List[numberOfEntries]); | 527 mnuInitDataItem(&data->menu_list_data->List[numberOfEntries]); |
528 /* Here we specify the function that checks and unchecks the checkboxes */ | 528 /* Here we specify the function that checks and unchecks the checkboxes */ |
529 data->menu_list_data->List[numberOfEntries].func = mmi_band_menu_func; | 529 data->menu_list_data->List[numberOfEntries].func = mmi_band_menu_func; |
530 data->menu_list_data->List[numberOfEntries].str = (char *)Freq2StrID(band_list[index]); | 530 data->menu_list_data->List[numberOfEntries].str = (char *)Freq2StrID(band_list[index]); |
531 /* Here we specify the function that returns the checkbox status of any menu item */ | 531 /* Here we specify the function that returns the checkbox status of any menu item */ |
532 data->menu_list_data->List[numberOfEntries].flagFunc = mmi_band_menu_flag; | 532 data->menu_list_data->List[numberOfEntries].flagFunc = mmi_band_menu_flag; |
533 numberOfEntries++; | 533 numberOfEntries++; |
534 } | 534 } |
544 data->menu_list_data->KeyEvents = KEY_ALL; | 544 data->menu_list_data->KeyEvents = KEY_ALL; |
545 data->menu_list_data->Reason = 0; | 545 data->menu_list_data->Reason = 0; |
546 data->menu_list_data->Strings = FALSE; /* SPR#998 - SH - We no longer alter the menu strings */ | 546 data->menu_list_data->Strings = FALSE; /* SPR#998 - SH - We no longer alter the menu strings */ |
547 data->menu_list_data->Attr = (MfwMnuAttr*)&Freq_menuAttrib; | 547 data->menu_list_data->Attr = (MfwMnuAttr*)&Freq_menuAttrib; |
548 data->menu_list_data->autoDestroy = FALSE; | 548 data->menu_list_data->autoDestroy = FALSE; |
549 | 549 |
550 /* Create the dynamic menu window */ | 550 /* Create the dynamic menu window */ |
551 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)mmi_band_freq_list_cb,0); | 551 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)mmi_band_freq_list_cb,0); |
552 } | 552 } |
553 else /* We haven't been able to read the status */ | 553 else /* We haven't been able to read the status */ |
554 { | 554 { |
555 ShowMessage(win, TxtReadError, TxtNull); | 555 ShowMessage(win, TxtReadError, TxtNull); |
556 } | 556 } |
557 | 557 |
558 break; | 558 break; |
559 | 559 |
560 case BAND_DESTROY: | 560 case BAND_DESTROY: |
561 TRACE_EVENT("mmi_band_freq_exec_cb() Event:BAND_DESTROY"); | 561 TRACE_EVENT("mmi_band_freq_exec_cb() Event:BAND_DESTROY"); |
562 /* | 562 /* |
563 * Free Memory | 563 * Free Memory |
564 */ | 564 */ |
565 | 565 |
566 /* SPR#998 - SH - No longer free allocated strings here */ | 566 /* SPR#998 - SH - No longer free allocated strings here */ |
567 | 567 |
568 numberOfEntries = data->no_of_entries; | 568 numberOfEntries = data->no_of_entries; |
569 | 569 |
570 if (data->menu_list_data != NULL) | 570 if (data->menu_list_data != NULL) |
571 { | 571 { |
572 FREE_MEMORY ((void *)data->menu_list_data->List, numberOfEntries * sizeof (T_MFW_MNU_ITEM)); | 572 FREE_MEMORY ((void *)data->menu_list_data->List, numberOfEntries * sizeof (T_MFW_MNU_ITEM)); |
573 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData)); | 573 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData)); |
574 } | 574 } |
575 | 575 |
576 FREE_MEMORY ((void *)data, sizeof (T_FREQ_INFO)); | 576 FREE_MEMORY ((void *)data, sizeof (T_FREQ_INFO)); |
577 break; | 577 break; |
578 | 578 |
579 default: | 579 default: |
580 break; | 580 break; |
581 } | 581 } |
582 } | 582 } |
583 | 583 |
585 /******************************************************************************* | 585 /******************************************************************************* |
586 | 586 |
587 $Function: mmi_band_freq_list_cb | 587 $Function: mmi_band_freq_list_cb |
588 | 588 |
589 $Description: Callback function for the info num list. | 589 $Description: Callback function for the info num list. |
590 | 590 |
591 $Returns: none | 591 $Returns: none |
592 | 592 |
593 $Arguments: Parent - parent window. | 593 $Arguments: Parent - parent window. |
594 ListData - Menu item list | 594 ListData - Menu item list |
595 *******************************************************************************/ | 595 *******************************************************************************/ |
596 | 596 |
597 void mmi_band_freq_list_cb(T_MFW_HND * Parent, ListMenuData * ListData) | 597 void mmi_band_freq_list_cb(T_MFW_HND * Parent, ListMenuData * ListData) |
598 { | 598 { |
599 /* SPR#998 - SH - Selecting a checkbox is handled now by the checkbox functions, | 599 /* SPR#998 - SH - Selecting a checkbox is handled now by the checkbox functions, |
600 * so much less is required here */ | 600 * so much less is required here */ |
601 | 601 |
602 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data; | 602 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data; |
603 T_FREQ_INFO *data = (T_FREQ_INFO *)win_data->user; | 603 T_FREQ_INFO *data = (T_FREQ_INFO *)win_data->user; |
604 | 604 |
605 TRACE_FUNCTION("mmi_band_freq_list_cb"); | 605 TRACE_FUNCTION("mmi_band_freq_list_cb"); |
606 | 606 |
607 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR)) | 607 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR)) |
608 { | 608 { |
609 listsDestroy(ListData->win); | 609 listsDestroy(ListData->win); |
610 mmi_band_freq_list_destroy(data->freq_win); | 610 mmi_band_freq_list_destroy(data->freq_win); |
611 } | 611 } |
619 /******************************************************************************* | 619 /******************************************************************************* |
620 | 620 |
621 $Function: mmi_band_freq_list_destroy | 621 $Function: mmi_band_freq_list_destroy |
622 | 622 |
623 $Description: Destroy the info num window. | 623 $Description: Destroy the info num window. |
624 | 624 |
625 $Returns: none | 625 $Returns: none |
626 | 626 |
627 $Arguments: own_window- current window | 627 $Arguments: own_window- current window |
628 *******************************************************************************/ | 628 *******************************************************************************/ |
629 | 629 |
630 static void mmi_band_freq_list_destroy(MfwHnd own_window) | 630 static void mmi_band_freq_list_destroy(MfwHnd own_window) |
631 { | 631 { |
632 T_MFW_WIN *win_data; | 632 T_MFW_WIN *win_data; |
633 T_FREQ_INFO *data; | 633 T_FREQ_INFO *data; |
634 | 634 |
635 TRACE_FUNCTION ("mmi_band_freq_list_destroy()"); | 635 TRACE_FUNCTION ("mmi_band_freq_list_destroy()"); |
636 | 636 |
637 if (own_window) | 637 if (own_window) |
638 { | 638 { |
639 win_data = ((T_MFW_HDR *)own_window)->data; | 639 win_data = ((T_MFW_HDR *)own_window)->data; |
640 data = (T_FREQ_INFO *)win_data->user; | 640 data = (T_FREQ_INFO *)win_data->user; |
641 | 641 |
642 if (data) | 642 if (data) |
643 { | 643 { |
644 /* | 644 /* |
645 * Free Memory | 645 * Free Memory |
646 */ | 646 */ |
647 SEND_EVENT (own_window, BAND_DESTROY, 0, 0); | 647 SEND_EVENT (own_window, BAND_DESTROY, 0, 0); |
648 /* | 648 /* |
649 * Delete WIN handler | 649 * Delete WIN handler |
650 */ | 650 */ |
651 win_delete (own_window); | 651 win_delete (own_window); |
652 | 652 |
653 current_data = NULL; /* SPR#998 - SH - Set the data handle to NULL */ | 653 current_data = NULL; /* SPR#998 - SH - Set the data handle to NULL */ |
654 } | 654 } |
655 else | 655 else |
656 { | 656 { |
657 TRACE_EVENT ("mmi_band_freq_list_destroy() called twice"); | 657 TRACE_EVENT ("mmi_band_freq_list_destroy() called twice"); |
663 /******************************************************************************* | 663 /******************************************************************************* |
664 | 664 |
665 $Function: mmi_band_freq_win_cb | 665 $Function: mmi_band_freq_win_cb |
666 | 666 |
667 $Description: Window callback function for the info numbers window. | 667 $Description: Window callback function for the info numbers window. |
668 | 668 |
669 $Returns: none | 669 $Returns: none |
670 | 670 |
671 $Arguments: w - mfw window handler | 671 $Arguments: w - mfw window handler |
672 e - mfw event | 672 e - mfw event |
673 | 673 |
674 *******************************************************************************/ | 674 *******************************************************************************/ |
675 | 675 |
676 static int mmi_band_freq_win_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */ | 676 static int mmi_band_freq_win_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */ |
677 { | 677 { |
678 TRACE_FUNCTION ("mmi_band_freq_win_cb()"); | 678 TRACE_FUNCTION ("mmi_band_freq_win_cb()"); |
679 switch (e) | 679 switch (e) |
680 { | 680 { |
681 case MfwWinVisible: /* window is visible */ | 681 case MfwWinVisible: /* window is visible */ |
682 break; | 682 break; |
683 case MfwWinFocussed: /* input focus / selected */ | 683 case MfwWinFocussed: /* input focus / selected */ |
684 case MfwWinDelete: /* window will be deleted */ | 684 case MfwWinDelete: /* window will be deleted */ |
685 | 685 |
686 default: | 686 default: |
687 return MFW_EVENT_REJECTED; | 687 return MFW_EVENT_REJECTED; |
688 } | 688 } |
689 return MFW_EVENT_CONSUMED; | 689 return MFW_EVENT_CONSUMED; |
690 } | 690 } |
691 | 691 |
704 $Arguments: m, ma, mi - not used | 704 $Arguments: m, ma, mi - not used |
705 | 705 |
706 *******************************************************************************/ | 706 *******************************************************************************/ |
707 | 707 |
708 int mmi_band_menu_func(MfwMnu* menu, MfwMnuItem* item) | 708 int mmi_band_menu_func(MfwMnu* menu, MfwMnuItem* item) |
709 { | 709 { |
710 T_FREQ_INFO *data = current_data; | 710 T_FREQ_INFO *data = current_data; |
711 | 711 |
712 TRACE_FUNCTION("mmi_band_menu_func"); | 712 TRACE_FUNCTION("mmi_band_menu_func"); |
713 | 713 |
714 data->selected_freqs ^= data->type[menu->lCursor[menu->level]]; /* Toggle this band */ | 714 data->selected_freqs ^= data->type[menu->lCursor[menu->level]]; /* Toggle this band */ |
715 | 715 |
716 if (band_radio_mode_switch(MFW_BAND_MODE_Manual, data->selected_freqs) >= MFW_BAND_OK) | 716 if (band_radio_mode_switch(MFW_BAND_MODE_Manual, data->selected_freqs) >= MFW_BAND_OK) |
717 { | 717 { |
718 mnuUpdate(menu); | 718 mnuUpdate(menu); |
719 } | 719 } |
720 else | 720 else |
721 { | 721 { |
722 data->selected_freqs ^= data->type[menu->lCursor[menu->level]]; /* Undo change */ | 722 data->selected_freqs ^= data->type[menu->lCursor[menu->level]]; /* Undo change */ |
723 ShowMessage(data->freq_win, TxtFailed, TxtNull); | 723 ShowMessage(data->freq_win, TxtFailed, TxtNull); |
724 } | 724 } |
725 | 725 |
726 return 1; | 726 return 1; |
727 } | 727 } |
728 | 728 |
729 | 729 |
744 T_FREQ_INFO *data = current_data; /* SPR#998 - SH - Get data from static handle */ | 744 T_FREQ_INFO *data = current_data; /* SPR#998 - SH - Get data from static handle */ |
745 int currentOption; | 745 int currentOption; |
746 | 746 |
747 TRACE_FUNCTION("mmi_band_menu_flag()"); | 747 TRACE_FUNCTION("mmi_band_menu_flag()"); |
748 TRACE_EVENT_P1("Freq info data: %x", data); | 748 TRACE_EVENT_P1("Freq info data: %x", data); |
749 | 749 |
750 /* Identify current menu option */ | 750 /* Identify current menu option */ |
751 | 751 |
752 currentOption = mnuIdentify(attr, item); | 752 currentOption = mnuIdentify(attr, item); |
753 | 753 |
754 /* If we find it, work out if it's checked or not */ | 754 /* If we find it, work out if it's checked or not */ |
755 | 755 |
756 if (currentOption>-1) | 756 if (currentOption>-1) |
757 { | 757 { |
758 if (data->selected_freqs & data->type[currentOption]) | 758 if (data->selected_freqs & data->type[currentOption]) |
759 return MNU_ITEM_CHECKED; | 759 return MNU_ITEM_CHECKED; |
760 else | 760 else |