FreeCalypso > hg > fc-magnetite
comparison src/ui3/bmi/mmiResources.c @ 421:6a4d9f47793e
src/ui3/bmi: file renames to make the case consistent
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Jan 2018 03:28:53 +0000 |
parents | src/ui3/bmi/MmiResources.c@e8ddbb0837ed |
children |
comparison
equal
deleted
inserted
replaced
420:e8ddbb0837ed | 421:6a4d9f47793e |
---|---|
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: Resource Manager | |
15 $File: MmiResources.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 Simple wrapper for the MMI Block Resources | |
26 | |
27 This module provides a simple interface to the block | |
28 resources module, giving access to a single language, | |
29 which can be used to get strings by Id. | |
30 | |
31 This module is a hack to provide an interface to the | |
32 resource manager which can be easily used by a single | |
33 process. If an application needs to use the resource | |
34 manager it should call it directly, initialising it's | |
35 own context safe handlers. | |
36 | |
37 This module is designed to wrap the resource API | |
38 functions in a manner that gives the easiest and | |
39 fastest implementation. It is therefore not a | |
40 reentrant module, however given it only performs | |
41 read only actions this should not be a problem. | |
42 | |
43 ******************************************************************************** | |
44 $History: MmiResources.c | |
45 | |
46 Sep 14, 2007 REF: OMAPS00145860 Adrian Salido | |
47 Description: FT - MMI: Wrong trace class of new_getDataColour | |
48 Solution: changed event traces to function traces because the information content of | |
49 this is low for non-MMI people and against TI coding convention. | |
50 | |
51 Nov 07, 2006 ER:OMAPS00070661 R.Prabakar(a0393213) | |
52 R99 network compliancy : Implemented Language Notification and Provide Local Information (Language setting) | |
53 SAT proactive commands and Language Selection SAT event | |
54 | |
55 May 30, 2006 DR: OMAPS00070657 x0pleela | |
56 Description: CPHS feature on Locosto-Lite | |
57 Solution: For ALS feature, | |
58 a) Modified "MmiRsrcGetText" function to return the string from FFS for the current active line | |
59 | |
60 March 01, 2005 REF: ENH 29313 Deepa M.D | |
61 Isolating colour build related changes from MMI LITE flag. | |
62 The proper Feature flag COLORDISPLAY was used for all color | |
63 related changes. | |
64 | |
65 Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu. | |
66 Issue description: Golite booting problem. | |
67 Solution: If the FFS is not formatted, prevent writing into the FFS. | |
68 | |
69 | |
70 Aug 25, 2004 REF: CRR 24904 Deepa M.D | |
71 Bug:cleanup compile switches used for Go-lite | |
72 Fix:COLOURDISPLAY compiler switch has been added to the functions which are | |
73 used only for the normal color build. | |
74 | |
75 | |
76 Aug 25, 2004 REF: CRR 24297 Deepa M.D | |
77 Bug:Reduction of the size of the variable ColArray | |
78 Fix:The size of the structure T_COLDATA has been reduced for the Go-lite version. | |
79 For Go-lite only two colors are being used(Black&White), hence the members of the | |
80 T_COLDATA structure can be reduced to U8. | |
81 | |
82 | |
83 25/10/00 Original Condat(UK) BMI version. | |
84 03/10/02 Replaced most of the file with version on branch for issue 1150 (MC, SPR 1242) | |
85 $End | |
86 | |
87 *******************************************************************************/ | |
88 | |
89 | |
90 /******************************************************************************* | |
91 | |
92 Include Files | |
93 | |
94 *******************************************************************************/ | |
95 #define ENTITY_MFW | |
96 | |
97 /* includes */ | |
98 #include <string.h> | |
99 #include <stdio.h> | |
100 #include <stdlib.h> | |
101 | |
102 #if defined (NEW_FRAME) | |
103 | |
104 #include "typedefs.h" | |
105 #include "vsi.h" | |
106 #include "pei.h" | |
107 #include "custom.h" | |
108 #include "gsm.h" | |
109 | |
110 #else | |
111 | |
112 #include "STDDEFS.H" | |
113 #include "custom.h" | |
114 #include "gsm.h" | |
115 #include "vsi.h" | |
116 | |
117 #endif | |
118 | |
119 #include "mfw_sys.h" | |
120 | |
121 #include "prim.h" | |
122 | |
123 | |
124 #include "mfw_mfw.h" | |
125 #include "mfw_win.h" | |
126 #include "mfw_kbd.h" | |
127 /* SPR#1428 - SH - New Editor changes */ | |
128 #ifndef NEW_EDITOR | |
129 #include "mfw_edt.h" | |
130 #endif | |
131 #include "mfw_lng.h" | |
132 #include "mfw_icn.h" | |
133 #include "mfw_mnu.h" | |
134 #include "mfw_tim.h" | |
135 #include "mfw_sim.h" | |
136 #include "mfw_nm.h" | |
137 #include "mfw_cm.h" | |
138 #include "mfw_sat.h" | |
139 #include "mfw_phb.h" | |
140 #include "mfw_sms.h" | |
141 #include "mfw_ffs.h" /*MC, SPR 1111*/ | |
142 //Include the following ensure that the function definitions within it match the | |
143 //definitions in this file. | |
144 #include "mfw_mmi.h" | |
145 #include "dspl.h" | |
146 | |
147 #include "ksd.h" | |
148 #include "psa.h" | |
149 | |
150 /* SPR#1428 - SH - New Editor changes */ | |
151 #ifdef NEW_EDITOR | |
152 #include "ATBCommon.h" | |
153 #include "ATBDisplay.h" | |
154 #include "ATBEditor.h" | |
155 #include "AUIEditor.h" | |
156 #endif | |
157 | |
158 #include "MmiResources.h" | |
159 #include "MmiBlkLangDB.h" | |
160 #include "MmiBlkManager.h" | |
161 #include "MmiBlkResources.h" | |
162 #include "MmiBookShared.h" | |
163 | |
164 #include "MmiDummy.h" | |
165 #include "MmiMmi.h" | |
166 #include "MmiMain.h" | |
167 #include "MmiStart.h" | |
168 #include "MmiPins.h" | |
169 | |
170 | |
171 #include "MmiDialogs.h" | |
172 #include "MmiLists.h" | |
173 #include "MmiDialogs.h" | |
174 #include "Mmiicons.h" //GW | |
175 #include "mfw_ffs.h" | |
176 // this is for traces | |
177 #include "cus_aci.h" | |
178 | |
179 #include "prim.h" | |
180 #ifndef PCM_2_FFS | |
181 #include "pcm.h" | |
182 #endif | |
183 | |
184 | |
185 | |
186 #include "MmiLists.h" | |
187 #include "mmiColours.h" | |
188 | |
189 //#define COLOURDISPLAY | |
190 //#define TRACE_EVENT_COL TRACE_EVENT | |
191 | |
192 #ifndef TRACE_EVENT_COL | |
193 #define TRACE_EVENT_COL | |
194 #endif | |
195 | |
196 #ifndef LSCREEN | |
197 #define FIRST_LINE 6 | |
198 #define SECOND_LINE 14 | |
199 #define THIRD_LINE 24 | |
200 #define FOURTH_LINE 32 | |
201 #define FIFTH_LINE 40 | |
202 #define SIXTH_LINE 48 | |
203 #define LINE_HEIGHT 8 | |
204 #define FIRST_LINE_CHINESE 12 | |
205 #define SECOND_LINE_CHINESE 24 | |
206 #define THIRD_LINE_CHINESE 36 | |
207 #define FOURTH_LINE_CHINESE 48 | |
208 #define LINE_HEIGHT_CHINESE 12 | |
209 | |
210 #define FIRST_LINE_ICON 6 | |
211 #define SECOND_LINE_ICON 14 | |
212 #define THIRD_LINE_ICON 20 | |
213 | |
214 | |
215 #else | |
216 //#define LINE_HEIGHT 12 | |
217 //Colour display - all lines are the same height | |
218 //move to header for the moment #define LINE_HEIGHT 12 | |
219 #endif | |
220 //x33x-end*/ | |
221 | |
222 #ifndef LSCREEN | |
223 #define SK_HEIGHT_LATIN (LINE_HEIGHT_LATIN) | |
224 #define SK_HEIGHT_CHINESE (LINE_HEIGHT_CHINESE) | |
225 #define TITLE_HEIGHT_LATIN (LINE_HEIGHT_LATIN) | |
226 #define TITLE_HEIGHT_CHINESE (LINE_HEIGHT_CHINESE) | |
227 | |
228 #define NLINES_LATIN (SCREEN_SIZE_Y/LINE_HEIGHT_LATIN) //6 | |
229 #define NLINES_CHINESE (SCREEN_SIZE_Y/LINE_HEIGHT_CHINESE) //4 | |
230 #define CHINESE_MENU_VERTICAL_SIZE ((NLINES_CHINESE-1)*LINE_HEIGHT_CHINESE) | |
231 #define STANDARD_MENU_VERTICAL_SIZE ((NLINES_LATIN-1)*LINE_HEIGHT_LATIN) | |
232 | |
233 #define ICON_HEIGHT (6) | |
234 #else | |
235 #define SK_HEIGHT_LATIN (LINE_HEIGHT+8) | |
236 #define SK_HEIGHT_CHINESE (LINE_HEIGHT+8) | |
237 #define TITLE_HEIGHT_LATIN (LINE_HEIGHT_LATIN+4) | |
238 #define TITLE_HEIGHT_CHINESE (LINE_HEIGHT_CHINESE+4) | |
239 #define ALLOFFSET (LINE_HEIGHT*2) | |
240 #define MNUOFFSET (LINE_HEIGHT) | |
241 | |
242 #define NLINES_LATIN (SCREEN_SIZE_Y/LINE_HEIGHT_LATIN) | |
243 #define NLINES_CHINESE (SCREEN_SIZE_Y/LINE_HEIGHT_CHINESE) | |
244 #define CHINESE_MENU_VERTICAL_SIZE ((NLINES_CHINESE*LINE_HEIGHT_CHINESE)-SK_HEIGHT_CHINESE) | |
245 #define STANDARD_MENU_VERTICAL_SIZE ((NLINES_LATIN*LINE_HEIGHT_LATIN)-SK_HEIGHT_LATIN) | |
246 | |
247 #define ICON_HEIGHT (22) | |
248 #endif | |
249 | |
250 | |
251 /******************************************************************************* | |
252 | |
253 Static data elements | |
254 | |
255 *******************************************************************************/ | |
256 | |
257 /* Define static data elements to give the global | |
258 handles. These are not re-entrant, but what the | |
259 hell, there will only be one of these in the | |
260 system | |
261 */ | |
262 static tBlkHandle BlkManager = NULL; | |
263 UBYTE currentLanguage = NULL; | |
264 static tBlkHandle Language = NULL; | |
265 static long int ModuleKey = -1; | |
266 | |
267 | |
268 /* Define a unique key value to determine if the constructor | |
269 has been called. This is slightly dangerous as there is | |
270 a chance that the key value powers up in this state, however | |
271 this is unlikely in a cold boot situation. (In a warm boot, | |
272 if the RAM contents are preserved then the block resource | |
273 manager will also be preserved, so there should be no | |
274 problem there). | |
275 */ | |
276 #define KEYVALUE 0x00FADE00 | |
277 | |
278 | |
279 /* We know that the resource manager deals with two languages | |
280 at present, English and German, The first element in the | |
281 lists will indicate which is which in a later version, however | |
282 for now, we will just define constant settings for these. | |
283 | |
284 Note that the current MMI doesn't fully support German | |
285 characters, but the resource manager does. | |
286 */ | |
287 | |
288 #define SHOW_CONFIRM 3 | |
289 int Easy_Text_Available = TRUE; | |
290 | |
291 char* SIMToolKitString=NULL; | |
292 | |
293 | |
294 /*SPR 1111, country code and langauge tables*/ | |
295 /*MC, if English and Chinese Available*/ | |
296 #ifdef CHINESE_MMI | |
297 static const CountryLangEntry LanguageTableEntries[7]= | |
298 { | |
299 {"001", ENGLISH_LANGUAGE}, /*USA*/ | |
300 {"044", ENGLISH_LANGUAGE}, /*UK*/ | |
301 {"061", ENGLISH_LANGUAGE}, /*Australia*/ | |
302 {"353", ENGLISH_LANGUAGE}, /*Ireland*/ | |
303 {"064", ENGLISH_LANGUAGE}, /*New Zealand*/ | |
304 {"086", CHINESE_LANGUAGE}, /*PRChina*/ | |
305 {"065", CHINESE_LANGUAGE} /*Singapore*/ | |
306 }; | |
307 | |
308 static const CountryLanguageTable LanguageTable = | |
309 { 7, (CountryLangEntry*)LanguageTableEntries}; | |
310 #else /*MC, if English and German Available*/ | |
311 static const CountryLangEntry LanguageTableEntries[7]= | |
312 { | |
313 {"001", ENGLISH_LANGUAGE}, /*USA*/ | |
314 {"044", ENGLISH_LANGUAGE}, /*UK*/ | |
315 {"061", ENGLISH_LANGUAGE}, /*Australia*/ | |
316 {"353", ENGLISH_LANGUAGE}, /*Ireland*/ | |
317 {"064", ENGLISH_LANGUAGE}, /*New Zealand*/ | |
318 {"043", GERMAN_LANGUAGE}, /*Austria*/ | |
319 {"049", GERMAN_LANGUAGE} /*Germany*/ | |
320 }; | |
321 | |
322 static const CountryLanguageTable LanguageTable = | |
323 { 7, (CountryLangEntry*)LanguageTableEntries}; | |
324 | |
325 | |
326 #endif | |
327 | |
328 typedef struct | |
329 { | |
330 // cp_resource_file_t rf; | |
331 RESOURCE_DIRECTORY_HEADER language_table; | |
332 RESOURCE_DIRECTORY_HEADER melody_table; | |
333 RESOURCE_DIRECTORY_HEADER glyph_table; | |
334 RESOURCE_DIRECTORY_HEADER zone_table; | |
335 | |
336 UBYTE langid; // current language_table | |
337 UBYTE fontid; // current font | |
338 ST_DIMENSION fontHeight; // current font height | |
339 | |
340 } res_ResMgr_type; | |
341 | |
342 | |
343 | |
344 | |
345 typedef struct | |
346 { | |
347 T_MMI_CONTROL mmi_control; | |
348 T_MFW_HND resources_win; /* MFW win handler */ | |
349 } T_resources; | |
350 | |
351 T_resources resources_data; | |
352 | |
353 enum { | |
354 COL_TYPE_SCREEN=0, | |
355 COL_TYPE_SK, | |
356 COL_TYPE_HL, | |
357 COL_TYPE_TITLE, | |
358 COL_TYPE_MAX | |
359 }; | |
360 /***************************Go-lite Optimization changes Start***********************/ | |
361 //Aug 25, 2004 REF: CRR 24297 Deepa M.D | |
362 //T_COLDATA structure for the Go-lite has been reduced in size. | |
363 //March 01, 2005 REF: ENH 29313 Deepa M.D | |
364 // Isolating colour build related changes from MMI LITE flag. | |
365 // The proper Feature flag COLORDISPLAY was used for all color | |
366 //related changes. | |
367 #ifdef COLOURDISPLAY | |
368 typedef struct { | |
369 U32 fgd; | |
370 U32 bgd; | |
371 } T_COLDATA; | |
372 #else | |
373 typedef struct { | |
374 U8 fgd; | |
375 U8 bgd; | |
376 } T_COLDATA; | |
377 #endif | |
378 /***************************Go-lite Optimization changes end***********************/ | |
379 const char * colourFileDir = "/mmi"; | |
380 const char * colourFileName = "MmiColour"; | |
381 | |
382 static T_COLDATA colArray[LAST_COLOUR_DEF][COL_TYPE_MAX]; | |
383 | |
384 #define FGD_COL 1 | |
385 #define BGD_COL 2 | |
386 #define NO_COL 3 | |
387 | |
388 #ifndef LSCREEN | |
389 #define NLINES 4 | |
390 #define NLINES_MAX 5 | |
391 #else | |
392 #define NLINES ((SCREEN_SIZE_Y-SK_HEIGHT_LATIN)/LINE_HEIGHT) | |
393 #define NLINES_MAX ((SCREEN_SIZE_Y-SK_HEIGHT_LATIN)/LINE_HEIGHT) | |
394 #endif | |
395 | |
396 /*Data should be reset */ | |
397 MfwRect menuArea = {0,0,10,10}; | |
398 MfwRect menuNamesArea = {0,0,10,10}; | |
399 MfwRect menuListArea = {0,0,10,10}; | |
400 MfwRect editor_menuArea = {0,0,10,10}; /* menus display area */ | |
401 MfwRect network_menuArea = {0,0,10,10}; /* menus display area */ | |
402 MfwRect sat_setup_menuArea = {0,0,10,10}; /* menus display area */ | |
403 MfwRect sat_select_menuArea = {0,0,10,10}; /* menus display area */ | |
404 MfwRect smscb_M_CBArea = {0,0,10,10}; /* menus display area */ | |
405 MfwRect smscb_M_CB_ACTArea = {0,0,10,10}; /* menus display area */ | |
406 MfwRect smscb_M_CB_TOPArea = {0,0,10,10};/* menus display area */ | |
407 MfwRect smscb_M_CB_TOP_CONSArea = {0,0,10,10}; /* menus display area */ | |
408 MfwRect smscb_M_CB_TOP_CONS_SELArea = {0,0,10,10}; /* menus display area */ | |
409 MfwRect smscb_CBArea = {0,0,10,10}; /* menus display area */ | |
410 MfwRect smscb_CB_OPTArea = {0,0,10,10}; /* menus display area */ | |
411 MfwRect readSMS_menuArea = {0,0,10,10}; /* menus display area */ | |
412 #ifdef FF_MMI_FILEMANAGER | |
413 MfwRect FileType_menuArea = {0,0,10,10}; /* menus display area */ // RAVI - 19-05-2005 | |
414 #endif | |
415 MfwRect SmsRead_R_OPTArea = {0,0,10,10};/* menus display area */ | |
416 MfwRect SmsSend_R_OPTArea = {0,0,10,10}; /* menus display area */ | |
417 MfwRect melody_menuArea = {0,0,10,10}; /* menus display area */ | |
418 MfwRect MAINICONarea = {0,0,10,10}; | |
419 MfwRect MAINICONareaColour = {0,0,10,10}; //For the larger colour main icons | |
420 | |
421 static int resources_win_cb (T_MFW_EVENT event, T_MFW_WIN * win); | |
422 static void resources_language_confirm(void); | |
423 void resources_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
424 void resources (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
425 T_MFW_HND resources_Init (T_MFW_HND parent_window); | |
426 void resources_Exit (T_MFW_HND own_window); | |
427 T_MFW_HND resources_create (T_MFW_HND parent_window); | |
428 void initDefaultDataColour (void); | |
429 | |
430 // Extern Function ADDED - RAVI - 25-11-2005 | |
431 EXTERN int flash_formatted(void); | |
432 EXTERN void idle_setBgdBitmap(int bmpId); | |
433 // END - RAVI | |
434 | |
435 | |
436 | |
437 /******************************************************************************* | |
438 | |
439 Private Routines | |
440 | |
441 *******************************************************************************/ | |
442 | |
443 static void LanguageEnable( int newLanguage ) | |
444 { | |
445 /* Initialise if required | |
446 */ | |
447 currentLanguage = newLanguage; | |
448 if ( ModuleKey != KEYVALUE ) | |
449 { | |
450 /* Nope, then go do it, If the mmibm_* routines fail to initialise | |
451 they will return NULL, and they both deal with bad input values | |
452 cleanly, so we don't need error checking here. | |
453 */ | |
454 BlkManager = mmibm_Initialise( Mmir_BaseAddress(), Mmir_NumberOfEntries() ); | |
455 ModuleKey = KEYVALUE; | |
456 } | |
457 | |
458 /* Set up the new language based on the incoming value | |
459 */ | |
460 /*MC, SPR 1150, simplified for easier addition of new languages*/ | |
461 if (newLanguage> 0 && newLanguage <= NO_OF_LANGUAGES) | |
462 Language = mmibm_SupplyResourceHandler( BlkManager, newLanguage ); | |
463 } | |
464 | |
465 | |
466 /******************************************************************************* | |
467 | |
468 Public Routines | |
469 | |
470 *******************************************************************************/ | |
471 | |
472 /******************************************************************************* | |
473 $Function: MmiRsrcGetText | |
474 | |
475 $Description: Define access routine for the actual get text | |
476 routine. In order to make sure the routine can | |
477 be invoked and will automatically start, we will | |
478 use the key value above to ensure we detect the | |
479 startup conditions. | |
480 | |
481 The calling routine for this function should check | |
482 for NULL values which will be returned if the | |
483 | |
484 $Returns: Pointer to resource indicated by Id (Or NULL) | |
485 | |
486 $Arguments: Id of requested resource | |
487 | |
488 *******************************************************************************/ | |
489 | |
490 char *MmiRsrcGetText( int Id ) | |
491 { | |
492 /* Check if we have already initialised | |
493 */ | |
494 if ( ModuleKey != KEYVALUE ) | |
495 LanguageEnable( ENGLISH_LANGUAGE ); | |
496 | |
497 /* JVJ #1576 SAT is an exception, since the Menu string is variable depending on the SIM*/ | |
498 /* but the Languages table is constant. Therefore we need this workaround for the Mainmenu*/ | |
499 /* to display the SAT header */ | |
500 if ((Id == TxtSimToolkit)&&(SIMToolKitString)) | |
501 return (char*)SIMToolKitString; | |
502 | |
503 //x0pleela 23 May, 2006 DR: OMAPS00070657 | |
504 #ifdef FF_CPHS | |
505 if( (Id==TxtLine1) && strlen(FFS_flashData.line1)) | |
506 return (char*)FFS_flashData.line1; | |
507 | |
508 else if( (Id==TxtLine2) && strlen(FFS_flashData.line2)) | |
509 return (char*)FFS_flashData.line2; | |
510 #endif | |
511 /* use the currently set up resource handler for the English | |
512 language to get the text associaed with the Id, again if | |
513 there has been a problem with the initialisation of the | |
514 English handler, then the fetch routine will deal with it | |
515 cleanly and return NULL. | |
516 */ | |
517 return (char *) mmibr_Fetch( Language, Id ); | |
518 } | |
519 | |
520 /*MC, SPR 1150 new function, don't need to write a new function for each new langauge now*/ | |
521 void MmiRsrcSetLang( int lang ) | |
522 { if (lang == CHINESE_LANGUAGE) | |
523 dspl_set_char_type(DSPL_TYPE_UNICODE); | |
524 else | |
525 dspl_set_char_type(DSPL_TYPE_ASCII); | |
526 LanguageEnable( lang ); | |
527 Mmi_layout_areas(); | |
528 FFS_flashData.language = lang; | |
529 | |
530 // Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu | |
531 // Issue description: Golite booting problem. | |
532 // Solution: If the FFS is not formatted, prevent writing into the FFS. | |
533 if(flash_formatted() == TRUE) | |
534 { | |
535 flash_write(); | |
536 } | |
537 | |
538 | |
539 } | |
540 /*MC SPR 1150, Simplified menu interface functions. | |
541 It should be simpler to add new functions for new languages | |
542 We still need to write individual functions for each language to interface with the menus as | |
543 the menu architecture does not allow passing parmeters*/ | |
544 /*OMAPS00070661 (SAT-Lang selection) a0393213(R.Prabakar) language selection sent to mfw*/ | |
545 void Mmi_Set2English( void ) | |
546 { | |
547 TRACE_EVENT("English Language Selected"); | |
548 Mmi_Set2Language(ENGLISH_LANGUAGE); | |
549 #ifdef FF_MMI_R99_SAT_LANG | |
550 satLanguageSelected (ENGLISH_LANGUAGE); | |
551 #endif | |
552 } | |
553 | |
554 void Mmi_Set2German( void ) | |
555 { | |
556 TRACE_EVENT("German Language Selected"); | |
557 Mmi_Set2Language(GERMAN_LANGUAGE); | |
558 #ifdef FF_MMI_R99_SAT_LANG | |
559 satLanguageSelected (GERMAN_LANGUAGE); | |
560 #endif | |
561 } | |
562 | |
563 void Mmi_Set2Chinese( void ) | |
564 { | |
565 TRACE_EVENT("Chinese Language Selected"); | |
566 Mmi_Set2Language(CHINESE_LANGUAGE); | |
567 #ifdef FF_MMI_R99_SAT_LANG | |
568 satLanguageSelected (CHINESE_LANGUAGE); | |
569 #endif | |
570 } | |
571 | |
572 #ifdef LANG_CHANGE_TEST | |
573 void Mmi_Set2Martian( void ) | |
574 { | |
575 TRACE_EVENT("Martian Language Selected"); | |
576 Mmi_Set2Language(MARTIAN_LANGUAGE); | |
577 #ifdef FF_MMI_R99_SAT_LANG | |
578 satLanguageSelected (MARTIAN_LANGUAGE); | |
579 #endif | |
580 } | |
581 #endif | |
582 | |
583 /*MC SPR 1150,new generic langauge change function*/ | |
584 void Mmi_Set2Language(int lang) | |
585 { | |
586 T_MFW_HND win = mfw_parent(mfw_header()); | |
587 #ifndef FF_MMI_R99_SAT_LANG /*OMAPS00070661(SAT-lang notify) a0393213(R.Prabakar)*/ | |
588 resources_Init(win); | |
589 MmiRsrcSetLang(lang); | |
590 SEND_EVENT (resources_data.resources_win, SHOW_CONFIRM, 0, 0); | |
591 #else | |
592 /*OMAPS00070661 The sequence is changed to prevent the crash when the language is changed in quick succession*/ | |
593 MmiRsrcSetLang(lang); | |
594 if(!resources_data.resources_win) | |
595 { | |
596 resources_Init(win); | |
597 SEND_EVENT (resources_data.resources_win, SHOW_CONFIRM, 0, 0); | |
598 } | |
599 #endif | |
600 | |
601 } | |
602 | |
603 UBYTE Mmi_getCurrentLanguage(void) | |
604 { | |
605 return currentLanguage; | |
606 } | |
607 | |
608 //GW Created to return height of a line with just numbers on it | |
609 UBYTE numberLineHeight(void) | |
610 { | |
611 #ifndef LSCREEN | |
612 //All numbers are 8 bits high (whether chinese or latin chars) | |
613 return (8); | |
614 #else | |
615 //all text is 12 bits high | |
616 return (12); | |
617 #endif | |
618 } | |
619 //GW Created | |
620 UBYTE Mmi_layout_line(int lineNo) | |
621 { | |
622 #ifndef LSCREEN | |
623 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
624 { | |
625 switch (lineNo) | |
626 { | |
627 case 1: return FIRST_LINE_CHINESE; | |
628 | |
629 case SECOND_LAST_LINE_TOP: | |
630 case 2: return SECOND_LINE_CHINESE; | |
631 | |
632 case LAST_LINE_TOP: | |
633 case 3: return THIRD_LINE_CHINESE; | |
634 | |
635 case LAST_LINE: | |
636 case 4: return FOURTH_LINE_CHINESE; | |
637 //We are now asking for an invalid line | |
638 default: return FOURTH_LINE_CHINESE; | |
639 | |
640 } | |
641 } | |
642 else | |
643 { | |
644 switch (lineNo) | |
645 { | |
646 case 1: return FIRST_LINE; | |
647 case 2: return SECOND_LINE; | |
648 case 3: return THIRD_LINE; | |
649 | |
650 case SECOND_LAST_LINE_TOP: | |
651 case 4: return FOURTH_LINE; | |
652 | |
653 case LAST_LINE_TOP: //y-coord of the top of last line | |
654 case 5: return FIFTH_LINE; | |
655 | |
656 case LAST_LINE: | |
657 case 6: return SIXTH_LINE; | |
658 //We are now asking for an invalid line | |
659 default: return SIXTH_LINE; | |
660 } | |
661 } | |
662 #else | |
663 //assume both fonts are now the same height. | |
664 switch (lineNo) | |
665 { | |
666 case SECOND_LAST_LINE_TOP: return ( (UBYTE)(SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()-LINE_HEIGHT)); | |
667 case LAST_LINE_TOP: return ( (UBYTE)(SCREEN_SIZE_Y-Mmi_layout_softkeyHeight())); | |
668 case LAST_LINE: return ( (UBYTE) SCREEN_SIZE_Y); | |
669 | |
670 default: return (lineNo*LINE_HEIGHT); | |
671 } | |
672 #endif | |
673 } | |
674 UBYTE Mmi_layout_line_icons(int lineNo) | |
675 { | |
676 #ifndef LSCREEN | |
677 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
678 { | |
679 switch (lineNo) | |
680 { | |
681 case 1: return FIRST_LINE_CHINESE; | |
682 | |
683 case SECOND_LAST_LINE_TOP: | |
684 case 2: return SECOND_LINE_CHINESE; | |
685 | |
686 case LAST_LINE_TOP: | |
687 case 3: return THIRD_LINE_CHINESE; | |
688 | |
689 case LAST_LINE: | |
690 case 4: return FOURTH_LINE_CHINESE; | |
691 //We are now asking for an invalid line | |
692 default: return FOURTH_LINE_CHINESE; | |
693 | |
694 } | |
695 } | |
696 else | |
697 { | |
698 switch (lineNo) | |
699 { | |
700 case 1: //nobreak; | |
701 case 2: //nobreak; | |
702 case 3: //nobreak; | |
703 default: return (FIRST_LINE_ICON+(lineNo-1)*LINE_HEIGHT); | |
704 | |
705 case SECOND_LAST_LINE_TOP: | |
706 case 4: return FOURTH_LINE; | |
707 | |
708 case LAST_LINE_TOP: //y-coord of the top of last line | |
709 case 5: return FIFTH_LINE; | |
710 | |
711 case LAST_LINE: | |
712 case 6: return SIXTH_LINE; | |
713 } | |
714 | |
715 } | |
716 #else | |
717 switch (lineNo) | |
718 { | |
719 case SECOND_LAST_LINE_TOP: return((UBYTE)(SCREEN_SIZE_Y-(Mmi_layout_softkeyHeight()+Mmi_layout_line_height()))); | |
720 case LAST_LINE_TOP: return((UBYTE)(SCREEN_SIZE_Y-(Mmi_layout_softkeyHeight()))); | |
721 case LAST_LINE: return((UBYTE)(SCREEN_SIZE_Y)); | |
722 default: return(Mmi_layout_IconHeight()+Mmi_layout_line_height()*lineNo); | |
723 | |
724 } | |
725 #endif | |
726 } | |
727 | |
728 UBYTE Mmi_layout_line_height(void) | |
729 { | |
730 #ifndef LSCREEN | |
731 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
732 return LINE_HEIGHT_CHINESE; | |
733 else | |
734 return LINE_HEIGHT; | |
735 #else | |
736 return (LINE_HEIGHT); | |
737 #endif | |
738 } | |
739 | |
740 UBYTE Mmi_layout_softkeyHeight( void ) | |
741 { | |
742 #ifndef LSCREEN | |
743 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
744 return SK_HEIGHT_CHINESE; | |
745 else | |
746 return SK_HEIGHT_LATIN; | |
747 #else | |
748 return (SK_HEIGHT_LATIN); | |
749 #endif | |
750 } | |
751 UBYTE Mmi_layout_softkeyArea( MfwRect* rect ) | |
752 { | |
753 if (!rect) | |
754 return (0); | |
755 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
756 rect->sy = SK_HEIGHT_CHINESE; | |
757 else | |
758 rect->sy = SK_HEIGHT_LATIN; | |
759 rect->px = 0; | |
760 rect->sx = SCREEN_SIZE_X; | |
761 rect->py = SCREEN_SIZE_Y-rect->sy; | |
762 return(1); | |
763 } | |
764 UBYTE Mmi_layout_TitleHeight( void ) | |
765 { | |
766 #ifndef LSCREEN | |
767 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
768 return TITLE_HEIGHT_CHINESE; | |
769 else | |
770 return TITLE_HEIGHT_LATIN; | |
771 #else | |
772 return (TITLE_HEIGHT_LATIN); | |
773 #endif | |
774 } | |
775 UBYTE Mmi_layout_IconHeight( void ) | |
776 { | |
777 return (ICON_HEIGHT); | |
778 } | |
779 | |
780 UBYTE Mmi_number_of_lines_with_icons_on_top(void) | |
781 { | |
782 #ifndef LSCREEN | |
783 { | |
784 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
785 return 2; | |
786 else | |
787 return 4; | |
788 } | |
789 #else | |
790 return NLINES_MAX-1; | |
791 #endif | |
792 } | |
793 | |
794 | |
795 UBYTE Mmi_number_of_lines_without_icons_on_top(void) | |
796 { | |
797 #ifndef LSCREEN | |
798 { | |
799 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
800 return 3; | |
801 else | |
802 return 5; | |
803 } | |
804 #else //assume a single font of 12 pixels high 10 lines x 12 pixels | |
805 return NLINES_MAX; | |
806 #endif | |
807 } | |
808 | |
809 //GW 10/02/03 Modified code - icon position is now sorted out by 'iconsMainIconsAreaSet' - the code | |
810 // here only supplies the available screen size | |
811 void Mmi_layout_areas(void) | |
812 { | |
813 MAINICONarea.px = 0; | |
814 MAINICONarea.py =Mmi_layout_line_height(); | |
815 | |
816 MAINICONarea.sx = SCREEN_SIZE_X; | |
817 MAINICONarea.sy =SCREEN_SIZE_Y-Mmi_layout_line_height()*2-1; | |
818 | |
819 Mmi_set_area_attr(&menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
820 Mmi_set_area_attr(&menuNamesArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-LINE_HEIGHT-Mmi_layout_softkeyHeight()); | |
821 Mmi_set_area_attr(&menuListArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
822 Mmi_set_area_attr(&editor_menuArea,Mmi_layout_line(1),0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
823 Mmi_set_area_attr(&network_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-/*Mmi_layout_IconHeight()-*/Mmi_layout_softkeyHeight()); /* SPR#2354 - SH - icons aren't shown */ | |
824 Mmi_set_area_attr(&sat_setup_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
825 Mmi_set_area_attr(&sat_select_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
826 Mmi_set_area_attr(&smscb_M_CBArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
827 Mmi_set_area_attr(&smscb_M_CB_ACTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
828 Mmi_set_area_attr(&smscb_M_CB_TOPArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
829 Mmi_set_area_attr(&smscb_M_CB_TOP_CONSArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
830 Mmi_set_area_attr(&smscb_M_CB_TOP_CONS_SELArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
831 Mmi_set_area_attr(&smscb_CBArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
832 Mmi_set_area_attr(&smscb_CB_OPTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
833 Mmi_set_area_attr(&readSMS_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
834 #ifdef FF_MMI_FILEMANAGER | |
835 Mmi_set_area_attr(&FileType_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); // RAVI - 27-05-2005 | |
836 #endif | |
837 Mmi_set_area_attr(&SmsRead_R_OPTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
838 Mmi_set_area_attr(&SmsSend_R_OPTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
839 Mmi_set_area_attr(&melody_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()); | |
840 iconsMainIconsAreaSet (MAINICONarea); | |
841 | |
842 } | |
843 | |
844 void Mmi_set_area_attr(MfwRect* area,U16 px,U16 py,U16 sx,U16 sy) | |
845 { | |
846 | |
847 /* pass in top-left/bottom-right coordinates*/ | |
848 area->px = px; | |
849 area->py = py; | |
850 area->sx = sx-px; | |
851 area->sy = sy-py; | |
852 } | |
853 | |
854 /******************************************************************************* | |
855 | |
856 $Function: resources_Init | |
857 | |
858 $Description: | |
859 | |
860 $Returns: window | |
861 | |
862 $Arguments: parent window | |
863 | |
864 *******************************************************************************/ | |
865 T_MFW_HND resources_Init(T_MFW_HND parent_window) | |
866 { | |
867 return (resources_create (parent_window)); | |
868 } | |
869 | |
870 // API - 1550 - 13-01-03 - Add this function to reset the backgrounds of Idle and Main Menus. | |
871 void resetFactoryBackground ( void ) | |
872 { | |
873 idle_setBgdBitmap(BGD_TI_LOGO); | |
874 FFS_flashData.IdleScreenBgd = BGD_TI_LOGO; | |
875 | |
876 icon_setMainBgdBitmap(BGD_SQUARE); | |
877 FFS_flashData.MainMenuBgd = BGD_SQUARE; | |
878 | |
879 FFS_flashData.ProviderNetworkShow = TRUE; | |
880 } | |
881 | |
882 void resetFactoryColour ( void ) | |
883 { | |
884 initDefaultDataColour(); | |
885 if(flash_data_write(colourFileDir, colourFileName, colArray, sizeof(colArray)) >= EFFS_OK) | |
886 { | |
887 TRACE_EVENT("File Created in FFS"); | |
888 } | |
889 else | |
890 { | |
891 TRACE_EVENT("File Not Created in FFS"); | |
892 } | |
893 | |
894 } | |
895 void colour_initial_colours (void) | |
896 { | |
897 /* API/GW - Added to read the flash structure to see if the file structure to save the colour data in has been created | |
898 and if so save the initialised data to flash or load the saved values out of flash | |
899 */ | |
900 if (flash_data_read(colourFileDir, colourFileName, colArray, sizeof(colArray)) == sizeof(colArray)) | |
901 /* Marcus: Issue 1719: 11/02/2003: Altered comparison in condition */ | |
902 { | |
903 TRACE_EVENT("Correctly Read in!"); | |
904 } | |
905 else | |
906 { | |
907 resetFactoryColour(); | |
908 } | |
909 } | |
910 /******************************************************************************* | |
911 | |
912 $Function: resources_Exit | |
913 | |
914 $Description: exit network handling (Backward Compatibility interface) | |
915 | |
916 $Returns: none | |
917 | |
918 $Arguments: window | |
919 | |
920 *******************************************************************************/ | |
921 void resources_Exit (T_MFW_HND own_window) | |
922 { | |
923 | |
924 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data; | |
925 T_resources * data = (T_resources *)win_data->user; | |
926 | |
927 resources_destroy (data->resources_win); | |
928 } | |
929 | |
930 | |
931 | |
932 | |
933 /******************************************************************************* | |
934 | |
935 $Function: resources_create | |
936 | |
937 $Description: create network top window | |
938 | |
939 $Returns: window | |
940 | |
941 $Arguments: parent_window | |
942 | |
943 *******************************************************************************/ | |
944 T_MFW_HND resources_create (T_MFW_HND parent_window) | |
945 { | |
946 T_resources * data = &resources_data; | |
947 T_MFW_WIN * win; | |
948 | |
949 TRACE_FUNCTION ("resources_create()"); | |
950 | |
951 data->resources_win = win_create (parent_window, 0, 0, (T_MFW_CB)resources_win_cb); | |
952 | |
953 if (data->resources_win EQ 0) | |
954 return 0; | |
955 | |
956 /* | |
957 * Create window handler | |
958 */ | |
959 data->mmi_control.dialog = (T_DIALOG_FUNC)resources; | |
960 data->mmi_control.data = data; | |
961 win = ((T_MFW_HDR *)data->resources_win)->data; | |
962 win->user = (void *) data; | |
963 | |
964 | |
965 winShow(data->resources_win); | |
966 /* | |
967 * return window handle | |
968 */ | |
969 return data->resources_win; | |
970 } | |
971 | |
972 | |
973 | |
974 /******************************************************************************* | |
975 | |
976 $Function: resources_destroy | |
977 | |
978 $Description: | |
979 | |
980 $Returns: none | |
981 | |
982 $Arguments: window | |
983 | |
984 *******************************************************************************/ | |
985 void resources_destroy (T_MFW_HND own_window) | |
986 { | |
987 T_MFW_WIN * win; | |
988 T_resources * data; | |
989 | |
990 TRACE_FUNCTION ("resources_destroy()"); | |
991 | |
992 if (own_window) | |
993 { | |
994 win = ((T_MFW_HDR *)own_window)->data; | |
995 data = (T_resources *)win->user; | |
996 | |
997 if (data) | |
998 { | |
999 | |
1000 /* | |
1001 * Delete WIN handler | |
1002 */ | |
1003 win_delete (data->resources_win); | |
1004 data->resources_win = 0; | |
1005 } | |
1006 } | |
1007 } | |
1008 | |
1009 | |
1010 /******************************************************************************* | |
1011 | |
1012 $Function: resources_win_cb | |
1013 | |
1014 $Description: network top window | |
1015 | |
1016 $Returns: status int | |
1017 | |
1018 $Arguments: event, window | |
1019 | |
1020 *******************************************************************************/ | |
1021 static int resources_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
1022 { | |
1023 /* | |
1024 * Top Window has no output | |
1025 */ | |
1026 return 1; | |
1027 } | |
1028 | |
1029 | |
1030 | |
1031 | |
1032 | |
1033 /******************************************************************************* | |
1034 | |
1035 $Function: resources_language_confirm | |
1036 | |
1037 $Description: | |
1038 | |
1039 $Returns: void | |
1040 | |
1041 $Arguments: void | |
1042 | |
1043 *******************************************************************************/ | |
1044 static void resources_language_confirm(void) | |
1045 { | |
1046 T_DISPLAY_DATA display_info; | |
1047 | |
1048 TRACE_FUNCTION ("resources_language_confirm()"); | |
1049 | |
1050 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtDone, TxtNull , COLOUR_STATUS_PINS); | |
1051 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)resources_dialog_cb, THREE_SECS, KEY_CLEAR | KEY_RIGHT ); | |
1052 | |
1053 /* | |
1054 * Call Info Screen | |
1055 */ | |
1056 info_dialog (resources_data.resources_win, &display_info); | |
1057 | |
1058 } | |
1059 | |
1060 /******************************************************************************* | |
1061 | |
1062 $Function: resources_dialog_cb | |
1063 | |
1064 $Description: | |
1065 | |
1066 $Returns: void | |
1067 | |
1068 $Arguments: window, identifier, reason | |
1069 | |
1070 *******************************************************************************/ | |
1071 void resources_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
1072 { | |
1073 TRACE_FUNCTION ("resources_dialog_cb()"); | |
1074 | |
1075 switch (reason) | |
1076 { | |
1077 case INFO_TIMEOUT: | |
1078 /* no break; */ | |
1079 case INFO_KCD_HUP: | |
1080 /* no break; */ | |
1081 case INFO_KCD_LEFT: | |
1082 /* no break; */ | |
1083 case INFO_KCD_RIGHT: | |
1084 resources_Exit(win); | |
1085 break; | |
1086 } | |
1087 } | |
1088 | |
1089 | |
1090 | |
1091 /******************************************************************************* | |
1092 | |
1093 $Function: resources | |
1094 | |
1095 $Description: | |
1096 | |
1097 $Returns: void | |
1098 | |
1099 $Arguments: window, event, value, parameter | |
1100 | |
1101 *******************************************************************************/ | |
1102 void resources (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
1103 { | |
1104 // T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; // RAVI | |
1105 // T_resources * data = (T_resources *)win_data->user; // RAVI | |
1106 | |
1107 TRACE_FUNCTION("resources()"); | |
1108 | |
1109 switch (event) | |
1110 { | |
1111 case SHOW_CONFIRM: | |
1112 resources_language_confirm(); | |
1113 break; | |
1114 } | |
1115 | |
1116 } | |
1117 /*MC added for SPR 1111*/ | |
1118 /******************************************************************************* | |
1119 | |
1120 $Function: resources_reset_language | |
1121 | |
1122 $Description: Reset language using Pseudo-SS string | |
1123 | |
1124 $Returns: TRUE if reset successful, FALSE otherwise | |
1125 | |
1126 $Arguments: Pseudo-SS string | |
1127 | |
1128 *******************************************************************************/ | |
1129 BOOL resources_reset_language(char* string) | |
1130 { | |
1131 char country_code[4]; | |
1132 int i; | |
1133 /*extract country code from input string*/ | |
1134 memcpy(country_code, &string[3], 3); | |
1135 country_code[3] = NULL; | |
1136 | |
1137 /*for each entry in Language table*/ | |
1138 for(i=0; i<LanguageTable.no_of_entries; i++) | |
1139 { /*if country matches that of entry*/ | |
1140 | |
1141 if (!strcmp(country_code, LanguageTable.entries[i].country_dialling_code)) | |
1142 { /*MC SPR 1150, check language fits in allowed range, rather than checking for each | |
1143 and every language (easier to add more languages this way)*/ | |
1144 if (LanguageTable.entries[i].language>0 && LanguageTable.entries[i].language <= NO_OF_LANGUAGES) | |
1145 { MmiRsrcSetLang(LanguageTable.entries[i].language); | |
1146 return TRUE; | |
1147 } | |
1148 } | |
1149 } | |
1150 /*if no matches found*/ | |
1151 return FALSE; | |
1152 } | |
1153 | |
1154 /******************************************************************************* | |
1155 | |
1156 $Function: | |
1157 | |
1158 $Description: | |
1159 | |
1160 $Returns: | |
1161 | |
1162 $Arguments: | |
1163 | |
1164 $History | |
1165 GW 28/11/02 - | |
1166 | |
1167 *******************************************************************************/ | |
1168 #define NO_COLOUR_DEFINED (0x01010101) | |
1169 /***************************Go-lite Optimization changes Start***********************/ | |
1170 //Aug 25, 2004 REF: CRR 24297 Deepa M.D | |
1171 //This function is called only for Color build. | |
1172 #ifdef COLOURDISPLAY | |
1173 void init_getDataColour(int screenType, int colType, U32 *fgd, U32 *bgd) | |
1174 { | |
1175 U32 fgColor; | |
1176 U32 bgColor; | |
1177 U32 fgHLColor = NO_COLOUR_DEFINED; | |
1178 U32 bgHLColor = NO_COLOUR_DEFINED; | |
1179 U32 fgSKColor = NO_COLOUR_DEFINED; | |
1180 U32 bgSKColor = NO_COLOUR_DEFINED; | |
1181 U32 fgTColor = NO_COLOUR_DEFINED; | |
1182 U32 bgTColor = NO_COLOUR_DEFINED; | |
1183 | |
1184 TRACE_EVENT("init_getDataColour"); | |
1185 | |
1186 switch (screenType) | |
1187 { | |
1188 case COLOUR_STATUS_WELCOME: //start screen | |
1189 case COLOUR_STATUS_GOODBYE: //end screen | |
1190 fgColor = COL_Black; | |
1191 bgColor = COL_White; | |
1192 fgSKColor = COL_Blue; | |
1193 bgSKColor = COL_Yellow; | |
1194 break; | |
1195 | |
1196 /* GW#2294 Use a more legible colour as default background colour.*/ | |
1197 case COLOUR_POPUP: | |
1198 case COLOUR_STATUS: //generic status window | |
1199 fgColor = COL_Red; //0x0000FF00; | |
1200 bgColor = COL_Yellow;//0x00FFFFFF; | |
1201 fgSKColor = COL_Red; | |
1202 bgSKColor = COL_TRANSPARENT; | |
1203 break; | |
1204 | |
1205 case COLOUR_EDITOR: | |
1206 fgTColor = COL_White; | |
1207 bgTColor = COL_Blue; | |
1208 fgColor = COL_Blue; // 0x00FFFF00; | |
1209 bgColor = COL_Yellow;//COL_White;//0x00FFFFFF; | |
1210 fgSKColor = COL_Blue; | |
1211 bgSKColor = COL_PaleYellow; //0x00FFFF00; | |
1212 break; | |
1213 | |
1214 case COLOUR_LIST_MAIN: | |
1215 fgTColor = COL_White; | |
1216 bgTColor = COL_BLK; | |
1217 fgColor = COL_Yellow ; | |
1218 bgColor = COL_Blue; | |
1219 fgColor = COL_Black ; | |
1220 bgColor = COL_White; | |
1221 fgSKColor = COL_W; | |
1222 bgSKColor = COL_BLK; //0x00FFFF00; | |
1223 bgHLColor = COL_MidGrey; | |
1224 break; | |
1225 | |
1226 case COLOUR_LIST_SUBMENU: | |
1227 case COLOUR_LIST_SUBMENU1: | |
1228 case COLOUR_LIST_SUBMENU2: | |
1229 case COLOUR_LIST_SUBMENU3: | |
1230 case COLOUR_LIST_SUBMENU4: | |
1231 fgTColor = COL_Blue; | |
1232 bgTColor = COL_PaleYellow; | |
1233 fgColor = COL_Black ; | |
1234 bgColor = COL_White; | |
1235 bgHLColor = COL_MidGrey; | |
1236 fgSKColor = COL_Blue; | |
1237 bgSKColor = COL_PaleYellow; //0x00FFFF00; | |
1238 break; | |
1239 | |
1240 case COLOUR_LIST_COLOUR: | |
1241 fgColor = COL_RG2; | |
1242 bgColor = COL_W2; | |
1243 fgSKColor = COL_W; | |
1244 bgSKColor = COL_B; | |
1245 fgTColor = COL_RG; | |
1246 bgTColor = COL_B; | |
1247 fgHLColor = dspl_GetBgdColour(); | |
1248 bgHLColor = dspl_GetFgdColour(); | |
1249 break; | |
1250 | |
1251 //Colours for specific displays | |
1252 case COLOUR_GAME: | |
1253 fgColor = COL_BLK ; | |
1254 bgColor = COL_W; | |
1255 fgSKColor = COL_BLK ; | |
1256 bgSKColor = COL_Orange; | |
1257 fgHLColor = COL_B; | |
1258 bgHLColor = COL_W; | |
1259 fgTColor = COL_RB; | |
1260 bgTColor = COL_G; | |
1261 break; | |
1262 | |
1263 case COLOUR_IDLE: | |
1264 fgColor = COL_BLK;//Green ; | |
1265 bgColor = COL_TRANSPARENT;//White ; | |
1266 fgSKColor = COL_Blue; | |
1267 bgSKColor = COL_TRANSPARENT; | |
1268 //Colours are for the icons | |
1269 fgTColor = COL_RB; | |
1270 bgTColor = COL_G; | |
1271 break; | |
1272 | |
1273 case COLOUR_INCALL: | |
1274 fgColor = COL_RG ; | |
1275 bgColor = COL_BLK; | |
1276 fgSKColor = COL_B ; /* SPR#1699 - SH - Modified so softkeys visible */ | |
1277 bgSKColor = COL_TRANSPARENT; | |
1278 fgHLColor = COL_B; | |
1279 bgHLColor = COL_W; | |
1280 fgTColor = COL_RB; | |
1281 bgTColor = COL_G; | |
1282 break; | |
1283 | |
1284 | |
1285 default: | |
1286 fgColor = 0x002020FF; | |
1287 bgColor = COL_GR;//0x00FFFFFF; | |
1288 fgSKColor = 0x0000FF01; | |
1289 bgSKColor = COL_GR;//0x00FF0000; | |
1290 break; | |
1291 } | |
1292 | |
1293 /*If we have no preference for the other colours - set to default*/ | |
1294 if (fgHLColor == NO_COLOUR_DEFINED) | |
1295 fgHLColor = bgColor; | |
1296 if (bgHLColor == NO_COLOUR_DEFINED) | |
1297 bgHLColor = fgColor; | |
1298 | |
1299 if (fgSKColor == NO_COLOUR_DEFINED) | |
1300 fgSKColor = fgColor; | |
1301 if (bgSKColor == NO_COLOUR_DEFINED) | |
1302 bgSKColor = bgColor; | |
1303 if (fgTColor == NO_COLOUR_DEFINED) | |
1304 fgTColor = fgColor; | |
1305 if (bgTColor == NO_COLOUR_DEFINED) | |
1306 bgTColor = bgColor; | |
1307 | |
1308 switch (colType) | |
1309 { | |
1310 case COL_TYPE_SCREEN: | |
1311 default: | |
1312 *fgd = fgColor; | |
1313 *bgd = bgColor; | |
1314 break; | |
1315 case COL_TYPE_SK: | |
1316 *fgd = fgSKColor; | |
1317 *bgd = bgSKColor; | |
1318 break; | |
1319 case COL_TYPE_HL: | |
1320 *fgd = fgHLColor; | |
1321 *bgd = bgHLColor; | |
1322 break; | |
1323 case COL_TYPE_TITLE: | |
1324 *fgd = fgTColor; | |
1325 *bgd = bgTColor; | |
1326 break; | |
1327 | |
1328 } | |
1329 if (*fgd == *bgd) | |
1330 { | |
1331 if (*fgd != COL_B) | |
1332 *fgd = COL_B; | |
1333 } | |
1334 } | |
1335 #endif | |
1336 /***************************Go-lite Optimization changes end***********************/ | |
1337 //This array will be used to store all the colour info for each colour type. | |
1338 //This will allow us to let the user change the colour selected | |
1339 /******************************************************************************* | |
1340 | |
1341 $Function: | |
1342 | |
1343 $Description: | |
1344 | |
1345 $Returns: | |
1346 | |
1347 $Arguments: | |
1348 | |
1349 $History | |
1350 | |
1351 *******************************************************************************/ | |
1352 | |
1353 /***************************Go-lite Optimization changes Start***********************/ | |
1354 //Aug 25, 2004 REF: CRR 24904 Deepa M.D | |
1355 //This function is used only for the Color build.Hence it is put under the | |
1356 //COLOURDISPLAY compiler switch | |
1357 #ifdef COLOURDISPLAY | |
1358 void setDataColour(int screenType, int colType, U32 fgdORbgd, U32 newColour) | |
1359 { | |
1360 | |
1361 TRACE_EVENT("setDataColour"); | |
1362 | |
1363 if ((newColour == NO_COLOUR_DEFINED) || (fgdORbgd ==NO_COL)) | |
1364 return; | |
1365 if ((screenType < LAST_COLOUR_DEF) && | |
1366 (screenType >=0) && | |
1367 (colType < LAST_COLOUR_DEF) && | |
1368 (colType >=0)) | |
1369 { | |
1370 if (fgdORbgd == FGD_COL) | |
1371 { | |
1372 //Do not allow transparent foreground colours | |
1373 if ((newColour & 0xFF000000) != 0xFF000000) | |
1374 colArray[screenType][colType].fgd = newColour; | |
1375 } | |
1376 else | |
1377 { | |
1378 colArray[screenType][colType].bgd = newColour; | |
1379 } | |
1380 } | |
1381 } | |
1382 #endif | |
1383 /***************************Go-lite Optimization changes Start***********************/ | |
1384 | |
1385 | |
1386 /******************************************************************************* | |
1387 | |
1388 $Function: | |
1389 | |
1390 $Description: | |
1391 | |
1392 $Returns: | |
1393 | |
1394 $Arguments: | |
1395 | |
1396 $History | |
1397 | |
1398 *******************************************************************************/ | |
1399 void initDefaultDataColour (void) | |
1400 { | |
1401 | |
1402 int i,j; | |
1403 | |
1404 for (i=0; i<LAST_COLOUR_DEF;i++) | |
1405 { | |
1406 for (j=0; j<COL_TYPE_MAX;j++) | |
1407 { | |
1408 /***************************Go-lite Optimization changes Start***********************/ | |
1409 //Aug 25, 2004 REF: CRR 24297 Deepa M.D | |
1410 //For Go-lite build, do the initialization of the colArray with black and white. | |
1411 //March 01, 2005 REF: ENH 29313 Deepa M.D | |
1412 // Isolating colour build related changes from MMI LITE flag. | |
1413 // The proper Feature flag COLORDISPLAY was used for all color | |
1414 //related changes. | |
1415 #ifdef COLOURDISPLAY | |
1416 init_getDataColour(i, j, &colArray[i][j].fgd, &colArray[i][j].bgd); | |
1417 #else | |
1418 colArray[i][j].fgd = COL_Lite_Black; | |
1419 colArray[i][j].bgd = COL_Lite_White; | |
1420 #endif | |
1421 /***************************Go-lite Optimization changes end***********************/ | |
1422 } | |
1423 } | |
1424 } | |
1425 | |
1426 void getDataColour(int screenType, int colType, U32 *fgd, U32 *bgd) | |
1427 { | |
1428 | |
1429 | |
1430 TRACE_EVENT("getDataColour"); | |
1431 | |
1432 if ((screenType == COLOUR_LIST_COLOUR) && (colType ==COL_TYPE_HL)) | |
1433 { | |
1434 /* x0083025 on Sep 14, 2007 for OMAPS00145860 (adrian) */ | |
1435 MMI_TRACE_EVENT("new_getDataColour IF"); | |
1436 | |
1437 *fgd = dspl_GetBgdColour(); | |
1438 *bgd = dspl_GetFgdColour(); | |
1439 } | |
1440 else if ((screenType < LAST_COLOUR_DEF) && | |
1441 (screenType >=0) && | |
1442 (colType < COL_TYPE_MAX) && | |
1443 (colType >=0)) | |
1444 { | |
1445 /* x0083025 on Sep 14, 2007 for OMAPS00145860 (adrian) */ | |
1446 MMI_TRACE_EVENT("new_getDataColour ELSE IF"); | |
1447 *fgd = colArray[screenType][colType].fgd; | |
1448 *bgd = colArray[screenType][colType].bgd; | |
1449 /***************************Go-lite Optimization changes Start***********************/ | |
1450 //Aug 25, 2004 REF: CRR 24297 Deepa M.D | |
1451 //Set the fgd and bgd color for Go-lite version based | |
1452 //on the value stored in the colArray | |
1453 //March 01, 2005 REF: ENH 29313 Deepa M.D | |
1454 // Isolating colour build related changes from MMI LITE flag. | |
1455 // The proper Feature flag COLORDISPLAY was used for all color | |
1456 //related changes. | |
1457 #ifndef COLOURDISPLAY | |
1458 if(*fgd==COL_Lite_Black) | |
1459 *fgd=COL_Black; | |
1460 else | |
1461 *fgd=COL_White; | |
1462 if(*bgd==COL_Lite_Black) | |
1463 *bgd=COL_Black; | |
1464 else | |
1465 *bgd=COL_White; | |
1466 #endif | |
1467 /***************************Go-lite Optimization changes end***********************/ | |
1468 } | |
1469 else | |
1470 { | |
1471 /* x0083025 on Sep 14, 2007 for OMAPS00145860 (adrian) */ | |
1472 MMI_TRACE_EVENT("new_getDataColour ELSE"); | |
1473 *fgd = colArray[0][0].fgd; | |
1474 *bgd = colArray[0][0].bgd; | |
1475 /***************************Go-lite Optimization changes Start***********************/ | |
1476 //Aug 25, 2004 REF: CRR 24297 Deepa M.D | |
1477 //Set the fgd and bgd color for Go-lite version based | |
1478 //on the value stored in the colArray | |
1479 //March 01, 2005 REF: ENH 29313 Deepa M.D | |
1480 // Isolating colour build related changes from MMI LITE flag. | |
1481 // The proper Feature flag COLORDISPLAY was used for all color | |
1482 //related changes. | |
1483 #ifndef COLOURDISPLAY | |
1484 if(*fgd==COL_Lite_Black) | |
1485 *fgd=COL_Black; | |
1486 else | |
1487 *fgd=COL_White; | |
1488 if(*bgd==COL_Lite_Black) | |
1489 *bgd=COL_Black; | |
1490 else | |
1491 *bgd=COL_White; | |
1492 #endif | |
1493 /***************************Go-lite Optimization changes end***********************/ | |
1494 TRACE_EVENT_P1("fdg color is %d",*fgd); | |
1495 TRACE_EVENT_P1("bdg color is %d",*bgd); | |
1496 | |
1497 } | |
1498 } | |
1499 | |
1500 /******************************************************************************* | |
1501 | |
1502 $Function: | |
1503 | |
1504 $Description: | |
1505 | |
1506 $Returns: | |
1507 | |
1508 $Arguments: | |
1509 | |
1510 $History | |
1511 | |
1512 *******************************************************************************/ | |
1513 static U32 oldFgdCol,oldBgdCol; | |
1514 static U32 oldmnuFgdCol,oldmnuBgdCol; | |
1515 void resources_setColour(unsigned int colIndex) | |
1516 { | |
1517 U32 fgdColour,bgdColour; | |
1518 getDataColour(colIndex, COL_TYPE_SCREEN, &fgdColour, &bgdColour); | |
1519 oldFgdCol = dspl_SetFgdColour( fgdColour); | |
1520 oldBgdCol = dspl_SetBgdColour( bgdColour); | |
1521 if (colIndex==0xFFFF) | |
1522 {//disabled for the moment | |
1523 char str[50]; | |
1524 sprintf(str,"Id=%d (%x,%x)",colIndex,fgdColour,bgdColour); | |
1525 dspl_ScrText (0, 180, str, 0); | |
1526 } | |
1527 } | |
1528 /******************************************************************************* | |
1529 | |
1530 $Function: | |
1531 | |
1532 $Description: | |
1533 | |
1534 $Returns: | |
1535 | |
1536 $Arguments: | |
1537 | |
1538 $History | |
1539 | |
1540 *******************************************************************************/ | |
1541 void resources_setSKColour(unsigned int colIndex) | |
1542 { | |
1543 U32 fgdSKColour,bgdSKColour; | |
1544 getDataColour(colIndex, COL_TYPE_SK, &fgdSKColour, &bgdSKColour ); | |
1545 oldmnuFgdCol = dspl_SetFgdColour( fgdSKColour); | |
1546 oldmnuBgdCol = dspl_SetBgdColour( bgdSKColour); | |
1547 } | |
1548 /******************************************************************************* | |
1549 | |
1550 $Function: | |
1551 | |
1552 $Description: | |
1553 | |
1554 $Returns: | |
1555 | |
1556 $Arguments: | |
1557 | |
1558 $History | |
1559 | |
1560 *******************************************************************************/ | |
1561 void resources_setHLColour(unsigned int colIndex) | |
1562 { | |
1563 U32 fgdColour,bgdColour; | |
1564 #ifdef COLOURDISPLAY | |
1565 getDataColour(colIndex, COL_TYPE_HL, &fgdColour, &bgdColour ); | |
1566 #else | |
1567 //For b+w highlight, get fgd colour as bgd and vice versa | |
1568 fgdColour = dspl_GetBgdColour(); | |
1569 bgdColour = dspl_GetFgdColour(); | |
1570 //If one colour is black/white, make other colour the opposite | |
1571 if (fgdColour == COL_Black) | |
1572 bgdColour = COL_White; | |
1573 else if (bgdColour == COL_Black) | |
1574 fgdColour = COL_White; | |
1575 else if (fgdColour == COL_White) | |
1576 bgdColour = COL_Black; | |
1577 else if (bgdColour == COL_White) | |
1578 fgdColour = COL_Black; | |
1579 else | |
1580 { //Default : assume the rest of the display is black on white=> highlight is white on black. | |
1581 fgdColour = COL_White; | |
1582 bgdColour = COL_Black; | |
1583 } | |
1584 | |
1585 #endif | |
1586 oldmnuFgdCol = dspl_SetFgdColour( fgdColour); | |
1587 oldmnuBgdCol = dspl_SetBgdColour( bgdColour); | |
1588 } | |
1589 /******************************************************************************* | |
1590 | |
1591 $Function: | |
1592 | |
1593 $Description: | |
1594 | |
1595 $Returns: | |
1596 | |
1597 $Arguments: | |
1598 | |
1599 $History | |
1600 | |
1601 *******************************************************************************/ | |
1602 void resources_setTitleColour(unsigned int colIndex) | |
1603 { | |
1604 U32 fgdColour,bgdColour; | |
1605 getDataColour(colIndex, COL_TYPE_TITLE, &fgdColour, &bgdColour ); | |
1606 oldmnuFgdCol = dspl_SetFgdColour( fgdColour); | |
1607 oldmnuBgdCol = dspl_SetBgdColour( bgdColour); | |
1608 } | |
1609 /******************************************************************************* | |
1610 | |
1611 $Function: | |
1612 | |
1613 $Description: | |
1614 | |
1615 $Returns: | |
1616 | |
1617 $Arguments: | |
1618 | |
1619 $History | |
1620 | |
1621 *******************************************************************************/ | |
1622 void resources_restoreColour(void) | |
1623 { | |
1624 dspl_SetFgdColour( oldFgdCol); | |
1625 dspl_SetBgdColour( oldBgdCol); | |
1626 } | |
1627 /******************************************************************************* | |
1628 | |
1629 $Function: | |
1630 | |
1631 $Description: | |
1632 | |
1633 $Returns: | |
1634 | |
1635 $Arguments: | |
1636 | |
1637 $History | |
1638 GW 28/11/02 - | |
1639 | |
1640 *******************************************************************************/ | |
1641 void resources_restoreMnuColour(void) | |
1642 { | |
1643 dspl_SetFgdColour( oldmnuFgdCol); | |
1644 dspl_SetBgdColour( oldmnuBgdCol); | |
1645 } | |
1646 | |
1647 | |
1648 /******************************************************************************* | |
1649 | |
1650 $Function: | |
1651 | |
1652 $Description: | |
1653 | |
1654 $Returns: | |
1655 | |
1656 $Arguments: | |
1657 | |
1658 $History | |
1659 GW 28/11/02 - | |
1660 | |
1661 *******************************************************************************/ | |
1662 void getDisplayData(int txtId,int *colDisplayType, int *colType, int *colFgdSelect) | |
1663 { | |
1664 *colFgdSelect = NO_COL; | |
1665 | |
1666 /**/ | |
1667 switch (txtId) | |
1668 { | |
1669 | |
1670 default: | |
1671 *colFgdSelect = NO_COL; | |
1672 break; | |
1673 | |
1674 case TxtIdleScreenBackground: | |
1675 *colDisplayType = COLOUR_IDLE; | |
1676 *colType = COL_TYPE_SCREEN; | |
1677 *colFgdSelect = BGD_COL; | |
1678 break; | |
1679 case TxtIdleScreenSoftKey: | |
1680 *colDisplayType = COLOUR_IDLE; | |
1681 *colType = COL_TYPE_SK; | |
1682 *colFgdSelect = FGD_COL; | |
1683 break; | |
1684 case TxtIdleScreenText: | |
1685 *colDisplayType = COLOUR_IDLE; | |
1686 *colType = COL_TYPE_SCREEN; | |
1687 *colFgdSelect = FGD_COL; | |
1688 break; | |
1689 case TxtIdleScreenNetworkName: | |
1690 *colDisplayType = COLOUR_IDLE; | |
1691 *colType = COL_TYPE_SCREEN; | |
1692 *colFgdSelect = FGD_COL; | |
1693 break; | |
1694 case TxtGeneralBackground: | |
1695 *colDisplayType = COLOUR_LIST_MAIN; | |
1696 *colType = COL_TYPE_SCREEN; | |
1697 *colFgdSelect = BGD_COL; | |
1698 break; | |
1699 case TxtMenuSoftKeyForeground: | |
1700 *colDisplayType = COLOUR_LIST_MAIN; | |
1701 *colType = COL_TYPE_SK; | |
1702 *colFgdSelect = FGD_COL; | |
1703 break; | |
1704 case TxtMenuSoftKeyBackground: | |
1705 *colDisplayType = COLOUR_LIST_MAIN; | |
1706 *colType = COL_TYPE_SK; | |
1707 *colFgdSelect = BGD_COL; | |
1708 break; | |
1709 case TxtSubMenuHeadingText: | |
1710 *colDisplayType = COLOUR_LIST_SUBMENU; | |
1711 *colType = COL_TYPE_TITLE; | |
1712 *colFgdSelect = FGD_COL; | |
1713 break; | |
1714 | |
1715 case TxtSubMenuHeadingBackground: | |
1716 *colDisplayType = COLOUR_LIST_SUBMENU; | |
1717 *colType = COL_TYPE_TITLE; | |
1718 *colFgdSelect = BGD_COL; | |
1719 break; | |
1720 case TxtSubMenuTextForeground: | |
1721 *colDisplayType = COLOUR_LIST_SUBMENU; | |
1722 *colType = COL_TYPE_SCREEN; | |
1723 *colFgdSelect = FGD_COL; | |
1724 break; | |
1725 | |
1726 case TxtSubMenuTextBackground: | |
1727 *colDisplayType = COLOUR_LIST_SUBMENU; | |
1728 *colType = COL_TYPE_SCREEN; | |
1729 *colFgdSelect = BGD_COL; | |
1730 break; | |
1731 case TxtSubMenuSelectionBar: | |
1732 *colDisplayType = COLOUR_LIST_SUBMENU; | |
1733 *colType = COL_TYPE_HL; | |
1734 *colFgdSelect = BGD_COL; | |
1735 break; | |
1736 case TxtPopUpTextForeground: /* GW#2294 COLOUR_STATUS has been used for all popups - change this colour instead of COLOUR_POPUP .*/ | |
1737 *colDisplayType = COLOUR_STATUS; | |
1738 *colType = COL_TYPE_SCREEN; | |
1739 *colFgdSelect = FGD_COL; | |
1740 break; | |
1741 case TxtPopUpTextBackground: /* GW#2294 COLOUR_STATUS has been used for all popups - change this colour instead of COLOUR_POPUP .*/ | |
1742 *colDisplayType = COLOUR_STATUS; | |
1743 *colType = COL_TYPE_SCREEN; | |
1744 *colFgdSelect = BGD_COL; | |
1745 break; | |
1746 } | |
1747 /**/ | |
1748 } | |
1749 /******************************************************************************* | |
1750 | |
1751 $Function: | |
1752 | |
1753 $Description: | |
1754 | |
1755 $Returns: | |
1756 | |
1757 $Arguments: | |
1758 | |
1759 $History | |
1760 | |
1761 *******************************************************************************/ | |
1762 //This is called to set the colour of menu items controlled by the text id's | |
1763 int resources_getColourFromText(int txtId) | |
1764 { | |
1765 U32 col; | |
1766 switch (txtId) | |
1767 { | |
1768 case TxtColourBlack: col = COL_Black; break; | |
1769 case TxtColourBlue: col = COL_Blue; break; | |
1770 case TxtColourCyan: col = COL_Cyan; break; | |
1771 case TxtColourGreen: col = COL_Green; break; | |
1772 case TxtColourMagenta: col = COL_Magenta; break; | |
1773 case TxtColourYellow: col = COL_Yellow; break; | |
1774 case TxtColourRed: col = COL_Red; break; | |
1775 case TxtColourWhite: col = COL_White; break; | |
1776 case TxtColourPink: col = COL_Pink; break;// 0x00FF4040; break; | |
1777 case TxtColourOrange: col = COL_Orange; break; | |
1778 case TxtColourLightBlue: col = COL_LightBlue; break;// 0x004040FF; break; | |
1779 case TxtColourLightGreen: col = COL_LightGreen; break;// 0x0040FF40; break; | |
1780 case TxtColourPaleYellow: col = COL_PaleYellow; break;// 0x00FFFF40; break; | |
1781 case TxtColourTransparent: col = COL_Transparent; break; | |
1782 default: col = NO_COLOUR_DEFINED; | |
1783 } | |
1784 return (col); | |
1785 } | |
1786 | |
1787 | |
1788 | |
1789 /******************************************************************************* | |
1790 | |
1791 $Function: | |
1792 | |
1793 $Description: | |
1794 | |
1795 $Returns: | |
1796 | |
1797 $Arguments: | |
1798 | |
1799 $History | |
1800 GW 28/11/02 - | |
1801 | |
1802 *******************************************************************************/ | |
1803 void resources_setColourMnuItem( int txtId) | |
1804 { | |
1805 U32 col = NO_COLOUR_DEFINED; | |
1806 int colType; | |
1807 int colFgdSelect = FALSE; | |
1808 int colDisplayType; | |
1809 U32 fgd,bgd; | |
1810 | |
1811 col = resources_getColourFromText(txtId); | |
1812 if (col == NO_COLOUR_DEFINED) | |
1813 { | |
1814 getDisplayData(txtId, &colDisplayType, &colType,&colFgdSelect); | |
1815 getDataColour(colDisplayType, colType, &fgd, &bgd); | |
1816 switch (colFgdSelect) | |
1817 { | |
1818 case FGD_COL: col = fgd; break; | |
1819 case BGD_COL: col = bgd; break; | |
1820 default: break; | |
1821 } | |
1822 } | |
1823 if (col != NO_COLOUR_DEFINED) | |
1824 { | |
1825 if (col!=COL_Transparent) | |
1826 { | |
1827 dspl_SetFgdColour( col ); | |
1828 dspl_SetBgdColour( (~col) & 0x00FFFFFF ); | |
1829 } | |
1830 else | |
1831 { | |
1832 dspl_SetFgdColour( COL_Black ); | |
1833 dspl_SetBgdColour( COL_Magenta ); | |
1834 | |
1835 } | |
1836 } | |
1837 } | |
1838 | |
1839 | |
1840 | |
1841 /******************************************************************************* | |
1842 | |
1843 $Function: | |
1844 | |
1845 $Description: | |
1846 | |
1847 $Returns: | |
1848 | |
1849 $Arguments: | |
1850 | |
1851 $History | |
1852 | |
1853 *******************************************************************************/ | |
1854 int res_getTitleHeight( void ) | |
1855 { | |
1856 if (Mmi_getCurrentLanguage() != CHINESE_LANGUAGE) | |
1857 { | |
1858 return(TITLE_HEIGHT_LATIN); | |
1859 } | |
1860 else | |
1861 { | |
1862 return(TITLE_HEIGHT_CHINESE); | |
1863 } | |
1864 } | |
1865 /*Function added for SPr 1442*/ | |
1866 /******************************************************************************* | |
1867 $Function: string_len_in_bytes | |
1868 | |
1869 $Description: internal function which returns th length of a string in bytes | |
1870 | |
1871 $Returns: length of string | |
1872 | |
1873 $Arguments: string, maximum possibel length, whether unicode or not | |
1874 | |
1875 *******************************************************************************/ | |
1876 int string_len_in_bytes(char* string, int max_len, int unicode) | |
1877 { int i; | |
1878 int length=0; | |
1879 /* if unicode, nee to check for double-NULL termination*/ | |
1880 if (string[0] == (char)0x80 || unicode== TRUE) /*a0393213 lint warnings removal - typecast done*/ | |
1881 { | |
1882 for(i=0; i < max_len; i+=2) | |
1883 { if (string[i] == 0 && string[i+1]==0) | |
1884 { length = i; | |
1885 break; | |
1886 } | |
1887 } | |
1888 return length; | |
1889 | |
1890 } | |
1891 | |
1892 else/*just use standard function*/ | |
1893 { return strlen(string); | |
1894 } | |
1895 | |
1896 } | |
1897 | |
1898 #ifdef LSCREEN | |
1899 #define TRUNC_LENGTH 3 /*... at end of string in D-sample*/ | |
1900 #else | |
1901 #define TRUNC_LENGTH 1/* . at end of string in c-sample*/ | |
1902 #endif | |
1903 | |
1904 /*Function added for SPr 1442*/ | |
1905 /******************************************************************************* | |
1906 $Function: resources_truncate_to_screen_width | |
1907 | |
1908 $Description: Copies and truncates the input string to the passed screen width | |
1909 and puts it into the output string. | |
1910 Note: this function only works for Unicode strings which have a unicode | |
1911 tag at the beginning, or if the unicode parameter is set to TRUE. | |
1912 If the input length is zero, then this function calculates | |
1913 the actual length of the input string. | |
1914 | |
1915 $Returns: length of truncated string | |
1916 | |
1917 $Arguments: input sctring and it's length, ouput string and it's length, | |
1918 screen width desired (pixels), unicode flag (TRUE/FALSE) | |
1919 | |
1920 *******************************************************************************/ | |
1921 //GW #1541 16/01/03 - Modified code to first test if string will fit and return string if it does. | |
1922 int resources_truncate_to_screen_width(char* IpStr, int IpLen, char* OpStr, int OpLen, | |
1923 int ScreenWidth, BOOL unicode) | |
1924 | |
1925 { | |
1926 int start_position = 0; | |
1927 #ifdef LSCREEN | |
1928 char* ellipse_str = "..."; | |
1929 #else | |
1930 char* ellipse_str = "."; | |
1931 #endif | |
1932 int ellipsis_len = dspl_GetTextExtent(ellipse_str, 0); | |
1933 int i; | |
1934 int j; | |
1935 int calc_input_len = 0; | |
1936 int no_of_chars = 0; | |
1937 int len; | |
1938 | |
1939 memset(OpStr, 0, OpLen); | |
1940 | |
1941 /*if input string length 0, we calculate the string len ourselves*/ | |
1942 if (IpLen == 0) | |
1943 { calc_input_len = string_len_in_bytes(IpStr, 256, unicode); | |
1944 } | |
1945 else | |
1946 { calc_input_len = IpLen; | |
1947 } /*Test for string alrady fitting */ | |
1948 | |
1949 if (dspl_GetTextExtent(IpStr, 0) < ScreenWidth) | |
1950 { | |
1951 for (i=0; i<OpLen && i<calc_input_len; ) | |
1952 { //if length of string less that width of screen | |
1953 //if unicode copy two chars | |
1954 if (IpStr[0] == (char)0x80 || unicode == TRUE)/*a0393213 lint warnings removal-typecasting done*/ | |
1955 { | |
1956 OpStr[i] = IpStr[i]; | |
1957 OpStr[i+1] = IpStr[i+1]; | |
1958 i+=2; | |
1959 } | |
1960 else | |
1961 { OpStr[i] = IpStr[i]; | |
1962 i++; | |
1963 } | |
1964 } | |
1965 return string_len_in_bytes(OpStr, OpLen, unicode); | |
1966 } | |
1967 /*SPR 1541, use function dspl_GetNcharToFit rather than loop to work | |
1968 out how many chars will fit in line*/ | |
1969 no_of_chars = dspl_GetNcharToFit (IpStr, ScreenWidth - ellipsis_len); | |
1970 /*copy characters*/ | |
1971 if (no_of_chars < OpLen) | |
1972 memcpy(OpStr, IpStr, no_of_chars); | |
1973 else | |
1974 memcpy(OpStr, IpStr, OpLen); | |
1975 | |
1976 /*SPR 1541, end*/ | |
1977 TRACE_EVENT_P1("trunc string len:%d", dspl_GetTextExtent(OpStr, 0)); | |
1978 /*we need to add the ellipsis if we've truncated the string*/ | |
1979 if(string_len_in_bytes(OpStr, OpLen, unicode) < calc_input_len) | |
1980 { /*if unicode*/ | |
1981 if (OpStr[0] == (char)0x80|| unicode == TRUE) /*a0393213 lint warnings removal - typecasting done*/ | |
1982 { | |
1983 if (string_len_in_bytes(OpStr, OpLen, TRUE) < (OpLen -2*TRUNC_LENGTH+2)) | |
1984 { start_position = string_len_in_bytes(OpStr, OpLen, unicode); | |
1985 } | |
1986 else | |
1987 { start_position = OpLen - 2*TRUNC_LENGTH+2;} | |
1988 TRACE_EVENT_P1("Adding chars at %d", start_position); | |
1989 for(j=start_position; j < start_position+2*TRUNC_LENGTH; j+=2) | |
1990 { OpStr[j] = 0; | |
1991 OpStr[j + 1] = '.'; | |
1992 } | |
1993 /*add NULL termination*/ | |
1994 OpStr[start_position+ 2*TRUNC_LENGTH] = NULL; | |
1995 OpStr[start_position+ 2*TRUNC_LENGTH+1] = NULL; | |
1996 } | |
1997 else /*if ASCII*/ | |
1998 { len = strlen(OpStr); | |
1999 if (len < (OpLen -(TRUNC_LENGTH+1))) | |
2000 { start_position = string_len_in_bytes(OpStr, OpLen, FALSE); | |
2001 } | |
2002 else | |
2003 { start_position = OpLen - TRUNC_LENGTH;} | |
2004 memcpy(&OpStr[start_position], ellipse_str, TRUNC_LENGTH); | |
2005 | |
2006 } | |
2007 } | |
2008 | |
2009 TRACE_EVENT_P1("trunc string len post ellipsis:%d", dspl_GetTextExtent(OpStr, 0)); | |
2010 | |
2011 return string_len_in_bytes(OpStr, OpLen, unicode); | |
2012 | |
2013 } | |
2014 | |
2015 /******************************************************************************* | |
2016 | |
2017 $Function: | |
2018 | |
2019 $Description: | |
2020 | |
2021 $Returns: | |
2022 | |
2023 $Arguments: | |
2024 | |
2025 $History | |
2026 GW 28/11/02 - | |
2027 | |
2028 *******************************************************************************/ | |
2029 /***************************Go-lite Optimization changes Start***********************/ | |
2030 //Aug 25, 2004 REF: CRR 24904 Deepa M.D | |
2031 //This function is used only for the Color build.Hence it is put under the | |
2032 //COLOURDISPLAY compiler switch | |
2033 #ifdef COLOURDISPLAY | |
2034 int colMenuSelected(MfwMnu* mnu, MfwMnuItem* mnuItem) | |
2035 { | |
2036 T_MFW_HND win = mfw_parent(mfw_header()); | |
2037 int mnuId; | |
2038 int colDisplayType; | |
2039 int colType; | |
2040 int colFgdSelect = FALSE; | |
2041 int mnuColour; | |
2042 int storedMenuId; | |
2043 | |
2044 //GW Read the stored menu Id from generic procedure | |
2045 storedMenuId = MmiBook_getStoredOption(); | |
2046 mnuId = (int)mnuItem->str; | |
2047 | |
2048 mnuColour=resources_getColourFromText(mnuId); | |
2049 | |
2050 getDisplayData(storedMenuId, &colDisplayType, &colType,&colFgdSelect); | |
2051 | |
2052 setDataColour(colDisplayType, colType, colFgdSelect,mnuColour); | |
2053 | |
2054 info_screen(win, TxtColour, TxtSelected, 0); | |
2055 | |
2056 // API/GW - Saved the selected colour so the flash file structure after selected | |
2057 flash_data_write(colourFileDir, colourFileName, colArray, sizeof(colArray)); | |
2058 | |
2059 return(0); | |
2060 } | |
2061 | |
2062 #endif | |
2063 /***************************Go-lite Optimization changes Start***********************/ | |
2064 | |
2065 | |
2066 /******************************************************************************* | |
2067 $Function: set_SIMToolkit_title_string | |
2068 | |
2069 $Description: Changes the value of the SAT main menu entry title. | |
2070 | |
2071 $Returns: | |
2072 | |
2073 $Arguments: New SAT Title. | |
2074 | |
2075 *******************************************************************************/ | |
2076 | |
2077 | |
2078 void res_set_SIMToolkit_title_string(char* SAT_string) | |
2079 { | |
2080 SIMToolKitString = SAT_string; | |
2081 } | |
2082 | |
2083 /*API - 27/07/03 - CQ10203 - New function to reset the SMS VP in flash on factory reset*/ | |
2084 /******************************************************************************* | |
2085 $Function: resetSMSValidityPeriod | |
2086 | |
2087 $Description: Resets the value of the SMS VP in flash | |
2088 | |
2089 $Returns: | |
2090 | |
2091 $Arguments: None | |
2092 | |
2093 *******************************************************************************/ | |
2094 void resetSMSValidityPeriod() | |
2095 { | |
2096 /* x0045876, 14-Aug-2006 (WR - "sms_settings" was set but never used) */ | |
2097 #ifndef NEPTUNE_BOARD | |
2098 T_MFW_SMS_INFO sms_settings; | |
2099 #endif | |
2100 | |
2101 TRACE_EVENT("resetSMSValidityPeriod()"); | |
2102 | |
2103 if ( FFS_flashData.vp_rel != VP_REL_24_HOURS) | |
2104 FFS_flashData.vp_rel = VP_REL_24_HOURS; | |
2105 | |
2106 /* x0045876, 14-Aug-2006 (WR - "sms_settings" was set but never used) */ | |
2107 #ifndef NEPTUNE_BOARD | |
2108 /*NDH - 13/01/04 - CQ16753 - Propogate the Validity Period Settings to the ACI */ | |
2109 sms_settings.vp_rel = FFS_flashData.vp_rel; | |
2110 #endif | |
2111 | |
2112 #ifdef NEPTUNE_BOARD | |
2113 //(void)sms_set_val_period(&sms_settings); /* NEPTUNE: Sumit: temp comment */ | |
2114 #else | |
2115 (void)sms_set_val_period(&sms_settings); | |
2116 #endif | |
2117 /*NDH - 13/01/04 - CQ16753 - END */ | |
2118 | |
2119 } | |
2120 /*API - CQ10203 - END*/ | |
2121 /******************************************************************************* | |
2122 | |
2123 End of File | |
2124 | |
2125 *******************************************************************************/ | |
2126 |