⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmiresources.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*******************************************************************************

					CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		Resource Manager
 $File:		    MmiResources.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:

   Simple wrapper for the MMI Block Resources

   This module provides a simple interface to the block
   resources module, giving access to a single language,
   which can be used to get strings by Id.

   This module is a hack to provide an interface to the
   resource manager which can be easily used by a single
   process. If an application needs to use the resource
   manager it should call it directly, initialising it's
   own context safe handlers.

   This module is designed to wrap the resource API
   functions in a manner that gives the easiest and
   fastest implementation. It is therefore not a
   reentrant module, however given it only performs
   read only actions this should not be a problem.
                        
********************************************************************************
 $History: MmiResources.c

	25/10/00			Original Condat(UK) BMI version.	
	   
 $End

*******************************************************************************/
/********************************************************************************
 $History: MmiResources.c

	01/08/02		zy Mobile Innovation add laguageFlag but will remove it after flash add this flag	
	04/08/02        zy Mobile Innovation  change language settings functions
    09/08         windy modified
 $End

*******************************************************************************/

/*******************************************************************************
                                                                              
                                Include Files                                 
                                                                              
*******************************************************************************/
#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"

#else

#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"

#endif

#include "mfw_sys.h"

#include "p_sim.h"


#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_lng.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_cm.h"
#include "mfw_sat.h"
#include "mfw_phb.h"
#include "mfw_sms.h"
#include "mfw_ffs.h"//zy add 04/08/02

#include "dspl.h"

#include "ksd.h"
#include "psa.h"




//#include "stddefs.h"
#include "MmiResources.h"
#include "MmiBlkLangDB.h"
#include "MmiBlkManager.h"
#include "MmiBlkResources.h"
#include "MmiBookShared.h"



#include "MmiDummy.h"
#include "MmiMmi.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"


#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiDialogs.h"


// this is for traces
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"


/*******************************************************************************
                                                                              
                                Static data elements
                                                                              
*******************************************************************************/

/* Define static data elements to give the global
   handles. These are not re-entrant, but what the
   hell, there will only be one of these in the
   system
*/
static tBlkHandle BlkManager = NULL;
UBYTE currentLanguage		= NULL;
static tBlkHandle Language   = NULL;
// modified by clrobert 
// from
/*static long int   ModuleKey  = -1;*/
// to
#ifndef _INNOVATION_EMULATOR_
static long int   ModuleKey  = -1;
#else
long int ModuleKey = -1;
#endif
// for purpose that the emulator can access 'ModuleKey', so that the language
// module can be install/uninstall as run in a target when the emulator on/off 
// modify end

/* Define a unique key value to determine if the constructor
   has been called. This is slightly dangerous as there is 
   a chance that the key value powers up in this state, however
   this is unlikely in a cold boot situation. (In a warm boot,
   if the RAM contents are preserved then the block resource
   manager will also be preserved, so there should be no
   problem there).
*/
#define KEYVALUE 0x00FADE00


/* We know that the resource manager deals with two languages
   at present, English and German, The first element in the
   lists will indicate which is which in a later version, however
   for now, we will just define constant settings for these.

   Note that the current MMI doesn't fully support German
   characters, but the resource manager does.
*/

#define SHOW_CONFIRM     3
int Easy_Text_Available = TRUE;

typedef struct 
{
	// cp_resource_file_t rf;
	RESOURCE_DIRECTORY_HEADER language_table;
	RESOURCE_DIRECTORY_HEADER melody_table;
	RESOURCE_DIRECTORY_HEADER glyph_table;
	RESOURCE_DIRECTORY_HEADER zone_table;

	UBYTE langid;		// current language_table
	UBYTE fontid;		// current font
	ST_DIMENSION    fontHeight;	// current font height

}  res_ResMgr_type;

// private resources data 
static res_ResMgr_type this_res ;

typedef struct
{
  T_MMI_CONTROL    mmi_control;
  T_MFW_HND        recources_win;        /* MFW win handler      */
} T_recources;

T_recources recources_data;


MfwRect menuArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*5};
MfwRect menuNamesArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4};
MfwRect menuListArea = { 0,  0, SCREEN_SIZE_X, STANDARD_MENU_VERTICAL_SIZE };
/* talcon : change 112 to 140 for phonebook browse window, delete the bar that show phone number */
#if(MAIN_LCD_SIZE==3)
MfwRect menuDynamicArea ={0,  0, SCREEN_SIZE_X, VIEWLIST_MENU_VERTICAL_SIZE};	/* 2004/01/14 sunsj modify */
MfwRect ShortCutDynamicArea ={0,  0, SCREEN_SIZE_X, STANDARD_MENU_VERTICAL_SIZE};	
#elif(MAIN_LCD_SIZE==4)
MfwRect menuDynamicArea ={0,  0, SCREEN_SIZE_X, 108};	/* 2004/05/26 sunsj modify */
MfwRect ShortCutDynamicArea ={0,  0, SCREEN_SIZE_X, 126};
#endif
MfwRect menuDynamicArea_fromcall={0,  0, SCREEN_SIZE_X, 108};/*2004/05/26, sunsj modify call phonebook area*/
MfwRect menuWeeklyArea ={0,  0, SCREEN_SIZE_X,  VIEWLIST_MENU_VERTICAL_SIZE};	/* 2004/01/14 sunsj modify */
MfwRect menuViewListArea = { 0,  0, SCREEN_SIZE_X, VIEWLIST_MENU_VERTICAL_SIZE };
MfwRect editor_menuArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*5}; /* menus display area      */
MfwRect network_menuArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect sat_setup_menuArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*5}; /* menus display area      */
MfwRect sat_select_menuArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*5}; /* menus display area      */
MfwRect smscb_M_CBArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect smscb_M_CB_ACTArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect smscb_M_CB_TOPArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect smscb_M_CB_TOP_CONSArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect smscb_M_CB_TOP_CONS_SELArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect smscb_CBArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect smscb_CB_OPTArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect readSMS_menuArea = {0,  0, SCREEN_SIZE_X, 108}; /* menus display area      */	/* 2004/05/26 sunsj modify */
MfwRect readSMS_menuAreaMo = {0,  0, SCREEN_SIZE_X, 142}; /* 2003/12/4, wangyan add    */
MfwRect SmsRead_R_OPTArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect SmsSend_R_OPTArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*4}; /* menus display area      */
MfwRect melody_menuArea = {0,0,SCREEN_SIZE_X,LINE_HEIGHT*5}; /* menus display area      */
MfwRect selected_area = {2,8,80,31};




static int recources_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static void recources_language_confirm(void);
void recources_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
void recources (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
T_MFW_HND recources_Init (T_MFW_HND parent_window);
void recources_Exit (T_MFW_HND own_window);
T_MFW_HND recources_create (T_MFW_HND parent_window);



/*******************************************************************************
                                                                              
                                Private Routines
                                                                              
*******************************************************************************/

static void LanguageEnable( int newLanguage )
{
    /* Initialise if required
    */
	currentLanguage = newLanguage;
	if ( ModuleKey != KEYVALUE )
	{
		/* Nope, then go do it, If the mmibm_* routines fail to initialise
		   they will return NULL, and they both deal with bad input values
		   cleanly, so we don't need error checking here.
		*/
        BlkManager = mmibm_Initialise( Mmir_BaseAddress(), Mmir_NumberOfEntries() );
		ModuleKey  = KEYVALUE;
	}

    /* Set up the new language based on the incoming value
    */
    if ( newLanguage == GERMAN_LANGUAGE )
		Language   = mmibm_SupplyResourceHandler( BlkManager, GERMAN_LANGUAGE );
    else
	    if ( newLanguage == ENGLISH_LANGUAGE )
		    Language   = mmibm_SupplyResourceHandler( BlkManager, ENGLISH_LANGUAGE );
	    else
		    Language   = mmibm_SupplyResourceHandler( BlkManager, CHINESE_LANGUAGE );
}


/*******************************************************************************
                                                                              
                                Public Routines
                                                                              
*******************************************************************************/

/*******************************************************************************
 $Function:    	MmiRsrcGetText

 $Description:	Define access routine for the actual get text
                routine. In order to make sure the routine can
				be invoked and will automatically start, we will
				use the key value above to ensure we detect the
				startup conditions.
				
				The calling routine for this function should check
				for NULL values which will be returned if the 

 $Returns:		Pointer to resource indicated by Id (Or NULL)

 $Arguments:	Id of requested resource
 
*******************************************************************************/

char *MmiRsrcGetText( int Id )
{
	/* Check if we have already initialised
	*/
	if ( ModuleKey != KEYVALUE )
        LanguageEnable( ENGLISH_LANGUAGE );

    /* use the currently set up resource handler for the English
	   language to get the text associaed with the Id, again if
	   there has been a problem with the initialisation of the
	   English handler, then the fetch routine will deal with it
	   cleanly and return NULL.
	*/
	return (char *) mmibr_Fetch( Language, Id );
}

void MmiRsrcSetEnglish( void )
{
	dspl_set_char_type(DSPL_TYPE_ASCII);
    LanguageEnable( ENGLISH_LANGUAGE );
	Mmi_layout_areas();
}

void MmiRsrcSetGerman( void )
{
	dspl_set_char_type(DSPL_TYPE_ASCII);
    LanguageEnable( GERMAN_LANGUAGE );
	Mmi_layout_areas();

}

void MmiRsrcSetChinese( void )
{
  
	dspl_set_char_type(DSPL_TYPE_UNICODE);
    LanguageEnable( CHINESE_LANGUAGE );
	Mmi_layout_areas();
}



void Mmi_Set2English( void )
{
    T_MFW_HND win = mfw_parent(mfw_header());

	recources_Init (win);
/*zy change the language flashdata......04/08/02.................*/
    MmiRsrcSetEnglish();
    FFS_flashData.language=1;
    flash_write();
/*........... end of zychange..............04/08/02.......................*/
	SEND_EVENT (recources_data.recources_win, SHOW_CONFIRM, 0, 0);    

}

void Mmi_Set2German( void )
{
    T_MFW_HND win = mfw_parent(mfw_header());
    
	recources_Init(win);

    MmiRsrcSetGerman();

	SEND_EVENT (recources_data.recources_win, SHOW_CONFIRM, 0, 0);

}

void Mmi_Set2Chinese( void )
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -