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

📄 editorpen.c

📁 The font library converting tool MCT mainly introduces the process of the font formats to give us a
💻 C
📖 第 1 页 / 共 5 页
字号:
    }
#endif /* __MMI_HAND_WRITING_EXCLUDE_VK_AREA__ */ 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_set_left_soft_key
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_pen_editor_set_left_soft_key(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    set_left_softkey_label(gPenEditorLSKText);
    set_left_softkey_icon(NULL);
    redraw_left_softkey();
    register_left_softkey_handler();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_set_left_soft_key_select
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_pen_editor_set_left_soft_key_select(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    set_left_softkey_label((UI_string_type) get_string(STR_GLOBAL_SELECT));
    set_left_softkey_icon(NULL);
    redraw_left_softkey();
    register_left_softkey_handler();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_set_right_soft_key_inline_text
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_pen_editor_set_right_soft_key_inline_text(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (pixtel_UI_single_line_input_box_get_text_length(&MMI_inline_singleline_inputbox) > 0)
    {
        set_right_softkey_label((UI_string_type) get_string(WGUI_CATEGORY_CLEAR_STRING_ID));
        set_right_softkey_icon(NULL);
        register_right_softkey_handler();
        redraw_right_softkey();
        set_right_softkey_function(UI_dummy_function, KEY_EVENT_UP);
        set_right_softkey_function(handle_inline_text_edit_right_softkey_down, KEY_EVENT_DOWN);
        set_right_softkey_function(handle_inline_text_edit_right_softkey_long_press, KEY_EVENT_LONG_PRESS);
    }
    else
    {
        if (wgui_inline_list_menu_changed)
        {
            wgui_inline_text_edit_set_RSK_BACK_function();
            /* W06.11 Set RSK as handle_inline_text_edit_right_softkey_up when buffer is empty */
            set_right_softkey_function(handle_inline_text_edit_right_softkey_up, KEY_EVENT_UP);
        }
        else
        {
            set_right_softkey_label(inline_text_edit_RSK_label_string);
            set_right_softkey_icon(inline_text_edit_RSK_label_icon);
            register_right_softkey_handler();
            redraw_right_softkey();
            set_right_softkey_function(register_inline_text_edit_handle_right_softkey_up, KEY_EVENT_UP);
            set_right_softkey_function(UI_dummy_function, KEY_EVENT_DOWN);
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_set_right_softkey
 * DESCRIPTION
 *  
 * PARAMETERS
 *  rsk_type        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_pen_editor_set_right_softkey(mmi_pen_editor_rsk_type_enum rsk_type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (rsk_type)
    {
        case PEN_EDITOR_RSK_BY_STATE:
            if (get_multitap_state())
            {
                set_right_softkey_label((UI_string_type) get_string(STR_GLOBAL_CLEAR));
            }
            else
            {
                set_right_softkey_label((UI_string_type) get_string(STR_GLOBAL_BACK));
            }
            break;

        case PEN_EDITOR_RSK_BACK:
            set_right_softkey_label((UI_string_type) get_string(STR_GLOBAL_BACK));
            break;

        case PEN_EDITOR_RSK_CLEAR:
            set_right_softkey_label((UI_string_type) get_string(STR_GLOBAL_CLEAR));
            break;

        default:
            MMI_DBG_ASSERT(0);
    }
    set_right_softkey_icon(NULL);
    redraw_right_softkey();
    register_right_softkey_handler();
    /* W06.10 Fix Right Soft Key Issue */
    set_right_softkey_function(mmi_pen_editor_right_soft_key_handler, KEY_EVENT_UP);
    set_right_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
    set_right_softkey_function(UI_dummy_function, KEY_LONG_PRESS);
}

#if defined(__MMI_HAND_WRITING_GET_STROKES__)


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_save_stroke_to_file
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_pen_editor_save_stroke_to_file(void)
{
#if defined(MMI_ON_HARDWARE_P)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    {
        FS_HANDLE stroke_out;
        U32 write_len;
        int i = 0;

        /*----------------------------------------------------------------*/
        /* Code Body                                                      */
        /*----------------------------------------------------------------*/
        stroke_out = FS_Open(L"Stroke_Out.str", FS_CREATE | FS_READ_WRITE);
        if (stroke_out <= 0)
        {
            MMI_ASSERT(0);
        }

        FS_Seek(stroke_out, 0, FS_FILE_END);
        for (i = 0; i < PEN_EDITOR_STROKE_BUFFER_SIZE; i++)
        {
            FS_Write(stroke_out, &(gPenEditorStrokeBuffer[i].x), sizeof(S16), (UINT*) & write_len);
            FS_Write(stroke_out, &(gPenEditorStrokeBuffer[i].y), sizeof(S16), (UINT*) & write_len);
        #if defined(__MMI_HANWANG__)
            if ((-1) == gPenEditorStrokeBuffer[i].x && (-1) == gPenEditorStrokeBuffer[i].y)
            {
                break;
            }
        #elif defined(__MMI_PENPOWER__)
            if ((-1) == gPenEditorStrokeBuffer[i].x && (0) == gPenEditorStrokeBuffer[i].y)
            {
                break;
            }
        #else 
            if ((-1) == gPenEditorStrokeBuffer[i].x && (-1) == gPenEditorStrokeBuffer[i].y)
            {
                break;
            }
        #endif 
        }
        FS_Close(stroke_out);
    }
#else /* defined(MMI_ON_HARDWARE_P) */ 
    {
        FILE *stroke_out;
        int i = 0;

        if ((stroke_out = fopen("Stroke_Out.str", "a+")) == NULL)
        {
            fprintf(stderr, "Cannot open output file.\n");
        }

        fseek(stroke_out, 0, SEEK_END);
        for (i = 0; i < PEN_EDITOR_STROKE_BUFFER_SIZE; i++)
        {
            fwrite(&(gPenEditorStrokeBuffer[i].x), sizeof(S16), 1, stroke_out);
            fwrite(&(gPenEditorStrokeBuffer[i].y), sizeof(S16), 1, stroke_out);
            if ((-1) == gPenEditorStrokeBuffer[i].x && (-1) == gPenEditorStrokeBuffer[i].y)
            {
                break;
            }
        }
        fclose(stroke_out);
    }
#endif /* defined(MMI_ON_HARDWARE_P) */ 
}
#endif /* defined(__MMI_HAND_WRITING_GET_STROKES__) */ 


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_disable_input
 * DESCRIPTION
 *  
 * PARAMETERS
 *  disable_input_flag      [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_editor_disable_input(U32 disable_input_flag)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (disable_input_flag & PEN_EDITOR_DISABLE_HANDWRITNG)
    {
        g_pen_editor_disable_handwriting = MMI_TRUE;
    }
    if (disable_input_flag & PEN_EDITOR_DISABLE_VIRTUAL_KEYBOARD)
    {
        g_pen_editor_disable_virtual_keyboard = MMI_TRUE;
    }
    if (disable_input_flag & PEN_EDITOR_DISABLE_KEYPAD)
    {
        g_pen_editor_disable_keypad = MMI_TRUE;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_check_phrase
 * DESCRIPTION
 *  
 * PARAMETERS
 *  ch      [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_editor_check_phrase(UI_character_type ch)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (ch >= 0x4e00 && ch <= 0x9fff)
    {
        /* W05.35 Temp Solution for Candidate Index Issue */
        mmi_pen_editor_reset_candidate_index();
        if (g_pen_editor_composition_state.candidate_state != PEN_EDITOR_CANDIDATE_OFF)
        {
            int change_height = g_pen_editor_composition_input_box.height;

            g_pen_editor_composition_state.candidate_state = PEN_EDITOR_CANDIDATE_OFF;
            mmi_pen_editor_resize_content_area(change_height);
            mmi_pen_editor_reset_key_sequence(&g_pen_editor_key_sequence);
        }
        if (mmi_pen_editor_get_candidates_by_phrase(ch))
        {
            gPenEditorSelectCandidate = MMI_TRUE;
            /* Temp Solution for LSK Text Update */
            //W05.35 For LSK Text Issue
            //mmi_pen_editor_store_LSK_Text();
            mmi_pen_editor_set_left_soft_key_select();
            set_left_softkey_function(mmi_pen_editor_left_soft_key_handler, KEY_EVENT_UP);
            set_left_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
            mmi_pen_editor_register_arrow_keys();
            if (gPenEditorCandidateInputBox.y >= (PEN_EDITOR_Y_OF_CANDIDATE_INPUT_BOX_IN_BOTTOM))
            {
                gPenEditorVKState = PEN_EDITOR_VK_OFF;
            }
            mmi_pen_editor_set_right_softkey(PEN_EDITOR_RSK_BY_STATE);
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_pen_editor_hide_candidate_area
 * DESCRIPTION
 *  \brief This function is to hide the candidate input box.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_pen_editor_hide_candidate_area(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    color c;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    c.r = 255;
    c.g = 255;
    c.b = 255;
    c.alpha = 100;

    pixtel_UI_reset_clip();
    gdi_layer_lock_frame_buffer();
    if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
    {
        gdi_draw_solid_rect(
            0,
            gPenEditorCandidateInputBox.y - 1,
            UI_device_width,
            gPenEditorCandidateInputBox.y + gPenEditorCandidateInputBox.height - 1,
            GDI_COLOR_TRANSPARENT);
    }
    else
    {
        pixtel_UI_fill_rectangle(
            0,
            gPenEditorCandidateInputBox.y - 1,
            UI_device_width,
            gPenEditorCandidateInputBox.y + gPenEditorCandidateInputBox.height - 1,
            c);

⌨️ 快捷键说明

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