mmibooksearchwindow.c
来自「是一个手机功能的模拟程序」· C语言 代码 · 共 1,372 行 · 第 1/5 页
C
1,372 行
memset(&data, 0x00, sizeof(data));
memcpy(data.name,(char *)l_phb_NVMEntry.name,PHB_name_len+2);
memcpy(data.number,(char *)l_phb_NVMEntry.number,PHB_number_len);
SetCallData(data);
callNumber((UBYTE *)l_phb_NVMEntry.number);
}
break;
case B_HOME:
{
T_EasyName data;
memset(&data, 0x00, sizeof(data));
memcpy(data.name,(char *)l_phb_NVMEntry.name,PHB_name_len+2);
memcpy(data.number,(char *)l_phb_NVMEntry.number,PHB_number_len);
SetCallData(data);
callNumber((UBYTE *)l_phb_NVMEntry.home);
}
break;
case B_OFFICE:
{
T_EasyName data;
memset(&data, 0x00, sizeof(data));
memcpy(data.name,(char *)l_phb_NVMEntry.name,PHB_name_len+2);
memcpy(data.number,(char *)l_phb_NVMEntry.number,PHB_number_len);
SetCallData(data);
callNumber((UBYTE *)l_phb_NVMEntry.office);
}
break;
default:break;
}
}
}
else if( l_phb_index[bookname[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
{
if( ReadSIMRecord(bookname[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_Shortentry) )
{
T_EasyName data;
/* 2004/06/30 sunsj modify */
memset(&data, 0x00, sizeof(data));
memcpy(data.name,(char *)l_phb_Shortentry.name.data,PHB_name_len);
memcpy(data.number,(char *)l_phb_Shortentry.number,PHB_number_len);
SetCallData(data);
callNumber((UBYTE *) l_phb_Shortentry.number);
}
}
}
}
break;
case LISTS_REASON_SELECT:
case LISTS_REASON_OK:
{
timStop(show_timer);
timStop(edt_timer);
memset(data->edtBuf,0,sizeof(data->edtBuf));
switch( data->phbk->EntryType )
{
case PhbkFromShortcutKey:
case PhbkNormal:
{
data->phbk->dynamicmenu_win =ListData->win;
data->phbk->select_index =(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal;
if( Phbk->BufferTable==GlobalTable )
show_index=l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition+SearchTotal)%SearchTotal].index;
else if( Phbk->BufferTable==SearchTable )
show_index=bookname[(Phbk->BufferIndex+ListData->CursorPosition+SearchTotal)%SearchTotal].index;
timStop(show_timer);
data->phbk->menu_options_win =bookMenuStart( data->phbk->win, bookNameMenuAttributes(),PhbkSearchItem);
}
break;
case PhbkFromSms:
{
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
{
if( ReadNVMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_NVMEntry) )
{
switch( CurrentType )
{
case B_NUMBER:
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *)l_phb_NVMEntry.number);
edtSymbol(getactiveEditor(),ecBottom);
}
break;
case B_HOME:
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *)l_phb_NVMEntry.home);
edtSymbol(getactiveEditor(),ecBottom);
}
break;
case B_OFFICE:
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *)l_phb_NVMEntry.office);
edtSymbol(getactiveEditor(),ecBottom);
}
break;
default:break;
}
}
}
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
{
if( ReadSIMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_Shortentry) )
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,(UBYTE *) l_phb_Shortentry.number);
edtSymbol(getactiveEditor(),ecBottom);
}
}
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
bookSearchDestroy(data->win);
}
break;
case PhbkFromDivert:
{
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
{
if( ReadNVMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_NVMEntry) )
{
switch( CurrentType )
{
case B_NUMBER:
{
SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, 0,
(UBYTE *)l_phb_NVMEntry.number);
edtSymbol(getactiveEditor(),ecBottom);
}
break;
case B_HOME:
{
SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, 0,
(UBYTE *)l_phb_NVMEntry.home);
edtSymbol(getactiveEditor(),ecBottom);
}
break;
case B_OFFICE:
{
SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, 0,
(UBYTE *)l_phb_NVMEntry.office);
edtSymbol(getactiveEditor(),ecBottom);
}
break;
default:break;
}
}
}
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
{
if( ReadSIMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_Shortentry) )
{
SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, 0,(UBYTE *) l_phb_Shortentry.number);
edtSymbol(getactiveEditor(),ecBottom);
}
}
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
bookSearchDestroy(data->win);
}
break;
default:break;
}
}
break;
case LISTS_REASON_HANGUP:
{
//if(returntoidle())
// break;
memset(data->edtBuf,0,sizeof(data->edtBuf));
timStop(show_timer);
timStop(edt_timer);
memset(data->phbk->edt_buf_name,'\0',PHB_name_len+5);
listsDestroy(ListData->win);
if( data->phbk->EntryType != PhbkNormal )
SEND_EVENT(data->win, SEARCH_DESTROY, NULL, NULL);
else
{
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
edtChar(data->edtname,ecBottom);
}
}
break;
case LISTS_REASON_BACK:
{
if( wstrlen(data->edtBuf)==0 )
{
timStop(show_timer);
timStop(edt_timer);
memset(data->phbk->edt_buf_name,'\0',PHB_name_len+5);
listsDestroy(ListData->win);
if( data->phbk->EntryType != PhbkNormal )
SEND_EVENT(data->win, SEARCH_DESTROY, NULL, NULL);
else
{
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
edtChar(data->edtname,ecBottom);
}
}
else
edtChar(data->edt,ecBack);
}
break;
case LISTS_REASON_UPDATE:
{
if( Phbk->BufferTable==GlobalTable )
show_index=l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index;
else if( Phbk->BufferTable==SearchTable )
show_index=bookname[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index;
refresh_flag=1;
#if(MAIN_LCD_SIZE==4)
/* 2004/05/26 sunsj modify */
dspl_Clear(0, 108, SCREEN_SIZE_X, 126);
/* 2004/06 sunsj modify for icon manage */
//dspl_BitBlt(0, 110, 14, 14, 0, (void *)abc_bmp, 0);
DRAW_ICON_LOCATION(ICON_TEXTINPUT_abc, 0, 110);
ShowPhoneBookNumber(show_index,NONE);
edtChar(data->edt,ecBottom);
#elif(MAIN_LCD_SIZE==3)
dspl_Clear(0, 72, SCREEN_SIZE_X, 110);
phonebook_search_flag=TRUE;
ShowPhoneBookNumber(show_index,NONE);
edtChar(data->edt,ecBottom);
#endif
}
break;
case LISTS_REASON_UP:
{
if( Phbk->BufferTable==GlobalTable )
{
if( (ListData->CursorPosition-1>=0) || (SearchTotal<=PHONEBOOK_RECORD_PERPAGE) )
{
dataInfo->MenuListsAttr.pageturnindex=((Phbk->BufferIndex+ListData->CursorPosition-1+SearchTotal)%SearchTotal)+1;
mnuUp(dataInfo->MenuLists);
show_index=l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition-1+SearchTotal)%SearchTotal].index;
show_number();
}
else
{
Phbk->BufferIndex=(Phbk->BufferIndex-PHONEBOOK_RECORD_PERPAGE+SearchTotal)%SearchTotal;
dataInfo->MenuListsAttr.pageturnindex=(Phbk->BufferIndex+PHONEBOOK_RECORD_PERPAGE-1)%SearchTotal+1;
for( i=0;i<PHONEBOOK_RECORD_PERPAGE;i++ )
{
/* 2004/06 sunsj modify for picture manage */
memcpy(DynamicBuffer[i].name,l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].name,PHB_name_len);
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_NVMBOOK, 0);//nvmbookicon;
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_SIMBOOK, 0);//simbookicon;
}
mnuChooseVisibleItem(dataInfo->MenuLists,PHONEBOOK_RECORD_PERPAGE-1);
show_index=l_phb_sort_index[(Phbk->BufferIndex+PHONEBOOK_RECORD_PERPAGE-1)%SearchTotal].index;
show_number();
}
}
else if( Phbk->BufferTable==SearchTable )
{
if( (ListData->CursorPosition-1>=0) || (SearchTotal<=PHONEBOOK_RECORD_PERPAGE) )
{
dataInfo->MenuListsAttr.pageturnindex=((Phbk->BufferIndex+ListData->CursorPosition-1+SearchTotal)%SearchTotal)+1;
mnuUp(dataInfo->MenuLists);
show_index=bookname[(Phbk->BufferIndex+ListData->CursorPosition-1+SearchTotal)%SearchTotal].index;
show_number();
}
else
{
Phbk->BufferIndex=(Phbk->BufferIndex-PHONEBOOK_RECORD_PERPAGE+SearchTotal)%SearchTotal;
dataInfo->MenuListsAttr.pageturnindex=(Phbk->BufferIndex+PHONEBOOK_RECORD_PERPAGE-1)%SearchTotal+1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?