📄 mmiresources.c
字号:
{
Mmi_Set2Language(CHINESE_LANGUAGE);
}
#ifdef LANG_CHANGE_TEST
void Mmi_Set2Martian( void )
{
Mmi_Set2Language(MARTIAN_LANGUAGE);
}
#endif
/*MC SPR 1150,new generic langauge change function*/
void Mmi_Set2Language(int lang)
{
T_MFW_HND win = mfw_parent(mfw_header());
resources_Init(win);
MmiRsrcSetLang(lang);
SEND_EVENT (resources_data.resources_win, SHOW_CONFIRM, 0, 0);
}
UBYTE Mmi_getCurrentLanguage(void)
{
return currentLanguage;
}
//GW Created to return height of a line with just numbers on it
UBYTE numberLineHeight(void)
{
#ifndef LSCREEN
//All numbers are 8 bits high (whether chinese or latin chars)
return (8);
#else
//all text is 12 bits high
return (12);
#endif
}
//GW Created
UBYTE Mmi_layout_line(int lineNo)
{
#ifndef LSCREEN
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
{
switch (lineNo)
{
case 1: return FIRST_LINE_CHINESE;
case SECOND_LAST_LINE_TOP:
case 2: return SECOND_LINE_CHINESE;
case LAST_LINE_TOP:
case 3: return THIRD_LINE_CHINESE;
case LAST_LINE:
case 4: return FOURTH_LINE_CHINESE;
//We are now asking for an invalid line
default: return FOURTH_LINE_CHINESE;
}
}
else
{
switch (lineNo)
{
case 1: return FIRST_LINE;
case 2: return SECOND_LINE;
case 3: return THIRD_LINE;
case SECOND_LAST_LINE_TOP:
case 4: return FOURTH_LINE;
case LAST_LINE_TOP: //y-coord of the top of last line
case 5: return FIFTH_LINE;
case LAST_LINE:
case 6: return SIXTH_LINE;
//We are now asking for an invalid line
default: return SIXTH_LINE;
}
}
#else
//assume both fonts are now the same height.
switch (lineNo)
{
case SECOND_LAST_LINE_TOP: return ( SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()-LINE_HEIGHT);
case LAST_LINE_TOP: return ( SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
case LAST_LINE: return ( SCREEN_SIZE_Y);
default: return (lineNo*LINE_HEIGHT);
}
#endif
}
UBYTE Mmi_layout_line_icons(int lineNo)
{
#ifndef LSCREEN
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
{
switch (lineNo)
{
case 1: return FIRST_LINE_CHINESE;
case SECOND_LAST_LINE_TOP:
case 2: return SECOND_LINE_CHINESE;
case LAST_LINE_TOP:
case 3: return THIRD_LINE_CHINESE;
case LAST_LINE:
case 4: return FOURTH_LINE_CHINESE;
//We are now asking for an invalid line
default: return FOURTH_LINE_CHINESE;
}
}
else
{
switch (lineNo)
{
case 1: //nobreak;
case 2: //nobreak;
case 3: //nobreak;
default: return (FIRST_LINE_ICON+(lineNo-1)*LINE_HEIGHT);
case SECOND_LAST_LINE_TOP:
case 4: return FOURTH_LINE;
case LAST_LINE_TOP: //y-coord of the top of last line
case 5: return FIFTH_LINE;
case LAST_LINE:
case 6: return SIXTH_LINE;
}
}
#else
switch (lineNo)
{
case SECOND_LAST_LINE_TOP: return(SCREEN_SIZE_Y-(Mmi_layout_softkeyHeight()+Mmi_layout_line_height()));
case LAST_LINE_TOP: return(SCREEN_SIZE_Y-(Mmi_layout_softkeyHeight()));
case LAST_LINE: return(SCREEN_SIZE_Y);
default: return(Mmi_layout_IconHeight()+Mmi_layout_line_height()*lineNo);
}
#endif
}
UBYTE Mmi_layout_line_height(void)
{
#ifndef LSCREEN
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
return LINE_HEIGHT_CHINESE;
else
return LINE_HEIGHT;
#else
return (LINE_HEIGHT);
#endif
}
UBYTE Mmi_layout_softkeyHeight( void )
{
#ifndef LSCREEN
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
return SK_HEIGHT_CHINESE;
else
return SK_HEIGHT_LATIN;
#else
return (SK_HEIGHT_LATIN);
#endif
}
UBYTE Mmi_layout_softkeyArea( MfwRect* rect )
{
if (!rect)
return (0);
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
rect->sy = SK_HEIGHT_CHINESE;
else
rect->sy = SK_HEIGHT_LATIN;
rect->px = 0;
rect->sx = SCREEN_SIZE_X;
rect->py = SCREEN_SIZE_Y-rect->sy;
return(1);
}
UBYTE Mmi_layout_TitleHeight( void )
{
#ifndef LSCREEN
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
return TITLE_HEIGHT_CHINESE;
else
return TITLE_HEIGHT_LATIN;
#else
return (TITLE_HEIGHT_LATIN);
#endif
}
UBYTE Mmi_layout_IconHeight( void )
{
return (ICON_HEIGHT);
}
UBYTE Mmi_number_of_lines_with_icons_on_top(void)
{
#ifndef LSCREEN
{
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
return 2;
else
return 4;
}
#else
return NLINES_MAX-1;
#endif
}
UBYTE Mmi_number_of_lines_without_icons_on_top(void)
{
#ifndef LSCREEN
{
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
return 3;
else
return 5;
}
#else //assume a single font of 12 pixels high 10 lines x 12 pixels
return NLINES_MAX;
#endif
}
//GW 10/02/03 Modified code - icon position is now sorted out by 'iconsMainIconsAreaSet' - the code
// here only supplies the available screen size
void Mmi_layout_areas(void)
{
MAINICONarea.px = 0;
MAINICONarea.py =Mmi_layout_line_height();
MAINICONarea.sx = SCREEN_SIZE_X;
MAINICONarea.sy =SCREEN_SIZE_Y-Mmi_layout_line_height()*2-1;
Mmi_set_area_attr(&menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&menuNamesArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-LINE_HEIGHT-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&menuListArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&editor_menuArea,Mmi_layout_line(1),0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&network_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_IconHeight()-Mmi_layout_softkeyHeight()); //Mmi_layout_line_height()*Mmi_number_of_lines_with_icons_on_top());
Mmi_set_area_attr(&sat_setup_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&sat_select_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_M_CBArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_M_CB_ACTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_M_CB_TOPArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_M_CB_TOP_CONSArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_M_CB_TOP_CONS_SELArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_CBArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&smscb_CB_OPTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&readSMS_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&SmsRead_R_OPTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&SmsSend_R_OPTArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
Mmi_set_area_attr(&melody_menuArea, 0,0,SCREEN_SIZE_X,SCREEN_SIZE_Y-Mmi_layout_softkeyHeight());
iconsMainIconsAreaSet (MAINICONarea);
}
void Mmi_set_area_attr(MfwRect* area,U16 px,U16 py,U16 sx,U16 sy)
{
/* pass in top-left/bottom-right coordinates*/
area->px = px;
area->py = py;
area->sx = sx-px;
area->sy = sy-py;
}
/*******************************************************************************
$Function: resources_Init
$Description:
$Returns: window
$Arguments: parent window
*******************************************************************************/
T_MFW_HND resources_Init(T_MFW_HND parent_window)
{
return (resources_create (parent_window));
}
// API - 1550 - 13-01-03 - Add this function to reset the backgrounds of Idle and Main Menus.
void resetFactoryBackground ( void )
{
idle_setBgdBitmap(BGD_TI_LOGO);
FFS_flashData.IdleScreenBgd = BGD_TI_LOGO;
icon_setMainBgdBitmap(BGD_SQUARE);
FFS_flashData.MainMenuBgd = BGD_SQUARE;
FFS_flashData.ProviderNetworkShow = TRUE;
}
void resetFactoryColour ( void )
{
initDefaultDataColour();
if(flash_data_write(colourFileDir, colourFileName, colArray, sizeof(colArray)) >= EFFS_OK)
{
TRACE_EVENT("File Created in FFS");
}
else
{
TRACE_EVENT("File Not Created in FFS");
}
}
void colour_initial_colours (void)
{
/* API/GW - Added to read the flash structure to see if the file structure to save the colour data in has been created
and if so save the initialised data to flash or load the saved values out of flash
*/
if (flash_data_read(colourFileDir, colourFileName, colArray, sizeof(colArray)) == sizeof(colArray))
/* Marcus: Issue 1719: 11/02/2003: Altered comparison in condition */
{
TRACE_EVENT("Correctly Read in!");
}
else
{
resetFactoryColour();
}
}
/*******************************************************************************
$Function: resources_Exit
$Description: exit network handling (Backward Compatibility interface)
$Returns: none
$Arguments: window
*******************************************************************************/
void resources_Exit (T_MFW_HND own_window)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data;
T_resources * data = (T_resources *)win_data->user;
resources_destroy (data->resources_win);
}
/*******************************************************************************
$Function: resources_create
$Description: create network top window
$Returns: window
$Arguments: parent_window
*******************************************************************************/
T_MFW_HND resources_create (T_MFW_HND parent_window)
{
T_resources * data = &resources_data;
T_MFW_WIN * win;
TRACE_FUNCTION ("resources_create()");
data->resources_win = win_create (parent_window, 0, 0, (T_MFW_CB)resources_win_cb);
if (data->resources_win EQ 0)
return 0;
/*
* Create window handler
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)resources;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->resources_win)->data;
win->user = (void *) data;
winShow(data->resources_win);
/*
* return window handle
*/
return data->resources_win;
}
/*******************************************************************************
$Function: resources_destroy
$Description:
$Returns: none
$Arguments: window
*******************************************************************************/
void resources_destroy (T_MFW_HND own_window)
{
T_MFW_WIN * win;
T_resources * data;
TRACE_FUNCTION ("resources_destroy()");
if (own_window)
{
win = ((T_MFW_HDR *)own_window)->data;
data = (T_resources *)win->user;
if (data)
{
/*
* Delete WIN handler
*/
win_delete (data->resources_win);
data->resources_win = 0;
}
}
}
/*******************************************************************************
$Function: resources_win_cb
$Description: network top window
$Returns: status int
$Arguments: event, window
*******************************************************************************/
static int resources_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
{
/*
* Top Window has no output
*/
return 1;
}
/*******************************************************************************
$Function: resources_language_confirm
$Description:
$Returns: void
$Arguments: void
*******************************************************************************/
static void resources_language_confirm(void)
{
T_DISPLAY_DATA display_info;
TRACE_FUNCTION ("resources_language_confirm()");
dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtDone, TxtNull , COLOUR_STATUS_PINS);
dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)resources_dialog_cb, THREE_SECS, KEY_CLEAR | KEY_RIGHT );
/*
* Call Info Screen
*/
info_dialog (resources_data.resources_win, &display_info);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -