mmiouteridle.c
来自「是一个手机功能的模拟程序」· C语言 代码 · 共 1,532 行 · 第 1/3 页
C
1,532 行
#endif
#if (SUB_LCD_SIZE==1)
dspl_sub_TextOut(96 - get_StringWidth(line),50,DSPL_TXTATTR_WHITE_EDGE,(char *)line);
#endif
#if (SUB_LCD_SIZE==5)
#endif
}
}//shiheng 0810 add
}//end drawOuterIdleZone2
/*****************************************************************************************
$Name: drawOuterIdleMissedCallAndSms
$Author: Sunny
$Date: 2004-04-02
$Description: Display the missed call and SMS.
$History: Sunny modify at 2004-04-13
*****************************************************************************************/
void drawOuterIdleMissedCallAndSms()
{
char text[20];
int txtNo;
int xOfs = 0;
int txtStrId = TxtNull;
int len1 = 0, len2 = 0;
IsMissedCallAndSms = 0;
if( FlashDCTbData.MissedCallNum )
{
txtNo = FlashDCTbData.MissedCallNum;
if( txtNo <= 1 )
{
txtStrId = TxtMissedCall;
}
else
{
txtStrId = TxtMissedCalls;
}
}
else
{
txtStrId = (smsidle_display_sms_status(&txtNo ));
}
if( txtStrId != TxtNull )
{
len1 = get_StringWidth(GET_TEXT(txtStrId));
if( txtNo != 0 )
{
memset(text,0,sizeof(text));
sprintf((char*)text,"%d",txtNo);
len2 = get_StringWidth(text);
xOfs = (OUTERSCREEN_SIZE_X - len1 - len2) /2;
#if (SUB_LCD_SIZE==5)
dspl_sub_TextOut(xOfs, 13, DSPL_TXTATTR_WHITE_EDGE,text);
dspl_sub_TextOut(xOfs + len2, 13, DSPL_TXTATTR_WHITE_EDGE,GET_TEXT(txtStrId));
#endif
dspl_sub_TextOut(xOfs, SECOND_LINE, DSPL_TXTATTR_WHITE_EDGE,text);
dspl_sub_TextOut(xOfs + len2, SECOND_LINE, DSPL_TXTATTR_WHITE_EDGE,GET_TEXT(txtStrId));
}
else
{
xOfs = (OUTERSCREEN_SIZE_X - len1) /2;
#if (SUB_LCD_SIZE==5)
dspl_sub_TextOut(xOfs, 13, DSPL_TXTATTR_WHITE_EDGE,GET_TEXT(txtStrId));
#endif
dspl_sub_TextOut(xOfs, SECOND_LINE, DSPL_TXTATTR_WHITE_EDGE,GET_TEXT(txtStrId));
}
IsMissedCallAndSms = 1;
}
}
/****************************************
$Description:draw normal
***********************************************/
void drawOuterIdle()
{
U8 uScreenType;
U8 uMode;
/* zhq, 2004/07/08, add for we use pin_outer_wait to init sub screen
and we do not refresh untile main screen drawIdle. */
if(main_sreen_init_complete == FALSE)
{
if( NotCharingMode == TRUE )
{
return;
}
}
uScreenType = dspl_SetScreenType(1);
uMode = pdspl_Enable(0);
/* 2004/07/15 sunsj modify */
/*
if( NotCharingMode == TRUE )
{
drawIconByIcnAttr((MfwIcnAttr* )OTBkgIcns+FlashSettingData.OutBGI,NULL);
}
else
{
pdspl_BitBlt(0, 0, 96, 64, 0, (char *)pin_outer_wait, 0);
}
*/
#if (SUB_LCD_SIZE==1)
if( NotCharingMode == TRUE )
{
//drawIconByIcnAttr((MfwIcnAttr* )OTBkgIcns+FlashSettingData.OutBGI,NULL);
DRAW_ICON_SEL(ICON_OUTERBKG,FlashSettingData.OutBGI);
}
#endif
#if (SUB_LCD_SIZE==6)
DRAW_ICON(ICON_OUTERBKG);
#endif
#if (SUB_LCD_SIZE==5)
DRAW_ICON(ICON_OUTERBKG);
#endif
drawOuterIdleZone1();
drawOuterIdleZone2();
//else
/*
{
if( pwr_Status.charger_plugged == 1 )
{
if( pwr_Status.charging_state == 0 )
{
dspl_sub_TextOut((96-get_StringWidth(MmiRsrcGetText(TxtChargComplete)))/2,30,DSPL_TXTATTR_WHITE_EDGE,MmiRsrcGetText(TxtChargComplete),0);
}
else
{
dspl_sub_TextOut((96-get_StringWidth(MmiRsrcGetText(TxtCharging)))/2,30,DSPL_TXTATTR_WHITE_EDGE,MmiRsrcGetText(TxtCharging),0);
}
}
}
*/
pdspl_Enable(uMode);
dspl_SetScreenType(uScreenType);
}
/*********************************************************
$Function:DrawOuterNotifyIcon
$Description:draw notify icon
$History: 2004/06 sunsj modify for picture manage
**********************************************************/
void DrawOuterNotifyIcon()
{
GlobalIconStatus_Outer = GlobalSMSIconFlag | GlobalAlarmIconFlag |
GlobalIconMissedCallFlag;
if( GlobalIconStatus_Outer & GlobalSMSIconFlag )
{
if( state_Outer[iconIdSMS].state == ICON_VISIBLE )
{
DRAW_ICON_SEL_MASK(ICON_OUTERIDLESTATE, iconIdSMS);
}
}
if( GlobalIconStatus_Outer & GlobalAlarmIconFlag )
{
if( state_Outer[iconIdAlarm].state == ICON_VISIBLE )
{
DRAW_ICON_SEL_MASK(ICON_OUTERIDLESTATE, iconIdAlarm);
}
}
if( GlobalIconStatus_Outer & GlobalIconMissedCallFlag )
{
if( state_Outer[iconIdMissedCall].state == ICON_VISIBLE )
{
DRAW_ICON_SEL_MASK(ICON_OUTERIDLESTATE, iconIdMissedCall);
}
}
//Note: Other flags you need can append.
}
/*********************************************************
$Function:DrawOuterSeceneMode
$Description:draw secene mode
$History:
********2004/03/11,Sunny create
**********************************************************/
void DrawOuterSeceneMode(U8 scenestatus)
{
if( ( scenestatus < 0 ) || ( scenestatus >= iconSceneMax ) )
return;
/* 2004/06 sunsj modify for picture manage */
#if (SUB_LCD_SIZE==6)
DRAW_ICON_SEL_MASK(ICON_SCENEOUTER, scenestatus);
#elif (SUB_LCD_SIZE==1)
DRAW_ICON_SEL_MASK(ICON_SCENEOUTER, scenestatus);
#endif
}
/*********************************************************
$Function:InitialIconState
$Description:Initial notify icon
$History:
********2004/03/11,Sunny create
**********************************************************/
void InitialIconState()
{
int i = iconIdSMS;
for( i; i < idlIdMax; i++ )
{
iconsDeleteState(i);
}
}
/*********************************************************
$Function:InitialIconState
$Description:Initial notify icon
$History:
********2004/03/23,Sunny create
**********************************************************/
void DisplayIncomingCall(char *par)
{
int stringLength = 0;
USHORT startXPos = 0;
dspl_DevCaps deviceCaps;
char *Idtext;
U8 uScreenType = dspl_SetScreenType(1);
dspl_GetDeviceCaps(&deviceCaps);
Idtext=(char*)MmiRsrcGetText( TxtIncomingCall );
stringLength = get_StringWidth(Idtext);
startXPos = (deviceCaps.Width - stringLength) / 2;
#if (SUB_LCD_SIZE==1)
pdspl_colorTextOut(startXPos,25,DSPL_TXTATTR_WHITE_EDGE,Idtext,0);
pdspl_colorTextOut((96-get_StringWidth(par))/2,40,DSPL_TXTATTR_WHITE_EDGE,(char *)par,0);
#endif
#if (SUB_LCD_SIZE==6)
pdspl_colorTextOut(startXPos,25,DSPL_TXTATTR_WHITE_EDGE,Idtext,0);
pdspl_colorTextOut((96-get_StringWidth(par))/2,40,DSPL_TXTATTR_WHITE_EDGE,(char *)par,0);
#endif
#if (SUB_LCD_SIZE==5)
pdspl_colorTextOut(startXPos,14,DSPL_TXTATTR_WHITE_EDGE,Idtext,0);
pdspl_colorTextOut((96-get_StringWidth(par))/2,26,DSPL_TXTATTR_WHITE_EDGE,(char *)par,0);
#endif
dspl_SetScreenType(uScreenType);
}
/* 2004/4/16 sunsj add for outer idle font */
int DisplayOuterNumber(int coor_x, int coor_y, int iconwidth, int iconheight, void * BmpPtr)
{
if( BmpPtr == NULL )
{
MMI_TRACE_EVENT(("icon is null"));
return;
}
pdspl_BitBlt(coor_x, coor_y, iconwidth, iconheight, 0, BmpPtr, DSPL_BMPXOR);
pdspl_BitBlt(coor_x, coor_y, iconwidth, iconheight, 0, BmpPtr, DSPL_BMPAND);
pdspl_BitBlt(coor_x, coor_y, iconwidth, iconheight, 0, BmpPtr, DSPL_BMPXOR);
}
#define DATE_START_X 8
#define DATE_START_Y 20
#if (SUB_LCD_SIZE==6)
#define OUTERIDLE_NUM_WIDTH 10
#define OUTERIDLE_NUM_HEIGHT 14
#endif
#if (SUB_LCD_SIZE==5)
#define OUTERIDLE_NUM_WIDTH 12
#define OUTERIDLE_NUM_HEIGHT 17
#endif
#if (SUB_LCD_SIZE==1)
#define OUTERIDLE_NUM_WIDTH 10
#define OUTERIDLE_NUM_HEIGHT 14
#endif
int DisplayOuterDate(char *date)
{
int i = 0;
int date_sort[10] = {1, 2, 0, 3, 4, 0, 15, 15, 9, 10};
int date_pixel_x = DATE_START_X;
int date_pixel_y = DATE_START_Y;
if( date == NULL )
{
return 0;
}
for( i = 0; i < 10; i++ )
{
if( date_sort[i] != 0 )
{
if( date_sort[i] != 15 )
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, date_pixel_x, date_pixel_y, date[i]-0x30, ICON_LOCATION);
}
else
{
continue;
}
}
else
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, date_pixel_x, date_pixel_y, 10, ICON_LOCATION);
}
date_pixel_x+=OUTERIDLE_NUM_WIDTH;
}
return 1;
}
int DisplayOuterTime(char *time, int time_type_flag)
{
int i = 0;
int time_sort[5] = {1, 2, 0, 3, 4};
int time_pixel_x = 0;
int time_pixel_y = 0;
if( time == NULL )
{
return 0;
}
if( time_type_flag == 0 )
{
#if (SUB_LCD_SIZE==6)
time_pixel_x = 13;
time_pixel_y = 32;
#endif
#if (SUB_LCD_SIZE==1)
time_pixel_x = 13;
time_pixel_y = 32;
#endif
#if (SUB_LCD_SIZE==5)
time_pixel_x = 7;
time_pixel_y = 16;
#endif
for( i = 0; i < 5; i++ )
{
if( time_sort[i] != 0 )
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, time[i]-0x30, ICON_LOCATION);
}
else
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, 11, ICON_LOCATION);
}
time_pixel_x += OUTERIDLE_NUM_WIDTH;
}
if( time[5] == 80 )
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, 12, ICON_LOCATION);
}
else if( time[5] == 65 )
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, 13, ICON_LOCATION);
}
time_pixel_x += OUTERIDLE_NUM_WIDTH;
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, 14, ICON_LOCATION);
}
else
{
#if (SUB_LCD_SIZE==6)
time_pixel_x = 23;
time_pixel_y = 32;
#endif
#if (SUB_LCD_SIZE==1)
time_pixel_x = 23;
time_pixel_y = 32;
#endif
#if (SUB_LCD_SIZE==5)
time_pixel_x = 19;
time_pixel_y = 16;
#endif
for( i = 0; i < 5; i++ )
{
if( time_sort[i] != 0 )
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, time[i]-0x30, ICON_LOCATION);
}
else
{
DRAW_ICON_ATTRIBUTE(ICON_OUTERNUMBER, time_pixel_x, time_pixel_y, 11, ICON_LOCATION);
}
time_pixel_x += OUTERIDLE_NUM_WIDTH;
}
}
return 1;
}
/********************************************************************************************
$Function: GetTimeString
$Description:
$Author: Sunny
$Date: 2004-04-22
********************************************************************************************/
void GetTimeString(char * line)
{
int hour = 0;
char *AmPm;
if( FFS_flashData.time_format == TWELVE_HOUR )
{
if( currclock.hour / 12 )
{
AmPm = "PM";
}
else
{
AmPm = "AM";
}
if( currclock.hour>12 )
{
hour=currclock.hour-12;
}
else if( currclock.hour==0 )
{
hour=12;
}
else
{
hour=currclock.hour;
}
sprintf(line,"%02d:%02d%s",hour,currclock.min,AmPm);
}
else
{
hour = currclock.hour;
sprintf(line,"%02d:%02d",hour,currclock.min);
}
}
/********************************************************************************************
$Function: DrawAnimation
$Description:
$Author: Sunny
$Date: 2004-04-22
********************************************************************************************/
static void DrawAnimation(U8 index)
{
char strDebug[100];
U8 uScreenType = 0;
MfwIcnAttr *icon = 0;
MfwIcnAttr *icon_mask = 0;
drawOuterIdle();
uScreenType = dspl_SetScreenType(1);
icon = (MfwIcnAttr *)(outerIdledata.curIcnAttr + index);
icon_mask = (MfwIcnAttr *)(outerIdledata.curIcnAttr_mask + index);
drawIconByIcnAttr(icon, icon_mask);
dspl_SetScreenType(uScreenType);
}
/********************************************************************************************
$Function: SetNeedAnimID
$Description:
$Author: Sunny
$Date: 2004-04-22
********************************************************************************************/
void SetNeedAnimID(U32 flags,UBYTE mask)
{
if( mask == 1 )
{
GlobalStatusNeedAnimation |= flags;
}
if( mask == 0 )
{
GlobalStatusNeedAnimation &= ~flags;
}
}
/********************************************************************************************
$Function: InitNeedAnimID
$Description:
$Author: Sunny
$Date: 2004-04-22
********************************************************************************************/
void InitNeedAnimID()
{
GlobalStatusNeedAnimation = 0;
SetNeedAnimID(OUTERIDLESTATE_INCOMING, 1);
SetNeedAnimID(OUTERIDLESTATE_SMS, 1);
SetNeedAnimID(OUTERIDLESTATE_ALERT, 1);
SetNeedAnimID(OUTERIDLESTATE_LCDOFF, 1); //shiheng 0810 add
}
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?