EditorPen.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:513k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2.  * FUNCTION
  3.  *  mmi_pen_editor_reset_composition_index
  4.  * DESCRIPTION
  5.  *  Reset the current index and the currect page for the composition box
  6.  * PARAMETERS
  7.  *  void
  8.  * RETURNS
  9.  *  void
  10.  *****************************************************************************/
  11. void mmi_pen_editor_reset_composition_index(void)
  12. {
  13.     /*----------------------------------------------------------------*/
  14.     /* Local Variables                                                */
  15.     /*----------------------------------------------------------------*/
  16.     /*----------------------------------------------------------------*/
  17.     /* Code Body                                                      */
  18.     /*----------------------------------------------------------------*/
  19.     g_pen_editor_composition_index = 0;
  20.     g_pen_editor_composition_page = 0;
  21. }
  22. /*****************************************************************************
  23.  * FUNCTION
  24.  *  mmi_pen_editor_set_CSK_content
  25.  * DESCRIPTION
  26.  *  Set the CSK content by the input method
  27.  * PARAMETERS
  28.  *  void
  29.  * RETURNS
  30.  *  void
  31.  *****************************************************************************/
  32. void mmi_pen_editor_set_CSK_content(void)
  33. {
  34. #ifdef __MMI_WGUI_CSK_ENABLE__
  35.     /*----------------------------------------------------------------*/
  36.     /* Local Variables                                                */
  37.     /*----------------------------------------------------------------*/
  38.     /* W05.36 Add Center Soft Key for switching Input Method */
  39.     UI_string_type inputmode_string = NULL;
  40.     PU8 inputbox_information_icon = NULL;
  41.     U16 name[] = {0x0};
  42. #if defined(__MMI_LANG_MARATHI__)
  43.     U16 input_mode_marathi_string_array[] = {C_MA, C_RA, DV_AA, C_TTHA, DV_II, 0x0};
  44. #endif /* defined(__MMI_LANG_MARATHI__) */    
  45.     /*----------------------------------------------------------------*/
  46.     /* Code Body                                                      */
  47.     /*----------------------------------------------------------------*/
  48.     set_softkey_label(NULL, MMI_CENTER_SOFTKEY);
  49.     set_softkey_icon(NULL, MMI_CENTER_SOFTKEY);
  50.     switch (MMI_current_input_mode)
  51.     {
  52.         case INPUT_MODE_SMART_UPPERCASE_ABC:
  53.             inputbox_information_icon = get_image(WGUI_IME_SMART_ENGLISH_IMG);
  54.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
  55.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC:
  56.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_ABC_STRING_ID);
  57.             break;
  58.         case INPUT_MODE_SMART_LOWERCASE_ABC:
  59.             inputbox_information_icon = get_image(WGUI_IME_SMART_ENGLISH_IMG);
  60.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
  61.         case INPUT_MODE_MMI_LOWERCASE_ABC:
  62.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC:
  63.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_abc_STRING_ID);
  64.             break;
  65. #ifdef __MMI_LANG_THAI__    //KP Jerry add on 2007-4-29
  66.         case INPUT_MODE_MULTITAP_THAI:
  67.         case INPUT_MODE_MMI_MULTITAP_THAI:
  68.         case INPUT_MODE_SMART_THAI:
  69.             inputmode_string=(UI_string_type)get_string(WGUI_CATEGORY_thai_STRING_ID);    //KP Jerry enable on 2007-4-29
  70.             break;
  71. #endif    //KP Jerry add on 2007-4-29
  72.         case INPUT_MODE_MULTITAP_UPPERCASE_SPANISH:
  73.         case INPUT_MODE_SMART_UPPERCASE_SPANISH:
  74.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_SPANISH_STRING_ID);
  75.             break;
  76.         case INPUT_MODE_MULTITAP_LOWERCASE_SPANISH:
  77.         case INPUT_MODE_MMI_LOWERCASE_SPANISH:
  78.         case INPUT_MODE_SMART_LOWERCASE_SPANISH:
  79.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_spanish_STRING_ID);
  80.             break;
  81.         case INPUT_MODE_MULTITAP_UPPERCASE_DANISH:
  82.         case INPUT_MODE_SMART_UPPERCASE_DANISH:
  83.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_DANISH_STRING_ID);
  84.             break;
  85.         case INPUT_MODE_MULTITAP_LOWERCASE_DANISH:
  86.         case INPUT_MODE_MMI_LOWERCASE_DANISH:
  87.         case INPUT_MODE_SMART_LOWERCASE_DANISH:
  88.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_danish_STRING_ID);
  89.             break;
  90.         case INPUT_MODE_MULTITAP_UPPERCASE_FRENCH:
  91.         case INPUT_MODE_SMART_UPPERCASE_FRENCH:
  92.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_FRENCH_STRING_ID);
  93.             break;
  94.         case INPUT_MODE_MULTITAP_LOWERCASE_FRENCH:
  95.         case INPUT_MODE_MMI_LOWERCASE_FRENCH:
  96.         case INPUT_MODE_SMART_LOWERCASE_FRENCH:
  97.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_french_STRING_ID);
  98.             break;
  99.         case INPUT_MODE_MULTITAP_UPPERCASE_GERMAN:
  100.         case INPUT_MODE_SMART_UPPERCASE_GERMAN:
  101.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_GERMAN_STRING_ID);
  102.             break;
  103.         case INPUT_MODE_MULTITAP_LOWERCASE_GERMAN:
  104.         case INPUT_MODE_MMI_LOWERCASE_GERMAN:
  105.         case INPUT_MODE_SMART_LOWERCASE_GERMAN:
  106.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_german_STRING_ID);
  107.             break;
  108.         case INPUT_MODE_MULTITAP_UPPERCASE_ITALIAN:
  109.         case INPUT_MODE_SMART_UPPERCASE_ITALIAN:
  110.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_ITALIAN_STRING_ID);
  111.             break;
  112.         case INPUT_MODE_MULTITAP_LOWERCASE_ITALIAN:
  113.         case INPUT_MODE_MMI_LOWERCASE_ITALIAN:
  114.         case INPUT_MODE_SMART_LOWERCASE_ITALIAN:
  115.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_italian_STRING_ID);
  116.             break;
  117.         case INPUT_MODE_MULTITAP_UPPERCASE_RUSSIAN:
  118.         case INPUT_MODE_SMART_UPPERCASE_RUSSIAN:
  119.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_RUSSIAN_STRING_ID);
  120.             break;
  121.         case INPUT_MODE_MULTITAP_LOWERCASE_RUSSIAN:
  122.         case INPUT_MODE_MMI_LOWERCASE_RUSSIAN:
  123.         case INPUT_MODE_SMART_LOWERCASE_RUSSIAN:
  124.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_russian_STRING_ID);
  125.             break;
  126.         case INPUT_MODE_MULTITAP_UPPERCASE_TURKISH:
  127.         case INPUT_MODE_SMART_UPPERCASE_TURKISH:
  128.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_TURKISH_STRING_ID);
  129.             break;
  130.         case INPUT_MODE_MULTITAP_LOWERCASE_TURKISH:
  131.         case INPUT_MODE_MMI_LOWERCASE_TURKISH:
  132.         case INPUT_MODE_SMART_LOWERCASE_TURKISH:
  133.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_turkish_STRING_ID);
  134.             break;
  135.         case INPUT_MODE_MULTITAP_UPPERCASE_PORTUGUESE:
  136.         case INPUT_MODE_SMART_UPPERCASE_PORTUGUESE:
  137.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_PORTUGUESE_STRING_ID);
  138.             break;
  139.         case INPUT_MODE_MULTITAP_LOWERCASE_PORTUGUESE:
  140.         case INPUT_MODE_MMI_LOWERCASE_PORTUGUESE:
  141.         case INPUT_MODE_SMART_LOWERCASE_PORTUGUESE:
  142.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_portuguese_STRING_ID);
  143.             break;
  144.         case INPUT_MODE_MULTITAP_HINDI:
  145.             inputmode_string = (UI_string_type) name;
  146.             break;
  147.             
  148.     #if defined(__MMI_LANG_MARATHI__)
  149.         case INPUT_MODE_MULTITAP_MARATHI:
  150.             inputmode_string = (UI_string_type) input_mode_marathi_string_array;
  151.             break;
  152.     #endif /* defined(__MMI_LANG_MARATHI__) */ 
  153.             
  154.         case INPUT_MODE_MULTITAP_UPPERCASE_INDONESIAN:
  155.         case INPUT_MODE_SMART_UPPERCASE_INDONESIAN:
  156.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_INDONESIAN_STRING_ID);
  157.             break;
  158.         case INPUT_MODE_MULTITAP_LOWERCASE_INDONESIAN:
  159.         case INPUT_MODE_MMI_LOWERCASE_INDONESIAN:
  160.         case INPUT_MODE_SMART_LOWERCASE_INDONESIAN:
  161.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_indonesian_STRING_ID);
  162.             break;
  163.         case INPUT_MODE_MULTITAP_UPPERCASE_MALAY:
  164.         case INPUT_MODE_SMART_UPPERCASE_MALAY:
  165.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_MALAY_STRING_ID);
  166.             break;
  167.         case INPUT_MODE_MULTITAP_LOWERCASE_MALAY:
  168.         case INPUT_MODE_MMI_LOWERCASE_MALAY:
  169.         case INPUT_MODE_SMART_LOWERCASE_MALAY:
  170.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_malay_STRING_ID);
  171.             break;
  172.         case INPUT_MODE_MULTITAP_UPPERCASE_VIETNAMESE:
  173.         case INPUT_MODE_SMART_UPPERCASE_VIETNAMESE:
  174.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_VIETNAMESE_STRING_ID);
  175.             break;
  176.         case INPUT_MODE_MULTITAP_LOWERCASE_VIETNAMESE:
  177.         case INPUT_MODE_MMI_LOWERCASE_VIETNAMESE:
  178.         case INPUT_MODE_SMART_LOWERCASE_VIETNAMESE:
  179.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_vietnamese_STRING_ID);
  180.             break;
  181.         case INPUT_MODE_123:
  182.         case INPUT_MODE_MMI_NUMERIC:
  183.         case INPUT_MODE_123_SYMBOLS:
  184.             inputmode_string = (UI_string_type) get_string(WGUI_CATEGORY_123_STRING_ID);
  185.             break;
  186.         case INPUT_MODE_SMART_ARABIC:
  187.             /* inputmode_string=(UI_string_type)get_string(STR_INPUT_METHOD_ARABIC); */
  188.             break;
  189.         case INPUT_MODE_MMI_MULTITAP_BPMF:
  190.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  191.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  192.     #elif defined(__MMI_ZI__)
  193.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_BPMF_LOGO);
  194.     #else 
  195.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  196.     #endif 
  197.             break;
  198.         case INPUT_MODE_MMI_MULTITAP_PINYIN:
  199.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  200.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_PINYIN_IMG);
  201.     #elif defined(__MMI_ZI__)
  202.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_PINYIN_LOGO);
  203.     #else 
  204.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  205.     #endif 
  206.             break;
  207.         case INPUT_MODE_MMI_SM_STROKE:
  208.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  209.             inputbox_information_icon = get_image(WGUI_IME_SM_STROKE_IMG);
  210.     #elif defined(__MMI_ZI__)
  211.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_SM_STROKE_LOGO);
  212.     #else 
  213.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  214.     #endif 
  215.             break;
  216.         case INPUT_MODE_MMI_TR_STROKE:
  217.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  218.             inputbox_information_icon = get_image(WGUI_IME_TR_STROKE_IMG);
  219.     #elif defined(__MMI_ZI__)
  220.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_TR_STROKE_LOGO);
  221.     #else 
  222.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  223.     #endif 
  224.             break;
  225.         case INPUT_MODE_TR_MULTITAP_BOPOMO:
  226.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  227.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  228.     #elif defined(__MMI_ZI__)
  229.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_BPMF_LOGO);
  230.     #else 
  231.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  232.     #endif 
  233.             break;
  234.         case INPUT_MODE_SM_MULTITAP_PINYIN:
  235.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  236.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_PINYIN_IMG);
  237.     #elif defined(__MMI_ZI__)
  238.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_PINYIN_LOGO);
  239.     #else 
  240.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  241.     #endif 
  242.             break;
  243.         case INPUT_MODE_TR_STROKE:
  244.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  245.             inputbox_information_icon = get_image(WGUI_IME_TR_STROKE_IMG);
  246.     #elif defined(__MMI_ZI__)
  247.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_TR_STROKE_LOGO);
  248.     #else 
  249.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  250.     #endif 
  251.             break;
  252.         case INPUT_MODE_SM_STROKE:
  253.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  254.             inputbox_information_icon = get_image(WGUI_IME_SM_STROKE_IMG);
  255.     #elif defined(__MMI_ZI__)
  256.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_SM_STROKE_LOGO);
  257.     #else 
  258.             inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  259.     #endif 
  260.             break;
  261.         case INPUT_MODE_TR_BOPOMO:
  262.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  263.             inputbox_information_icon = get_image(WGUI_IME_SMART_BPMF_IMG);
  264.     #elif defined(__MMI_ZI__)
  265.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_BPMF_LOGO);
  266.     #else 
  267.             inputbox_information_icon = get_image(WGUI_IME_SMART_BPMF_IMG);
  268.     #endif 
  269.             break;
  270.         case INPUT_MODE_SM_PINYIN:
  271.     #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-8
  272.             inputbox_information_icon = get_image(WGUI_IME_SMART_PINYIN_IMG);
  273.     #elif defined(__MMI_ZI__)
  274.             inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_PINYIN_LOGO);
  275.     #else 
  276.             inputbox_information_icon = get_image(WGUI_IME_SMART_PINYIN_IMG);
  277.     #endif 
  278.             break;
  279.     }
  280.     if (NULL != inputmode_string)
  281.     {
  282.         set_softkey_label(inputmode_string, MMI_CENTER_SOFTKEY);
  283.     }
  284.     if (NULL != inputbox_information_icon)
  285.     {
  286.         set_softkey_icon(inputbox_information_icon, MMI_CENTER_SOFTKEY);
  287.     }
  288.     redraw_softkey(MMI_CENTER_SOFTKEY);
  289. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  290. }
  291. /*****************************************************************************
  292.  * FUNCTION
  293.  *  mmi_pen_editor_exit_screen
  294.  * DESCRIPTION
  295.  *  Common function for handwriting when exiting screen. This is used in UI_common_screen_exit.
  296.  * PARAMETERS
  297.  *  void
  298.  * RETURNS
  299.  *  void
  300.  *****************************************************************************/
  301. void mmi_pen_editor_exit_screen(void)
  302. {
  303.     /*----------------------------------------------------------------*/
  304.     /* Local Variables                                                */
  305.     /*----------------------------------------------------------------*/
  306.     /*----------------------------------------------------------------*/
  307.     /* Code Body                                                      */
  308.     /*----------------------------------------------------------------*/
  309.     /* W06.04 Set gPenEditorGDIHandler to NULL when exiting screen */
  310.     gPenEditorGDIHandler = NULL;
  311.     gPenEditorListMenuHeight = 0;
  312.     if (gPenEditorStrokeGDIBuffer)
  313.     {
  314.         mmi_frm_scrmem_free((void*)gPenEditorStrokeGDIBuffer);
  315.     }
  316.     gPenEditorStrokeGDIBuffer = NULL;
  317. }
  318. /* W06.09 Touch Screen With Keypad V1 */
  319. /*****************************************************************************
  320.  * FUNCTION
  321.  *  mmi_pen_editor_bpmf_pinyin_key_down_handler
  322.  * DESCRIPTION
  323.  *  The handler of key down(number keys) in Multitap BPMF/PinYin
  324.  * PARAMETERS
  325.  *  key     [IN]        The key index
  326.  * RETURNS
  327.  *  void
  328.  *****************************************************************************/
  329. void mmi_pen_editor_bpmf_pinyin_key_down_handler(S32 key)
  330. {
  331. //Jerry add on 2007-1-12 start
  332. #if defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)
  333. if(gPenEditorFirstStroke)
  334. {
  335. #endif
  336. //Jerry add on 2007-1-12 end
  337.     /*----------------------------------------------------------------*/
  338.     /* Local Variables                                                */
  339.     /*----------------------------------------------------------------*/
  340.     /*----------------------------------------------------------------*/
  341.     /* Code Body                                                      */
  342.     /*----------------------------------------------------------------*/
  343.     mmi_pen_editor_cancel_handwriting();
  344.     if (gPenEditorSelectCandidate && (0 == gPenEditorVKText.TextLength))
  345.     {
  346.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  347.         mmi_pen_editor_confirm_selection();
  348.     }
  349.     if (key < 0 || key > MAX_MULTITAPS - 1)
  350.     {
  351.         return;
  352.     }
  353.     if (MMI_virtual_keyboard.lang_type == GUI_VIRTUAL_KEYBOARD_CHINESE_SYMBOL)
  354.     {
  355.         mmi_pen_editor_vk_symbol_picker();
  356.     }
  357.     if (MMI_virtual_keyboard.lang_type == GUI_VIRTUAL_KEYBOARD_TRAY)
  358.     {
  359.         mmi_pen_editor_vk_show();
  360.     }
  361.     if (key != g_pen_editor_active_multitap_index)
  362.     {
  363.         if (g_pen_editor_active_multitap_index >= 0)
  364.         {
  365.             gui_multitap_input_complete(&
  366.                                         (g_pen_editor_bpmf_pinyin_active_multitap[g_pen_editor_active_multitap_index]));
  367.         }
  368.         g_pen_editor_active_multitap_index = key;
  369.     }
  370.     gui_change_multitap_input_state(&(g_pen_editor_bpmf_pinyin_active_multitap[g_pen_editor_active_multitap_index]));
  371. //Jerry add on 2007-1-12 start
  372. #if defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)
  373. }
  374. #endif
  375. //Jerry add on 2007-1-12 end
  376. }
  377. /*****************************************************************************
  378.  * FUNCTION
  379.  *  mmi_pen_editor_bpmf_pinyin_key_up_handler
  380.  * DESCRIPTION
  381.  *  The handler of key up(number keys) in Multitap BPMF/PinYin
  382.  * PARAMETERS
  383.  *  key     [IN]        The key index
  384.  * RETURNS
  385.  *  void
  386.  *****************************************************************************/
  387. void mmi_pen_editor_bpmf_pinyin_key_up_handler(S32 key)
  388. {
  389.     /*----------------------------------------------------------------*/
  390.     /* Local Variables                                                */
  391.     /*----------------------------------------------------------------*/
  392.     /*----------------------------------------------------------------*/
  393.     /* Code Body                                                      */
  394.     /*----------------------------------------------------------------*/
  395.     UI_UNUSED_PARAMETER(key);
  396.     gui_start_timer(MMI_MULTITAP_TIMEOUT, mmi_pen_editor_bpmf_pinyin_disable_active_multitap);
  397. }
  398. /*****************************************************************************
  399.  * FUNCTION
  400.  *  mmi_pen_editor_bpmf_pinyin_disable_active_multitap
  401.  * DESCRIPTION
  402.  *  Complete Multitap input for Multitap BPMF/PinYin
  403.  * PARAMETERS
  404.  *  void
  405.  * RETURNS
  406.  *  void
  407.  *****************************************************************************/
  408. void mmi_pen_editor_bpmf_pinyin_disable_active_multitap(void)
  409. {
  410.     /*----------------------------------------------------------------*/
  411.     /* Local Variables                                                */
  412.     /*----------------------------------------------------------------*/
  413.     /*----------------------------------------------------------------*/
  414.     /* Code Body                                                      */
  415.     /*----------------------------------------------------------------*/
  416.     if (g_pen_editor_active_multitap_index < 0)
  417.     {
  418.         return;
  419.     }
  420.     gui_multitap_input_complete(&g_pen_editor_bpmf_pinyin_active_multitap[g_pen_editor_active_multitap_index]);
  421.     g_pen_editor_active_multitap_index = -1;
  422. }
  423. /*****************************************************************************
  424.  * FUNCTION
  425.  *  mmi_pen_editor_bpmf_pinyin_multitap_input
  426.  * DESCRIPTION
  427.  *  Handle the multitap input character c in multitap BPMF/PinYin
  428.  * PARAMETERS
  429.  *  c       [IN]        The multitap input character
  430.  * RETURNS
  431.  *  void
  432.  *****************************************************************************/
  433. void mmi_pen_editor_bpmf_pinyin_multitap_input(UI_character_type c)
  434. {
  435.     /*----------------------------------------------------------------*/
  436.     /* Local Variables                                                */
  437.     /*----------------------------------------------------------------*/
  438.     /*----------------------------------------------------------------*/
  439.     /* Code Body                                                      */
  440.     /*----------------------------------------------------------------*/
  441.     if (g_pen_editor_bpmf_pinyin_previous_valid_character)
  442.     {
  443.         mmi_pen_editor_vk_delete_character(&gPenEditorVKText);
  444.     }
  445.     if (mmi_pen_editor_vk_insert_character(&gPenEditorVKText, c))
  446.     {
  447.         /* Check the input is valid or not */
  448.         if (mmi_pen_editor_get_candidates_by_vk())
  449.         {
  450.             switch (gPenEditorInputBoxType)
  451.             {
  452.                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  453.                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  454.                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  455.                     wgui_inputbox_RSK_label_clear = 1;
  456.                     break;
  457.                 case PEN_EDITOR_EMS_INPUT_BOX:
  458.                     category28_RSK_label_clear = 1;
  459.                     break;
  460.                 default:
  461.                     break;
  462.             }
  463.             /* Temp Solution for LSK Text Update */
  464.             /* W05.35 For LSK Text Issue */
  465.             if (gPenEditorVKText.TextLength == 1 && MMI_FALSE == gPenEditorSelectCandidate)
  466.             {
  467.                 mmi_pen_editor_store_LSK_Text();
  468.             }
  469.             mmi_pen_editor_set_left_soft_key_select();
  470.             set_left_softkey_function(mmi_pen_editor_left_soft_key_handler, KEY_EVENT_UP);
  471.             set_left_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
  472.             gPenEditorSelectCandidate = MMI_TRUE;
  473.             mmi_pen_editor_register_arrow_keys();
  474.             mmi_pen_editor_set_right_softkey(PEN_EDITOR_RSK_CLEAR);
  475.             g_pen_editor_bpmf_pinyin_previous_valid_character = c;
  476.         }
  477.         else
  478.         {
  479.             mmi_pen_editor_vk_delete_character(&gPenEditorVKText);
  480.             if (g_pen_editor_bpmf_pinyin_previous_valid_character)
  481.             {
  482.                 mmi_pen_editor_vk_insert_character(
  483.                     &gPenEditorVKText,
  484.                     g_pen_editor_bpmf_pinyin_previous_valid_character);
  485.             }
  486.         }
  487.     }
  488.     wgui_set_virtual_keyboard_display_area((U8*) gPenEditorVKText.VKText, MMI_TRUE);
  489. }
  490. /*****************************************************************************
  491.  * FUNCTION
  492.  *  mmi_pen_editor_bpmf_pinyin_multitap_input_complete
  493.  * DESCRIPTION
  494.  *  Set g_pen_editor_bpmf_pinyin_previous_valid_character to 0 when conmpleting multitap input
  495.  * PARAMETERS
  496.  *  void
  497.  * RETURNS
  498.  *  void
  499.  *****************************************************************************/
  500. void mmi_pen_editor_bpmf_pinyin_multitap_input_complete(void)
  501. {
  502.     /*----------------------------------------------------------------*/
  503.     /* Local Variables                                                */
  504.     /*----------------------------------------------------------------*/
  505.     /*----------------------------------------------------------------*/
  506.     /* Code Body                                                      */
  507.     /*----------------------------------------------------------------*/
  508.     g_pen_editor_bpmf_pinyin_previous_valid_character = 0;
  509. }
  510. /*****************************************************************************
  511.  * FUNCTION
  512.  *  mmi_pen_editor_bpmf_pinyin_register_multitap_function
  513.  * DESCRIPTION
  514.  *  Register key functions for Multitap BPMF/PinYin and set Multitap BPMF/Pinyin functions to g_pen_editor_bpmf_pinyin_active_multitap
  515.  * PARAMETERS
  516.  *  void
  517.  * RETURNS
  518.  *  void
  519.  *****************************************************************************/
  520. void mmi_pen_editor_bpmf_pinyin_register_multitap_function(void)
  521. {
  522.     /*----------------------------------------------------------------*/
  523.     /* Local Variables                                                */
  524.     /*----------------------------------------------------------------*/
  525.     int i = 0;
  526.     /*----------------------------------------------------------------*/
  527.     /* Code Body                                                      */
  528.     /*----------------------------------------------------------------*/
  529.     register_MMI_key_input_handler();
  530.     register_key_up_handler(mmi_pen_editor_bpmf_pinyin_key_up_handler);
  531.     register_key_down_handler(mmi_pen_editor_bpmf_pinyin_key_down_handler);
  532.     for (i = 0; i < MAX_MULTITAPS; i++)
  533.     {
  534.         gui_set_multitap_input_callbacks(
  535.             &g_pen_editor_bpmf_pinyin_active_multitap[i],
  536.             mmi_pen_editor_bpmf_pinyin_multitap_input,
  537.             mmi_pen_editor_bpmf_pinyin_multitap_input_complete);
  538.     }
  539. }
  540. /*****************************************************************************
  541.  * FUNCTION
  542.  *  mmi_pen_editor_bpmf_pinyin_create_multitap
  543.  * DESCRIPTION
  544.  *  Create multitap control according to input_mode
  545.  * PARAMETERS
  546.  *  input_mode      [IN]        Its value should be INPUT_MODE_TR_MULTITAP_BOPOMO or INPUT_MODE_SM_MULTITAP_PINYIN
  547.  * RETURNS
  548.  *  void
  549.  *****************************************************************************/
  550. void mmi_pen_editor_bpmf_pinyin_create_multitap(U8 input_mode)
  551. {
  552.     /*----------------------------------------------------------------*/
  553.     /* Local Variables                                                */
  554.     /*----------------------------------------------------------------*/
  555.     S32 i, width;
  556.     UI_string_type s;
  557.     /*----------------------------------------------------------------*/
  558.     /* Code Body                                                      */
  559.     /*----------------------------------------------------------------*/
  560.     width = MMI_multitap_width; /* Width needs to be auto-calculated   */
  561.     g_pen_editor_active_multitap_index = -1;
  562.     for (i = 0; i < MAX_MULTITAPS; i++)
  563.     {
  564.         if (INPUT_MODE_TR_MULTITAP_BOPOMO == MMI_current_input_mode)
  565.         {
  566.             s = get_bpmf_multitap_string(i);
  567.             gui_create_multitap_input(
  568.                 &g_pen_editor_bpmf_pinyin_active_multitap[i],
  569.                 MMI_multitap_x,
  570.                 MMI_multitap_y,
  571.                 width,
  572.                 MMI_multitap_height,
  573.                 s);
  574.         }
  575.         else if (INPUT_MODE_SM_MULTITAP_PINYIN == MMI_current_input_mode)
  576.         {
  577.             s = (UI_string_type) numberless_lowercase_multitap_strings[i];
  578.             gui_create_multitap_input(
  579.                 &g_pen_editor_bpmf_pinyin_active_multitap[i],
  580.                 MMI_multitap_x,
  581.                 MMI_multitap_y,
  582.                 width,
  583.                 MMI_multitap_height,
  584.                 s);
  585.         }
  586.         else
  587.         {
  588.             MMI_ASSERT(0);
  589.         }
  590.     }
  591. }
  592. /*****************************************************************************
  593.  * FUNCTION
  594.  *  mmi_pen_editor_hold_confirm
  595.  * DESCRIPTION
  596.  *  Do not confirm the selection directly when the candidate box is on
  597.  * PARAMETERS
  598.  *  void
  599.  * RETURNS
  600.  *  void
  601.  *****************************************************************************/
  602. void mmi_pen_editor_hold_confirm(void)
  603. {
  604.     /*----------------------------------------------------------------*/
  605.     /* Local Variables                                                */
  606.     /*----------------------------------------------------------------*/
  607.     /*----------------------------------------------------------------*/
  608.     /* Code Body                                                      */
  609.     /*----------------------------------------------------------------*/
  610.     if (gPenEditorSelectCandidate)
  611.     {
  612.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  613.         g_pen_editor_hold_confirm = MMI_TRUE;
  614.     }
  615. }
  616. /*****************************************************************************
  617.  * FUNCTION
  618.  *  mmi_pen_editor_smart_latin_register_key_function
  619.  * DESCRIPTION
  620.  *  Register key functions for Smart Latin
  621.  * PARAMETERS
  622.  *  void
  623.  * RETURNS
  624.  *  void
  625.  *****************************************************************************/
  626. void mmi_pen_editor_smart_latin_register_key_function(void)
  627. {
  628.     /*----------------------------------------------------------------*/
  629.     /* Local Variables                                                */
  630.     /*----------------------------------------------------------------*/
  631.     /*----------------------------------------------------------------*/
  632.     /* Code Body                                                      */
  633.     /*----------------------------------------------------------------*/
  634.     register_MMI_key_input_handler();
  635.     register_key_up_handler(mmi_pen_editor_smart_latin_key_up_handler);
  636.     register_key_down_handler(mmi_pen_editor_smart_latin_key_down_handler);
  637.     ClearKeyHandler(KEY_0, KEY_REPEAT);
  638.     ClearKeyHandler(KEY_1, KEY_REPEAT);
  639.     ClearKeyHandler(KEY_2, KEY_REPEAT);
  640.     ClearKeyHandler(KEY_3, KEY_REPEAT);
  641.     ClearKeyHandler(KEY_4, KEY_REPEAT);
  642.     ClearKeyHandler(KEY_5, KEY_REPEAT);
  643.     ClearKeyHandler(KEY_6, KEY_REPEAT);
  644.     ClearKeyHandler(KEY_7, KEY_REPEAT);
  645.     ClearKeyHandler(KEY_8, KEY_REPEAT);
  646.     ClearKeyHandler(KEY_9, KEY_REPEAT);
  647. }
  648. /*****************************************************************************
  649.  * FUNCTION
  650.  *  mmi_pen_editor_smart_latin_key_down_handler
  651.  * DESCRIPTION
  652.  *  The handler of key down(number keys) in Smart Latin
  653.  * PARAMETERS
  654.  *  key     [IN]        The key index
  655.  * RETURNS
  656.  *  void
  657.  *****************************************************************************/
  658. void mmi_pen_editor_smart_latin_key_down_handler(S32 key)
  659. {
  660.     /*----------------------------------------------------------------*/
  661.     /* Local Variables                                                */
  662.     /*----------------------------------------------------------------*/
  663.     UI_character_type candidate_buffer[PEN_EDITOR_MAX_KEY_BUFFER_SIZE];
  664.     U32 candidatelength = 0;
  665.     /*----------------------------------------------------------------*/
  666.     /* Code Body                                                      */
  667.     /*----------------------------------------------------------------*/
  668.     if (!mmi_pen_editor_get_remaining_length())
  669.     {
  670.         return;
  671.     }
  672.     gdi_layer_lock_frame_buffer();
  673.     if (gPenEditorSelectCandidate && !g_pen_editor_key_sequence.KeyLength)
  674.     {
  675.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  676.         mmi_pen_editor_confirm_selection();
  677.     }
  678.     if (KEY_0 == key)
  679.     {
  680.         if (g_pen_editor_smart_latin_pre_candidate_length)
  681.         {
  682.             mmi_pen_editor_smart_latin_confirm_select();
  683.             mmi_pen_editor_set_left_soft_key();
  684.         }
  685.         mmi_pen_editor_input_character(0x20, MMI_FALSE);
  686.     }
  687.     else if (mmi_pen_editor_add_key_sequence(&g_pen_editor_key_sequence, key))
  688.     {
  689.         candidatelength = mmi_ime_smart_latin_get_candidates_by_key_sequence(
  690.                             g_pen_editor_key_sequence.KeySequence,
  691.                             g_pen_editor_key_sequence.KeyLength,
  692.                             candidate_buffer);
  693.         if (candidatelength)
  694.         {
  695.             if (candidatelength < g_pen_editor_key_sequence.KeyLength)
  696.             {
  697.                 mmi_pen_editor_smart_latin_confirm_select();
  698.                 mmi_pen_editor_add_key_sequence(&g_pen_editor_key_sequence, key);
  699.                 candidatelength = mmi_ime_smart_latin_get_candidates_by_key_sequence(
  700.                                     g_pen_editor_key_sequence.KeySequence,
  701.                                     g_pen_editor_key_sequence.KeyLength,
  702.                                     candidate_buffer);
  703.             }
  704.             mmi_pen_editor_smart_latin_replace_candidate(candidate_buffer, candidatelength);
  705.             if (g_pen_editor_key_sequence.KeyLength == 1 && MMI_FALSE == gPenEditorSelectCandidate)
  706.             {
  707.                 mmi_pen_editor_store_LSK_Text();
  708.             }
  709.             mmi_pen_editor_set_left_soft_key_select();
  710.             set_left_softkey_function(mmi_pen_editor_left_soft_key_handler, KEY_EVENT_UP);
  711.             set_left_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
  712.             mmi_pen_editor_smart_latin_register_arrow_keys();
  713.         }
  714.         else
  715.         {
  716.             mmi_pen_editor_del_key_sequence(&g_pen_editor_key_sequence);
  717.         }
  718.     }
  719.     gdi_layer_unlock_frame_buffer();
  720.     gdi_lcd_repaint_all();
  721. }
  722. /*****************************************************************************
  723.  * FUNCTION
  724.  *  mmi_pen_editor_smart_latin_key_up_handler
  725.  * DESCRIPTION
  726.  *  The handler of key up(number keys) in Smart Latin
  727.  * PARAMETERS
  728.  *  key     [IN]        The key index
  729.  * RETURNS
  730.  *  void
  731.  *****************************************************************************/
  732. void mmi_pen_editor_smart_latin_key_up_handler(S32 key)
  733. {
  734.     /*----------------------------------------------------------------*/
  735.     /* Local Variables                                                */
  736.     /*----------------------------------------------------------------*/
  737.     /*----------------------------------------------------------------*/
  738.     /* Code Body                                                      */
  739.     /*----------------------------------------------------------------*/
  740.     UI_UNUSED_PARAMETER(key);
  741. }
  742. /*****************************************************************************
  743.  * FUNCTION
  744.  *  mmi_pen_editor_smart_latin_highlight_candidate
  745.  * DESCRIPTION
  746.  *  Unhighlight the candidate in Smart Latin
  747.  * PARAMETERS
  748.  *  candidate_length        [IN]        The length of the highlighted candidate
  749.  * RETURNS
  750.  *  void
  751.  *****************************************************************************/
  752. void mmi_pen_editor_smart_latin_highlight_candidate(U32 candidate_length)
  753. {
  754.     /*----------------------------------------------------------------*/
  755.     /* Local Variables                                                */
  756.     /*----------------------------------------------------------------*/
  757.     S32 count = 0;
  758.     /*----------------------------------------------------------------*/
  759.     /* Code Body                                                      */
  760.     /*----------------------------------------------------------------*/
  761.     switch (gPenEditorInputBoxType)
  762.     {
  763.         case PEN_EDITOR_MULTILINE_INPUT_BOX:
  764.         case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  765.         case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  766.             count = gui_multi_line_input_box_highlight_cursor_number(&MMI_multiline_inputbox, candidate_length);
  767.             break;
  768.         case PEN_EDITOR_EMS_INPUT_BOX:
  769.             count = gui_EMS_input_box_highlight_cursor_number(&MMI_EMS_inputbox, candidate_length);
  770.             gui_show_EMS_input_box(&MMI_EMS_inputbox);
  771.             break;
  772.         case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  773.             count = gui_single_line_input_box_highlight_cursor_number(&MMI_singleline_inputbox, candidate_length);
  774.             break;
  775.         case PEN_EDITOR_INLINE_TEXT:
  776.             count = gui_single_line_input_box_highlight_cursor_number(&MMI_inline_singleline_inputbox, candidate_length);
  777.             break;
  778.         default:
  779.             break;
  780.     }
  781. }
  782. /*****************************************************************************
  783.  * FUNCTION
  784.  *  mmi_pen_editor_smart_latin_unhighlight_candidate
  785.  * DESCRIPTION
  786.  *  
  787.  * PARAMETERS
  788.  *  draw        [IN]        MMI_TRUE : Redraw the input box
  789.  *                          MMI_FALSE : Do not redraw the input box
  790.  * RETURNS
  791.  *  void
  792.  *****************************************************************************/
  793. void mmi_pen_editor_smart_latin_unhighlight_candidate(MMI_BOOL draw)
  794. {
  795.     /*----------------------------------------------------------------*/
  796.     /* Local Variables                                                */
  797.     /*----------------------------------------------------------------*/
  798.     /*----------------------------------------------------------------*/
  799.     /* Code Body                                                      */
  800.     /*----------------------------------------------------------------*/
  801.     switch (gPenEditorInputBoxType)
  802.     {
  803.         case PEN_EDITOR_MULTILINE_INPUT_BOX:
  804.         case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  805.         case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  806.             MMI_multiline_inputbox.flags &= ~UI_MULTI_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  807.             if (draw)
  808.             {
  809.                 gui_show_multi_line_input_box(&MMI_multiline_inputbox);
  810.             }
  811.             break;
  812.         case PEN_EDITOR_EMS_INPUT_BOX:
  813.             MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
  814.             if (draw)
  815.             {
  816.                 gui_show_EMS_input_box(&MMI_EMS_inputbox);
  817.             }
  818.             break;
  819.         case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  820.             MMI_singleline_inputbox.flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  821.             if (draw)
  822.             {
  823.                 gui_show_single_line_input_box(&MMI_singleline_inputbox);
  824.             }
  825.             break;
  826.         case PEN_EDITOR_INLINE_TEXT:
  827.             MMI_inline_singleline_inputbox.flags &= ~UI_SINGLE_LINE_INPUT_BOX_WORD_HIGHLIGHT;
  828.             if (draw)
  829.             {
  830.                 gui_show_single_line_input_box(&MMI_inline_singleline_inputbox);
  831.             }
  832.             break;
  833.         default:
  834.             break;
  835.     }
  836. }
  837. /*****************************************************************************
  838.  * FUNCTION
  839.  *  mmi_pen_editor_chinese_stroke_register_key_function
  840.  * DESCRIPTION
  841.  *  Register key functions for Chinese Stroke
  842.  * PARAMETERS
  843.  *  void
  844.  * RETURNS
  845.  *  void
  846.  *****************************************************************************/
  847. void mmi_pen_editor_chinese_stroke_register_key_function(void)
  848. {
  849.     /*----------------------------------------------------------------*/
  850.     /* Local Variables                                                */
  851.     /*----------------------------------------------------------------*/
  852.     /*----------------------------------------------------------------*/
  853.     /* Code Body                                                      */
  854.     /*----------------------------------------------------------------*/
  855.     register_MMI_key_input_handler();
  856.     register_key_up_handler(mmi_pen_editor_chinese_stroke_key_up_handler);
  857.     register_key_down_handler(mmi_pen_editor_chinese_stroke_key_down_handler);
  858.     ClearKeyHandler(KEY_0, KEY_REPEAT);
  859.     ClearKeyHandler(KEY_1, KEY_REPEAT);
  860.     ClearKeyHandler(KEY_2, KEY_REPEAT);
  861.     ClearKeyHandler(KEY_3, KEY_REPEAT);
  862.     ClearKeyHandler(KEY_4, KEY_REPEAT);
  863.     ClearKeyHandler(KEY_5, KEY_REPEAT);
  864.     ClearKeyHandler(KEY_6, KEY_REPEAT);
  865.     ClearKeyHandler(KEY_7, KEY_REPEAT);
  866.     ClearKeyHandler(KEY_8, KEY_REPEAT);
  867.     ClearKeyHandler(KEY_9, KEY_REPEAT);
  868. }
  869. /*****************************************************************************
  870.  * FUNCTION
  871.  *  mmi_pen_editor_chinese_stroke_key_down_handler
  872.  * DESCRIPTION
  873.  *  The handler of key down(number keys) in Chinese Stroke
  874.  * PARAMETERS
  875.  *  key     [IN]        The key index
  876.  * RETURNS
  877.  *  void
  878.  *****************************************************************************/
  879. void mmi_pen_editor_chinese_stroke_key_down_handler(S32 key)
  880. {
  881. //Jerry add on 2007-1-12 start
  882. #if defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)
  883. if(gPenEditorFirstStroke)
  884. {
  885. #endif
  886. //Jerry add on 2007-1-12 end
  887.     /*----------------------------------------------------------------*/
  888.     /* Local Variables                                                */
  889.     /*----------------------------------------------------------------*/
  890.     /*----------------------------------------------------------------*/
  891.     /* Code Body                                                      */
  892.     /*----------------------------------------------------------------*/
  893.     gdi_layer_lock_frame_buffer();
  894.     mmi_pen_editor_cancel_handwriting();
  895.     if (gPenEditorSelectCandidate && (g_pen_editor_composition_state.candidate_state == PEN_EDITOR_CANDIDATE_OFF))
  896.     {
  897.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  898.         mmi_pen_editor_confirm_selection();
  899.     }
  900.     if (KEY_0 == key)
  901.     {
  902.     }
  903.     else 
  904. #if defined(__MMI_T9__) || defined(__MMI_CSTAR__)     //KP Jerry add "__MMI_CSTAR__" on 2007-3-21
  905.     if (KEY_7 <= key && KEY_9 >= key)
  906.     {
  907.     }
  908.     else 
  909. #endif
  910.     if (mmi_pen_editor_add_key_sequence(&g_pen_editor_key_sequence, key))
  911.     {
  912.         if (mmi_pen_editor_chinese_stroke_get_candidates_by_key_sequence(&g_pen_editor_key_sequence))
  913.         {
  914.             switch (gPenEditorInputBoxType)
  915.             {
  916.                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  917.                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  918.                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  919.                     wgui_inputbox_RSK_label_clear = 1;
  920.                     break;
  921.                 case PEN_EDITOR_EMS_INPUT_BOX:
  922.                     category28_RSK_label_clear = 1;
  923.                     break;
  924.                 default:
  925.                     break;
  926.             }
  927.             /* Temp Solution for LSK Text Update */
  928.             /* W05.35 For LSK Text Issue */
  929.             if (g_pen_editor_key_sequence.KeyLength == 1 && MMI_FALSE == gPenEditorSelectCandidate)
  930.             {
  931.                 mmi_pen_editor_store_LSK_Text();
  932.             }
  933.             mmi_pen_editor_set_left_soft_key_select();
  934.             set_left_softkey_function(mmi_pen_editor_left_soft_key_handler, KEY_EVENT_UP);
  935.             set_left_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
  936.             gPenEditorSelectCandidate = MMI_TRUE;
  937.             mmi_pen_editor_register_arrow_keys();
  938.             mmi_pen_editor_set_right_softkey(PEN_EDITOR_RSK_CLEAR);
  939.         }
  940.         else
  941.         {
  942.             mmi_pen_editor_del_key_sequence(&g_pen_editor_key_sequence);
  943.         }
  944.     }
  945.     gdi_layer_unlock_frame_buffer();
  946.     gdi_lcd_repaint_all();
  947.     mmi_pen_editor_change_handwriting_area();
  948. //Jerry add on 2007-1-12 start
  949. #if defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)
  950. }
  951. #endif
  952. //Jerry add on 2007-1-12 end
  953. }
  954. /*****************************************************************************
  955.  * FUNCTION
  956.  *  mmi_pen_editor_chinese_stroke_key_up_handler
  957.  * DESCRIPTION
  958.  *  The handler of key up(number keys) in Chinese Stroke
  959.  * PARAMETERS
  960.  *  key     [IN]        The key index
  961.  * RETURNS
  962.  *  void
  963.  *****************************************************************************/
  964. void mmi_pen_editor_chinese_stroke_key_up_handler(S32 key)
  965. {
  966.     /*----------------------------------------------------------------*/
  967.     /* Local Variables                                                */
  968.     /*----------------------------------------------------------------*/
  969.     /*----------------------------------------------------------------*/
  970.     /* Code Body                                                      */
  971.     /*----------------------------------------------------------------*/
  972.     UI_UNUSED_PARAMETER(key);
  973. }
  974. /*****************************************************************************
  975.  * FUNCTION
  976.  *  mmi_pen_editor_get_remaining_length
  977.  * DESCRIPTION
  978.  *  To know how many characters could be inserted in current state
  979.  * PARAMETERS
  980.  *  void
  981.  * RETURNS
  982.  *  The number of the characters could be inserted
  983.  *****************************************************************************/
  984. S32 mmi_pen_editor_get_remaining_length(void)
  985. {
  986.     /*----------------------------------------------------------------*/
  987.     /* Local Variables                                                */
  988.     /*----------------------------------------------------------------*/
  989.     /*----------------------------------------------------------------*/
  990.     /* Code Body                                                      */
  991.     /*----------------------------------------------------------------*/
  992.     switch (gPenEditorInputBoxType)
  993.     {
  994.         case PEN_EDITOR_MULTILINE_INPUT_BOX:
  995.         case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  996.         case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  997.             return (gui_multi_line_input_box_get_remaining_length(&MMI_multiline_inputbox));
  998.         case PEN_EDITOR_EMS_INPUT_BOX:
  999.             return (EMS_get_remaining_length(MMI_EMS_inputbox.data));
  1000.         case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  1001.         case PEN_EDITOR_QUICK_SEARCH_SINGLE_LINE_INPU_BOX:
  1002.             return (gui_single_line_input_box_get_remaining_length(&MMI_singleline_inputbox));
  1003.         case PEN_EDITOR_INLINE_TEXT:
  1004.             return (gui_single_line_input_box_get_remaining_length(&MMI_inline_singleline_inputbox));
  1005.         case PEN_EDITOR_DATE:
  1006.         case PEN_EDITOR_IP4:
  1007.         case PEN_EDITOR_TIME:
  1008.         case PEN_EDITOR_TIME_PERIOD:
  1009.             return 0;
  1010.         default:
  1011.             MMI_ASSERT(0);
  1012.     }
  1013.     return 0;
  1014. }
  1015. /*****************************************************************************
  1016.  * FUNCTION
  1017.  *  mmi_pen_editor_smart_latin_confirm_select
  1018.  * DESCRIPTION
  1019.  *  Confirm the selection in Smart Latin
  1020.  * PARAMETERS
  1021.  *  void
  1022.  * RETURNS
  1023.  *  void
  1024.  *****************************************************************************/
  1025. void mmi_pen_editor_smart_latin_confirm_select(void)
  1026. {
  1027.     /*----------------------------------------------------------------*/
  1028.     /* Local Variables                                                */
  1029.     /*----------------------------------------------------------------*/
  1030.     /*----------------------------------------------------------------*/
  1031.     /* Code Body                                                      */
  1032.     /*----------------------------------------------------------------*/
  1033.     g_pen_editor_smart_latin_pre_candidate_length = 0;
  1034.     g_pen_editor_smart_latin_candidate_index = 0;
  1035.     mmi_pen_editor_smart_latin_unhighlight_candidate(MMI_TRUE);
  1036.     mmi_pen_editor_reset_key_sequence(&g_pen_editor_key_sequence);
  1037. }
  1038. /*****************************************************************************
  1039.  * FUNCTION
  1040.  *  mmi_pen_editor_smart_latin_replace_candidate
  1041.  * DESCRIPTION
  1042.  *  Replace the candiate in the input box the candidate is changed
  1043.  * PARAMETERS
  1044.  *  candidate_buffer        [OUT]         The new candidate
  1045.  *  candidatelength         [IN]          The length of the candidate
  1046.  * RETURNS
  1047.  *  void
  1048.  *****************************************************************************/
  1049. void mmi_pen_editor_smart_latin_replace_candidate(UI_character_type *candidate_buffer, S32 candidatelength)
  1050. {
  1051.     /*----------------------------------------------------------------*/
  1052.     /* Local Variables                                                */
  1053.     /*----------------------------------------------------------------*/
  1054.     U32 i = 0;
  1055.     /*----------------------------------------------------------------*/
  1056.     /* Code Body                                                      */
  1057.     /*----------------------------------------------------------------*/
  1058.     if (g_pen_editor_smart_latin_pre_candidate_length)
  1059.     {
  1060.         for (i = 0; i < g_pen_editor_smart_latin_pre_candidate_length; i++)
  1061.         {
  1062.             mmi_pen_editor_backspace();
  1063.         }
  1064.     }
  1065.     g_pen_editor_smart_latin_pre_candidate_length = candidatelength;
  1066.     for (i = 0; i < g_pen_editor_smart_latin_pre_candidate_length; i++)
  1067.     {
  1068.         mmi_pen_editor_input_character(candidate_buffer[i], MMI_FALSE);
  1069.     }
  1070.     mmi_pen_editor_smart_latin_highlight_candidate(g_pen_editor_smart_latin_pre_candidate_length);
  1071.     mmi_pen_editor_set_right_softkey(PEN_EDITOR_RSK_CLEAR);
  1072. }
  1073. /*****************************************************************************
  1074.  * FUNCTION
  1075.  *  mmi_pen_editor_smart_bpmf_pinyin_register_key_function
  1076.  * DESCRIPTION
  1077.  *  Register key functions for Smart BPMF/PinYin
  1078.  * PARAMETERS
  1079.  *  void
  1080.  * RETURNS
  1081.  *  void
  1082.  *****************************************************************************/
  1083. void mmi_pen_editor_smart_bpmf_pinyin_register_key_function(void)
  1084. {
  1085.     /*----------------------------------------------------------------*/
  1086.     /* Local Variables                                                */
  1087.     /*----------------------------------------------------------------*/
  1088.     /*----------------------------------------------------------------*/
  1089.     /* Code Body                                                      */
  1090.     /*----------------------------------------------------------------*/
  1091.     register_MMI_key_input_handler();
  1092.     register_key_up_handler(mmi_pen_editor_smart_bpmf_pinyin_key_up_handler);
  1093.     register_key_down_handler(mmi_pen_editor_smart_bpmf_pinyin_key_down_handler);
  1094.     ClearKeyHandler(KEY_0, KEY_REPEAT);
  1095.     ClearKeyHandler(KEY_1, KEY_REPEAT);
  1096.     ClearKeyHandler(KEY_2, KEY_REPEAT);
  1097.     ClearKeyHandler(KEY_3, KEY_REPEAT);
  1098.     ClearKeyHandler(KEY_4, KEY_REPEAT);
  1099.     ClearKeyHandler(KEY_5, KEY_REPEAT);
  1100.     ClearKeyHandler(KEY_6, KEY_REPEAT);
  1101.     ClearKeyHandler(KEY_7, KEY_REPEAT);
  1102.     ClearKeyHandler(KEY_8, KEY_REPEAT);
  1103.     ClearKeyHandler(KEY_9, KEY_REPEAT);
  1104. }
  1105. /*****************************************************************************
  1106.  * FUNCTION
  1107.  *  mmi_pen_editor_smart_bpmf_pinyin_key_down_handler
  1108.  * DESCRIPTION
  1109.  *  The handler of key down(number keys) in Smart BPMF/PinYin
  1110.  * PARAMETERS
  1111.  *  key     [IN]        The key index
  1112.  * RETURNS
  1113.  *  void
  1114.  *****************************************************************************/
  1115. void mmi_pen_editor_smart_bpmf_pinyin_key_down_handler(S32 key)
  1116. {
  1117.     /*----------------------------------------------------------------*/
  1118.     /* Local Variables                                                */
  1119.     /*----------------------------------------------------------------*/
  1120.     /*----------------------------------------------------------------*/
  1121.     /* Code Body                                                      */
  1122.     /*----------------------------------------------------------------*/
  1123.     gdi_layer_lock_frame_buffer();
  1124.     mmi_pen_editor_cancel_handwriting();
  1125.     if (gPenEditorSelectCandidate && (g_pen_editor_composition_state.candidate_state == PEN_EDITOR_CANDIDATE_OFF))
  1126.     {
  1127.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  1128.         mmi_pen_editor_confirm_selection();
  1129.     }
  1130.     if (KEY_0 == key &&
  1131.         (g_pen_editor_composition_state.candidate_state == PEN_EDITOR_CANDIDATE_OFF) &&
  1132.         INPUT_MODE_SM_PINYIN == MMI_current_input_mode && !gPenEditorSelectCandidate)
  1133.     {
  1134.         mmi_pen_editor_input_character(0x20, MMI_FALSE);
  1135.     }
  1136.     else if (KEY_1 == key && INPUT_MODE_SM_PINYIN == MMI_current_input_mode)
  1137.     {
  1138.     }
  1139.     else if (mmi_pen_editor_add_key_sequence(&g_pen_editor_key_sequence, key))
  1140.     {
  1141.         if (mmi_pen_editor_smart_bpmf_pinyin_get_candidates_by_key_sequence(&g_pen_editor_key_sequence, MMI_TRUE))
  1142.         {
  1143.             switch (gPenEditorInputBoxType)
  1144.             {
  1145.                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  1146.                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  1147.                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  1148.                     wgui_inputbox_RSK_label_clear = 1;
  1149.                     break;
  1150.                 case PEN_EDITOR_EMS_INPUT_BOX:
  1151.                     category28_RSK_label_clear = 1;
  1152.                     break;
  1153.                 default:
  1154.                     break;
  1155.             }
  1156.             /* Temp Solution for LSK Text Update */
  1157.             /* W05.35 For LSK Text Issue */
  1158.             if (g_pen_editor_key_sequence.KeyLength == 1 && MMI_FALSE == gPenEditorSelectCandidate)
  1159.             {
  1160.                 mmi_pen_editor_store_LSK_Text();
  1161.             }
  1162.             mmi_pen_editor_set_left_soft_key_select();
  1163.             set_left_softkey_function(mmi_pen_editor_left_soft_key_handler, KEY_EVENT_UP);
  1164.             set_left_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
  1165.             gPenEditorSelectCandidate = MMI_TRUE;
  1166.             switch (gPenEditorInputBoxType)
  1167.             {
  1168.                 case PEN_EDITOR_EMS_INPUT_BOX:
  1169.                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  1170.                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  1171.                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  1172.                     mmi_pen_editor_smart_bpmf_pinyin_register_arrow_keys();
  1173.                     break;
  1174.                 default:
  1175.                     break;
  1176.             }
  1177.             mmi_pen_editor_set_right_softkey(PEN_EDITOR_RSK_CLEAR);
  1178.         }
  1179.         else
  1180.         {
  1181.             mmi_pen_editor_del_key_sequence(&g_pen_editor_key_sequence);
  1182.         }
  1183.         mmi_pen_editor_show_composition_area(MMI_TRUE, PEN_EDITOR_CANDIDATE_ON_AND_FOCUS);
  1184.     }
  1185.     gdi_layer_unlock_frame_buffer();
  1186.     gdi_lcd_repaint_all();
  1187.     mmi_pen_editor_change_handwriting_area();
  1188. }
  1189. /*****************************************************************************
  1190.  * FUNCTION
  1191.  *  mmi_pen_editor_smart_bpmf_pinyin_key_up_handler
  1192.  * DESCRIPTION
  1193.  *  The handler of key up(number keys) in Smart BPMF/PinYin
  1194.  * PARAMETERS
  1195.  *  key     [IN]        The key index
  1196.  * RETURNS
  1197.  *  void
  1198.  *****************************************************************************/
  1199. void mmi_pen_editor_smart_bpmf_pinyin_key_up_handler(S32 key)
  1200. {
  1201.     /*----------------------------------------------------------------*/
  1202.     /* Local Variables                                                */
  1203.     /*----------------------------------------------------------------*/
  1204.     /*----------------------------------------------------------------*/
  1205.     /* Code Body                                                      */
  1206.     /*----------------------------------------------------------------*/
  1207.     UI_UNUSED_PARAMETER(key);
  1208. }
  1209. /*****************************************************************************
  1210.  * FUNCTION
  1211.  *  mmi_pen_editor_chinese_stroke_get_candidates_by_key_sequence
  1212.  * DESCRIPTION
  1213.  *  Get the candidates from the key sequence for Chinese Stroke
  1214.  * PARAMETERS
  1215.  *  key_sequence        [IN]     The key sequence of Chinese Stroke
  1216.  * RETURNS
  1217.  *  The number of the candidates
  1218.  *****************************************************************************/
  1219. S32 mmi_pen_editor_chinese_stroke_get_candidates_by_key_sequence(mmi_pen_editor_key_sequence_struct *key_sequence)
  1220. {
  1221.     /*----------------------------------------------------------------*/
  1222.     /* Local Variables                                                */
  1223.     /*----------------------------------------------------------------*/
  1224.     UI_character_type candidate_buffer[PEN_EDITOR_MAX_CANDIDATE_SIZE];
  1225.     UI_character_type stroke_buffer[PEN_EDITOR_MAX_KEY_BUFFER_SIZE];
  1226.     U32 num = 0, i = 0;
  1227.     /*----------------------------------------------------------------*/
  1228.     /* Code Body                                                      */
  1229.     /*----------------------------------------------------------------*/
  1230.     num = mmi_ime_chinese_stroke_get_candidates_by_key_sequence(
  1231.             key_sequence->KeySequence,
  1232.             key_sequence->KeyLength,
  1233.             candidate_buffer,
  1234.             stroke_buffer);
  1235.     if (num)
  1236.     {
  1237.         mmi_pen_editor_reset_candidate_index();
  1238.         if ((g_pen_editor_composition_state.candidate_state == PEN_EDITOR_CANDIDATE_OFF))
  1239.         {
  1240.             int change_height = 0;
  1241.             if (PEN_EDITOR_VK_ON == gPenEditorVKState && (GUI_VIRTUAL_KEYBOARD_TRAY != MMI_virtual_keyboard.lang_type))
  1242.             {
  1243.                 mmi_pen_editor_vk_hide();
  1244.             }
  1245.             gPenEditorVKState = PEN_EDITOR_VK_OFF;
  1246.             change_height -= g_pen_editor_composition_input_box.height;
  1247.             mmi_pen_editor_resize_content_area(change_height);
  1248.             g_pen_editor_composition_state.candidate_state = PEN_EDITOR_CANDIDATE_ON_NOT_FOCUS;
  1249.         }
  1250.         gui_single_line_input_box_delete_all(&g_pen_editor_composition_input_box);
  1251.         for (i = 0; i < g_pen_editor_key_sequence.KeyLength; i++)
  1252.         {
  1253.             gui_single_line_input_box_insert_character(&g_pen_editor_composition_input_box, stroke_buffer[i]);
  1254.         }
  1255.         mmi_pen_editor_show_composition_area(MMI_FALSE, PEN_EDITOR_CANDIDATE_ON_NOT_FOCUS);
  1256.         gui_single_line_input_box_delete_all(&gPenEditorCandidateInputBox);
  1257.         for (i = 0; i < num; i++)
  1258.         {
  1259.             gui_single_line_input_box_insert_character(&gPenEditorCandidateInputBox, candidate_buffer[i]);
  1260.         }
  1261.         gui_single_line_input_box_goto_first_character(&gPenEditorCandidateInputBox);
  1262.         gui_single_line_input_box_next(&gPenEditorCandidateInputBox);
  1263.         mmi_pen_editor_show_candidate_area(MMI_TRUE, PEN_EDITOR_CANDIDATE_ON_AND_FOCUS);
  1264.     }
  1265.     return num;
  1266. }
  1267. /*****************************************************************************
  1268.  * FUNCTION
  1269.  *  mmi_pen_editor_smart_bpmf_pinyin_get_candidates_by_key_sequence
  1270.  * DESCRIPTION
  1271.  *  Get the candidates from the key sequence for Smart BPMF/PinYin
  1272.  * PARAMETERS
  1273.  *  key_sequence        [IN]         The key sequence of Smart BPMF/PinYin
  1274.  *  is_reset            [IN]         MMI_TRUE : Resest the index for the composition box
  1275.  *                                   MMI_FALSE : Do not resest the index for the composition box
  1276.  * RETURNS
  1277.  *  The number of the candidates
  1278.  *****************************************************************************/
  1279. S32 mmi_pen_editor_smart_bpmf_pinyin_get_candidates_by_key_sequence(
  1280.         mmi_pen_editor_key_sequence_struct *key_sequence,
  1281.         BOOL is_reset)
  1282. {
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Local Variables                                                */
  1285.     /*----------------------------------------------------------------*/
  1286.     UI_character_type syllable_buffer[PEN_EDITOR_MAX_SYLLABLE_BUFFER_SIZE];
  1287.     UI_character_type candidate_buffer[PEN_EDITOR_MAX_CANDIDATE_SIZE];
  1288.     U32 num = 0, i = 0, j = 0, k = 0;
  1289.     S32 start_index,end_index;
  1290.     /*----------------------------------------------------------------*/
  1291.     /* Code Body                                                      */
  1292.     /*----------------------------------------------------------------*/
  1293.     if (is_reset)
  1294.     {
  1295.         start_index = 0;
  1296.         end_index = PEN_EDITOR_MAX_SYLLABLE_CANDIDATE_SIZE - 1;
  1297.     }
  1298.     else
  1299.     {
  1300.         start_index = g_pen_editor_composition_page * PEN_EDITOR_MAX_SYLLABLE_CANDIDATE_SIZE;
  1301.         end_index = (g_pen_editor_composition_page + 1) * PEN_EDITOR_MAX_SYLLABLE_CANDIDATE_SIZE - 1;
  1302.     }
  1303.     num = mmi_ime_smart_bpmf_pinyin_get_syllable_by_key_sequence(
  1304.             key_sequence->KeySequence,
  1305.             key_sequence->KeyLength,
  1306.             syllable_buffer,
  1307.             start_index,
  1308.             end_index);
  1309.     if (num)
  1310.     {
  1311.         mmi_pen_editor_reset_candidate_index();
  1312.         if (is_reset)
  1313.         {
  1314.             mmi_pen_editor_reset_composition_index();
  1315.         }
  1316.         if ((g_pen_editor_composition_state.candidate_state == PEN_EDITOR_CANDIDATE_OFF))
  1317.         {
  1318.             int change_height = 0;
  1319.             if (PEN_EDITOR_VK_ON == gPenEditorVKState && (GUI_VIRTUAL_KEYBOARD_TRAY != MMI_virtual_keyboard.lang_type))
  1320.             {
  1321.                 mmi_pen_editor_vk_hide();
  1322.             }
  1323.             gPenEditorVKState = PEN_EDITOR_VK_OFF;
  1324.             change_height -= g_pen_editor_composition_input_box.height;
  1325.             mmi_pen_editor_resize_content_area(change_height);
  1326.             g_pen_editor_composition_state.candidate_state = PEN_EDITOR_CANDIDATE_ON_AND_FOCUS;
  1327.         }
  1328.         memset(g_pen_editor_syllable_table, 0, sizeof(g_pen_editor_syllable_table));
  1329.         gui_single_line_input_box_delete_all(&g_pen_editor_composition_input_box);
  1330.         for (i = 0;; i++)
  1331.         {
  1332.             if (syllable_buffer[i])
  1333.             {
  1334.                 gui_single_line_input_box_insert_character(&g_pen_editor_composition_input_box, syllable_buffer[i]);
  1335.                 if (syllable_buffer[i] == 0x20)
  1336.                 {
  1337.                     g_pen_editor_syllable_table[j][k] = '';
  1338.                     j++;
  1339.                     k = 0;
  1340.                 }
  1341.                 else
  1342.                 {
  1343.                     g_pen_editor_syllable_table[j][k++] = syllable_buffer[i];
  1344.                 }
  1345.             }
  1346.             else
  1347.             {
  1348.                 gui_single_line_input_box_insert_character(&g_pen_editor_composition_input_box, 0x20);
  1349.                 g_pen_editor_syllable_table[j+1][0] = syllable_buffer[i];
  1350.                 break;
  1351.             }
  1352.         }
  1353.         gui_single_line_input_box_goto_first_character(&g_pen_editor_composition_input_box);
  1354.         for (i = 0;;)
  1355.         {
  1356.             UI_character_type ch, ch1, ch2;
  1357.             ch1 = *(g_pen_editor_composition_input_box.current_text_p - 2);
  1358.             ch2 = *(g_pen_editor_composition_input_box.current_text_p - 1);
  1359.             ch = ch1 | (ch2 << 8);
  1360.             if (ch == 0x20)
  1361.             {
  1362.                 i++;
  1363.             }
  1364.             if (i == g_pen_editor_composition_index)
  1365.             {
  1366.                 for (i = 0; i < g_pen_editor_key_sequence.KeyLength + 1; i++)
  1367.                 {
  1368.                     gui_single_line_input_box_next(&g_pen_editor_composition_input_box);
  1369.                 }
  1370.                 break;
  1371.             }
  1372.             gui_single_line_input_box_next(&g_pen_editor_composition_input_box);
  1373.         }
  1374.         gui_single_line_input_box_previous(&g_pen_editor_composition_input_box);
  1375.         gui_single_line_input_box_highlight_cursor_number(
  1376.             &g_pen_editor_composition_input_box,
  1377.             g_pen_editor_key_sequence.KeyLength);
  1378.         //mmi_pen_editor_show_composition_area(MMI_TRUE, PEN_EDITOR_CANDIDATE_ON_AND_FOCUS);
  1379.         num = mmi_ime_get_candidates_by_composition(
  1380.                 g_pen_editor_syllable_table[g_pen_editor_composition_index],
  1381.                 candidate_buffer);
  1382.         gui_single_line_input_box_delete_all(&gPenEditorCandidateInputBox);
  1383.         for (i = 0; i < num; i++)
  1384.         {
  1385.             gui_single_line_input_box_insert_character(&gPenEditorCandidateInputBox, candidate_buffer[i]);
  1386.         }
  1387.         gui_single_line_input_box_goto_first_character(&gPenEditorCandidateInputBox);
  1388.         gui_single_line_input_box_next(&gPenEditorCandidateInputBox);
  1389.         mmi_pen_editor_show_candidate_area(MMI_TRUE, PEN_EDITOR_CANDIDATE_ON_NOT_FOCUS);
  1390.     }
  1391.     return num;
  1392. }
  1393. /*****************************************************************************
  1394.  * FUNCTION
  1395.  *  mmi_pen_editor_cancel_handwriting
  1396.  * DESCRIPTION
  1397.  *  Cancel the handwriting. This function is usually used when key down
  1398.  * PARAMETERS
  1399.  *  void
  1400.  * RETURNS
  1401.  *  void
  1402.  *****************************************************************************/
  1403. void mmi_pen_editor_cancel_handwriting(void)
  1404. {
  1405.     /*----------------------------------------------------------------*/
  1406.     /* Local Variables                                                */
  1407.     /*----------------------------------------------------------------*/
  1408.     /*----------------------------------------------------------------*/
  1409.     /* Code Body                                                      */
  1410.     /*----------------------------------------------------------------*/
  1411.     if (!gPenEditorFirstStroke)
  1412.     {
  1413.         int changed_height = 0;
  1414.         if (gPenEditorGDIHandler != NULL && *gPenEditorGDIHandler != GDI_ERROR_HANDLE)
  1415.         {
  1416.             gdi_layer_push_and_set_active(*gPenEditorGDIHandler);
  1417.             gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  1418.             gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  1419.             gdi_layer_pop_and_restore_active();
  1420.         }
  1421.         gui_cancel_timer(mmi_pen_editor_stroke_up_timer_handler);
  1422.         mmi_pen_begin_strokes_of_character();
  1423.         gdi_layer_lock_frame_buffer();
  1424.         gPenEditorVKState = PEN_EDITOR_VK_ON;
  1425.         if (gPenEditorShowVK && (gPenEditorCandidateInputBox.y >= (PEN_EDITOR_Y_OF_CANDIDATE_INPUT_BOX_IN_BOTTOM)))
  1426.         {
  1427.             /* W05.47 Change the Input Control Height when the VK is not Tray Type */
  1428.             if (!(GUI_VIRTUAL_KEYBOARD_TRAY == MMI_virtual_keyboard.lang_type
  1429.                   || GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY == MMI_virtual_keyboard.lang_type
  1430.                   || GUI_VIRTUAL_KEYBOARD_NUMBER_TRAY == MMI_virtual_keyboard.lang_type
  1431.                   || GUI_VIRTUAL_KEYBOARD_NUMBER_DOT_TRAY == MMI_virtual_keyboard.lang_type))
  1432.             {
  1433.                 changed_height = gPenEditorCandidateInputBox.height;
  1434.                 if (gPenEditorVKCandidate)
  1435.                 {
  1436.                     changed_height -= gPenEditorCandidateInputBox.height;
  1437.                 }
  1438.                 changed_height -= MMI_virtual_keyboard.height;
  1439.                 if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX != gPenEditorInputBoxType)
  1440.                 {
  1441.                     mmi_pen_editor_resize_content_area(changed_height);
  1442.                 }
  1443.             }
  1444.         }
  1445.         if (gPenEditorShowVK)
  1446.         {
  1447.             mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  1448.         }
  1449.         if (gPenEditorVKCandidate)
  1450.         {
  1451.             if (gPenEditorShowVK)
  1452.             {
  1453.                 gui_move_single_line_input_box(
  1454.                     &gPenEditorCandidateInputBox,
  1455.                     gPenEditorCandidateInputBox.x,
  1456.                     MMI_virtual_keyboard.y - gPenEditorCandidateInputBox.height - 2);
  1457.             }
  1458.             mmi_pen_editor_hide_candidate_area();
  1459.         }
  1460.         gdi_layer_unlock_frame_buffer();
  1461.         gdi_lcd_repaint_all();
  1462.         return;
  1463.     }
  1464. }
  1465. /*****************************************************************************
  1466.  * FUNCTION
  1467.  *  mmi_pen_editor_set_handwriting_style
  1468.  * DESCRIPTION
  1469.  *  Set the current handwriting Style
  1470.  * PARAMETERS
  1471.  *  style       [IN]        PEN_EDITOR_HANDWRITING_STYLE_FULL_SCREEN : Handwriting on the full screen
  1472.  *                          PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK : Handwriting with Handwriting blocks
  1473.  * RETURNS
  1474.  *  void
  1475.  *****************************************************************************/
  1476. void mmi_pen_editor_set_handwriting_style(mmi_pen_editor_handwriting_style_enum style)
  1477. {
  1478.     /*----------------------------------------------------------------*/
  1479.     /* Local Variables                                                */
  1480.     /*----------------------------------------------------------------*/
  1481.     /*----------------------------------------------------------------*/
  1482.     /* Code Body                                                      */
  1483.     /*----------------------------------------------------------------*/
  1484.     g_pen_editor_handwriting_style = style;
  1485. }
  1486. /*****************************************************************************
  1487.  * FUNCTION
  1488.  *  mmi_pen_editor_get_handwriting_style
  1489.  * DESCRIPTION
  1490.  *  To get the current handwriting style
  1491.  * PARAMETERS
  1492.  *  void
  1493.  * RETURNS
  1494.  *  PEN_EDITOR_HANDWRITING_STYLE_FULL_SCREEN : Handwriting on the full screen
  1495.  *  PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK : Handwriting with Handwriting blocks
  1496.  *****************************************************************************/
  1497. mmi_pen_editor_handwriting_style_enum mmi_pen_editor_get_handwriting_style(void)
  1498. {
  1499.     /*----------------------------------------------------------------*/
  1500.     /* Local Variables                                                */
  1501.     /*----------------------------------------------------------------*/
  1502.     /*----------------------------------------------------------------*/
  1503.     /* Code Body                                                      */
  1504.     /*----------------------------------------------------------------*/
  1505.     return g_pen_editor_handwriting_style;
  1506. }
  1507. /*****************************************************************************
  1508.  * FUNCTION
  1509.  *  mmi_pen_editor_multi_block_stroke_up_handler
  1510.  * DESCRIPTION
  1511.  *  Draw the last point of the stroke and start the timer to check this is the last stroke or not if pos in the handwriting block
  1512.  * PARAMETERS
  1513.  *  pos     [IN]        The position of the stroke up event
  1514.  * RETURNS
  1515.  *  void
  1516.  *****************************************************************************/
  1517. void mmi_pen_editor_multi_block_stroke_up_handler(mmi_pen_point_struct pos)
  1518. {
  1519.     /*----------------------------------------------------------------*/
  1520.     /* Local Variables                                                */
  1521.     /*----------------------------------------------------------------*/
  1522.     int active_block;
  1523.     /*----------------------------------------------------------------*/
  1524.     /* Code Body                                                      */
  1525.     /*----------------------------------------------------------------*/
  1526.     /* if hand writing is not enabled, it should not go here */
  1527.     if (!gPenEditorEnableHandWriting)
  1528.     {
  1529.         MMI_DBG_ASSERT(0);
  1530.         return;
  1531.     }
  1532.     active_block = mmi_pen_editor_handwriting_check_block(pos);
  1533.     if (active_block)
  1534.     {
  1535.         mmi_pen_editor_stroke_move_handler(pos);
  1536.         gui_cancel_timer(mmi_pen_editor_stroke_up_timer_handler);
  1537.         /* The end of the stroke, if no more stroke in the period, the end of the character */
  1538.         gui_start_timer(PEN_EDITOR_CHARACTER_END_PERIOD, mmi_pen_editor_stroke_up_timer_handler);
  1539.     }
  1540.     gPenEditorPreviousPoint.x = -1;
  1541.     gPenEditorPreviousPoint.y = -1;
  1542. }
  1543. /*****************************************************************************
  1544.  * FUNCTION
  1545.  *  mmi_pen_editor_handwriting_check_block
  1546.  * DESCRIPTION
  1547.  *  To check the position is on which block (0 : out of handwriting area)
  1548.  * PARAMETERS
  1549.  *  pos     [IN]        The position of the point to check
  1550.  * RETURNS
  1551.  *  Which block the position is on
  1552.  *****************************************************************************/
  1553. S32 mmi_pen_editor_handwriting_check_block(mmi_pen_point_struct pos)
  1554. {
  1555.     /*----------------------------------------------------------------*/
  1556.     /* Local Variables                                                */
  1557.     /*----------------------------------------------------------------*/
  1558.     MMI_BOOL ret = MMI_FALSE;
  1559.     S32 active_block = 0;
  1560.     /*----------------------------------------------------------------*/
  1561.     /* Code Body                                                      */
  1562.     /*----------------------------------------------------------------*/
  1563.     ret = PEN_CHECK_BOUND(
  1564.             pos.x,
  1565.             pos.y,
  1566.             1,
  1567.             MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT + gPenEditorCandidateInputBox.height + 3,
  1568.             ((UI_device_width - 2) >> 1),
  1569.             PEN_EDITOR_BLOCK_HEIGHT - gPenEditorCandidateInputBox.height + 3);
  1570.     if (ret)
  1571.     {
  1572.         active_block = 1;
  1573.     }
  1574.     ret = PEN_CHECK_BOUND(
  1575.             pos.x,
  1576.             pos.y,
  1577.             1 + ((UI_device_width - 2) >> 1),
  1578.             MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT + gPenEditorCandidateInputBox.height + 3,
  1579.             ((UI_device_width - 2) >> 1),
  1580.             PEN_EDITOR_BLOCK_HEIGHT - gPenEditorCandidateInputBox.height + 3);
  1581.     if (ret)
  1582.     {
  1583.         active_block = 2;
  1584.     }
  1585.     return active_block;
  1586. }
  1587. /*****************************************************************************
  1588.  * FUNCTION
  1589.  *  mmi_pen_editor_handwriting_direct_input
  1590.  * DESCRIPTION
  1591.  *  Insert the recognizing result from handwriting to the input box directly
  1592.  * PARAMETERS
  1593.  *  void
  1594.  * RETURNS
  1595.  *  void
  1596.  *****************************************************************************/
  1597. void mmi_pen_editor_handwriting_direct_input(void)
  1598. {
  1599.     /*----------------------------------------------------------------*/
  1600.     /* Local Variables                                                */
  1601.     /*----------------------------------------------------------------*/
  1602.     UI_character_type candidate_buffer[10];
  1603.     int num = 0;
  1604.     /*----------------------------------------------------------------*/
  1605.     /* Code Body                                                      */
  1606.     /*----------------------------------------------------------------*/
  1607.     /* The end of the character, pass the stroke data for hand writing recognization */
  1608.     gui_cancel_timer(mmi_pen_editor_stroke_up_timer_handler);
  1609.     mmi_pen_end_strokes_of_character();
  1610.     /* mmi_pen_end_strokes_of_character_with_dropping_last_point(); */
  1611. #if defined(__MMI_HAND_WRITING_GET_STROKES__)
  1612.     mmi_pen_editor_save_stroke_to_file();
  1613. #endif 
  1614.     gdi_layer_push_and_set_active(*gPenEditorGDIHandler);
  1615.     gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  1616.     gdi_layer_pop_and_restore_active();
  1617.     gPenEditorFirstStroke = MMI_TRUE;
  1618.     switch (MMI_current_input_mode)
  1619.     {
  1620. #ifdef __MMI_LANG_TR_CHINESE__      //KP Jerry add on 2007-4-17
  1621.         case INPUT_MODE_TR_MULTITAP_BOPOMO:
  1622.         case INPUT_MODE_TR_BOPOMO:
  1623.         case INPUT_MODE_TR_STROKE:
  1624.             num = mmi_pen_editor_hand_writing_get_candidates(
  1625.                     (U16*) gPenEditorStrokeBuffer,
  1626.                     candidate_buffer,
  1627.                     PEN_EDITOR_TRADITIONAL_CHINESE,
  1628.                     1);
  1629.             break;
  1630. #endif/*__MMI_LANG_TR_CHINESE__*/      //KP Jerry add on 2007-4-17
  1631. #ifdef __MMI_LANG_SM_CHINESE__      //KP Jerry add on 2007-4-17
  1632.         case INPUT_MODE_SM_MULTITAP_PINYIN:
  1633.         case INPUT_MODE_SM_PINYIN:
  1634.         case INPUT_MODE_SM_STROKE:
  1635.             num = mmi_pen_editor_hand_writing_get_candidates(
  1636.                     (U16*) gPenEditorStrokeBuffer,
  1637.                     candidate_buffer,
  1638.                     PEN_EDITOR_SIMPLIFIED_CHINESE,
  1639.                     1);
  1640.             break;
  1641. #endif/*__MMI_LANG_SM_CHINESE__*/      //KP Jerry add on 2007-4-17
  1642. //KP Jerry add on 2007-4-17 start
  1643. #ifdef __MMI_LANG_VIETNAMESE__
  1644.         case INPUT_MODE_MULTITAP_UPPERCASE_VIETNAMESE:
  1645.         case INPUT_MODE_SMART_UPPERCASE_VIETNAMESE:
  1646.             num = mmi_pen_editor_hand_writing_get_candidates(
  1647.                     (U16*) gPenEditorStrokeBuffer,
  1648.                     candidate_buffer,
  1649.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  1650.                     1);
  1651.             break;
  1652.         case INPUT_MODE_MULTITAP_LOWERCASE_VIETNAMESE:
  1653.         case INPUT_MODE_SMART_LOWERCASE_VIETNAMESE:
  1654.             num = mmi_pen_editor_hand_writing_get_candidates(
  1655.                     (U16*) gPenEditorStrokeBuffer,
  1656.                     candidate_buffer,
  1657.                     PEN_EDITOR_LOWER_CASE_ENGLISH,
  1658.                     1);
  1659.             break;
  1660. #endif /* __MMI_LANG_VIETNAMESE__ */ 
  1661. #ifdef __MMI_LANG_RUSSIAN__
  1662.         case INPUT_MODE_MULTITAP_UPPERCASE_RUSSIAN:
  1663.         case INPUT_MODE_SMART_UPPERCASE_RUSSIAN:
  1664.             num = mmi_pen_editor_hand_writing_get_candidates(
  1665.                     (U16*) gPenEditorStrokeBuffer,
  1666.                     candidate_buffer,
  1667.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  1668.                     1);
  1669.             break;
  1670.         case INPUT_MODE_MULTITAP_LOWERCASE_RUSSIAN:
  1671.         case INPUT_MODE_SMART_LOWERCASE_RUSSIAN:
  1672.             num = mmi_pen_editor_hand_writing_get_candidates(
  1673.                     (U16*) gPenEditorStrokeBuffer,
  1674.                     candidate_buffer,
  1675.                     PEN_EDITOR_LOWER_CASE_ENGLISH,
  1676.                     1);
  1677.             break;
  1678. #endif /* __MMI_LANG_RUSSIAN__ */ 
  1679. #ifdef __MMI_LANG_THAI__
  1680.         case INPUT_MODE_MULTITAP_THAI:
  1681.         case INPUT_MODE_SMART_THAI:
  1682.             num = mmi_pen_editor_hand_writing_get_candidates(
  1683.                     (U16*) gPenEditorStrokeBuffer,
  1684.                     candidate_buffer,
  1685.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  1686.                     1);
  1687.             break;
  1688. #endif /* __MMI_LANG_THAI__ */ 
  1689. //KP Jerry add on 2007-4-17 end
  1690.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
  1691.         case INPUT_MODE_SMART_UPPERCASE_ABC:
  1692.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC:
  1693.             num = mmi_pen_editor_hand_writing_get_candidates(
  1694.                     (U16*) gPenEditorStrokeBuffer,
  1695.                     candidate_buffer,
  1696.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  1697.                     1);
  1698.             break;
  1699.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
  1700.         case INPUT_MODE_SMART_LOWERCASE_ABC:
  1701.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC:
  1702.             num = mmi_pen_editor_hand_writing_get_candidates(
  1703.                     (U16*) gPenEditorStrokeBuffer,
  1704.                     candidate_buffer,
  1705.                     PEN_EDITOR_LOWER_CASE_ENGLISH,
  1706.                     1);
  1707.             break;
  1708.         case INPUT_MODE_123:
  1709.         case INPUT_MODE_123_SYMBOLS:
  1710.             num = mmi_pen_editor_hand_writing_get_candidates(
  1711.                     (U16*) gPenEditorStrokeBuffer,
  1712.                     candidate_buffer,
  1713.                     PEN_EDITOR_NUMBER,
  1714.                     1);
  1715.             break;
  1716.         default:
  1717.             break;
  1718.     }
  1719.     if (num)
  1720.     {
  1721.         mmi_pen_editor_input_character(candidate_buffer[0], MMI_FALSE);
  1722.     }
  1723.     g_pen_editor_active_block = 0;
  1724.     gPenEditorVKState = PEN_EDITOR_VK_ON;
  1725.     mmi_pen_begin_strokes_of_character();
  1726. }
  1727. /*****************************************************************************
  1728.  * FUNCTION
  1729.  *  mmi_pen_editor_draw_handwriting_block
  1730.  * DESCRIPTION
  1731.  *  To draw the handwriting block area
  1732.  * PARAMETERS
  1733.  *  void
  1734.  * RETURNS
  1735.  *  void
  1736.  *****************************************************************************/
  1737. void mmi_pen_editor_draw_handwriting_block(void)
  1738. {
  1739.     /*----------------------------------------------------------------*/
  1740.     /* Local Variables                                                */
  1741.     /*----------------------------------------------------------------*/
  1742.     color c;
  1743.     /*----------------------------------------------------------------*/
  1744.     /* Code Body                                                      */
  1745.     /*----------------------------------------------------------------*/
  1746.     c.r = 255;
  1747.     c.g = 255;
  1748.     c.b = 255;
  1749.     c.alpha = 100;
  1750.     if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  1751.     {
  1752.         gdi_draw_solid_rect(
  1753.             0,
  1754.             MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT - 2,
  1755.             UI_device_width - 1,
  1756.             MMI_content_y + MMI_content_height - 1,
  1757.             GDI_COLOR_TRANSPARENT);
  1758.     }
  1759.     else
  1760.     {
  1761.         gui_fill_rectangle(
  1762.             0,
  1763.             MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT - 2,
  1764.             UI_device_width - 1,
  1765.             MMI_content_y + MMI_content_height - 1,
  1766.             c);
  1767.     }
  1768. gdi_draw_rect(
  1769. 1,
  1770.     MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT + gPenEditorCandidateInputBox.height + 3, 
  1771. UI_device_width - 2,
  1772. MMI_content_y + MMI_content_height - 1,
  1773. GDI_COLOR_BLACK);
  1774. gdi_draw_line(
  1775. 1 + ((UI_device_width - 2) >> 1),
  1776.     MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT + gPenEditorCandidateInputBox.height + 3, 
  1777. 1 + ((UI_device_width - 2) >> 1),
  1778. MMI_content_y + MMI_content_height - 1,
  1779. GDI_COLOR_BLACK);
  1780. gui_move_single_line_input_box(
  1781. &gPenEditorCandidateInputBox, 
  1782. gPenEditorCandidateInputBox.x, 
  1783. MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT + 1);
  1784. }
  1785. /*****************************************************************************
  1786.  * FUNCTION
  1787.  *  mmi_pen_editor_reset_LSK_and_RSK_state
  1788.  * DESCRIPTION
  1789.  *  Reset LSK and RSK label and function to un-selected state
  1790.  * PARAMETERS
  1791.  *  void
  1792.  * RETURNS
  1793.  *  void
  1794.  *****************************************************************************/
  1795. void mmi_pen_editor_reset_LSK_and_RSK_state(void)
  1796. {
  1797.     /*----------------------------------------------------------------*/
  1798.     /* Local Variables                                                */
  1799.     /*----------------------------------------------------------------*/
  1800.     /*----------------------------------------------------------------*/
  1801.     /* Code Body                                                      */
  1802.     /*----------------------------------------------------------------*/
  1803.     if (gPenEditorSelectCandidate)
  1804.     {
  1805.         gPenEditorSelectCandidate = MMI_FALSE;
  1806.         mmi_pen_editor_set_left_soft_key();
  1807.         switch (gPenEditorInputBoxType)
  1808.         {
  1809.             case PEN_EDITOR_EMS_INPUT_BOX:
  1810.                 /* LSK */
  1811.                 register_EMS_inputbox_keys();
  1812.                 /* RSK */
  1813.                 handle_category28_input();
  1814.                 wgui_set_EMS_inputbox_RSK();
  1815.                 break;
  1816.             case PEN_EDITOR_MULTILINE_INPUT_BOX:
  1817.             case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  1818.             case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  1819.                 /* LSK */
  1820.                 register_multiline_inputbox_keys();
  1821.                 /* RSK */
  1822.                 wgui_handle_inputbox_input();
  1823.                 wgui_set_RSK();
  1824.                 
  1825.                 if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  1826.                 {
  1827.                     cat201_register_key_func();
  1828.                 }
  1829.                 break;
  1830.             default:
  1831.                 break;
  1832.         }
  1833.         mmi_pen_editor_reset_vk_text(&gPenEditorVKText);
  1834.         wgui_set_virtual_keyboard_display_area((U8*) gPenEditorVKText.VKText, MMI_FALSE);
  1835.     }     
  1836. }
  1837. /*****************************************************************************
  1838.  * FUNCTION
  1839.  *  mmi_pen_editor_enable_multi_block_handwriting
  1840.  * DESCRIPTION
  1841.  *  Change from the main virtual keybaord mode to the multi-block handwriting mode. Enable the stroke mode.
  1842.  * PARAMETERS
  1843.  *  void
  1844.  * RETURNS
  1845.  *  void
  1846.  *****************************************************************************/
  1847. void mmi_pen_editor_enable_multi_block_handwriting(void)
  1848. {
  1849.     /*----------------------------------------------------------------*/
  1850.     /* Local Variables                                                */
  1851.     /*----------------------------------------------------------------*/
  1852.     int changed_height = 0;
  1853.     U16 input_type_only = MMI_current_input_type & INPUT_TYPE_MASK;
  1854.     /*----------------------------------------------------------------*/
  1855.     /* Code Body                                                      */
  1856.     /*----------------------------------------------------------------*/
  1857.     mmi_pen_editor_hide_virtual_keyboard_area();
  1858. changed_height = gPenEditorCandidateInputBox.height;
  1859.     if (changed_height < MMI_virtual_keyboard.height)
  1860.     {
  1861.         changed_height = MMI_virtual_keyboard.height;
  1862.         if (gPenEditorVKCandidate)
  1863.         {
  1864.             changed_height += (gPenEditorCandidateInputBox.height + 1);
  1865.         }
  1866.         gPenEditorVKCandidate = MMI_FALSE;
  1867.     }
  1868.     changed_height -= PEN_EDITOR_BLOCK_HEIGHT;
  1869. gui_reset_clip();
  1870. mmi_pen_editor_resize_content_area(changed_height);
  1871.     mmi_pen_editor_draw_handwriting_block();
  1872.     wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_TRAY);
  1873.     if (PEN_EDITOR_INLINE_TEXT == gPenEditorInputBoxType
  1874.         || PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  1875.     {
  1876.         s32 temp_multiline_height = MMI_multiline_inputbox.height;
  1877.         MMI_BOOL temp_VKCandidate = gPenEditorVKCandidate;
  1878.         gui_virtual_keyboard_language_enum keyboard_type = MMI_virtual_keyboard.lang_type;
  1879.         mmi_pen_editor_vk_list_menu_resize();
  1880.         if (PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  1881.         {
  1882.             gui_resize_multi_line_input_box(
  1883.                 &MMI_multiline_inputbox,
  1884.                 MMI_multiline_inputbox.width,
  1885.                 temp_multiline_height);
  1886.             redraw_fixed_list();
  1887.             redraw_current_inline_item();
  1888.             gPenEditorVKCandidate = temp_VKCandidate;
  1889.         }
  1890.         wgui_setup_virtual_keyboard(keyboard_type);
  1891.     }
  1892.     wgui_move_virtual_keyboard(
  1893.         MMI_virtual_keyboard.x,
  1894.         MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT + 3);
  1895.     mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  1896.     if (!(INPUT_TYPE_NUMERIC_PASSWORD == input_type_only ||
  1897.           INPUT_TYPE_SAT_NUMERIC_PASSWORD == input_type_only) && (!g_pen_editor_disable_handwriting))
  1898.     {
  1899.     g_multi_block_stroke_area[0].x1 = 3;
  1900.             g_multi_block_stroke_area[0].y1 =
  1901.                 MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT +
  1902.                 mmi_pen_editor_compute_candidate_input_box_height() + 4;
  1903.             g_multi_block_stroke_area[0].x2 = (UI_device_width >> 1) - 2;
  1904.     g_multi_block_stroke_area[0].y2 = MMI_content_y + MMI_content_height - 3;
  1905.     g_multi_block_stroke_area[1].x1 = (UI_device_width >> 1) + 1;
  1906.             g_multi_block_stroke_area[1].y1 =
  1907.                 MMI_content_y + MMI_content_height - PEN_EDITOR_BLOCK_HEIGHT +
  1908.                 mmi_pen_editor_compute_candidate_input_box_height() + 4;
  1909.             g_multi_block_stroke_area[1].x2 = UI_device_width - 3;
  1910.     g_multi_block_stroke_area[1].y2 = MMI_content_y + MMI_content_height - 3;
  1911. gPenEditorEnableHandWriting = MMI_TRUE;
  1912.         mmi_pen_start_capture_strokes(
  1913.             PEN_EDITOR_STROKE_BUFFER_SIZE,
  1914.             gPenEditorStrokeBuffer,
  1915.             2,
  1916.             g_multi_block_stroke_area,
  1917.             NULL);
  1918.         memcpy(
  1919.             &g_pen_editor_original_handwriting_area,
  1920.             &g_multi_block_stroke_area,
  1921.             sizeof(mmi_pen_handwriting_area_struct));
  1922.         
  1923.         /*
  1924.          * 06.38 Fixing LSK/RSK didnt be properly set when changing state 
  1925.          * from Virtual Keyboard to Multi-Block HandWriting in the case of
  1926.          * Candidate Inputbox in selection state.
  1927.          */
  1928.         mmi_pen_editor_reset_LSK_and_RSK_state();
  1929.         mmi_pen_register_stroke_down_handler(mmi_pen_editor_multi_block_stroke_down_handler);
  1930.         mmi_pen_register_stroke_move_handler(NULL, NULL, mmi_pen_editor_multi_block_stroke_move_handler);
  1931.         mmi_pen_register_stroke_up_handler(mmi_pen_editor_multi_block_stroke_up_handler);
  1932.         mmi_pen_editor_hand_writing_initailize();
  1933.         mmi_pen_begin_strokes_of_character();
  1934.     }
  1935. }
  1936. /*****************************************************************************
  1937.  * FUNCTION
  1938.  *  mmi_pen_editor_disable_multi_block_handwriting
  1939.  * DESCRIPTION
  1940.  *  Change Multi-Block handwriting to the main virtual keyboard mode. Disable the stroke mode.
  1941.  * PARAMETERS
  1942.  *  void
  1943.  * RETURNS
  1944.  *  void
  1945.  *****************************************************************************/
  1946. void mmi_pen_editor_disable_multi_block_handwriting(void)
  1947. {
  1948.     /*----------------------------------------------------------------*/
  1949.     /* Local Variables                                                */
  1950.     /*----------------------------------------------------------------*/
  1951.     int changed_height = 0;
  1952.     /*----------------------------------------------------------------*/
  1953.     /* Code Body                                                      */
  1954.     /*----------------------------------------------------------------*/
  1955.     mmi_pen_stop_capture_strokes();
  1956.     if (PEN_EDITOR_QUICK_SEARCH_SINGLE_LINE_INPU_BOX == gPenEditorInputBoxType)
  1957.     {
  1958.         changed_height = MMI_virtual_keyboard.height;
  1959.         mmi_pen_editor_set_virtual_keyboard_by_input_mode(MMI_current_input_mode);
  1960.         changed_height -= MMI_virtual_keyboard.height;
  1961.         mmi_pen_editor_resize_content_area(changed_height);
  1962.         RedrawCategoryControlledArea200Screen(NULL);
  1963.         return;
  1964.     }
  1965.     if (GUI_VIRTUAL_KEYBOARD_TRAY == MMI_virtual_keyboard.lang_type)
  1966.     {
  1967. changed_height = PEN_EDITOR_BLOCK_HEIGHT;
  1968. //KP Jerry modify on 2007-4-17 start
  1969.         if (INPUT_MODE_MULTITAP_LOWERCASE_ABC == MMI_current_input_mode ||     //KP Jerry remove "else" for adjust them order on 2007-4-16
  1970.                  INPUT_MODE_SMART_LOWERCASE_ABC == MMI_current_input_mode ||
  1971.                  INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC == MMI_current_input_mode)
  1972.         {
  1973.             if (gPenEditorVKCandidate)
  1974.             {
  1975.                 changed_height += gPenEditorCandidateInputBox.height;
  1976.             }
  1977.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_ENGLISH);
  1978.         }
  1979.         else if (INPUT_MODE_MULTITAP_UPPERCASE_ABC == MMI_current_input_mode ||
  1980.                  INPUT_MODE_SMART_UPPERCASE_ABC == MMI_current_input_mode ||
  1981.                  INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC == MMI_current_input_mode)
  1982.         {
  1983.             if (gPenEditorVKCandidate)
  1984.             {
  1985.                 changed_height += gPenEditorCandidateInputBox.height;
  1986.             }
  1987.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_ENGLISH_UPPERCASE);
  1988.         }
  1989.         else if (INPUT_MODE_123 == MMI_current_input_mode ||
  1990.                  INPUT_MODE_123_SYMBOLS == MMI_current_input_mode)
  1991.         {
  1992.             if (gPenEditorVKCandidate)
  1993.             {
  1994.                 changed_height += gPenEditorCandidateInputBox.height;
  1995.             }
  1996.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_NUMBER);
  1997.         }
  1998. #ifdef __MMI_LANG_TR_CHINESE__      //KP Jerry add on 2007-4-16
  1999.         else if (INPUT_MODE_TR_MULTITAP_BOPOMO == MMI_current_input_mode || INPUT_MODE_TR_BOPOMO == MMI_current_input_mode)     //KP Jerry delete "INPUT_MODE_TR_STROKE == MMI_current_input_mode" on 2007-3-21
  2000.         {
  2001.             if (!gPenEditorVKCandidate)
  2002.             {
  2003.                 changed_height -= (gPenEditorCandidateInputBox.height + 1);
  2004.                 gPenEditorVKCandidate = MMI_TRUE;
  2005.             }
  2006.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_BOPOMO);
  2007.         }
  2008. //KP Jerry add on 2007-3-21 start
  2009.         else if(INPUT_MODE_TR_STROKE==MMI_current_input_mode)
  2010.         {
  2011.             if (!gPenEditorVKCandidate)
  2012.             {
  2013.                 changed_height -= (gPenEditorCandidateInputBox.height + 1);
  2014.                 gPenEditorVKCandidate = MMI_TRUE;
  2015.             }
  2016.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_SYMBOL);
  2017.         }
  2018. //KP Jerry add on 2007-3-21 end
  2019. #endif/*__MMI_LANG_TR_CHINESE__*/      //KP Jerry add on 2007-4-16
  2020. #ifdef __MMI_LANG_SM_CHINESE__      //KP Jerry add on 2007-4-16
  2021.         else if (INPUT_MODE_SM_MULTITAP_PINYIN == MMI_current_input_mode || INPUT_MODE_SM_PINYIN == MMI_current_input_mode)     //KP Jerry delete "INPUT_MODE_SM_STROKE == MMI_current_input_mode" on 2007-3-21
  2022.         {
  2023.             if (!gPenEditorVKCandidate)
  2024.             {
  2025.                 changed_height -= (gPenEditorCandidateInputBox.height + 1);
  2026.                 gPenEditorVKCandidate = MMI_TRUE;
  2027.             }
  2028.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_PINYIN);
  2029.         }
  2030. //KP Jerry add on 2007-3-21 start
  2031.         else if(INPUT_MODE_SM_STROKE==MMI_current_input_mode)
  2032.         {
  2033.             if (!gPenEditorVKCandidate)
  2034.             {
  2035.                 changed_height -= (gPenEditorCandidateInputBox.height + 1);
  2036.                 gPenEditorVKCandidate = MMI_TRUE;
  2037.             }
  2038.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_SYMBOL);
  2039.         }
  2040. //KP Jerry add on 2007-3-21 end
  2041. #endif/*__MMI_LANG_SM_CHINESE__*/      //KP Jerry add on 2007-4-16
  2042. //KP Jerry add on 2007-4-16 start
  2043. #ifdef __MMI_LANG_VIETNAMESE__
  2044.         else if (INPUT_MODE_MULTITAP_LOWERCASE_VIETNAMESE == MMI_current_input_mode || 
  2045.                  INPUT_MODE_SMART_LOWERCASE_VIETNAMESE == MMI_current_input_mode)
  2046.         {
  2047.             if (gPenEditorVKCandidate)
  2048.             {
  2049.                 changed_height += gPenEditorCandidateInputBox.height;
  2050.             }
  2051.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_ENGLISH);
  2052.         }
  2053.         else if (INPUT_MODE_MULTITAP_UPPERCASE_VIETNAMESE == MMI_current_input_mode ||
  2054.                  INPUT_MODE_SMART_UPPERCASE_VIETNAMESE == MMI_current_input_mode)
  2055.          {
  2056.             if (gPenEditorVKCandidate)
  2057.             {
  2058.                 changed_height += gPenEditorCandidateInputBox.height;
  2059.             }
  2060.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_ENGLISH_UPPERCASE);
  2061.         }
  2062. #endif
  2063. #ifdef __MMI_LANG_RUSSIAN__
  2064.         else if (INPUT_MODE_MULTITAP_LOWERCASE_RUSSIAN == MMI_current_input_mode || 
  2065.                  INPUT_MODE_SMART_LOWERCASE_RUSSIAN == MMI_current_input_mode)
  2066.         {
  2067.             if (gPenEditorVKCandidate)
  2068.             {
  2069.                 changed_height += gPenEditorCandidateInputBox.height;
  2070.             }
  2071.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_RUSSIAN);
  2072.         }
  2073.         else if (INPUT_MODE_MULTITAP_UPPERCASE_RUSSIAN== MMI_current_input_mode ||
  2074.                  INPUT_MODE_SMART_UPPERCASE_RUSSIAN == MMI_current_input_mode)
  2075.          {
  2076.             if (gPenEditorVKCandidate)
  2077.             {
  2078.                 changed_height += gPenEditorCandidateInputBox.height;
  2079.             }
  2080.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_RUSSIAN_UPPERCASE);
  2081.         }
  2082. #endif
  2083. #ifdef __MMI_LANG_THAI__
  2084.         else if (INPUT_MODE_MULTITAP_THAI == MMI_current_input_mode || 
  2085.                  INPUT_MODE_SMART_THAI == MMI_current_input_mode)
  2086.         {
  2087.             if (gPenEditorVKCandidate)
  2088.             {
  2089.                 changed_height += gPenEditorCandidateInputBox.height;
  2090.             }
  2091.             wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_ENGLISH_UPPERCASE );
  2092.         }
  2093. #endif
  2094. //KP Jerry add on 2007-4-16 end
  2095. //KP Jerry modify on 2007-4-17 end
  2096.         if (gPenEditorCandidateInputBox.height > MMI_virtual_keyboard.height)
  2097.         {
  2098.             changed_height -= gPenEditorCandidateInputBox.height;
  2099.         }
  2100.         else
  2101.         {
  2102.             changed_height -= MMI_virtual_keyboard.height;
  2103.         }
  2104.         gdi_layer_lock_frame_buffer();
  2105.         mmi_pen_editor_resize_content_area(changed_height);
  2106.         if (PEN_EDITOR_INLINE_TEXT == gPenEditorInputBoxType
  2107.             || PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  2108.         {
  2109.             s32 temp_multiline_height = MMI_multiline_inputbox.height;
  2110.             MMI_BOOL temp_VKCandidate = gPenEditorVKCandidate;
  2111.             gui_virtual_keyboard_language_enum keyboard_type = MMI_virtual_keyboard.lang_type;
  2112.             mmi_pen_editor_vk_list_menu_resize();
  2113.             if (PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  2114.             {
  2115.                 gui_resize_multi_line_input_box(
  2116.                     &MMI_multiline_inputbox,
  2117.                     MMI_multiline_inputbox.width,
  2118.                     temp_multiline_height);
  2119.                 redraw_fixed_list();
  2120.                 redraw_current_inline_item();
  2121.                 gPenEditorVKCandidate = temp_VKCandidate;
  2122.             }
  2123.             wgui_setup_virtual_keyboard(keyboard_type);
  2124.         }
  2125.         gui_move_single_line_input_box(
  2126.             &gPenEditorCandidateInputBox,
  2127.             gPenEditorCandidateInputBox.x,
  2128.             MMI_virtual_keyboard.y - gPenEditorCandidateInputBox.height - 2);
  2129.         if (gPenEditorVKCandidate)
  2130.         {
  2131.             mmi_pen_editor_hide_candidate_area();
  2132.         }
  2133.         gdi_layer_unlock_frame_buffer();
  2134.         mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  2135.     }
  2136.     /* W05.50 Exclude Virtual Keyboard Area from Handwriting Area */
  2137.     mmi_pen_editor_change_handwriting_area();
  2138. }
  2139. /*****************************************************************************
  2140.  * FUNCTION
  2141.  *  mmi_pen_editor_multi_block_stroke_down_handler
  2142.  * DESCRIPTION
  2143.  *  When receiving the stroke down event, do the related action according to the current situation
  2144.  * PARAMETERS
  2145.  *  pos     [IN]        The position of the stroke down event
  2146.  * RETURNS
  2147.  *  void
  2148.  *****************************************************************************/
  2149. void mmi_pen_editor_multi_block_stroke_down_handler(mmi_pen_point_struct pos)
  2150. {
  2151.     /*----------------------------------------------------------------*/
  2152.     /* Local Variables                                                */
  2153.     /*----------------------------------------------------------------*/
  2154.     int changed_height;
  2155.     S32 active_block = 0;
  2156.     /*----------------------------------------------------------------*/
  2157.     /* Local Variables Initializing                                   */
  2158.     /*----------------------------------------------------------------*/
  2159.     changed_height = 0;
  2160.     /*----------------------------------------------------------------*/
  2161.     /* Code Body                                                      */
  2162.     /*----------------------------------------------------------------*/
  2163.     if (!gPenEditorEnableHandWriting)
  2164.     {
  2165.         MMI_DBG_ASSERT(0);
  2166.         return;
  2167.     }
  2168.     if (g_pen_editor_smart_latin_pre_candidate_length)
  2169.     {
  2170.         mmi_pen_editor_smart_latin_confirm_select();
  2171.         mmi_pen_editor_set_left_soft_key();
  2172.     }
  2173.     if (g_pen_editor_composition_state.candidate_state != PEN_EDITOR_CANDIDATE_OFF)
  2174.     {
  2175.         int change_height = 0;
  2176.         g_pen_editor_composition_state.candidate_state = PEN_EDITOR_CANDIDATE_OFF;
  2177.         change_height += g_pen_editor_composition_input_box.height;
  2178.         mmi_pen_editor_resize_content_area(change_height);
  2179.         mmi_pen_editor_reset_key_sequence(&g_pen_editor_key_sequence);
  2180.     }
  2181.     /* create new layer for stroke through Draw Manager */
  2182.     if (gPenEditorGDIHandler == NULL || *gPenEditorGDIHandler == GDI_ERROR_HANDLE)
  2183.     {
  2184.         gPenEditorStrokeGDIBuffer = (U8*) mmi_frm_scrmem_alloc(handwriting_stroke_layer_mem);
  2185.         MMI_ASSERT(gPenEditorStrokeGDIBuffer);
  2186.         if (GDI_LAYER_SUCCEED != dm_create_layer_using_outside_memory(
  2187.                                     0,
  2188.                                     0,
  2189.                                     UI_device_width,
  2190.                                     UI_device_height,
  2191.                                     &gPenEditorGDIHandler,
  2192.                                     (U8*) gPenEditorStrokeGDIBuffer,
  2193.                                     handwriting_stroke_layer_mem,
  2194.                                     DM_LAYER_TOP))
  2195.         {
  2196.             MMI_ASSERT(0);
  2197.         }
  2198.         gdi_layer_push_and_set_active(*gPenEditorGDIHandler);
  2199.         gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  2200.         gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  2201.         gdi_layer_pop_and_restore_active();
  2202.     }
  2203.     /* If the state requires confirm, confirm it directly in this situation// */
  2204.     if (gPenEditorSelectCandidate)
  2205.     {
  2206.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  2207.         gPenEditorShowVK = MMI_FALSE;
  2208.         mmi_pen_editor_confirm_selection();
  2209.         mmi_pen_editor_hide_candidate_area();
  2210.         mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  2211.     }
  2212.     active_block = mmi_pen_editor_handwriting_check_block(pos);
  2213.     if (g_pen_editor_active_block)
  2214.     {
  2215.         if (g_pen_editor_active_block != active_block)
  2216.         {
  2217.             mmi_pen_editor_handwriting_direct_input();
  2218.         }
  2219.     }
  2220.     g_pen_editor_active_block = active_block;
  2221.     if (!g_pen_editor_active_block)
  2222.     {
  2223.         g_pen_editor_active_block = 0;
  2224.     }
  2225.     /* Clear Virtual Keyboard Area only at the first stroke */
  2226.     if (gPenEditorFirstStroke)
  2227.     {
  2228.         gPenEditorFirstStroke = MMI_FALSE;
  2229.     }
  2230.     gPenEditorShowVK = MMI_TRUE;
  2231.     gPenEditorVKState = PEN_EDITOR_VK_OFF;
  2232.     gPenEditorPreviousPoint.x = pos.x;
  2233.     gPenEditorPreviousPoint.y = pos.y;
  2234. }
  2235. /*****************************************************************************
  2236.  * FUNCTION
  2237.  *  mmi_pen_editor_multi_block_stroke_move_handler
  2238.  * DESCRIPTION
  2239.  *  Draw the stroke when moving the pen in the stroke mode and check the stroke is out of the current block or not.
  2240.  *  If yes, pass the stroke buffer to the handwriting module for recognizing
  2241.  * PARAMETERS
  2242.  *  pos     [IN]        The position of the stroke move event
  2243.  * RETURNS
  2244.  *  void
  2245.  *****************************************************************************/
  2246. void mmi_pen_editor_multi_block_stroke_move_handler(mmi_pen_point_struct pos)
  2247. {
  2248.     /*----------------------------------------------------------------*/
  2249.     /* Local Variables                                                */
  2250.     /*----------------------------------------------------------------*/
  2251.     S32 active_block = 0;
  2252.     /*----------------------------------------------------------------*/
  2253.     /* Code Body                                                      */
  2254.     /*----------------------------------------------------------------*/
  2255.     /* if hand writing is not enabled, it should not go here */
  2256.     if (!gPenEditorEnableHandWriting)
  2257.     {
  2258.         MMI_DBG_ASSERT(0);
  2259.         return;
  2260.     }
  2261.     active_block = mmi_pen_editor_handwriting_check_block(pos);
  2262.     if (active_block)
  2263.     {
  2264.         S32 previous_block = mmi_pen_editor_handwriting_check_block(gPenEditorPreviousPoint);
  2265.         if (active_block == previous_block)
  2266.         {
  2267.             gdi_layer_lock_frame_buffer();
  2268.             gdi_layer_push_and_set_active(*gPenEditorGDIHandler);
  2269.             gdi_layer_push_clip();
  2270.             /* Draw the point of the stroke */
  2271.             gui_line(gPenEditorPreviousPoint.x, gPenEditorPreviousPoint.y, pos.x, pos.y, gPenEditorStrokeColor);
  2272.             gui_line(gPenEditorPreviousPoint.x + 1, gPenEditorPreviousPoint.y, pos.x + 1, pos.y, gPenEditorStrokeColor);
  2273.             gui_line(gPenEditorPreviousPoint.x, gPenEditorPreviousPoint.y + 1, pos.x, pos.y + 1, gPenEditorStrokeColor);
  2274.             gui_line(gPenEditorPreviousPoint.x - 1, gPenEditorPreviousPoint.y, pos.x - 1, pos.y, gPenEditorStrokeColor);
  2275.             gui_line(gPenEditorPreviousPoint.x, gPenEditorPreviousPoint.y - 1, pos.x, pos.y - 1, gPenEditorStrokeColor);
  2276.             gdi_layer_pop_clip();
  2277.             gdi_layer_pop_and_restore_active();
  2278.             gdi_layer_unlock_frame_buffer();
  2279.             gdi_layer_blt_previous(
  2280.                 PEN_MIN(gPenEditorPreviousPoint.x, pos.x) - 1,
  2281.                 PEN_MIN(gPenEditorPreviousPoint.y, pos.y) - 1,
  2282.                 PEN_MAX(gPenEditorPreviousPoint.x, pos.x) + 1,
  2283.                 PEN_MAX(gPenEditorPreviousPoint.y, pos.y) + 1);
  2284.         }
  2285.         gPenEditorPreviousPoint.x = pos.x;
  2286.         gPenEditorPreviousPoint.y = pos.y;
  2287.     }
  2288.     if (g_pen_editor_active_block)
  2289.     {
  2290.         if (g_pen_editor_active_block != active_block)
  2291.         {
  2292.             mmi_pen_editor_handwriting_direct_input();
  2293.             if (active_block)
  2294.             {
  2295.                 gPenEditorFirstStroke = MMI_FALSE;
  2296.             }
  2297.         }
  2298.     }
  2299.     g_pen_editor_active_block = active_block;
  2300.     if (!g_pen_editor_active_block)
  2301.     {
  2302.         gPenEditorVKState = PEN_EDITOR_VK_ON;
  2303.     }
  2304.     else
  2305.     {
  2306.         gPenEditorVKState = PEN_EDITOR_VK_OFF;
  2307.     }
  2308. }
  2309. void mmi_pen_editor_inline_full_screen_redraw_handwriting_area(void)
  2310. {
  2311.     /* W06.05 Fix Background display issue in virtual keyboard */
  2312.     if (PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK == mmi_pen_editor_get_handwriting_style()&&
  2313.         (GUI_VIRTUAL_KEYBOARD_TRAY == MMI_virtual_keyboard.lang_type
  2314.          || GUI_VIRTUAL_KEYBOARD_NUMBER_DOT_TRAY == MMI_virtual_keyboard.lang_type
  2315.          || GUI_VIRTUAL_KEYBOARD_NUMBER_TRAY == MMI_virtual_keyboard.lang_type
  2316.          || GUI_VIRTUAL_KEYBOARD_PHONE_NUMBER == MMI_virtual_keyboard.lang_type))
  2317.     {
  2318.         mmi_pen_editor_draw_handwriting_block();
  2319.     }
  2320.     mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  2321. }
  2322. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */