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