⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmibookservices.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:

UBYTE bookActiveBook( int process )
{
    //TRACE_FUNCTION( "bookActiveBook()" );
    if( process == READ )
        return( phb_get_mode() == PHB_RESTRICTED ) ? PHB_FDN : PHB_ADN_FDN;
    else if( process == WRITE )
        return( phb_get_mode() == PHB_RESTRICTED ) ? PHB_FDN : PHB_ADN;
}

/*******************************************************************************

 $Function:    	bookActivateFDN

 $Description:	information screen to tell user to activate FDN
 
 $Returns:		None

 $Arguments:	None
 
*******************************************************************************/

void bookActivateFDN( T_MFW_HND window )
{
    tBookDialogData Dialog;

    /* Initialise the dialog control block with default information
    */
    dialog_info_init(&Dialog);//gdy add 
    Dialog.KeyEvents    = KEY_CLEAR | KEY_LEFT | KEY_RIGHT;
    Dialog.TextId       = TxtPlease;
    Dialog.TextId2      = TxtActivateFDN;
    Dialog.TextString   = '\0';
    Dialog.TextString2  = '\0';
    Dialog.LeftSoftKey  = TxtNull;
    Dialog.RightSoftKey = TxtNull;
    Dialog.Time         = 4000;
    Dialog.Callback     = (T_VOID_FUNC) NULL;
    Dialog.Identifier   = 0;

    /* Show the dialog
    */
    info_dialog( /*bookCurrent*/window, &Dialog );
}


/*******************************************************************************

 $Function:     bookMemoryView

 $Description:  Display the memory status

 $Returns:    None

 $Arguments:  None

*******************************************************************************/

void bookMemoryView( void )
{
    T_MFW_HND       win         = mfwParent( mfw_header() );
    T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
    tBookStandard   *data       = (tBookStandard *) win_data->user;
    USHORT      simleft;
    int TxtToShow;
    T_DISPLAY_DATA  display_info;

    // Determine which book we are currently using

    data->phbk->current.status.book = bookActiveBook(READ);

    // retrieve he status of the book, and create a string for output
    //   based on the status

    //memset( Buffer, '\0', 16 );
    //memset( Buffer1,'\0', 16 );
    //memset( Buffer2,'\0', 16 );
    //memset( Buffer3,'\0', 16 );
    data->phbk->current.status.book=PHB_ADN;
    if( bookGetCurrentStatus( &data->phbk->current.status ) == MFW_PHB_OK )
    {
//        simleft = (data->phbk->current.status.avail_entries+data->phbk->current.status.used_entries);//data->phbk->current.status.used_entries
simleft = (data->phbk->current.status.avail_entries+SIMTotal);/*2004/5/28, wy modify*/
        //sprintf( Buffer1, "%d%s",(SIMTotal-data->phbk->current.status.avail_entries+data->phbk->current.status.used_entries),GET_TEXT(TxtPhbkleft));

    }
    dialog_info_init(&display_info);//gdy add 
    display_info.KeyEvents    =  KEY_RIGHT|KEY_CLEAR|KEY_HUP|KEY_F4;    /* 2004/04/10 sunsj modify */
    display_info.TextId       = simleft;
    display_info.TextId2      = NVMTotal;
    display_info.TextString   = '\0';
    display_info.TextString2  = '\0';
    display_info.LeftSoftKey  = TxtNull;
    display_info.RightSoftKey = TxtSoftBack;
    display_info.Time         =FOREVER;
    display_info.Callback     = NULL;
    display_info.Identifier = MMI_PHONEBOOK_MEMORYSTATE;

    info_dialog( win, &display_info );
}


void bookSearchCB( T_MFW_HND win,USHORT Identifier, UBYTE reason )
{
    T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
    tBookStandard     *data       = (tBookStandard *) win_data->user;
    T_phbk           *Phbk       = data->phbk;    
    BOOL             NotFound,CompFlag;
    int               i;
    char              info[30];
    char              temp[100];

    switch( reason )
    {
    case INFO_KCD_LEFT:
        {
            if( (wstrlen(Phbk->edt_buf_name)!=0) && (PHBKTotal!=0) )
            {
                Phbk->BufferTable=SearchTable;
                ShortName=GetShortName(Phbk->edt_buf_name);
                //                zgzTraceDataFunc("the shortname:",ShortName);
                memset(Phbk->edt_buf_name,'\0',PHB_name_len+5);
                NotFound=TRUE;
                CompFlag=FALSE;
                for( i=0,SearchTotal=0;i<PHBKTotal;i++ )
                {
                    //                    zgzTraceDataFunc("i",i);
                    //                   zgzTraceDataFunc("name",l_phb_sort_index[i].name);
                    if( (l_phb_sort_index[i].name==ShortName)||((l_phb_sort_index[i].name&0xff00)==ShortName) )
                    {
                        bookname[SearchTotal].index=l_phb_sort_index[i].index;
                        CompFlag=TRUE;
                        NotFound= FALSE;
                        SearchTotal=SearchTotal+1;
                    }
                    else CompFlag=FALSE;

                    if( (NotFound==FALSE) && (CompFlag==FALSE) ) break;
                }

                if( NotFound==FALSE )
                {
                    /* 2004/05/26 sunsj modify */
                    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[bookname[i].index].name,PHB_name_len+2);
                            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;
                        }                       
                        Phbk->BufferIndex=0;                   
                        sprintf(info,"%d",SearchTotal);                   
                        wstrcat((char *)info, MmiRsrcGetText(TxtPhbkFind));

                        bookShowPhbkInformation(win,NULL,info,(T_VOID_FUNC)book_search_information);                
                    }
                    else
                    {
                        /* 2004/05/26 sunsj modify */
                        for( i=0;i<PHONEBOOK_RECORD_PERPAGE;i++ )
                        {
                            /* 2004/06 sunsj modify for picture manage */
                            memcpy(DynamicBuffer[i].name,l_phb_index[bookname[i].index].name,PHB_name_len+2);
                            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;
                        }   
                        Phbk->BufferIndex=0;
                        sprintf(info,"%d",SearchTotal);                   
                        wstrcat((char *)info, MmiRsrcGetText(TxtPhbkFind));

                        bookShowPhbkInformation(win,NULL,info,(T_VOID_FUNC)book_search_information);                    
                    }   
                }
                else
                {
                    MmiBookSetCurrentText(TxtEmptyList);//显示信息返回                   
                    bookShowInformation( win , MmiBookCurrentText(),NULL,NULL);                
                }
            }
            else if( PHBKTotal!=0 )
            {
                Phbk->BufferTable=GlobalTable; 
                /* 2004/05/26 sunsj modify */
                if( PHBKTotal<=PHONEBOOK_RECORD_PERPAGE )
                {
                    for( i=0;i<PHBKTotal;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+2); 
                        //Sprintf(temp,"namelen:%d",wstrlen((char *)DynamicBuffer[i].name));
                        //TRACE_EVENT(temp);
                        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
                {
                    /* 2004/05/26 sunsj modify */
                    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[i].index].name,PHB_name_len+2);                                        
                        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;
                    }   

                }
                Phbk->BufferIndex=0;
                SearchTotal=PHBKTotal;
                sprintf(info,"%d",SearchTotal);                   
                wstrcat((char *)info, MmiRsrcGetText(TxtPhbkFind));

                bookShowPhbkInformation(win,NULL,info,(T_VOID_FUNC)book_search_information);                
            }
            else
            {
                MmiBookSetCurrentText(TxtEmptyList);//显示信息返回                   
                bookShowInformation( win, MmiBookCurrentText(),NULL,NULL);                 
            }
        } 
        break;
    case INFO_KCD_RIGHT:
    case INFO_KCD_HUP:    
        {
            /* 2003/12/04 sunsj modify for new editor mode */
            //editor_destroy(data->edtname);
            text_input_destroy(data->edtname);

            bookSearchDestroy( win ); 
        } 
        break;
    default: break;
    }
}

/*******************************************************************************

 $Function:     bookAddNameCB

 $Description:  default call back for name entry

 $Returns:    None

 $Arguments:  win, handle of parent window, reason, for invocation

 $History:    2003/11/10 sunsj modify number display method
              2004/01/14 sunsj modify for different screen size

*******************************************************************************/

void bookAddCB( T_MFW_HND win,USHORT Identifier, UBYTE reason )
{

    T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
    tBookStandard     *data       = (tBookStandard *) win_data->user;
    T_phbk           *Phbk       = data->phbk;
    char              temp[100];
    int                i,Index;

    T_MFW_HND       parentwin    =data->parent_win;
    T_MFW_HND       Dynamicwin  =Phbk->dynamicmenu_win;
    T_MFW_HND       searchwin    =Phbk->search_win;
    UINT32 oldColor,oldFontColor;

    //sprintf(temp,"Phbk->BookType:%d",Phbk->BookType);
    //TRACE_EVENT(temp);
    //sprintf(temp,"Phbk->MODE:%d",Phbk->MODE);
    //TRACE_EVENT(temp);

    //TRACE_FUNCTION("bookAddCB");

    NewIndex=-1;
    switch( reason )
    {
    case INFO_KCD_LEFT:
        {
			/* 2004/06/01 sunsj modify */
			if( Phbk->MODE == MEMO )
			{
				if( data->edtmemo )
				{
					text_input_destroy( data->edtmemo );
					data->edtmemo = 0;
				}
				SEND_EVENT( data->win, INPUT_NAME, NULL , NULL);
				break;
			}
			/* 2004/06/01 sunsj modify */
            if( (Phbk->BookType==SIM_BOOK_SEL) && /*(wstrlen((char *)Phbk->edt_buf_name)!=0) && */(strlen((char *)Phbk->edt_buf_number)!=0) )
            {
                //sprintf(temp,"UpdateAction:%d",Phbk->UpdateAction);
                //TRACE_EVENT(temp);
                dspl_ClearAll();
				/* 2004/05/17 sunsj modify */
#if (MAIN_LCD_SIZE==3)
		DRAW_ICON_SEL(ICON_POPUPICON,7);//jhxu720
#elif ( MAIN_LCD_SIZE==4 )
		/* 2004/06 sunsj modify for picture manage */
		DRAW_ICON_SEL(ICON_POPWAITING, 0);
                //dspl_BitBlt(48, 52, 32, 32,0,(void*)waiting1,0);
#elif ( MAIN_LCD_SIZE==2)
                dspl_BitBlt(44,50,32,32,0,(void *)iconWaitting,0);
#endif
                if( Phbk->UpdateAction == CREATE_ENTRY )
                {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -