mmisettings.c

来自「是一个手机功能的模拟程序」· C语言 代码 · 共 2,351 行 · 第 1/5 页

C
2,351
字号
 
*******************************************************************************/
int settingFlower(MfwMnu* m, MfwMnuItem* i)
{


    return 0; 
}
/*******************************************************************************

 $Function:    	settingSkyrocket
 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
int settingSkyrocket(MfwMnu* m, MfwMnuItem* i)
{


    return 0; 
}
#endif
/*******************************************************************************

 $Function:    	settingSavingMode
 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
int settingSavingMode(MfwMnu* m, MfwMnuItem* i)
{


    return 0; 
}
/*******************************************************************************

 $Function:    	settingNormalMode
 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
int settingNormalMode(MfwMnu* m, MfwMnuItem* i)
{



    return 0; 
}

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

 $Function:    	ViewBmpAlbum
 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
int ViewBmpAlbum(MfwMnu* m, MfwMnuItem* i)
{


    return 0; 
}
/*******************************************************************************

 $Function:    	GreetingWordOff
 $Description:	

 $Returns:		

 $Arguments:	
 
*******************************************************************************/
int GreetingWordOff(MfwMnu* m, MfwMnuItem* i)
{


    return 0; 
}







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

 $Function:		NameInputCreate

 $Description:	Create the input window and asociate it's handlers
 
 $Returns:		handle of new window, or NULL if failure

 $Arguments:	parent, handle of the parent window
 
*******************************************************************************/

static T_MFW_HND NameInputCreate( T_MFW_HND parent_window )
{
    T_MFW_WIN       *win;
    T_editBGname    *data;

    TRACE_EVENT("NameInputCreate()");


    data = (T_editBGname  *) ALLOC_MEMORY( sizeof(T_editBGname ) ) ;

    /* Create the window if we can
    */

    data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB) NameInputWindowCB );
    if( data->win EQ NULL )
        return NULL;
    data->parent_win=parent_window;


    /* 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) NameInputDialog;
    data->mmi_control.data      = data;
    win                         = ((T_MFW_HDR *)data->win)->data;
    win->user                   = (void *) data;

    /* create keyboards and menus for our window
    */
    //	data->kbd		= kbdCreate( data->win, KEY_ALL,            (MfwCb) NameInputKbdCB );



    return data->win;
}

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

 $Function:		NameInputDialog

 $Description:	Dialog function for the input window
 
 $Returns:		None

 $Arguments:	win, window handle
                event, event to be handled
                value, not used
                parameter, not used
 $History: 2004/07/01 sunsj modify for greeting word length
*******************************************************************************/

static void NameInputDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
{
    T_MFW_WIN       *win_data   = ((T_MFW_HDR *) win)->data;
    T_editBGname    *data       = (T_editBGname*) win_data->user;
    T_EDITOR_DATA editor_data;
    TRACE_EVENT("NAMEInputDialog()");

    /* Handle the input event, ew only deal with initialise and
       destroy of the window in here
    */
    switch( event )
    {
    case NAMEINPUT_INIT:
        {  TRACE_EVENT("NAMEInput_INIT");
            memset( data->edt_buf_name,  '\0', 15 );
            /* 2003/12/22 sunsj initialize editor buffer */
            memcpy( data->edt_buf_name, FlashSettingData.greeting_word, 15 );

            /*zy	    bookSetEditAttributes( 20,50 , 80, 80, 0, 0, edtCurBar1, 0, 
                    (char *)data->edt_buf_name, PHB_MAX_LEN, &data->attr );
                        /* Initialise the input window
                        */
            /*zy			data->properties.abc			= TRUE;
                        data->properties.text			= TxtEnterName;
                        data->properties.left_soft_key	= TxtSoftOK;
                        data->properties.right_soft_key      = TxtDelete;
                        data->properties.callback		= NameAddNameCB;
                        data->properties.edt_attr_input	= &data->attr;
                         data->edt						= edtCreate( data->win, data->properties.edt_attr_input, 0, 0 );
            zy*/
            editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtGreetingWord,(char *)data->edt_buf_name,15,edtCurBar1);
            editor_data.min_enter            = 1;             
            editor_data.LeftSoftKey          = TxtSoftOK;     /* 2004/04/16 sunsj modify */
            editor_data.AlternateLeftSoftKey = TxtNull;
            editor_data.RightSoftKey         = TxtDelete;
            editor_data.Callback             =(T_EDIT_CB) NameAddNameCB;
            editor_data.destroyEditor        = TRUE;
            editor_data.mode                 = TEXTINPUT_MODE;      /* 2003/12/04 sunsj modify */
            editor_data.hide                 = FALSE;
            editor_data.Identifier           =  0; 
            editor_data.TextString           = NULL;  
            editor_data.timeout              = FOREVER;  // Avoid to return empty strings
            editor_data.TextId               = '\0'; 
            editor_data.edtInPbk             =0;//zy 2003-04-08
            editor_data.InputMode            = PINYIN_INPUT_MODE;   /* 2003/12/04 sunsj set default input mode */
            /* 2003/12/04 sunsj modify for new editor mode */
            if( editor_data.mode == TEXTINPUT_MODE )
            {
                data->edt = text_input(data->win, &editor_data);
            }
            else
            {
                data->edt = editor_start(data->win,&editor_data);  /* start the editor */
            }

        }
        break;

    case NAMEINPUT_DESTROY:
        {
            /* destroy the input window
            */
            NameInputDestroy(data-> win );
        }
        break;
    default:
        break;
    }
}
/*******************************************************************************

 $Function:		NameInputDestroy

 $Description:	Destroy Input Window
 
 $Returns:		None

 $Arguments:	Handle of window to be destroyed
 
*******************************************************************************/

static void NameInputDestroy( MfwHnd window )
{
    T_MFW_WIN     *win  = ((T_MFW_HDR *) window)->data;
    T_editBGname *data = (T_editBGname *) win->user;

    TRACE_EVENT("NameInputDestroy()");

    if( data )
    {
        editDeactivate();

        winDelete ( data->win );
        FREE_MEMORY( (void *) data, sizeof( T_editBGname ) );

    }
}


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

 $Function:		NameInputWindowCB

 $Description:	Window event handler
 
 $Returns:		MFW_CONSUMED for the visible event, MFW_PASSED otherwise

 $Arguments:	e, event, w, window handle
 
*******************************************************************************/

static int NameInputWindowCB( MfwEvt e, MfwWin *w )
{
    T_editBGname *data = (T_editBGname *) w->user;

    TRACE_EVENT("NameInputWindowCB()");

    /* Handle the visible event, otherwise return MFW_EVENT_PASSED
    */
    switch( e )
    {
    case MfwWinVisible:

        break;

    default:
        break;
        /* unabel to handle event, pass handling of event back up tree
        */
        return MFW_EVENT_PASSED;
    }
    return MFW_EVENT_CONSUMED;
}

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

 $Function:		NameInputKbdCB

 $Description:	Input window keyboard handler
 
 $Returns:		MFW_EVENT_CONSUMED always, this will pass LEFT, RIGHT and CLEAR
                events back to the calling window using the installed callback
                method

 $Arguments:	e, event, k, key handle
 
*******************************************************************************/

/*static int NameInputKbdCB( MfwEvt e, MfwKbd *k )
{   T_MFW_HND       win  = mfw_parent (mfw_header());
    T_MFW_WIN		*win_data	= ((T_MFW_HDR *) win)->data;
    T_editBGname	*data		= (T_editBGname *) win_data->user;

     TRACE_EVENT("NameInputKbdCB()");
    /* make sure the active editor is ours
    */
/*    if ( activeEditor() != data->edt )
        editActivate( data->edt, data->properties.abc );

    /* Handle the key press
    */
/*    switch (k->code)
    {
        case KCD_MNUUP:
        {
            /* move right
            */
/*			edtChar( data->edt, ecRight );
        }
        break;

        case KCD_MNUDOWN:
        {
            /* move left
            */
/*		    edtChar( data->edt, ecLeft );
        }
        break;

        case KCD_LEFT:
        {
            /* select the entry using the parent window callback
            */
/*		    data->properties.callback( win, NAMEINPUT_LEFT );
           
        }
        break;

        case KCD_HUP:
        {
            /* get edit control block
            */
//            MfwEdt *edt = ( (MfwHdr *) data->edt )->data;

/* if current buffer is empty then we clear the editor, otherwise
   we step back in the buffer
*/
// MC -- hang up will now exit the editor
// if ( edt->attr->text[0] )
//    edtChar( data->edt, ecBack );
//else
//               data->properties.callback( win, NAMEINPUT_CLEAR );
//		}
/*		break;

        case KCD_RIGHT:
        {
            MfwEdt *edt = ( (MfwHdr *) data->edt )->data;
            /* select the entry using the parent windows callback
            */
//If we have any data input, delete the char before cursor
/*		if ( edt->attr->text[0] )
            edtChar( data->edt, ecBack );
        else	
        {
            data->properties.callback( win, NAMEINPUT_RIGHT );
            displaySoftKeys_edition (TxtNull, TxtNull ,TxtNull);

        }
         
    }
    break;

    case KCD_HASH:
    {
        /* deal with hash key 
        */
/*	        edtChar( data->edt, '#' );
        }
        break;

        case KCD_STAR:
        {
            /* deal with star key
            */
/*		    edtChar( data->edt, '*' );
        }
        break;

        default:
        {
            /* default handling for the key being pressed
            */
/*		    editEventKey( e, k );
        }
        break;
    }

    /* always consume the event
    */
/*    return MFW_EVENT_CONSUMED;
}
*/

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

 $Function:     bookAddNameCB

 $Description:  default call back for name entry

 $Returns:    None

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

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

static void NameAddNameCB( T_MFW_HND win, USHORT Identifier, SHORT reason )
{
    char A[4];
    T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
    T_editBGname *data       = (T_editBGname *) win_data->user;
    TRACE_EVENT("NameAddNameCB");
    switch( reason )
    {
    case INFO_KCD_ALTERNATELEFT:
    case INFO_KCD_LEFT:
        {
            wstrncpy( FlashSettingData.greeting_word, data->edt_buf_name,PHB_MAX_LEN );
            TRACE_EVENT((char * )FlashSettingData.greeting_word);
            TRACE_EVENT((char * )data->edt_buf_name);
            FlashSettingData.GreetingWordIsOn=1;
            flash_settingwrite();
            confirm_Init(data->parent_win);
            confirm_data.local_status = ACTIVATE_CONFIRM;
            SEND_EVENT (confirm_data.confirm_win, SHOW_CONFIRM, 0, 0);
            SEND_EVENT( win, NAMEINPUT_DESTROY, 0, 0 );
        }
        break;
    case INFO_KCD_RIGHT:
    case INFO_KCD_HUP:
        SEND_EVENT( win, NAMEINPUT_DESTROY, 0, 0 );
        break;
    default:
        break;
    }
}


/*******************************************************************************
 $Function:    	factoryReset

 $Description:	Reset all the user-settings, 
                At first it show up a confirmation screen 
 $Returns:		

 $Arguments:	
 
*******************************************************************************/
int factoryReset(MfwMnu* m, MfwMnuItem* i)
{

⌨️ 快捷键说明

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