📄 mmidialogs.c
字号:
wy = wy/2;
if ((wx == 0) || (wy==0))
fullScreen = 1; //not enough room to display as a window - use whole screen
else
fullScreen = 0;
}
/*
* Draw display - either full screen or a pop-up window
*/
area.px = 0;
area.py = 0;
area.sx = sx;
area.sy = sy;
resources_setColour(data->dlgCol);
drawWinType = DSPL_WIN_CENTRE;
/* future expansion
switch (data->dlgType &DLG_DISPLAY_TYPE)
{
case 0: drawWinType = DSPL_WIN_CENTRE; break;
default: drawWinType = DSPL_WIN_CENTRE; break;
}
end of future expansion */
if (fullScreen==0)
{
t_font_bitmap bmp;
t_font_bitmap* bmpPtr = NULL;
yPos1 = wy+yOfs;
yPos2 = wy+yOfs+Mmi_layout_line_height();
#ifdef COLOURDISPLAY
if (data->dlgBgdBitmap == NULL)
{
TRACE_EVENT("display_info->bgdBitmap == NULL");
data->dlgBgdBitmap = icon_getBgdBitmap(BGD_CLOUD);
}
if (data->dlgBgdBitmap != NULL)
{
bmp.format = data->dlgBgdBitmap->icnType;
bmp.height = data->dlgBgdBitmap->area.sy;
bmp.width = data->dlgBgdBitmap->area.sx;
bmp.bitmap = data->dlgBgdBitmap->icons;
bmpPtr = &bmp;
area = calcLayout(data->dlgType, sx, sy, bmp.width, bmp.height);
//Adjust size of available area depending on bitmap properties/dlgType.
//dlgType== 0 =>display info in centre of bitmap
if (data->dlgType == 0)
{
//If the bmp is bigger than the data we will move the bmp to
//lie over the centre of the data
area.px = area.px - (bmp.width - sx)/2;
area.py = area.py - (bmp.height- sy)/2;
}
xPos1 = area.px+wx+(area.sx-l1)/2;
xPos2 = area.px+wx+(area.sx-l2)/2;
yPos1 = wy+yOfs+area.py;
yPos2 = yPos1 + Mmi_layout_line_height();
TRACE_EVENT_P3("wy = %d, yOfs = %d, area.py = %d",wy,yOfs,area.py);
if( data->dlgBgdBitmap->icnType != ICON_TYPE_1BIT_UNPACKED )
dspl_SetBgdColour( COL_TRANSPARENT );
}
#endif
dspl_DrawWin( wx,wy,sx,sy, drawWinType , bmpPtr);
}
else
{
dspl_ClearAll();
sx = 84;
xPos1 = 0;
xPos2 = 0;
yPos1 = Mmi_layout_line(1);
yPos2 = Mmi_layout_line(2);
}
/*
* Print softkeys
*/
icnShow(data->icon);
if ((lskStr != NULL) || (rskStr != NULL))
{
if (fullScreen)
Mmi_layout_softkeyArea( &skArea );
else
{
skArea.px = area.px+wx;
skArea.sx = area.sx;
skArea.py = area.py+wy+area.sy-Mmi_layout_softkeyHeight()-1;
skArea.sy = Mmi_layout_softkeyHeight();
}
softKeys_displayStrXY(lskStr, rskStr, data->dlgSkFormat, data->dlgCol, &skArea);
}
if (str1 != NULL)
dspl_TextOut(xPos1, yPos1, display_mode1/*mc, SPR1319*/, str1 );
if (str2 != NULL)
dspl_TextOut(xPos2, yPos2, display_mode2/*mc, SPR1319*/, str2 );
resources_restoreColour();
}
break;
default:
return 0;
}
return 1;
}
/*******************************************************************************
$Function: dialog_info_tim_cb
$Description: Callback function for the dialog info timer.
$Returns: MFW event handler
$Arguments: window handle event, timer control block
*******************************************************************************/
static T_MFW_CB dialog_info_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_dialog_info * data = (T_dialog_info *)win_data->user;
T_MFW_HND parent_win = data->parent_win;
USHORT Identifier = data->Identifier;
void (* Callback)() = data->Callback;
#if defined (WIN32)
{
char buf[40];
sprintf (buf, "Identifier %d", data->Identifier);
TRACE_EVENT (buf);
}
#endif
/*
** SPR#1744 NDH
** Move the dialog destory in front of the Callback to make the processing consistent
** with the Right Keypress and Hangup Processing. Also to ensure that the dialog is
** removed when the screen is redrawn.
*/
dialog_info_destroy (win);
if (Callback)
(Callback) (parent_win, Identifier, INFO_TIMEOUT);
return 0;
}
/*******************************************************************************
$Function: dialog_info_kbd_cb
$Description: Keyboard event handler
$Returns: status int
$Arguments: window handle event, keyboard control block
*******************************************************************************/
static int dialog_info_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_dialog_info * data = (T_dialog_info *)win_data->user;
T_MFW_HND parent_win = data->parent_win;
USHORT Identifier = data->Identifier;
void (* Callback)() = data->Callback;
TRACE_FUNCTION("dialog_info_kbd_cb");
switch (keyboard->code)
{
case KCD_LEFT:
if (data->KeyEvents & KEY_LEFT )
{
dialog_info_destroy (win);
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_LEFT);
}
break;
case KCD_RIGHT:
if (data->KeyEvents & KEY_RIGHT)
{
dialog_info_destroy (win);
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_RIGHT);
}
break;
case KCD_HUP:
if (data->KeyEvents & KEY_HUP || data->KeyEvents & INFO_KCD_ALL)
{
dialog_info_destroy (win);
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_HUP);
}
break;
case KCD_MNUUP:
if (data->KeyEvents & KEY_MNUUP)
{
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_UP);
}
break;
case KCD_MNUDOWN:
if (data->KeyEvents & KEY_MNUDOWN)
{
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_DOWN);
}
break;
//MZ 7/3/01 used to start a call.
case KCD_CALL:
if (data->KeyEvents & KEY_CALL )
{
dialog_info_destroy (win);
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_OFFHOOK);
}
break;
default:
if (data->KeyEvents & INFO_KCD_ALL)
{
/*
Note: The variable Identifier is overwritten with the
keycode of the dialog;
we need it only for the Multicall Control !!
*/
Identifier = keyboard->code;
dialog_info_destroy (win);
if (Callback)
(Callback) (parent_win, Identifier, INFO_KCD_ALL);
}
break;
}
return MFW_EVENT_CONSUMED;
}
static int dialog_info_kbd_long_cb(T_MFW_EVENT event, T_MFW_KBD *keyboard){
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: mmi_dialog_information_screen
$Description:
$Returns:
$Arguments:
*******************************************************************************/
T_MFW_HND mmi_dialog_information_screen(T_MFW_HND parent_win, int TxtId, char* text, T_VOID_FUNC call_back, USHORT identifier)
{
T_DISPLAY_DATA display_info;
dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtId, TxtNull, COLOUR_STATUS);
dlg_initDisplayData_events( &display_info, call_back, THREE_SECS, KEY_ALL );
display_info.TextString = text;
display_info.Identifier = identifier;
return info_dialog(parent_win,&display_info); //information screen
}
T_MFW_HND mmi_dialog_information_screen_forever(MfwHnd win,int TextId, char* TextStr, int colour)
{
T_DISPLAY_DATA DisplayInfo;
dlg_initDisplayData_TextId( &DisplayInfo, TxtNull, TxtNull, TextId, TxtNull, colour);
dlg_initDisplayData_events( &DisplayInfo, NULL, FOREVER, KEY_HUP );
DisplayInfo.TextString = TextStr;
return info_dialog(win, &DisplayInfo);
}
/*******************************************************************************
$Function: mmi_dialogs_insert_icon
$Description: Displays one icon in a dialog
$Returns: none
$Arguments: win, pointer to an icon
*******************************************************************************/
void mmi_dialogs_insert_icon (T_MFW_HND win_dialog ,MfwIcnAttr *icon)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)win_dialog)->data;
T_dialog_info * data = (T_dialog_info *)win_data->user;
data->icon = icnCreate(win_dialog,icon,E_ICN_VISIBLE,NULL);
icnUnhide(data->icon);
winShow(win_dialog);
}
/*******************************************************************************
$Function: mmi_dialogs_insert_animation
$Description: starts an animation in a dialog
$Returns: none
$Arguments: win, animation time, pointer to an icon, number of frames
*******************************************************************************/
void mmi_dialogs_insert_animation (T_MFW_HND win_dialog , S32 anim_time ,MfwIcnAttr *icon ,UBYTE number_of_frames)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)win_dialog)->data;
T_dialog_info * data = (T_dialog_info *)win_data->user;
data->number_of_frames = number_of_frames;
data->current_frame = 0;
data->icon_array = icon;
data->current_icon = data->icon_array;
data->icon = icnCreate(win_dialog,data->current_icon,E_ICN_VISIBLE,NULL);
icnUnhide(data->icon);
data->animation_timer = timCreate(win_dialog,anim_time,(MfwCb)mmi_dialogs_insert_animation_CB);
timStart(data->animation_timer);
winShow(win_dialog);
}
/*******************************************************************************
$Function: mmi_dialogs_insert_animation_CB
$Description: destroys the current icon and starts the next icon
$Returns: none
$Arguments: timer event, timer control block
*******************************************************************************/
void mmi_dialogs_insert_animation_CB (T_MFW_EVENT event, T_MFW_TIM *tc)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_dialog_info * data = (T_dialog_info *)win_data->user;
icnDelete(data->icon);
if (data->current_frame < (data->number_of_frames-1))
{
data->current_frame++;
data->current_icon++;
}
else
{
data->current_frame = 0;
data->current_icon = data->icon_array;
}
data->icon = icnCreate(win,data->current_icon,E_ICN_VISIBLE,NULL);
icnUnhide(data->icon);
timStart(data->animation_timer);
winShow(win);
}
void mmi_dialogs_insert_animation_new (T_DISPLAY_DATA *animateInfo , S32 anim_time ,MfwIcnAttr* icon ,UBYTE number_of_frames)
{
TRACE_EVENT("mmi_dialogs_insert_animation_new()");
animateInfo->number_of_frames = number_of_frames;
animateInfo->current_frame = 0;
animateInfo->icon_array = icon;
animateInfo->anim_time = anim_time;
}
void mmi_dialogs_animation_new_CB (T_MFW_EVENT event, T_MFW_TIM *tc)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_dialog_info * data = (T_dialog_info *)win_data->user;
char * idData;
int px, py, sx, sy;
MfwIcnAttr* icn_array;
MfwIcnAttr* icn;
TRACE_EVENT("mmi_dialogs_insert_animation_new_CB()");
data->current_frame = (data->current_frame +1) % data->number_of_frames;
TRACE_EVENT_P1("data->current_frame = %d", data->current_frame);
TRACE_EVENT_P1("number_of_frames = %d", data->number_of_frames);
icn_array = (MfwIcnAttr*)data->icon_array;
TRACE_EVENT_P1("data->icon_array = %x", (int)data->icon_array);
icn = &icn_array[data->current_frame];
px = icn->area.px;
py = icn->area.py;
sx = icn->area.sx;
sy = icn->area.sy;
TRACE_EVENT_P4("px = %d, py = %d, sx = %d, sy = %d", icn->area.px,icn->area.py,icn->area.sx,icn->area.sy);
idData = icn->icons;
dspl_BitBlt2(px,py,sx,sy,(void*)idData,0,0x02);
timStart(data->animation_timer);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -