📄 mmischedule.c
字号:
TRACE_EVENT("sche_DialogCB");
switch( event )
{
case SCHE_INIT:
//if(data->menu_options_win!=NULL)
//bookMenuDestroy(data->menu_options_win);
break;
case SCHE_EDIT:
//PROMPT(30, 0, 0, TxtSchedule);
ScheSetEditor(win);//set editor with default attribute values
/*
data->editor_data.editor_attr.win.px = 0;
data->editor_data.editor_attr.win.py = 20;
data->editor_data.editor_attr.win.sx = 120;
data->editor_data.editor_attr.win.sy = 120;
*/
data->editor_data.Callback = (T_EDIT_CB)ScheCB;
/* 2003/12/04 sunsj modify for new editor mode */
if( data->editor_data.mode == TEXTINPUT_MODE )
{
data->editor_win = text_input(win, &data->editor_data);
}
else
{
data->editor_win = editor_start(win, &(data->editor_data));
}
winShow(win);
break;
case SMS_PHBK_NUMBER:
TRACE_EVENT("SMS_PHBK_NUMBER");
strcpy((char*)sche_data.text,(char*)parameter);
//ScheSetPhoneEditor(win);
//data->editor_data.Callback = (T_EDIT_CB)ScheCB;
//data->editor_win = editor_start(win, &(data->editor_data));
//winShow(win);
break;
case SCHE_EXIT:
schedestroy(win);
break;
}
}
static int sche_win_cb (T_MFW_EVENT event,T_MFW_WIN * win)
{
// TR_data * data = (TR_data *)win->user;
// char strn[8];
TRACE_EVENT ("TR_win_cb()");
/*
if (data EQ 0)
return 1;*/
switch( event )
{
case E_WIN_VISIBLE:
TRACE_EVENT("E_WIN_VISIBLE");
if( win->flags & E_WIN_VISIBLE )
{ /*
* Clear Screen
*/
TRACE_EVENT("gdy test");
}
break;
default:
break;
}
return 1;
}
static void reset_editor(U16 winPx,U16 winPy,U16 winSx,U16 winSy,U8 fgColor,U8 font,U8 mode,
U8 *controls, char *text,U16 size,MfwEdtAttr* attr,U8 dsplTitle)
{
attr->win.px = winPx;
attr->win.py = winPy;
attr->win.sx = winSx;
attr->win.sy = winSy;
attr->fgColor = fgColor;
attr->font = font;
attr->mode = mode;
attr->controls = controls;
attr->text = text;
attr->size = size;
attr->title_id=dsplTitle;
}
/* "新日程" 文本框创建 */
void ScheSetEditor(T_MFW_HND win)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
schedule_data* data = (schedule_data *) win_data->user;
short TxtID;
char stre[3];
//editor_attr_init(&((data->editor_data).editor_attr), NULL, edtCurBar1, 0, 0, 0);
switch( sche_data.type )
{
case MEETING:
TxtID=TxtScheMeeting;
break;
case BIRTHDAY:
TxtID=TxtBirthday;
break;
case APPOINTMENT:
TxtID=TxtAppointment;
break;
case PHONE:
TxtID=TxtPhone;
break;
case REMIND:
TxtID=TxtRemind;
break;
default:
break;
}
memset((char*)sche_data.text,0,sizeof(sche_data.text));
if( sche_data.type==PHONE )
editor_attr_init_fullscr(&((data->editor_data).editor_attr), 1,TxtID, (char *)sche_data.text, 24, edtCurBar1);
else
editor_attr_init_fullscr(&((data->editor_data).editor_attr), 1,TxtID, (char *)sche_data.text, SCHE_LEN, edtCurBar1);
data->editor_data.hide = FALSE;
data->editor_data.min_enter = 1; // Avoid returning empty strings
data->editor_data.Identifier = 0xFFFF ;
data->editor_data.TextString = NULL;
data->editor_data.timeout = FOREVER; // Avoid returning empty strings
data->editor_data.destroyEditor = FALSE;
//data->editor_data.editor_attr.text = (char *)sche_data.text;
//data->editor_data.editor_attr.size = 98;
data->editor_data.TextId = '\0';
if( sche_data.type==PHONE )
{
data->editor_data.Identifier =SMSSEND_ID_NBEDIT;
data->editor_data.LeftSoftKey =TxtSoftOK;
data->editor_data.AlternateLeftSoftKey = TxtFind;
data->editor_data.RightSoftKey = TxtDelete;
}
else
{
data->editor_data.LeftSoftKey = TxtSoftOK;//comfirm
data->editor_data.AlternateLeftSoftKey = TxtNull;
data->editor_data.RightSoftKey = TxtDelete;
}
if( sche_data.type==PHONE )
{
data->editor_data.mode = PHONENUMONLY_MODE;
}
else
{
data->editor_data.mode = TEXTINPUT_MODE; /* 2003/12/04 sunsj modiyf */
data->editor_data.InputMode = PINYIN_INPUT_MODE; /* 2003/12/04 sunsj */
}
}
void ScheSetPhoneEditor(T_MFW_HND win)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
schedule_data* data = (schedule_data *) win_data->user;
editor_attr_init_fullscr(&((data->editor_data).editor_attr), 1,TxtPhone, (char *)sche_data.text, 24, edtCurBar1);
data->editor_data.hide = FALSE;
data->editor_data.min_enter = 1; // Avoid returning empty strings
data->editor_data.TextString = NULL;
data->editor_data.timeout = FOREVER; // Avoid returning empty strings
data->editor_data.destroyEditor = FALSE;
//data->editor_data.editor_attr.text = (char *)sche_data.text;
//data->editor_data.editor_attr.size = 98;
data->editor_data.TextId = '\0';
data->editor_data.Identifier =SMSSEND_ID_NBEDIT;
data->editor_data.LeftSoftKey =TxtSoftOK;
data->editor_data.AlternateLeftSoftKey = TxtFind;
data->editor_data.RightSoftKey = TxtDelete;
data->editor_data.mode = PHONENUMONLY_MODE;
}
/* "新日程" 文本框回调函数 */
static void ScheCB( T_MFW_HND win,USHORT Identifier,UBYTE reason)
{
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
schedule_data *data = (schedule_data *) win_data->user;
TRACE_EVENT("ScheCB");
switch( reason )
{
case INFO_KCD_ALTERNATELEFT:
TRACE_EVENT("INFO_KCD_ALTERNATELEFT");
//editor_destroy(data->editor_win);
bookPhonebookStart(data->win, PhbkFromSms);
break;
case INFO_KCD_LEFT:
{
TRACE_EVENT("INFO_KCD_LEFT");
//TraceInt(sche_year);
//TraceInt(sche_month);
//TraceInt(sche_day);
TimeAndRing(data->win);
}
break;
case INFO_KCD_RIGHT:
case INFO_KCD_HUP:
/* 2003/12/04 sunsj modify for new editor mode */
if( data->editor_data.mode == TEXTINPUT_MODE )
{
text_input_destroy(data->editor_win);
}
else
{
editor_destroy(data->editor_win);
}
schedestroy(sche_win);
break;
default:
break;
}
//return MFW_EVENT_CONSUMED;
}
void schedestroy(T_MFW_HND own_window)
{
T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data;
schedule_data* data = (schedule_data*)win->user;
TRACE_EVENT ("schedestroy()");
if( own_window )
{
/* Delete WIN Handler */
win_delete (own_window);
/* Free Memory */
FREE_MEMORY ((void *)data, sizeof (schedule_data));
}
}
void sche_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason)
{
TRACE_EVENT ("sche_dialog_cb()");
switch( reason )
{
case INFO_KCD_LEFT:
/* no break; */
case INFO_KCD_HUP:
/* no break; */
case INFO_KCD_RIGHT:
/* no break; */
case INFO_KCD_CLEAR:
//go back to the previous dialog
SEND_EVENT (sche_win, SCHE_EXIT,0, 0);
break;
}
}
/* "日程闹钟"窗口创建 */
static T_MFW_HND TR_create(MfwHnd parent_win)
{
TR_data* data = (TR_data *)ALLOC_MEMORY (sizeof (TR_data ));
T_MFW_WIN * win;
//int i=0;
TRACE_EVENT("TR_create");
if( data EQ NULL )
{
return NULL;
}
// Create window handler
data->win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)TR_win_cb);
if( data->win EQ NULL )
{
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)TR_DialogCB;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *)data;
data->parent_win = parent_win;
data->kbd=kbdCreate(data->win, KEY_ALL, (T_MFW_CB)TR_kbd_cb);
TR_win=data->win;
winShow(win);
return data->win;
}
/* "日程闹钟"显示回调 */
static int TR_win_cb (T_MFW_EVENT event,T_MFW_WIN * win)
{
TR_data *data = (TR_data *)win->user;
char strn[8];
char string[4];
int old_color;
game_Line line;
game_Rectangle rectangle;
TD_Line l;
TRACE_EVENT ("TR_win_cb()");
if( data EQ 0 )
return 1;
switch( event )
{
case E_WIN_VISIBLE:
TRACE_EVENT("E_WIN_VISIBLE");
if( win->flags & E_WIN_VISIBLE )
{
U8 uMode = 0;
uMode = dspl_Enable(0);
/* Clear Screen */
switch( data->id )
{
case TR_TIME:
TRACE_EVENT("dspl_title");
dspl_ClearAll();
/* background display */
TD_drawBkg(BG_rect, BG_attr);
/* title display */
/* 2004/06 sunsj modify for picture manage */
DRAW_ICON(ICON_MENUUP);
/*
dspl_BitBlt( menuup[FlashSettingData.theme].area.px,menuup[FlashSettingData.theme].area.py,
menuup[FlashSettingData.theme].area.sx,menuup[FlashSettingData.theme].area.sy,
menuup[FlashSettingData.theme].nIcons,menuup[FlashSettingData.theme].icons,0);
*/
/* 2004/05/19yhf modify */
dspl_colorTextOut(28+EX,0,DSPL_TXTATTR_TRANSPARENT,MmiRsrcGetText(TxtEnterTime),0x0); //输入时间
//dspl_colorTextOut(28+EX,0,DSPL_TXTATTR_TRANSPARENT,MmiRsrcGetText(TxtEnterTime),0x0);
/****end yhf modify****/
/* input rect display */
if( !data->position ) //focus on input rect
{
TD_drawSolidRectangle(AL_input_rect, AL_input_attr1);
l = AL_index_l;
/* 2004/05/19yhf modify */
#if(MAIN_LCD_SIZE==4)
l.x1 = AL_index_l.x1 + data->index*8;
l.x2 = AL_index_l.x2 + data->index*8;
#elif(MAIN_LCD_SIZE==3)
l.x1 = AL_index_l.x1 + data->index*8;
l.x2 = AL_index_l.x2 + data->index*8;
#endif
/***end yhf modify***/
TD_drawLine(l, AL_index_c);
}
else
{
TD_drawSolidRectangle(AL_input_rect, AL_input_attr2);
}
/* 2004/05/19yhf modify */
#if(MAIN_LCD_SIZE==3)
dspl_colorTextOut(30+EX, 19, DSPL_TXTATTR_TRANSPARENT, data->time,0 );
#elif(MAIN_LCD_SIZE==4)
dspl_colorTextOut(40+EX, 57, DSPL_TXTATTR_TRANSPARENT, data->time,0 );
#endif
/**** end yhf modify***/
/* hint rect dispaly */
TD_drawSolidRectangle(AL_hint_rect, AL_hint_attr);
set_font_type(UNI12X12_FONT);
#if(MAIN_LCD_SIZE==4)
if( FFS_flashData.time_format==TWENTYFOUR_HOUR )
{
/* 2004/05/19yhf modify */
if( Mmi_getCurrentLanguage()==CHINESE_LANGUAGE )
dspl_colorTextOut(37+EX, 83+20, DSPL_TXTATTR_TRANSPARENT, MmiRsrcGetText(TxtTwentyfourHour),0);
else
dspl_colorTextOut(36+EX, 83+20, DSPL_TXTATTR_TRANSPARENT, MmiRsrcGetText(TxtTwentyfourHour),0);
}
else
{
if( Mmi_getCurrentLanguage()==CHINESE_LANGUAGE )
dspl_colorTextOut(37+EX, 103, DSPL_TXTATTR_TRANSP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -