📄 mmiidle.c
字号:
/*******************************************************************************
$Function: idleExit
$Description: exit MMI idle handling
$Returns:
$Arguments:
*******************************************************************************/
void idleExit (void)
{
idle_destroy (idle_data.win);
}
/*******************************************************************************
$Function: idle_create
$Description: Creation of an instance for the Idle dialog.
$Returns:
$Arguments:
*******************************************************************************/
T_MFW_HND idle_create (T_MFW_HND parent_window)
{
T_idle * data = &idle_data;
T_MFW_WIN * win;
UBYTE result;
TRACE_FUNCTION ("idle_create");
memset(&idle_data,'\0',sizeof(idle_data));
idle_data.defTextOffset= SCREEN_SIZE_Y-Mmi_layout_softkeyHeight()-6*Mmi_layout_line_height();
/*
* Create window handler
*/
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)idle_win_cb);
if (data->win EQ 0)
return 0;
VOS_Idle_Win = data->win;
/*
* These assignments are necessary to attach the data to the window, and to handle the mmi event communication.
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)idle;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *) data;
/*
* Create any other handler
*/
data->kbd = kbd_create (data->win,KEY_ALL|KEY_MAKE,(T_MFW_CB)idle_kbd_cb);
data->kbd_long = kbd_create (data->win,KEY_ALL|KEY_LONG,(T_MFW_CB)idle_kbd_long_cb);
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
data->editor = 0;
data->editor_sat = 0;
AUI_edit_SetAttr(&data->editor_attr2, WIN_DIALLING_CB, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_ASCII, (UBYTE*)data->incoming_cb_msg, MAX_CBMSG_LEN);
AUI_edit_SetAttr(&data->editor_attr3, WIN_DIALLING_SMS, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_ASCII, (UBYTE*)data->incoming_sms_msg, MAX_MSG_LEN);
AUI_edit_SetAttr(&data->editor_attr_sat, WIN_DIALLING_SAT, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_ASCII, (UBYTE*)data->incoming_sat_msg, MAX_CBMSG_LEN);
#else /* NEW_EDITOR */
data->edt = 0;
data->edt_sat = 0; /* SPR759 - SH*/
bookSetEditAttributes(WIN_DIALLING_CB, COLOUR_EDITOR_XX,0,edtCurNone,0,(char*)data->incoming_cb_msg, MAX_CBMSG_LEN,&data->edt_attr2);
bookSetEditAttributes(WIN_DIALLING_SMS, COLOUR_EDITOR_XX,0,edtCurNone,0,(char*)data->incoming_sms_msg, MAX_MSG_LEN,&data->edt_attr3);
bookSetEditAttributes(WIN_DIALLING_SAT, COLOUR_EDITOR_XX,0,edtCurNone,0,(char*)data->incoming_sat_msg, MAX_CBMSG_LEN,&data->edt_attr_sat);
#endif /* NEW_EDITOR */
/*
* In the new design the are created and automatically shown.
*/
winShow(data->win);
data->search=FALSE;
data->missedCalls = 0;
//API - 23/09/02 - Emergency Call Define
pin_idle_emerg_call = FALSE;
data->flagIdle=FALSE;
data->right_key_pressed = FALSE;
addCBCH(NULL, IdleNewCBImmediateMessage);
data->new_cbch= FALSE;
data->clean_screen = FALSE; //for clean the DISPLAY ZONE 3
data->ciphering = DONT_SHOW_CPRS; //use as a default
data->starting_up = TRUE; /*SPR#1662 JVJ New flag for the start up procedure */
//init the Ciphering indication
result = sim_init_CPRS ((CallbackCPRI) idle_Ciphering, MFW_SIM_CPRI_SHOW );
if (result == FALSE)
TRACE_EVENT("Cant show Ciphering")
/*
* return window handle
*/
return data->win;
}
/*******************************************************************************
$Function: idle_destroy
$Description: Destroy the idle dialog.
$Returns:
$Arguments:
*******************************************************************************/
void idle_destroy (T_MFW_HND own_window)
{
T_MFW_WIN * win;
T_idle * data;
/*
* The destruction of this dialog is trivial, because the information contained is not dynamic. A better example
* of dialog destruction can be found in dialling_destroy
*/
TRACE_FUNCTION ("idle_destroy");
if (own_window)
{
win = ((T_MFW_HDR *)own_window)->data;
data = (T_idle *)win->user;
if (data)
{
/*
* Exit Keyboard Handler
*/
/*
* Delete WIN Handler
*/
win_delete (data->win);
data->win=0;
}
}
}
/*******************************************************************************
$Function: idle
$Description: Dialog function for idle top window.
$Returns:
$Arguments:
*******************************************************************************/
void idle (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
U8 * key_code;
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_idle * data = (T_idle *)win_data->user;
/*
* This function is called by the SEND_EVENT macro, when the parameter win is the idle window. the different events
* come from another mmi modules.
*/
TRACE_FUNCTION ("idle()");
switch (event)
{
case NETWORK_NO_SERVICE:
case NETWORK_NO_PLMN_XXX_AVAIL:
/*
* Network management indicates no or limited service
*/
data->nm_status = event;
data->search=TRUE;
/*NM, p020*/
if(idleIsFocussed())
windowsUpdate();
break;
case NETWORK_SEARCH_NETWORK:
case NETWORK_FULL_SERVICE:
/*
* Network will be searched or is available
*/
#ifdef MMI_HOMEZONE_ENABLED
if (event==NETWORK_FULL_SERVICE)
homezoneReadSim(HZ_READ_ONCE_ONLY); // Read in homezone data. Will do nothing on repeated calls.
#endif
data->search=FALSE;
data->nm_status = event;
/*NM, p020*/
if(idleIsFocussed())
windowsUpdate();
break;
case IDLE_UPDATE:
/*NM, p020*/
if ((idleIsFocussed()) || (idle_data.klck_win != NULL))
windowsUpdate();
break;
case IDLE_NEW_SMS:
// show the info about incoming sms on the idle screen
idle_data.clean_screen = FALSE;
/*NM, p020*/
if(idleIsFocussed())
windowsUpdate();
else if (idle_data.klck_win != NULL)
SEND_EVENT(idle_data.klck_win,IDLE_NEW_SMS,0,0);
break;
case IDLE_ACTIVE_KEY_PAD_LOCKED:
idle_data.klck_win = idle_key_pad_locked_create(win);
windowsUpdate();
break;
case IDLE_DETAILS_NUMBER:
idle_dialling_create(win);
windowsUpdate();
break;
case IDLE_START_DIALLING_NUMBER:
key_code = (U8*)parameter;
memset(idle_data.edt_buf,'\0',sizeof(idle_data.edt_buf));
idle_data.edt_buf[0]=editControls[*key_code];
idle_dialling_start(idle_data.win,NULL);
break;
default:
return;
}
}
/*******************************************************************************
$Function: idleExec
$Description:
$Returns:
$Arguments:
*******************************************************************************/
void idleExec (int reason, MmiState next)
{
MmiModuleSet (ModuleIdle); /* Set the global status of Idle */
switch (reason)
{
case IdleNormal: /* enter normal idle mode */
winShow(idle_data.win);
break;
default:
break;
}
}
/*******************************************************************************
$Function: idleEvent
$Description:
$Returns:
$Arguments:
*******************************************************************************/
void idleEvent (int reason)
{
sprintf(stringTrace,"IDLE event reason: %d",reason);
TRACE_FUNCTION(stringTrace);
switch (reason)
{
case IdleSearchNetwork:
if (idle_data.win)
SEND_EVENT(idle_data.win,IDLE_NO_NETWORK,0,0);
break;
case IdleUpdate:
if (idle_data.win)
SEND_EVENT(idle_data.win,IDLE_UPDATE,0,0);
break;
case IdleNewSmsMessage:
if (idle_data.win)
SEND_EVENT(idle_data.win,IDLE_NEW_SMS,0,0);
break;
case IdleActiveKeyPadLocked:
if (idle_data.win)
SEND_EVENT(idle_data.win,IDLE_ACTIVE_KEY_PAD_LOCKED,0,0);
break;
case PhbkDetailListToIdle:
if (idle_data.win)
SEND_EVENT(idle_data.win,IDLE_DETAILS_NUMBER,0,0);
break;
default:
break;
}
}
/*******************************************************************************
$Function: idle_setBgdBitmap
$Description: This procedure is called when the idle background bitmap is to be changed
$Returns: None
$Arguments: bmp - pointer to the bitmap structure.
*******************************************************************************/
void idle_setBgdBitmap(int bmpId)
{
idle_data.idleBgd = icon_getBitmapFromId(bmpId, NULL);
}
/*******************************************************************************
$Function: idle_initDisplayData
$Description: initialises the display data
$Returns:
$Arguments:
$History
GW 09/10/02 - Created
*******************************************************************************/
enum {
IDLE_CHARGING_MODE,
IDLE_NETWORK_NAME,
IDLE_CALL_SMS_INFO,
IDLE_CLOCK_STR,
IDLE_DATE_STR,
IDLE_LOCKED_ECC,
IDLE_LOCKED,
IDLE_MENU_PRESS,
IDLE_END
};
static int idlePosition[IDLE_END];
int idle_initDisplayData( void )
{
int i;
for (i=0;i<IDLE_END;i++)
idlePosition[i] = 0;
}
/*******************************************************************************
$Function: idle_displayData
$Description: Procedure to allow different layouts of the idle screen data depending on
hardware configuration.
Each bit of text that can be displayed is given a value in the enumerated type.
For some h/w configurations, different enumerated type values are displayed in
the same position. By checking the 'idlePosition' array we can tell if we can display
a particular bit of text. This allows a C-sample to display either the SMS information
or the clock and for the D-sample to always display the clock (and the date).
$Returns: None.
$Arguments: dataId - value form the enumerated type that indicates what the data is
txtId - text identifier (can be set to TxtNull if not used)
strId - pointer to a char array to be displayed. Array is assumed to be ascii.
NB If both txtId and strId are used, the string is displayed first followed by
1 or 2 spaces, then the text id allowing display of "1 New Message" etc.
$History
GW 09/10/02 - Created
*******************************************************************************/
int idle_displayData( int dataId , int txtId, char* txtStr)
{
int xPos, yPos;
int lenStr,lenId,lenSpace;
int txtWidth;
char *txtSpace = ""; //EF must initialise. 03/02/2003
char *idStr;
int txtFormat;
int noRoom = 0;
if (txtStr != NULL)
lenStr = dspl_GetTextExtent( txtStr, 0);
else
lenStr = 0;
if (txtId!=TxtNull)
{
idStr = (char*)MmiRsrcGetText(txtId);
lenId = dspl_GetTextExtent( idStr, 0);
}
else
{
lenId = 0;
idStr = "";
}
if ((lenId > 0 ) && (lenStr >0))
{
#ifndef LSCREEN
txtSpace=" ";
#else
txtSpace=" ";
#endif
lenSpace = dspl_GetTextExtent( txtSpace, 0);
}
else
{
lenSpace = 0;
}
txtWidth = lenStr+lenId+lenSpace;
if (idlePosition[dataId] == 0)
idlePosition[dataId] = 1;
else
{
//We have already output something here - do not overwrite it
noRoom = 1;
}
#ifndef LSCREEN
xPos = 0;
yPos = 0;
txtFormat = 0;
switch (dataId)
{
case IDLE_NETWORK_NAME:
xPos = 16;
yPos = Mmi_layout_line_icons(1);
break;
case IDLE_CHARGING_MODE:
xPos = 16;
yPos = Mmi_layout_line_icons(2);
break;
case IDLE_CALL_SMS_INFO:
xPos = 0;
yPos = Mmi_layout_line_icons(3);
break;
case IDLE_CLOCK_STR:
/* Marcus: Issue 1614: 23/01/2003: Start */
#ifdef NEW_EDITOR
if ((idlePosition[IDLE_CALL_SMS_INFO] == 0) &&
(idle_data.editor == NULL))
#else
if ((idlePosition[IDLE_CALL_SMS_INFO] == 0) &&
(idle_data.edt == NULL))
#endif
/* Marcus: Issue 1614: 23/01/2003: End */
{
xPos = 30;
yPos = 24;
}
else
{ //no room to display the time
noRoom = 1;
}
break;
case IDLE_DATE_STR:
noRoom = 1; //date not displayed in B-sample/C-sample
break;
case IDLE_LOCKED_ECC:
case IDLE_LOCKED:
xPos = 0;
yPos = idleLine(2);
break;
case IDLE_MENU_PRESS:
xPos = 0;
yPos = idleLine(3);
break;
default:
break;
}
#else
xPos = (SCREEN_SIZE_X - txtWidth)/2;
yPos = idle_data.defTextOffset;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -