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

📄 mmieditor.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
    attr->win.px = 0;
	attr->win.py = 0;
    attr->win.sx = SCREEN_SIZE_X;//115;		/* 2003/12/22 sunsj modify for LCD width */
	attr->win.sy = SCREEN_SIZE_Y-Mmi_layout_line_height()-1 ; 
#endif
	
    attr->titleMode = titleMode;
    attr->title_id = title_id;
    attr->text = text;
    attr->size = size;
    attr->mode = mode;
    attr->textnum = NULL;
    attr->e_size = 0;   /* 2003/12/04 sunsj set ascii text size */

    if( titleMode )
    {
        
#if(MAIN_LCD_SIZE==3)
		attr->win.py = Mmi_layout_line_height() +2;  
		attr->win.sy = SCREEN_SIZE_Y - 2*Mmi_layout_line_height()-4;
#elif(MAIN_LCD_SIZE==4)
		attr->win.py = Mmi_layout_line_height() + 2;  
		attr->win.sy = SCREEN_SIZE_Y - 2*Mmi_layout_line_height();//-4;
#endif
    }

    //set the default attribute
    attr->fgColor = 0xe6ffff;
    attr->font = 0;

}
#ifdef EASY_TEXT_ENABLED
void editor_attr_init_pred(MfwEdtAttr* attr, int zone_id, U8 mode, U8 *controls, char *text, U16 size)
{
    attr->win.px = 0;
    attr->win.py = Mmi_layout_line_height();
    attr->win.sx = SCREEN_SIZE_X;//120;  /* 2003/12/22 sunsj modify for LCD width */
    /* 2004/01/04 sunsj modify for different lcd size */
    attr->win.sy = SCREEN_SIZE_Y-2*Mmi_layout_line_height() ;  //attr->win.sy = 48-2*Mmi_layout_line_height() ;
    attr->fgColor = 0;
    attr->font = 0;
    attr->mode = mode;
    attr->controls = controls;
    attr->text = text;
    attr->size = size;
    AllowPredText = TRUE;
}

//returns true if next word after cursor ought to be capitalised
UBYTE capitalise_word(T_MFW_HND editor_handle)
{
    char LastChar;
    char CharBefore;

    LastChar = getCursorChar(editor_handle, -1);
    CharBefore = getCursorChar(editor_handle, -2);

    if( LastChar == '.' || LastChar == '!' || LastChar == '?' || LastChar == 0 )
        return TRUE;
    if( LastChar == ' ' )
        if( CharBefore == '.' || CharBefore == '!' || CharBefore == '?' )
            return TRUE;
    return FALSE;
}
#endif

//kk011107 #endif
#ifdef EASY_TEXT_ENABLED
/*******************************************************************************

 $Function:     eZitextIcon

 $Description:  Icon to be displayed if eZiText has been selected.

 $Returns:    None.

 $Arguments:  None.

*******************************************************************************/
int showeZiTextIcon(MfwMnu* m, MfwMnuItem* i)
{
    char buf[40];
    T_MFW_HND       win  = mfwParent(mfw_header());

    TRACE_EVENT ("showeZiTextIcon()");

    if( g_pcsyncstatus )//when pcsync run ,return,hxl add 2003-2-13
        return 1;

    if( Easy_Text_Available == TRUE )
    {
        if( FFS_flashData.PredTextSelected == TRUE )
        {
            T_DISPLAY_DATA display_info;

            dialog_info_init(&display_info);
            display_info.LeftSoftKey    = '\0';
            display_info.RightSoftKey   = '\0';
            display_info.TextId   = '\0';
            display_info.TextId2  = '\0';
            display_info.TextString = '\0';
            display_info.TextString2    = '\0';
            display_info.Time   = 4000;
            display_info.Callback = (T_VOID_FUNC)M_exeSendNew;
            display_info.KeyEvents  = 0;

            mmi_dialogs_insert_animation(info_dialog(win, &display_info), 400, (MfwIcnAttr*)&IconTexteZiText,1);
        }
        else if( FFS_flashData.PredTextSelected == FALSE )
        {
            M_exeSendNew(m,i);
        }
    }
    else
        M_exeSendNew(m,i);
}

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

 $Function:     EasyActivate

 $Description:  Icon to be displayed if eZiText has been selected.

 $Returns:    MFW_EVENT_CONSUMED.

 $Arguments:  None.

*******************************************************************************/
int Easy_Activate(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfwParent(mfw_header());
    T_DISPLAY_DATA display_info;

    if( FFS_flashData.PredTextSelected == FALSE )
    {
        FFS_flashData.PredTextSelected = TRUE;
        flash_write();

        dialog_info_init(&display_info);
        display_info.KeyEvents    = KEY_CLEAR|KEY_LEFT|KEY_RIGHT;
        display_info.TextId     = TxtEasyText;
        display_info.TextId2    = TxtActivated;
        display_info.TextString   = '\0';
        display_info.TextString2  = '\0';
        display_info.LeftSoftKey  = TxtNull;
        display_info.RightSoftKey = TxtNull;
        display_info.Time     = 3000;
        display_info.Callback   = (T_VOID_FUNC) NULL;

        info_dialog(win, &display_info);

        return MFW_EVENT_CONSUMED;
    }
}

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

 $Function:     EasyActivate

 $Description:  Icon to be displayed if eZiText has been selected.

 $Returns:    MFW_EVENT_CONSUMED.

 $Arguments:  None.

*******************************************************************************/
int Easy_DeActivate(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND win = mfwParent(mfw_header());
    T_DISPLAY_DATA display_info;

    if( FFS_flashData.PredTextSelected == TRUE )
    {
        FFS_flashData.PredTextSelected =  FALSE;
        flash_write();

        dialog_info_init(&display_info);
        display_info.KeyEvents    = KEY_CLEAR|KEY_LEFT|KEY_RIGHT;
        display_info.TextId     = TxtEasyText;
        display_info.TextId2    = TxtDeActivated;
        display_info.TextString   = '\0';
        display_info.TextString2  = '\0';
        display_info.LeftSoftKey  = TxtNull;
        display_info.RightSoftKey = TxtNull;
        display_info.Time     = 3000;
        display_info.Callback   = (T_VOID_FUNC) NULL;

        info_dialog(win, &display_info);

        return MFW_EVENT_CONSUMED;
    }
}
#endif

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

 $Function:    	nosimcard_animation_cb

 $Description:	Callback for information dialog (not used)n
             
 $Returns:		

 $Arguments:	
 
*******************************************************************************/
void nosimcard_animation_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
{
    T_MFW_WIN      * win_data  = ((T_MFW_HDR *)win)->data;
    T_EDITOR_INFO  * data      = (T_EDITOR_INFO *)win_data->user;

    data->edt_anim_win = 0;
    if( identifier == KCD_ABC )
    {
        SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_ABC, NULL);
        win_show(data->edt_win); 
        return;
    }

    if( identifier != KCD_HUP )
    {
        edtChar(data->edt_edt, editControls[identifier]);
        win_show(data->edt_win); 
    }

    if( identifier == KCD_STAR )
        data->ss_string = TRUE;
}

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

 $Function:     editor_start

 $Description:  Common editor.

 $Returns:    None.

 $Arguments:  None.

*******************************************************************************/
T_MFW_HND editor_start (T_MFW_HND parent, T_EDITOR_DATA * editor_data)
{
    T_MFW_HND win;

    TRACE_EVENT ("editor_start()");

    /* 2003/10/13 sunsj mark for remove mmihz.c & mmihzapi.c */
    //if (editForChineseInput)
    //    editForChineseInput=0;

    win = editor_create (parent);
    //set the e_size =0
    if( editor_data->editor_attr.e_size!=163 )
        editor_data->editor_attr.e_size=0;
    if( win NEQ NULL )
    {
        SEND_EVENT (win, E_EDITOR_INIT, 0, editor_data);
    }
    return win;
}

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

 $Function:     editor_create

 $Description:  Creation of an editor.

 $Returns:    None.

 $Arguments:  None.

*******************************************************************************/
static T_MFW_HND editor_create (T_MFW_HND  parent)
{
    T_EDITOR_INFO *  data = (T_EDITOR_INFO *)ALLOC_MEMORY (sizeof (T_EDITOR_INFO));
    T_MFW_WIN     *  win;

    TRACE_EVENT ("editor_create()");

    /*
     * Create window handler
     */

    data->edt_win = win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB)editor_win_cb);

    if( data->edt_win EQ NULL )
    {
        return NULL;
    }

    /*
     * connect the dialog data to the MFW-window
     */


    data->mmi_control.dialog = (T_DIALOG_FUNC)editor_exec_cb;
    data->mmi_control.data   = data;
    data->parent             = parent;
    win                      = ((T_MFW_HDR *)data->edt_win)->data;
    win->user                = (void *)data;
    g_norejectkeyflag=1;

    /*
     * return window handle
     */

    return data->edt_win;
}
/*******************************************************************************

 $Function:     editor_destroy

 $Description:  Destroy the editor.

 $Returns:    None.

 $Arguments:  None.

*******************************************************************************/
void editor_destroy (T_MFW_HND window)
{
    T_MFW_WIN     * win  = ((T_MFW_HDR *)window)->data;
    T_EDITOR_INFO * data = (T_EDITOR_INFO *)win->user;

    TRACE_EVENT ("editor_destroy()");

    if( data )
    {
        //GW Removed T9 reference
        //GW Removed T9 reference
        if( ((MfwHdr *)data->edt_edt)->type==MfwTypEdt )
        {
            AllowPredText = FALSE; //prevent any problems with new editors
            g_norejectkeyflag=0;

            /* 2003/10/13 sunsj mark for remove mmihz.c & mmihzapi.c */
            //if (editForChineseInput)
            //    editForChineseInput=0;

            /* end KGT */

            /*
             * Delete WIN Handler

⌨️ 快捷键说明

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