📄 mmibooksearchwindow.c
字号:
}
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
switch( value )
{
case 2:
/* 2003/12/04 sunsj modify for new editor mode */
text_input_destroy(data->edtname);
case 0:
{
bookSearchDestroy( win );
}
break;
case 1:
{
memset(DynamicBuffer,0,sizeof(DynamicBuffer));
if( Phbk->BufferTable==GlobalTable )
{
SearchTotal=PHBKTotal;
if( SearchTotal<=PHONEBOOK_RECORD_PERPAGE )
{
for( i=0;i<SearchTotal;i++ )
{
/* 2004/06 sunsj modify for picture manage */
memcpy(DynamicBuffer[i].name,l_phb_index[l_phb_sort_index[i].index].name,PHB_name_len);
if( l_phb_index[l_phb_sort_index[i].index].phonebook==NVM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_NVMBOOK, 0);//nvmbookicon;
else if( l_phb_index[l_phb_sort_index[i].index].phonebook==SIM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_SIMBOOK, 0);//simbookicon;
}
}
else
{
if( Phbk->BufferIndex>=SearchTotal ) Phbk->BufferIndex=0;
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;
}
}
}
else if( Phbk->BufferTable==SearchTable )
{
if( SearchTotal<=PHONEBOOK_RECORD_PERPAGE )
{
TRACE_EVENT("searchtotal<PHONEBOOK_RECORD_PERPAGE searchtable");
for( i=0;i<SearchTotal;i++ )
{
/* 2004/06 sunsj modify for picture manage */
memcpy(DynamicBuffer[i].name,l_phb_index[bookname[i].index].name,PHB_name_len);
if( l_phb_index[bookname[i].index].phonebook==NVM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_NVMBOOK, 0);//nvmbookicon;
else if( l_phb_index[bookname[i].index].phonebook==SIM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_SIMBOOK, 0);//simbookicon;
}
}
else
{
if( Phbk->BufferIndex>=SearchTotal ) Phbk->BufferIndex=0;
for( i=0;i<PHONEBOOK_RECORD_PERPAGE;i++ )
{
/* 2004/06 sunsj modify for picture manage */
memcpy(DynamicBuffer[i].name,l_phb_index[bookname[(Phbk->BufferIndex+i)%SearchTotal].index].name,PHB_name_len);
if( l_phb_index[bookname[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_NVMBOOK, 0);//nvmbookicon;
else if( l_phb_index[bookname[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
DynamicBuffer[i].bookicon = *GET_ICONATTR(ICON_SIMBOOK, 0);//simbookicon;
}
}
}
SEND_EVENT(win, SEARCH_INIT, NULL,(int *)Phbk->BufferIndex);
Sprintf(temp,"bufferindex:%d",Phbk->BufferIndex);
TRACE_EVENT(temp);
}
break;
default: break;
}
}
break;
default: break;
}
dspl_Enable(oldmode);
}
/*******************************************************************************
$Function: bookSearchWindowCB
$Description: Window call back function
$Returns: MFW_EVENT_CONSUMED, or MFW_EVENT_PASSED
$Arguments: e, event, w, window handle
*******************************************************************************/
static int bookSearchWindowCB( MfwEvt e, MfwWin *w )
{
tBookStandard *data = (tBookStandard *) w->user;
TRACE_FUNCTION( "bookSearchWindowCB()" );
switch( e )
{
case MfwWinVisible:
case MfwWinFocussed:
{
//MmiBookShowDefault();//Clear Screen
edtShow(data->edt);
edtChar(data->edt,ecBottom);
TRACE_EVENT("MfwWinVisible&MfwWinFocussed fzq");
}
break;
case MfwWinDelete:
{
TRACE_EVENT("MfwWinDelete fzq");
}
break;
default:
{
// default is to pass event back for further handling
return MFW_EVENT_PASSED;
}
break;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookSearchCreate
$Description: Create the search window
$Returns: handle of window or NULL if error
$Arguments: parent, handle of parent window
*******************************************************************************/
static T_MFW_HND bookSearchCreate( MfwHnd parent )
{
T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data;
T_phbk *phbk = (T_phbk *)parent_win_data->user;
T_MFW_WIN *win_data;
tBookStandard *data;
TRACE_FUNCTION ("bookSearchCreate()");
// allocate memory for our control block
if( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL )
return NULL;
// Create the window if we can
if( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookSearchWindowCB ) ) == NULL )
{
FREE_MEMORY( (void *) data, sizeof( tBookStandard ) );
return NULL;
}
// Okay, we have created the control block and the window, so
// we now need to configure the dialog and data pointers
data->mmi_control.dialog = (T_DIALOG_FUNC) bookSearchDialog;
data->mmi_control.data = data;
win_data = ((T_MFW_HDR *)data->win)->data;
win_data->user = (void *) data;
data->phbk = phbk;
data->parent_win = parent;
#if(MAIN_LCD_SIZE==3)
bookSetEditAttributes(35,72,20, 18,0, 0, edtCurBar1, 0,(char *)data->edtBuf,5,&data->attr);
#elif (MAIN_LCD_SIZE==4)
bookSetEditAttributes(20, 108, 32, 18, 0, 0, edtCurBar1, 0,(char *)data->edtBuf,5,&data->attr);
#endif
data->edt=edtCreate(data->win,&data->attr,0,0);
if( !show_timer )
show_timer=timCreate(data->win,300,(MfwCb)show_timercb);
if( !edt_timer )
edt_timer=timCreate(data->win,500,(MfwCb)edt_timer_cb);
winShow(data->win);
return data->win;
}
/*******************************************************************************
Public Methods
*******************************************************************************/
static void bookSearchRead_cb(T_MFW_HND * Parent, ListMenuData * ListData)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)Parent)->data;
tBookStandard * data = (tBookStandard *)win_data->user;
T_phbk * Phbk = data->phbk;
T_MFW_WIN * windata = ((T_MFW_HDR *)ListData->win)->data;
ListWinInfo * dataInfo = (ListWinInfo *)windata->user;
T_MFW_PHB_ENTRY l_phb_Shortentry;
PhbkDetailItem l_phb_NVMEntry;
int i;
UBYTE oldmode=dspl_Enable(0);
TRACE_EVENT("booksearchread_cb");
switch( ListData->Reason )
{
case LISTS_REASON_SEND:
{
memset(data->edtBuf,0,sizeof(data->edtBuf));
if( Phbk->BufferTable==GlobalTable )
{
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:
{
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.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.home,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.office,PHB_number_len);
SetCallData(data);
callNumber((UBYTE *)l_phb_NVMEntry.office);
}
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) )
{
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);
}
}
}
else if( Phbk->BufferTable==SearchTable )
{
if( l_phb_index[bookname[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
{
if( ReadNVMRecord(bookname[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_NVMEntry) )
{
switch( CurrentType )
{
case B_NUMBER:
{
T_EasyName data;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -