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

MTK

开发平台:

C/C++

  1.     /* If the state requires confirm, confirm it directly in this situation// */
  2.     if (gPenEditorSelectCandidate && (gPenEditorCandidateInputBox.y >= (PEN_EDITOR_Y_OF_CANDIDATE_INPUT_BOX_IN_BOTTOM)))
  3.     {
  4.         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  5.         gPenEditorShowVK = MMI_FALSE;
  6.         mmi_pen_editor_confirm_selection();
  7.         mmi_pen_editor_hide_candidate_area();
  8.     }
  9.     /* Clear Virtual Keyboard Area only at the first stroke */
  10.     if (gPenEditorFirstStroke)
  11.     {
  12.         gPenEditorFirstStroke = MMI_FALSE;
  13.         /* Clear Virtual Keyboard Text */
  14.         if (gPenEditorVKText.TextLength > 0 || gPenEditorSelectCandidate)
  15.         {
  16.             mmi_pen_editor_set_left_soft_key();
  17.             switch (gPenEditorInputBoxType)
  18.             {
  19.                 case PEN_EDITOR_EMS_INPUT_BOX:
  20.                     register_EMS_inputbox_keys();
  21.                     break;
  22.                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  23.                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  24.                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  25.                     register_multiline_inputbox_keys();
  26.                     if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  27.                     {
  28.                         cat201_register_key_func();
  29.                     }
  30.                     break;
  31.                 default:
  32.                     break;
  33.             }
  34.             mmi_pen_editor_reset_vk_text(&gPenEditorVKText);
  35.             wgui_set_virtual_keyboard_display_area((U8*) gPenEditorVKText.VKText, MMI_FALSE);
  36.         }
  37.         if (gPenEditorShowVK)
  38.         {
  39.             mmi_pen_editor_hide_virtual_keyboard_area();
  40.         }
  41.     }
  42.     /* W05.44 Change the Input Control Height when the VK is not Tray Type */
  43.     if ((PEN_EDITOR_VK_ON == gPenEditorVKState) &&
  44.         !(GUI_VIRTUAL_KEYBOARD_TRAY == MMI_virtual_keyboard.lang_type ||
  45.           GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY == MMI_virtual_keyboard.lang_type ||
  46.           GUI_VIRTUAL_KEYBOARD_NUMBER_TRAY == MMI_virtual_keyboard.lang_type ||
  47.           GUI_VIRTUAL_KEYBOARD_NUMBER_DOT_TRAY == MMI_virtual_keyboard.lang_type))
  48.     {
  49.         /* Resize the content area for candidate input box if needed// */
  50.         changed_height = MMI_virtual_keyboard.height;
  51.         if (!gPenEditorVKCandidate)
  52.         {
  53.             changed_height -= gPenEditorCandidateInputBox.height;
  54.         }
  55.         if (gPenEditorShowVK)
  56.         {
  57.             if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX != gPenEditorInputBoxType)
  58.             {
  59.                 mmi_pen_editor_resize_content_area(changed_height);
  60.             }
  61.             gui_move_single_line_input_box(
  62.                 &gPenEditorCandidateInputBox,
  63.                 gPenEditorCandidateInputBox.x,
  64.                 (PEN_EDITOR_Y_OF_CANDIDATE_INPUT_BOX_IN_BOTTOM));
  65.         }
  66.     }
  67.     gPenEditorShowVK = MMI_TRUE;
  68.     gPenEditorVKState = PEN_EDITOR_VK_OFF;
  69.     gPenEditorPreviousPoint.x = pos.x;
  70.     gPenEditorPreviousPoint.y = pos.y;
  71. }
  72. /*****************************************************************************
  73.  * FUNCTION
  74.  *  mmi_pen_editor_stroke_move_handler
  75.  * DESCRIPTION
  76.  *  Draw the stroke when moving the pen in the stroke mode
  77.  * PARAMETERS
  78.  *  pos     [IN]        The position of the stroke move event
  79.  * RETURNS
  80.  *  void
  81.  *****************************************************************************/
  82. void mmi_pen_editor_stroke_move_handler(mmi_pen_point_struct pos)
  83. {
  84.     /*----------------------------------------------------------------*/
  85.     /* Local Variables                                                */
  86.     /*----------------------------------------------------------------*/
  87.     /*----------------------------------------------------------------*/
  88.     /* Code Body                                                      */
  89.     /*----------------------------------------------------------------*/
  90.     /* if hand writing is not enabled, it should not go here */
  91.     if (!gPenEditorEnableHandWriting)
  92.     {
  93.         MMI_DBG_ASSERT(0);
  94.         return;
  95.     }
  96.     gdi_layer_lock_frame_buffer();
  97.     gdi_layer_push_and_set_active(*gPenEditorGDIHandler);
  98.     gdi_layer_push_clip();
  99.     /* Draw the point of the stroke */
  100.     gui_line(gPenEditorPreviousPoint.x, gPenEditorPreviousPoint.y, pos.x, pos.y, gPenEditorStrokeColor);
  101.     gui_line(gPenEditorPreviousPoint.x + 1, gPenEditorPreviousPoint.y, pos.x + 1, pos.y, gPenEditorStrokeColor);
  102.     gui_line(gPenEditorPreviousPoint.x, gPenEditorPreviousPoint.y + 1, pos.x, pos.y + 1, gPenEditorStrokeColor);
  103.     gui_line(gPenEditorPreviousPoint.x - 1, gPenEditorPreviousPoint.y, pos.x - 1, pos.y, gPenEditorStrokeColor);
  104.     gui_line(gPenEditorPreviousPoint.x, gPenEditorPreviousPoint.y - 1, pos.x, pos.y - 1, gPenEditorStrokeColor);
  105.     gdi_layer_pop_clip();
  106.     gdi_layer_pop_and_restore_active();
  107.     gdi_layer_unlock_frame_buffer();
  108.     gdi_layer_blt_previous(
  109.         PEN_MIN(gPenEditorPreviousPoint.x, pos.x) - 1,
  110.         PEN_MIN(gPenEditorPreviousPoint.y, pos.y) - 1,
  111.         PEN_MAX(gPenEditorPreviousPoint.x, pos.x) + 1,
  112.         PEN_MAX(gPenEditorPreviousPoint.y, pos.y) + 1);
  113.     gPenEditorPreviousPoint.x = pos.x;
  114.     gPenEditorPreviousPoint.y = pos.y;
  115. }
  116. /*****************************************************************************
  117.  * FUNCTION
  118.  *  mmi_pen_editor_stroke_up_handler
  119.  * DESCRIPTION
  120.  *  Draw the last point of the stroke and start the timer to check this is the last stroke or not
  121.  * PARAMETERS
  122.  *  pos     [IN]        The position of the stroke up event
  123.  * RETURNS
  124.  *  void
  125.  *****************************************************************************/
  126. void mmi_pen_editor_stroke_up_handler(mmi_pen_point_struct pos)
  127. {
  128.     /*----------------------------------------------------------------*/
  129.     /* Local Variables                                                */
  130.     /*----------------------------------------------------------------*/
  131.     /*----------------------------------------------------------------*/
  132.     /* Code Body                                                      */
  133.     /*----------------------------------------------------------------*/
  134.     /* if hand writing is not enabled, it should not go here */
  135.     if (!gPenEditorEnableHandWriting)
  136.     {
  137.         MMI_DBG_ASSERT(0);
  138.         return;
  139.     }
  140.     mmi_pen_editor_stroke_move_handler(pos);
  141.     gPenEditorPreviousPoint.x = -1;
  142.     gPenEditorPreviousPoint.y = -1;
  143.     gui_cancel_timer(mmi_pen_editor_stroke_up_timer_handler);
  144.     /* The end of the stroke, if no more stroke in the period, the end of the character */
  145.     gui_start_timer(PEN_EDITOR_CHARACTER_END_PERIOD, mmi_pen_editor_stroke_up_timer_handler);
  146. }
  147. /*****************************************************************************
  148.  * FUNCTION
  149.  *  mmi_pen_editor_stroke_up_timer_handler
  150.  * DESCRIPTION
  151.  *  If no more stroke, then pass the strokes to the handwiritng module to get candidates
  152.  * PARAMETERS
  153.  *  void
  154.  * RETURNS
  155.  *  void
  156.  *****************************************************************************/
  157. void mmi_pen_editor_stroke_up_timer_handler(void)
  158. {
  159.     /*----------------------------------------------------------------*/
  160.     /* Local Variables                                                */
  161.     /*----------------------------------------------------------------*/
  162.     BOOL has_unfinished_stroke;
  163.     int num = 0;
  164.     /*----------------------------------------------------------------*/
  165.     /* Code Body                                                      */
  166.     /*----------------------------------------------------------------*/
  167.     /* if hand writing is not enabled, it should not go here */
  168.     if (!gPenEditorEnableHandWriting)
  169.     {
  170.         MMI_DBG_ASSERT(0);
  171.         return;
  172.     }
  173.     mmi_pen_peek_stroke_state(&has_unfinished_stroke);
  174.     if (!has_unfinished_stroke)
  175.     {
  176.         /* The end of the character, pass the stroke data for hand writing recognization */
  177.         mmi_pen_end_strokes_of_character();
  178.     #if defined(__MMI_HAND_WRITING_GET_STROKES__)
  179.         mmi_pen_editor_save_stroke_to_file();
  180.     #endif 
  181.         gdi_layer_push_and_set_active(*gPenEditorGDIHandler);
  182.         gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  183.         gdi_layer_pop_and_restore_active();
  184.         gPenEditorFirstStroke = MMI_TRUE;
  185.         
  186.         gdi_layer_lock_frame_buffer();
  187.         num = mmi_pen_editor_get_candidates_from_hand_writing();
  188.         gdi_layer_unlock_frame_buffer();
  189.         
  190.         /* W05.36 Check the Candidates List, if empty, just clear stroke */
  191.         if (num == 0)
  192.         {
  193.             int changed_height = 0;
  194.             mmi_pen_begin_strokes_of_character();
  195.             gdi_layer_lock_frame_buffer();
  196.             gPenEditorVKState = PEN_EDITOR_VK_ON;
  197.             if (gPenEditorShowVK && (gPenEditorCandidateInputBox.y >= (PEN_EDITOR_Y_OF_CANDIDATE_INPUT_BOX_IN_BOTTOM)))
  198.             {
  199.                 /* W05.47 Change the Input Control Height when the VK is not Tray Type */
  200.                 if (!(GUI_VIRTUAL_KEYBOARD_TRAY == MMI_virtual_keyboard.lang_type
  201.                       || GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY == MMI_virtual_keyboard.lang_type
  202.                       || GUI_VIRTUAL_KEYBOARD_NUMBER_TRAY == MMI_virtual_keyboard.lang_type
  203.                       || GUI_VIRTUAL_KEYBOARD_NUMBER_DOT_TRAY == MMI_virtual_keyboard.lang_type))
  204.                 {
  205.                     changed_height = gPenEditorCandidateInputBox.height;
  206.                     if (gPenEditorVKCandidate)
  207.                     {
  208.                         changed_height -= gPenEditorCandidateInputBox.height;
  209.                     }
  210.                     changed_height -= MMI_virtual_keyboard.height;
  211.                     if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX != gPenEditorInputBoxType)
  212.                     {
  213.                         mmi_pen_editor_resize_content_area(changed_height);
  214.                     }
  215.                 }
  216.             }
  217.             if (gPenEditorShowVK)
  218.             {
  219.                 mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  220.             }
  221.             if (gPenEditorVKCandidate)
  222.             {
  223.                 if (gPenEditorShowVK)
  224.                 {
  225.                     gui_move_single_line_input_box(
  226.                         &gPenEditorCandidateInputBox,
  227.                         gPenEditorCandidateInputBox.x,
  228.                         MMI_virtual_keyboard.y - gPenEditorCandidateInputBox.height - 2);
  229.                 }
  230.                 mmi_pen_editor_hide_candidate_area();
  231.             }
  232.             gdi_layer_unlock_frame_buffer();
  233.             gdi_lcd_repaint_all();
  234.             return;
  235.         }
  236.         /* According different input box, do different actions */
  237.         mmi_pen_editor_input_character(gPenEditorCandidateBuffer[0], MMI_TRUE);
  238.         /* W05.50 Exclude Virtual Keyboard Area from Handwriting Area */
  239.         mmi_pen_editor_change_handwriting_area();
  240.         /* Temp Solution for LSK Text Update */
  241.         mmi_pen_editor_store_LSK_Text();
  242.         mmi_pen_editor_set_left_soft_key_select();
  243.         /* W05.32 Fix LSK issue in in-line multiline input box */
  244.         if (softkey_functions[MMI_LEFT_SOFTKEY][KEY_EVENT_UP] != mmi_pen_editor_left_soft_key_handler)
  245.         {
  246.             mmi_pen_editor_set_inputbox_LSK_Function(softkey_functions[MMI_LEFT_SOFTKEY][KEY_EVENT_UP]);
  247.         }
  248.         set_left_softkey_function(mmi_pen_editor_left_soft_key_handler, KEY_EVENT_UP);
  249.         set_left_softkey_function(mmi_pen_editor_hold_confirm, KEY_EVENT_DOWN);
  250.     #if !defined(__MMI_HANDWRITING_PAD__)
  251.         gui_start_timer(PEN_EDITOR_CONFIRM_PERIOD, mmi_pen_editor_confirm_selection);
  252.     #endif 
  253.         mmi_pen_begin_strokes_of_character();
  254.         g_pen_editor_active_block = 0;
  255.     }
  256. }
  257. /*****************************************************************************
  258.  * FUNCTION
  259.  *  mmi_pen_editor_confirm_selection
  260.  * DESCRIPTION
  261.  *  When the candidate input box is on, confirm the selection and update the state by its situation
  262.  * PARAMETERS
  263.  *  void
  264.  * RETURNS
  265.  *  void
  266.  *****************************************************************************/
  267. void mmi_pen_editor_confirm_selection(void)
  268. {
  269.     /*----------------------------------------------------------------*/
  270.     /* Local Variables                                                */
  271.     /*----------------------------------------------------------------*/
  272.     int changed_height = 0;
  273.     /*----------------------------------------------------------------*/
  274.     /* Code Body                                                      */
  275.     /*----------------------------------------------------------------*/
  276.     /* if hand writing is not enabled, it should not go here */
  277.     if (!gPenEditorEnableHandWriting)
  278.     {
  279.         MMI_DBG_ASSERT(0);
  280.         return;
  281.     }
  282.     /* gPenEditorShowVK to avoid clear the virtual keyboard area in some situation */
  283.     if (gPenEditorSelectCandidate)
  284.     {
  285.         gdi_layer_lock_frame_buffer();
  286.         gPenEditorSelectCandidate = MMI_FALSE;
  287.         /* Temp Solution for LSK Text Update */
  288.         mmi_pen_editor_set_left_soft_key();
  289.         switch (gPenEditorInputBoxType)
  290.         {
  291.             case PEN_EDITOR_EMS_INPUT_BOX:
  292.                 register_EMS_inputbox_keys();
  293.                 handle_category28_input();
  294.                 wgui_set_EMS_inputbox_RSK();
  295.                 break;
  296.             case PEN_EDITOR_MULTILINE_INPUT_BOX:
  297.             case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  298.             case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  299.                 register_multiline_inputbox_keys();
  300.                 wgui_handle_inputbox_input();
  301.                 wgui_set_RSK();
  302.                 if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX == gPenEditorInputBoxType)
  303.                 {
  304.                     cat201_register_key_func();
  305.                 }
  306.                 break;
  307.             case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  308.                 wgui_singleline_inputbox_RSK_label_clear = 0;
  309.                 singleline_inputbox_multitap_input_complete();
  310.                 wgui_set_singleline_RSK();
  311.                 break;
  312.             case PEN_EDITOR_INLINE_TEXT:
  313.                 inline_edit_singleline_inputbox_multitap_input_complete();
  314.                 mmi_pen_editor_set_right_soft_key_inline_text();
  315.                 break;
  316.             case PEN_EDITOR_DATE:
  317.             case PEN_EDITOR_IP4:
  318.             case PEN_EDITOR_TIME:
  319.             case PEN_EDITOR_TIME_PERIOD:
  320.                 set_right_softkey_label(wgui_inline_edit_get_RSK_string());
  321.                 set_right_softkey_icon(NULL);
  322.                 register_right_softkey_handler();
  323.                 set_right_softkey_function(execute_wgui_inline_edit_RSK_function, KEY_EVENT_UP);
  324.                 redraw_right_softkey();
  325.                 break;
  326.             default:
  327.                 break;
  328.         }
  329.         mmi_pen_editor_hide_candidate_area();
  330.         gPenEditorVKState = PEN_EDITOR_VK_ON;
  331.         if (gPenEditorShowVK && (gPenEditorCandidateInputBox.y >= (PEN_EDITOR_Y_OF_CANDIDATE_INPUT_BOX_IN_BOTTOM)))
  332.         {
  333.             if (PEN_EDITOR_CANDIDATE_OFF != g_pen_editor_composition_state.candidate_state)
  334.             {
  335.                 g_pen_editor_composition_state.candidate_state = PEN_EDITOR_CANDIDATE_OFF;
  336.                 changed_height += gPenEditorCandidateInputBox.height;
  337.                 mmi_pen_editor_reset_key_sequence(&g_pen_editor_key_sequence);
  338.             }
  339.             /* W05.47 Change the Input Control Height when the VK is not Tray Type */
  340.             if (!(GUI_VIRTUAL_KEYBOARD_TRAY == MMI_virtual_keyboard.lang_type ||
  341.                   GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY == MMI_virtual_keyboard.lang_type ||
  342.                   GUI_VIRTUAL_KEYBOARD_NUMBER_TRAY == MMI_virtual_keyboard.lang_type ||
  343.                   GUI_VIRTUAL_KEYBOARD_NUMBER_DOT_TRAY == MMI_virtual_keyboard.lang_type))
  344.             {
  345.                 changed_height += gPenEditorCandidateInputBox.height;
  346.                 if (gPenEditorVKCandidate)
  347.                 {
  348.                     changed_height -= gPenEditorCandidateInputBox.height;
  349.                 }
  350.                 changed_height -= MMI_virtual_keyboard.height;
  351.             }
  352.             if (PEN_EDITOR_DICT_MULTILINE_INPUT_BOX != gPenEditorInputBoxType)
  353.             {
  354.                 mmi_pen_editor_resize_content_area(changed_height);
  355.             }
  356.         }
  357.         if (gPenEditorShowVK)
  358.         {
  359.             mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  360.         }
  361.         if (gPenEditorVKCandidate)
  362.         {
  363.             if (gPenEditorShowVK)
  364.             {
  365.                 /* W05.48 If vk text is null, clear it */
  366.                 if (gPenEditorVKText.TextLength > 0)
  367.                 {
  368.                     mmi_pen_editor_reset_vk_text(&gPenEditorVKText);
  369.                     wgui_set_virtual_keyboard_display_area((U8*) gPenEditorVKText.VKText, MMI_TRUE);
  370.                 }
  371.                 gui_move_single_line_input_box(
  372.                     &gPenEditorCandidateInputBox,
  373.                     gPenEditorCandidateInputBox.x,
  374.                     MMI_virtual_keyboard.y - gPenEditorCandidateInputBox.height - 2);
  375.             }
  376.             mmi_pen_editor_hide_candidate_area();
  377.         }
  378.         /* W05.50 Exclude Virtual Keyboard Area from Handwriting Area */
  379.         if (gPenEditorShowVK)
  380.         {
  381.             mmi_pen_editor_change_handwriting_area();
  382.         }
  383.         gdi_layer_unlock_frame_buffer();
  384.         gdi_lcd_repaint_all();
  385.     }
  386.     else
  387.     {
  388.         return;
  389.     }
  390.     /* According different input box, do different action */
  391.     switch (gPenEditorInputBoxType)
  392.     {
  393.         case PEN_EDITOR_MULTILINE_INPUT_BOX:
  394.         case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  395.         case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  396.             multiline_inputbox_multitap_input_complete();
  397.             break;
  398.         case PEN_EDITOR_EMS_INPUT_BOX:
  399.             EMS_inputbox_multitap_input_complete();
  400.             break;
  401.         case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  402.             singleline_inputbox_multitap_input_complete();
  403.             break;
  404.         case PEN_EDITOR_INLINE_TEXT:
  405.             inline_edit_singleline_inputbox_multitap_input_complete();
  406.             break;
  407.         case PEN_EDITOR_DATE:
  408.             date_input_next_character();
  409.             break;
  410.         case PEN_EDITOR_IP4:
  411.             IP4_input_next_character();
  412.             break;
  413.         case PEN_EDITOR_TIME:
  414.             time_input_next_character();
  415.             break;
  416.         case PEN_EDITOR_TIME_PERIOD:
  417.             time_period_input_next_character();
  418.             break;
  419.         default:
  420.             MMI_ASSERT(0);
  421.     }
  422. }
  423. /*****************************************************************************
  424.  * FUNCTION
  425.  *  mmi_pen_editor_get_candidates_from_hand_writing
  426.  * DESCRIPTION
  427.  *  Get the candidates from the handwriting module
  428.  * PARAMETERS
  429.  *  void
  430.  * RETURNS
  431.  *  The number of the candidates
  432.  *****************************************************************************/
  433. int mmi_pen_editor_get_candidates_from_hand_writing(void)
  434. {
  435.     /*----------------------------------------------------------------*/
  436.     /* Local Variables                                                */
  437.     /*----------------------------------------------------------------*/
  438.     UI_character_type candidate_buffer[PEN_EDITOR_MAX_CANDIDATE_SIZE];
  439.     int num = 0, i = 0;
  440.     /*----------------------------------------------------------------*/
  441.     /* Code Body                                                      */
  442.     /*----------------------------------------------------------------*/
  443.     switch (MMI_current_input_mode)
  444.     {
  445. #ifdef __MMI_LANG_TR_CHINESE__     //KP Jerry add on 2007-4-18
  446.         case INPUT_MODE_TR_MULTITAP_BOPOMO:
  447.         case INPUT_MODE_TR_BOPOMO:
  448.         case INPUT_MODE_TR_STROKE:
  449.             num = mmi_pen_editor_hand_writing_get_candidates(
  450.                     (U16*) gPenEditorStrokeBuffer,
  451.                     candidate_buffer,
  452.                     PEN_EDITOR_TRADITIONAL_CHINESE,
  453.                     PEN_EDITOR_CANDIDATE_SIZE);
  454.             break;
  455. #endif /*__MMI_LANG_TR_CHINESE__*/     //KP Jerry add on 2007-4-18
  456. #ifdef __MMI_LANG_SM_CHINESE__     //KP Jerry add on 2007-4-18
  457.         case INPUT_MODE_SM_MULTITAP_PINYIN:
  458.         case INPUT_MODE_SM_PINYIN:
  459.         case INPUT_MODE_SM_STROKE:
  460.             num = mmi_pen_editor_hand_writing_get_candidates(
  461.                     (U16*) gPenEditorStrokeBuffer,
  462.                     candidate_buffer,
  463.                     PEN_EDITOR_SIMPLIFIED_CHINESE,
  464.                     PEN_EDITOR_CANDIDATE_SIZE);
  465.             break;
  466. #endif /*__MMI_LANG_SM_CHINESE__*/     //KP Jerry add on 2007-4-18
  467. //KP Jerry add on 2007-4-17 start
  468. #ifdef __MMI_LANG_VIETNAMESE__
  469.         case INPUT_MODE_MULTITAP_UPPERCASE_VIETNAMESE:
  470.         case INPUT_MODE_SMART_UPPERCASE_VIETNAMESE:
  471.             num = mmi_pen_editor_hand_writing_get_candidates(
  472.                     (U16*) gPenEditorStrokeBuffer,
  473.                     candidate_buffer,
  474.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  475.                     PEN_EDITOR_CANDIDATE_SIZE);
  476.             break;
  477.         case INPUT_MODE_MULTITAP_LOWERCASE_VIETNAMESE:
  478.         case INPUT_MODE_SMART_LOWERCASE_VIETNAMESE:
  479.             num = mmi_pen_editor_hand_writing_get_candidates(
  480.                     (U16*) gPenEditorStrokeBuffer,
  481.                     candidate_buffer,
  482.                     PEN_EDITOR_LOWER_CASE_ENGLISH,
  483.                     PEN_EDITOR_CANDIDATE_SIZE);
  484.             break;
  485. #endif
  486. #ifdef __MMI_LANG_RUSSIAN__
  487.         case INPUT_MODE_MULTITAP_UPPERCASE_RUSSIAN:
  488.         case INPUT_MODE_SMART_UPPERCASE_RUSSIAN:
  489.             num = mmi_pen_editor_hand_writing_get_candidates(
  490.                     (U16*) gPenEditorStrokeBuffer,
  491.                     candidate_buffer,
  492.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  493.                     PEN_EDITOR_CANDIDATE_SIZE);
  494.             break;
  495.         case INPUT_MODE_MULTITAP_LOWERCASE_RUSSIAN:
  496.         case INPUT_MODE_SMART_LOWERCASE_RUSSIAN:
  497.             num = mmi_pen_editor_hand_writing_get_candidates(
  498.                     (U16*) gPenEditorStrokeBuffer,
  499.                     candidate_buffer,
  500.                     PEN_EDITOR_LOWER_CASE_ENGLISH,
  501.                     PEN_EDITOR_CANDIDATE_SIZE);
  502.             break;
  503. #endif
  504. #ifdef __MMI_LANG_THAI__
  505.         case INPUT_MODE_MULTITAP_THAI:
  506.         case INPUT_MODE_SMART_THAI:
  507.             num = mmi_pen_editor_hand_writing_get_candidates(
  508.                     (U16*) gPenEditorStrokeBuffer,
  509.                     candidate_buffer,
  510.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  511.                     PEN_EDITOR_CANDIDATE_SIZE);
  512.             break;
  513. #endif
  514. //KP Jerry add on 2007-4-17 end
  515.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
  516.         case INPUT_MODE_SMART_UPPERCASE_ABC:
  517.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC:
  518.             num = mmi_pen_editor_hand_writing_get_candidates(
  519.                     (U16*) gPenEditorStrokeBuffer,
  520.                     candidate_buffer,
  521.                     PEN_EDITOR_UPPER_CASE_ENGLISH,
  522.                     PEN_EDITOR_CANDIDATE_SIZE);
  523.             /* W05.33 For candidates sorting issue */
  524.             mmi_pen_editor_resort_candidates(candidate_buffer, num, PEN_EDITOR_SORT_CAPITAL_FIRST);
  525.             break;
  526.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
  527.         case INPUT_MODE_SMART_LOWERCASE_ABC:
  528.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC:
  529.             num = mmi_pen_editor_hand_writing_get_candidates(
  530.                     (U16*) gPenEditorStrokeBuffer,
  531.                     candidate_buffer,
  532.                     PEN_EDITOR_LOWER_CASE_ENGLISH,
  533.                     PEN_EDITOR_CANDIDATE_SIZE);
  534.             /* W05.33 For candidates sorting issue */
  535.             mmi_pen_editor_resort_candidates(candidate_buffer, num, PEN_EDITOR_SORT_NON_CAPITAL_FIRST);
  536.             break;
  537.         case INPUT_MODE_123:
  538.         case INPUT_MODE_123_SYMBOLS:
  539.             num = mmi_pen_editor_hand_writing_get_candidates(
  540.                     (U16*) gPenEditorStrokeBuffer,
  541.                     candidate_buffer,
  542.                     PEN_EDITOR_NUMBER,
  543.                     PEN_EDITOR_CANDIDATE_SIZE);
  544.             break;
  545.         default:
  546.             break;
  547.     }
  548.     gui_single_line_input_box_delete_all(&gPenEditorCandidateInputBox);
  549.     /* W05.36 Check the Candidates List, if empty return 0 */
  550.     if (0 == num)
  551.     {
  552.         return 0;
  553.     }
  554.     {
  555.         /* W05.33 Fix numeric_leading_zero issue make sure that the first candidate can be '0' */
  556.         U8 temp = numeric_leading_zero;
  557.         set_leading_zero(TRUE);
  558.         for (; i < num; i++)
  559.         {
  560.             gui_single_line_input_box_insert_character(&gPenEditorCandidateInputBox, candidate_buffer[i]);
  561.         }
  562.         set_leading_zero(temp);
  563.     }
  564.     gui_single_line_input_box_goto_first_character(&gPenEditorCandidateInputBox);
  565.     gui_single_line_input_box_next(&gPenEditorCandidateInputBox);
  566.     gdi_layer_lock_frame_buffer();
  567.     mmi_pen_editor_hide_virtual_keyboard_area();
  568.     mmi_pen_editor_show_candidate_area(MMI_FALSE, PEN_EDITOR_CANDIDATE_ON_AND_FOCUS);
  569.     gdi_layer_unlock_frame_buffer();
  570.     gdi_lcd_repaint_all();
  571.     return num;
  572. }
  573. /*****************************************************************************
  574.  * FUNCTION
  575.  *  mmi_pen_editor_input_selection_character
  576.  * DESCRIPTION
  577.  *  Empty Function
  578.  * PARAMETERS
  579.  *  c       [IN]        The character to input
  580.  * RETURNS
  581.  *  void
  582.  *****************************************************************************/
  583. void mmi_pen_editor_input_selection_character(UI_character_type c)
  584. {
  585.     /*----------------------------------------------------------------*/
  586.     /* Local Variables                                                */
  587.     /*----------------------------------------------------------------*/
  588.     /*----------------------------------------------------------------*/
  589.     /* Code Body                                                      */
  590.     /*----------------------------------------------------------------*/
  591. }
  592. /*****************************************************************************
  593.  * FUNCTION
  594.  *  mmi_pen_editor_check_input
  595.  * DESCRIPTION
  596.  *  Check the character is able to input or not
  597.  * PARAMETERS
  598.  *  c       [IN]        The character to check
  599.  * RETURNS
  600.  *  MMI_TRUE  : yes
  601.  *  MMI_FALSE : no
  602.  *****************************************************************************/
  603. MMI_BOOL mmi_pen_editor_check_input(UI_character_type c)
  604. {
  605.     /*----------------------------------------------------------------*/
  606.     /* Local Variables                                                */
  607.     /*----------------------------------------------------------------*/
  608.     /*----------------------------------------------------------------*/
  609.     /* Code Body                                                      */
  610.     /*----------------------------------------------------------------*/
  611.     if (test_change_input_mode)
  612.     {
  613.         if (0 == test_change_input_mode() && UI_TEST_UCS2_CHARACTER(c))
  614.         {
  615.             return MMI_FALSE;
  616.         }
  617.     }
  618.     return MMI_TRUE;
  619. }
  620. /*****************************************************************************
  621.  * FUNCTION
  622.  *  mmi_pen_editor_pen_down_handler
  623.  * DESCRIPTION
  624.  *  According to the control which pen down on, do the related action
  625.  * PARAMETERS
  626.  *  pos     [IN]        The position of the pen down event
  627.  * RETURNS
  628.  *  void
  629.  *****************************************************************************/
  630. #if !defined(__MMI_HANDWRITING_PAD__)
  631. void mmi_pen_editor_pen_down_handler(mmi_pen_point_struct pos)
  632. {
  633.     /*----------------------------------------------------------------*/
  634.     /* Local Variables                                                */
  635.     /*----------------------------------------------------------------*/
  636.     S32 no_of_control_set = 0;
  637.     gui_single_line_input_box_pen_enum single_line_input_box_event;
  638.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  639.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  640.     gui_pen_event_param_struct vk_para;
  641.     gui_virtual_keyboard_pen_enum vk_event;
  642.     S32 multitap_index = 0;
  643.     BOOL ret = MMI_FALSE;
  644.     /*----------------------------------------------------------------*/
  645.     /* Code Body                                                      */
  646.     /*----------------------------------------------------------------*/
  647.     if (PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK == mmi_pen_editor_get_handwriting_style())
  648.     {
  649.         if (!gPenEditorFirstStroke && (g_pen_editor_active_block != mmi_pen_editor_handwriting_check_block(pos)))
  650.         {
  651.             mmi_pen_editor_handwriting_direct_input();
  652.         }
  653.         else if (!gPenEditorFirstStroke && g_pen_editor_active_block)
  654.         {
  655.             gui_start_timer(PEN_EDITOR_CHARACTER_END_PERIOD, mmi_pen_editor_stroke_up_timer_handler);
  656.         }
  657.     }
  658.     for (; no_of_control_set < gPenEditorControlSet.NumberofControlSets; no_of_control_set++)
  659.     {
  660.         switch (gPenEditorControlSet.PenEditorControlSet[no_of_control_set])
  661.         {
  662.             case PEN_EDITOR_CONTROL_INFORMATION_BAR:
  663.                 /* W06.11 Check information bar range according to gPenEditorInputBoxType */
  664.                 switch (gPenEditorInputBoxType)
  665.                 {
  666.                     case PEN_EDITOR_MULTILINE_INPUT_BOX:
  667.                     case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  668.                     case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  669.                     case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  670.                     case PEN_EDITOR_QUICK_SEARCH_SINGLE_LINE_INPU_BOX:
  671.                     case PEN_EDITOR_INLINE_TEXT:
  672.                         ret = PEN_CHECK_BOUND(
  673.                                 pos.x,
  674.                                 pos.y,
  675.                                 wgui_inputbox_information_bar_x,
  676.                                 wgui_inputbox_information_bar_y,
  677.                                 wgui_inputbox_information_bar_width,
  678.                                 wgui_inputbox_information_bar_height);
  679.                         break;
  680.                     case PEN_EDITOR_EMS_INPUT_BOX:
  681.                         ret = PEN_CHECK_BOUND(
  682.                                 pos.x,
  683.                                 pos.y,
  684.                                 wgui_EMS_inputbox_information_bar_x,
  685.                                 wgui_EMS_inputbox_information_bar_y,
  686.                                 wgui_EMS_inputbox_information_bar_width,
  687.                                 wgui_EMS_inputbox_information_bar_height);
  688.                         break;
  689.                     case PEN_EDITOR_DATE:
  690.                     case PEN_EDITOR_IP4:
  691.                     case PEN_EDITOR_TIME:
  692.                     case PEN_EDITOR_TIME_PERIOD:
  693.                         break;
  694.                     default:
  695.                         break;
  696.                 }
  697.                 if (ret)
  698.                 {
  699.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_INFORMATION_BAR;
  700.                     if (gPenEditorSelectCandidate)
  701.                     {
  702.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  703.                     }
  704.                     return;
  705.                 }
  706.                 break;
  707.             case PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX:
  708.                 if (MMI_multiline_inputbox.n_lines > PEN_EDITOR_GUI_MULTI_LINE_INPUT_BOX_LINES)
  709.                 {
  710.                     gui_multi_line_input_box_set_pen_scroll_delay(
  711.                         &MMI_multiline_inputbox,
  712.                         PEN_EDITOR_GUI_MULTI_LINE_INPUT_BOX_SCROLL_DELAY);
  713.                 }
  714.                 ret = gui_multi_line_input_box_translate_pen_event(
  715.                         &MMI_multiline_inputbox,
  716.                         MMI_PEN_EVENT_DOWN,
  717.                         pos.x,
  718.                         pos.y,
  719.                         &multi_line_input_box_event);
  720.                 if (ret)
  721.                 {
  722.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  723.                     if (gPenEditorSelectCandidate)
  724.                     {
  725.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  726.                     }
  727.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX;
  728.                     return;
  729.                 }
  730.                 break;
  731.             case PEN_EDITOR_CONTROL_EMS_INPUT_BOX:
  732.                 if (MMI_EMS_inputbox.n_lines > PEN_EDITOR_GUI_MULTI_LINE_INPUT_BOX_LINES)
  733.                 {
  734.                     gui_EMS_input_box_set_pen_scroll_delay(
  735.                         &MMI_EMS_inputbox,
  736.                         PEN_EDITOR_GUI_MULTI_LINE_INPUT_BOX_SCROLL_DELAY);
  737.                 }
  738.                 ret = gui_EMS_input_box_translate_pen_event(
  739.                         &MMI_EMS_inputbox,
  740.                         MMI_PEN_EVENT_DOWN,
  741.                         pos.x,
  742.                         pos.y,
  743.                         &EMS_input_box_event);
  744.                 if (ret)
  745.                 {
  746.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  747.                     if (gPenEditorSelectCandidate)
  748.                     {
  749.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  750.                     }
  751.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_EMS_INPUT_BOX;
  752.                     return;
  753.                 }
  754.                 break;
  755.             case PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX:
  756.                 if (MMI_multiline_inputbox.n_lines > PEN_EDITOR_GUI_MULTI_LINE_INPUT_BOX_LINES)
  757.                 {
  758.                     gui_multi_line_input_box_set_pen_scroll_delay(
  759.                         &MMI_multiline_inputbox,
  760.                         PEN_EDITOR_GUI_MULTI_LINE_INPUT_BOX_SCROLL_DELAY);
  761.                 }
  762.                 ret = gui_multi_line_input_box_translate_pen_event(
  763.                         &MMI_multiline_inputbox,
  764.                         MMI_PEN_EVENT_DOWN,
  765.                         pos.x,
  766.                         pos.y,
  767.                         &multi_line_input_box_event);
  768.                 if (ret)
  769.                 {
  770.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  771.                     if (gPenEditorSelectCandidate)
  772.                     {
  773.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  774.                     }
  775.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX;
  776.                     return;
  777.                 }
  778.                 break;
  779.             case PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX:
  780.                 ret = gui_single_line_input_box_translate_pen_event(
  781.                         &MMI_singleline_inputbox,
  782.                         MMI_PEN_EVENT_DOWN,
  783.                         pos.x,
  784.                         pos.y,
  785.                         &single_line_input_box_event);
  786.                 if (ret)
  787.                 {
  788.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  789.                     if (gPenEditorSelectCandidate)
  790.                     {
  791.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  792.                     }
  793.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX;
  794.                     return;
  795.                 }
  796.                 break;
  797.             case PEN_EDITOR_CONTROL_INLINE_TEXT:
  798.                 ret = gui_single_line_input_box_translate_pen_event(
  799.                         &MMI_inline_singleline_inputbox,
  800.                         MMI_PEN_EVENT_DOWN,
  801.                         pos.x,
  802.                         pos.y,
  803.                         &single_line_input_box_event);
  804.                 if (ret)
  805.                 {
  806.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  807.                     if (gPenEditorSelectCandidate)
  808.                     {
  809.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  810.                     }
  811.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_INLINE_TEXT;
  812.                     return;
  813.                 }
  814.                 break;
  815.             case PEN_EDITOR_CONTROL_DATE:
  816.                 if (PEN_CHECK_BOUND
  817.                     (pos.x, pos.y, current_date_input->x, current_date_input->y, current_date_input->width,
  818.                      current_date_input->height))
  819.                 {
  820.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  821.                     if (gPenEditorSelectCandidate)
  822.                     {
  823.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  824.                     }
  825.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_DATE;
  826.                     return;
  827.                 }
  828.                 break;
  829.             case PEN_EDITOR_CONTROL_IP4:
  830.                 if (PEN_CHECK_BOUND
  831.                     (pos.x, pos.y, current_IP4_input->x, current_IP4_input->y, current_IP4_input->width,
  832.                      current_IP4_input->height))
  833.                 {
  834.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  835.                     if (gPenEditorSelectCandidate)
  836.                     {
  837.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  838.                     }
  839.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_IP4;
  840.                     return;
  841.                 }
  842.                 break;
  843.             case PEN_EDITOR_CONTROL_TIME:
  844.                 if (PEN_CHECK_BOUND
  845.                     (pos.x, pos.y, current_time_input->x, current_time_input->y, current_time_input->width,
  846.                      current_time_input->height))
  847.                 {
  848.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  849.                     if (gPenEditorSelectCandidate)
  850.                     {
  851.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  852.                     }
  853.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_TIME;
  854.                     return;
  855.                 }
  856.                 break;
  857.             case PEN_EDITOR_CONTROL_TIME_PERIOD:
  858.                 if (PEN_CHECK_BOUND
  859.                     (pos.x, pos.y, current_time_period_input->x, current_time_period_input->y,
  860.                      current_time_period_input->width, current_time_period_input->height))
  861.                 {
  862.                     /* W05.45 Temp Solution for Pen Down When Selecting Candidates */
  863.                     if (gPenEditorSelectCandidate)
  864.                     {
  865.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  866.                     }
  867.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_TIME_PERIOD;
  868.                     return;
  869.                 }
  870.                 break;
  871.             case PEN_EDITOR_CONTROL_SCROLL_BAR:
  872.                 break;
  873.             case PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD:
  874.                 if (PEN_EDITOR_VK_ON == gPenEditorVKState)
  875.                 {
  876.                     ret = gui_virtual_keyboard_translate_pen_event(
  877.                             &MMI_virtual_keyboard,
  878.                             pos.x,
  879.                             pos.y,
  880.                             MMI_PEN_EVENT_DOWN,
  881.                             &vk_event,
  882.                             &vk_para);
  883.                 }
  884.                 else
  885.                 {
  886.                     break;
  887.                 }
  888.                 if (ret)
  889.                 {
  890.                     switch (vk_event)
  891.                     {
  892.                         case GUI_VKBD_PEN_BAKSPACE:
  893.                             break;
  894.                         case GUI_VKBD_PEN_BRACKET:
  895.                             break;
  896.                         case GUI_VKBD_PEN_CAPSLOCK:
  897.                             break;
  898.                         case GUI_VKBD_PEN_CHAR_I:
  899.                             break;
  900.                         case GUI_VKBD_PEN_DISPLAY_AREA:
  901.                             break;
  902.                         case GUI_VKBD_PEN_HIDE:
  903.                             break;
  904.                         case GUI_VKBD_PEN_NEWLINE:
  905.                             break;
  906.                         case GUI_VKBD_PEN_NONE:
  907.                             break;
  908.                         case GUI_VKBD_PEN_SHOW:
  909.                             break;
  910.                         case GUI_VKBD_PEN_SPACE:
  911.                             break;
  912.                         case GUI_VKBD_PEN_SYMBPICKER:
  913.                             break;
  914.                         default:
  915.                             MMI_ASSERT(0);
  916.                             break;
  917.                     }
  918.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD;
  919.                     return;
  920.                 }
  921.                 break;
  922.             case PEN_EDITOR_CONTROL_COMPOSITION_AREA:
  923.                 if (PEN_EDITOR_CANDIDATE_OFF != g_pen_editor_composition_state.candidate_state)
  924.                 {
  925.                     ret = gui_single_line_input_box_translate_pen_event(
  926.                             &g_pen_editor_composition_input_box,
  927.                             MMI_PEN_EVENT_DOWN,
  928.                             pos.x,
  929.                             pos.y,
  930.                             &single_line_input_box_event);
  931.                     if (ret)
  932.                     {
  933.                         g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_IN_CONTROL;
  934.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  935.                         gPenEditorActiveControl = PEN_EDITOR_CONTROL_COMPOSITION_AREA;
  936.                         gui_show_single_line_input_box_ext(&g_pen_editor_composition_input_box, pos.x, pos.y);
  937.                         gdi_layer_lock_frame_buffer();
  938.                         /* /TODO : Jump to the index */
  939.                         if ((INPUT_MODE_TR_BOPOMO == MMI_current_input_mode ||
  940.                              INPUT_MODE_SM_PINYIN == MMI_current_input_mode) &&
  941.                             PEN_EDITOR_CANDIDATE_ON_AND_FOCUS == g_pen_editor_composition_state.candidate_state)
  942.                         {
  943.                             g_pen_editor_composition_index = mmi_pen_editor_smart_bpmf_pinyin_set_syllable_by_position();
  944.                             mmi_pen_editor_smart_bpmf_pinyin_set_syllable_by_index(g_pen_editor_composition_index);
  945.                         }
  946.                         gdi_layer_unlock_frame_buffer();
  947.                         gdi_lcd_repaint_all();
  948.                         return;
  949.                     }
  950.                     if (g_pen_editor_composition_state.arrow_enable)
  951.                     {
  952.                         ret = PEN_CHECK_BOUND(
  953.                                 pos.x,
  954.                                 pos.y,
  955.                                 g_pen_editor_composition_input_box.x - (((g_pen_editor_composition_input_box.grid_width << 1) + g_pen_editor_composition_input_box.grid_width) >> 2) - 1,
  956.                                 g_pen_editor_composition_input_box.y + (g_pen_editor_composition_input_box.height >> 3),
  957.                                 g_pen_editor_composition_input_box.grid_width >> 1,
  958.                                 ((g_pen_editor_composition_input_box.height << 1) + g_pen_editor_composition_input_box.height) >> 2);
  959.                         if (ret)
  960.                         {
  961.                             g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_IN_LEFT_ARROW;
  962.                             gPenEditorActiveControl = PEN_EDITOR_CONTROL_COMPOSITION_AREA;
  963.                             gdi_layer_lock_frame_buffer();
  964.                             mmi_pen_editor_hide_composition_area();
  965.                             gui_show_single_line_input_box(&g_pen_editor_composition_input_box);
  966.                             if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_composition_state.left_arrow_state)
  967.                             {
  968.                                 g_pen_editor_composition_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  969.                             }
  970.                             mmi_pen_editor_draw_arrow(
  971.                                 PEN_EDITOR_ARROW_DIRECTION_LEFT,
  972.                                 g_pen_editor_composition_state.left_arrow_state,
  973.                                 PEN_EDITOR_ARROW_FOR_COMPOSITION);
  974.                             mmi_pen_editor_draw_arrow(
  975.                                 PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  976.                                 g_pen_editor_composition_state.right_arrow_state,
  977.                                 PEN_EDITOR_ARROW_FOR_COMPOSITION);
  978.                             gdi_layer_unlock_frame_buffer();
  979.                             gdi_lcd_repaint_all();
  980.                             return;
  981.                         }
  982.                         ret = PEN_CHECK_BOUND(
  983.                                 pos.x,
  984.                                 pos.y,
  985.                                 g_pen_editor_composition_input_box.x + g_pen_editor_composition_input_box.width + (g_pen_editor_composition_input_box.grid_width >> 2) - 1,
  986.                                 g_pen_editor_composition_input_box.y + (g_pen_editor_composition_input_box.height >> 3),
  987.                                 g_pen_editor_composition_input_box.grid_width >> 1,
  988.                                 ((g_pen_editor_composition_input_box.height << 1) + g_pen_editor_composition_input_box.height) >> 2);
  989.                         if (ret)
  990.                         {
  991.                             g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_IN_RIGHT_ARROW;
  992.                             gPenEditorActiveControl = PEN_EDITOR_CONTROL_COMPOSITION_AREA;
  993.                             gdi_layer_lock_frame_buffer();
  994.                             mmi_pen_editor_hide_composition_area();
  995.                             gui_show_single_line_input_box(&g_pen_editor_composition_input_box);
  996.                             if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_composition_state.right_arrow_state)
  997.                             {
  998.                                 g_pen_editor_composition_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  999.                             }
  1000.                             mmi_pen_editor_draw_arrow(
  1001.                                 PEN_EDITOR_ARROW_DIRECTION_LEFT,
  1002.                                 g_pen_editor_composition_state.left_arrow_state,
  1003.                                 PEN_EDITOR_ARROW_FOR_COMPOSITION);
  1004.                             mmi_pen_editor_draw_arrow(
  1005.                                 PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  1006.                                 g_pen_editor_composition_state.right_arrow_state,
  1007.                                 PEN_EDITOR_ARROW_FOR_COMPOSITION);
  1008.                             gdi_layer_unlock_frame_buffer();
  1009.                             gdi_lcd_repaint_all();
  1010.                             return;
  1011.                         }
  1012.                         ret = PEN_CHECK_BOUND(
  1013.                                 pos.x, 
  1014.                                 pos.y, 
  1015.                                 0, 
  1016.                                 g_pen_editor_composition_input_box.y, 
  1017.                                 UI_device_width, 
  1018.                                 g_pen_editor_composition_input_box.height);
  1019.                         if (ret)
  1020.                         {
  1021.                             g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_OUT_OF_RANGE;
  1022.                             gPenEditorActiveControl = PEN_EDITOR_CONTROL_COMPOSITION_AREA;
  1023.                             return;
  1024.                         }
  1025.                     }
  1026.                 }
  1027.                 break;
  1028.             case PEN_EDITOR_CONTROL_CANDIDATE_AREA:
  1029.                 if (gPenEditorSelectCandidate)
  1030.                 {
  1031.                     g_pen_editor_candidate_state.selected_candidate = 0;
  1032.                     ret = gui_single_line_input_box_translate_pen_event(
  1033.                             &gPenEditorCandidateInputBox,
  1034.                             MMI_PEN_EVENT_DOWN,
  1035.                             pos.x,
  1036.                             pos.y,
  1037.                             &single_line_input_box_event);
  1038.                     if (ret)
  1039.                     {
  1040.                         UI_character_type ch, ch1, ch2;
  1041.                         g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_IN_CONTROL;
  1042.                         gui_cancel_timer(mmi_pen_editor_confirm_selection);
  1043.                         gPenEditorActiveControl = PEN_EDITOR_CONTROL_CANDIDATE_AREA;
  1044.                         gui_show_single_line_input_box_ext(&gPenEditorCandidateInputBox, pos.x, pos.y);
  1045.                         gui_single_line_input_box_next(&gPenEditorCandidateInputBox);
  1046.                         ch1 = *(gPenEditorCandidateInputBox.current_text_p - 2);
  1047.                         ch2 = *(gPenEditorCandidateInputBox.current_text_p - 1);
  1048.                         ch = ch1 | (ch2 << 8);
  1049.                         g_pen_editor_candidate_state.selected_candidate = ch;
  1050.                         if (mmi_pen_editor_check_input(ch))
  1051.                         {
  1052.                             gdi_layer_lock_frame_buffer();
  1053.                             switch (gPenEditorInputBoxType)
  1054.                             {
  1055.                                     /* W05.32 Fix typo error */
  1056.                                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  1057.                                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  1058.                                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  1059.                                     multiline_inputbox_multitap_input(ch);
  1060.                                     break;
  1061.                                 case PEN_EDITOR_EMS_INPUT_BOX:
  1062.                                     EMS_inputbox_multitap_input(ch);
  1063.                                     break;
  1064.                                 case PEN_EDITOR_INLINE_TEXT:
  1065.                                     inline_edit_singleline_inputbox_multitap_input(ch);
  1066.                                     break;
  1067.                                 default:
  1068.                                     break;
  1069.                             }
  1070.                             mmi_pen_editor_show_candidate_area(
  1071.                                 g_pen_editor_candidate_state.arrow_enable,
  1072.                                 g_pen_editor_candidate_state.candidate_state);
  1073.                             gdi_layer_unlock_frame_buffer();
  1074.                             gdi_lcd_repaint_all();
  1075.                             return;
  1076.                         }
  1077.                         else
  1078.                         {
  1079.                             /* W06.16 Play warning tone when inserting characters is valid */
  1080.                             UI_editor_play_tone_cannot_insert();
  1081.                             return;
  1082.                         }
  1083.                     }
  1084.                     if (g_pen_editor_candidate_state.arrow_enable)
  1085.                     {
  1086.                         ret = PEN_CHECK_BOUND(
  1087.                                 pos.x,
  1088.                                 pos.y,
  1089.                                 gPenEditorCandidateInputBox.x - (((gPenEditorCandidateInputBox.grid_width << 1) + gPenEditorCandidateInputBox.grid_width) >> 2) - 1,
  1090.                                 gPenEditorCandidateInputBox.y + (gPenEditorCandidateInputBox.height >> 3),
  1091.                                 gPenEditorCandidateInputBox.grid_width >> 1,
  1092.                                 ((gPenEditorCandidateInputBox.height << 1) + gPenEditorCandidateInputBox.height) >> 2);
  1093.                         if (ret)
  1094.                         {
  1095.                             g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_IN_LEFT_ARROW;
  1096.                             gPenEditorActiveControl = PEN_EDITOR_CONTROL_CANDIDATE_AREA;
  1097.                             gdi_layer_lock_frame_buffer();
  1098.                             mmi_pen_editor_hide_candidate_area();
  1099.                             gui_show_single_line_input_box(&gPenEditorCandidateInputBox);
  1100.                             if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_candidate_state.left_arrow_state)
  1101.                             {
  1102.                                 g_pen_editor_candidate_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  1103.                             }
  1104.                             mmi_pen_editor_draw_arrow(
  1105.                                 PEN_EDITOR_ARROW_DIRECTION_LEFT,
  1106.                                 g_pen_editor_candidate_state.left_arrow_state,
  1107.                                 PEN_EDITOR_ARROW_FOR_CANDIDATE);
  1108.                             mmi_pen_editor_draw_arrow(
  1109.                                 PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  1110.                                 g_pen_editor_candidate_state.right_arrow_state,
  1111.                                 PEN_EDITOR_ARROW_FOR_CANDIDATE);
  1112.                             gdi_layer_unlock_frame_buffer();
  1113.                             gdi_lcd_repaint_all();
  1114.                             return;
  1115.                         }
  1116.                         ret = PEN_CHECK_BOUND(
  1117.                                 pos.x,
  1118.                                 pos.y,
  1119.                                 gPenEditorCandidateInputBox.x + gPenEditorCandidateInputBox.width + (gPenEditorCandidateInputBox.grid_width >> 2) - 1,
  1120.                                 gPenEditorCandidateInputBox.y + (gPenEditorCandidateInputBox.height >> 3),
  1121.                                 gPenEditorCandidateInputBox.grid_width >> 1,
  1122.                                 ((gPenEditorCandidateInputBox.height << 1) + gPenEditorCandidateInputBox.height) >> 2);
  1123.                         if (ret)
  1124.                         {
  1125.                             g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_IN_RIGHT_ARROW;
  1126.                             gPenEditorActiveControl = PEN_EDITOR_CONTROL_CANDIDATE_AREA;
  1127.                             gdi_layer_lock_frame_buffer();
  1128.                             mmi_pen_editor_hide_candidate_area();
  1129.                             gui_show_single_line_input_box(&gPenEditorCandidateInputBox);
  1130.                             if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_candidate_state.right_arrow_state)
  1131.                             {
  1132.                                 g_pen_editor_candidate_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  1133.                             }
  1134.                             mmi_pen_editor_draw_arrow(
  1135.                                 PEN_EDITOR_ARROW_DIRECTION_LEFT,
  1136.                                 g_pen_editor_candidate_state.left_arrow_state,
  1137.                                 PEN_EDITOR_ARROW_FOR_CANDIDATE);
  1138.                             mmi_pen_editor_draw_arrow(
  1139.                                 PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  1140.                                 g_pen_editor_candidate_state.right_arrow_state,
  1141.                                 PEN_EDITOR_ARROW_FOR_CANDIDATE);
  1142.                             gdi_layer_unlock_frame_buffer();
  1143.                             gdi_lcd_repaint_all();
  1144.                             return;
  1145.                         }
  1146.                         ret = PEN_CHECK_BOUND(
  1147.                                 pos.x, 
  1148.                                 pos.y, 
  1149.                                 0, 
  1150.                                 gPenEditorCandidateInputBox.y, 
  1151.                                 UI_device_width, 
  1152.                                 gPenEditorCandidateInputBox.height);
  1153.                         if (ret)
  1154.                         {
  1155.                             g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_OUT_OF_RANGE;
  1156.                             gPenEditorActiveControl = PEN_EDITOR_CONTROL_CANDIDATE_AREA;
  1157.                             return;
  1158.                         }
  1159.                     }
  1160.                 }
  1161.                 break;
  1162.             case PEN_EDITOR_CONTROL_IME_BUTTON:
  1163.                 if (ret)
  1164.                 {
  1165.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_IME_BUTTON;
  1166.                     return;
  1167.                 }
  1168.                 break;
  1169.             case PEN_EDITOR_CONTROL_MULTITAP:
  1170.                 if (MMI_TRUE == gPenEditorMultitapInputState)
  1171.                 {
  1172.                     ret = gui_multitap_input_translate_pen_position(
  1173.                             gPenEditorMultitapInput,
  1174.                             pos.x,
  1175.                             pos.y,
  1176.                             &multitap_index);
  1177.                 }
  1178.                 if (ret)
  1179.                 {
  1180.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_MULTITAP;
  1181.                     return;
  1182.                 }
  1183.                 break;
  1184.             case PEN_EDITOR_CONTROL_NONE:
  1185.                 break;
  1186.             default:
  1187.                 MMI_ASSERT(0);
  1188.         }
  1189.     }
  1190.     if (MMI_FALSE == ret)
  1191.     {
  1192.         //W05.43 Temp Solution for Switch Input Method Without Complete Selecting Candidate
  1193.         //W05.45 Temp Solution for Pen Down When Selecting Candidates
  1194.         gPenEditorActiveControl = PEN_EDITOR_CONTROL_NONE;
  1195.         wgui_general_pen_down_hdlr(pos);
  1196.         if (gPenEditorSelectCandidate && !g_pen_editor_hold_confirm)
  1197.         {
  1198.             gui_cancel_timer(mmi_pen_editor_confirm_selection);
  1199.             mmi_pen_editor_confirm_selection();
  1200.         }
  1201.     }
  1202. }
  1203. /*****************************************************************************
  1204.  * FUNCTION
  1205.  *  mmi_pen_editor_pen_up_handler
  1206.  * DESCRIPTION
  1207.  *  According to the control which pen up on, do the related action
  1208.  * PARAMETERS
  1209.  *  pos     [IN]        The position of the pen up event
  1210.  * RETURNS
  1211.  *  void
  1212.  *****************************************************************************/
  1213. void mmi_pen_editor_pen_up_handler(mmi_pen_point_struct pos)
  1214. {
  1215.     /*----------------------------------------------------------------*/
  1216.     /* Local Variables                                                */
  1217.     /*----------------------------------------------------------------*/
  1218.     /* S32 no_of_control_set = 0; */
  1219.     gui_single_line_input_box_pen_enum single_line_input_box_event;
  1220.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1221.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1222.     gui_pen_event_param_struct vk_para;
  1223.     gui_virtual_keyboard_pen_enum vk_event;
  1224.     BOOL ret = MMI_FALSE;
  1225.     S32 multitap_index = 0;
  1226.     /*----------------------------------------------------------------*/
  1227.     /* Code Body                                                      */
  1228.     /*----------------------------------------------------------------*/
  1229.     /* W06.09 Confirm Selection before moving cursor or switching input method */
  1230.     switch (gPenEditorActiveControl)
  1231.     {
  1232.         case PEN_EDITOR_CONTROL_INFORMATION_BAR:
  1233.             /* W06.11 Check information bar range according to gPenEditorInputBoxType */
  1234.             switch (gPenEditorInputBoxType)
  1235.             {
  1236.                 case PEN_EDITOR_MULTILINE_INPUT_BOX:
  1237.                 case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  1238.                 case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  1239.                 case PEN_EDITOR_SINGLE_LINE_INPU_BOX:
  1240.                 case PEN_EDITOR_QUICK_SEARCH_SINGLE_LINE_INPU_BOX:
  1241.                 case PEN_EDITOR_INLINE_TEXT:
  1242.                     ret = PEN_CHECK_BOUND(
  1243.                             pos.x,
  1244.                             pos.y,
  1245.                             wgui_inputbox_information_bar_x,
  1246.                             wgui_inputbox_information_bar_y,
  1247.                             wgui_inputbox_information_bar_x + wgui_information_bar_input_mode_display_width,
  1248.                             wgui_inputbox_information_bar_height);
  1249.                     break;
  1250.                 case PEN_EDITOR_EMS_INPUT_BOX:
  1251.                     ret = PEN_CHECK_BOUND(
  1252.                             pos.x,
  1253.                             pos.y,
  1254.                             wgui_EMS_inputbox_information_bar_x,
  1255.                             wgui_EMS_inputbox_information_bar_y,
  1256.                             wgui_EMS_inputbox_information_bar_x + wgui_information_bar_input_mode_display_width,
  1257.                             wgui_EMS_inputbox_information_bar_height);
  1258.                     break;
  1259.                 case PEN_EDITOR_DATE:
  1260.                 case PEN_EDITOR_IP4:
  1261.                 case PEN_EDITOR_TIME:
  1262.                 case PEN_EDITOR_TIME_PERIOD:
  1263.                     break;
  1264.                 default:
  1265.                     break;
  1266.             }
  1267.             if (!ret)
  1268.             {
  1269.                 break;
  1270.             }
  1271.             if (gPenEditorSelectCandidate)
  1272.             {
  1273.                 mmi_pen_editor_confirm_selection();
  1274.             }
  1275.             mmi_pen_editor_switch_input_method();
  1276.             if (ret)
  1277.             {
  1278.                 return;
  1279.             }
  1280.             break;
  1281.         case PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX:
  1282.             ret = gui_multi_line_input_box_translate_pen_event(
  1283.                     &MMI_multiline_inputbox,
  1284.                     MMI_PEN_EVENT_UP,
  1285.                     pos.x,
  1286.                     pos.y,
  1287.                     &multi_line_input_box_event);
  1288.             if (ret)
  1289.             {
  1290.                 if (gPenEditorSelectCandidate && gPenEditorVKText.TextLength == 0)
  1291.                 {
  1292.                     mmi_pen_editor_confirm_selection();
  1293.                 }
  1294.                 if (GUI_MULTI_LINE_INPUT_BOX_PEN_SCROLL_BAR != multi_line_input_box_event)
  1295.                 {
  1296.                     gui_show_multi_line_input_box_ext(&MMI_multiline_inputbox, pos.x, pos.y);
  1297.                     redraw_multiline_inputbox();
  1298.                 }
  1299.                 return;
  1300.             }
  1301.             break;
  1302.         case PEN_EDITOR_CONTROL_EMS_INPUT_BOX:
  1303.             ret = gui_EMS_input_box_translate_pen_event(
  1304.                     &MMI_EMS_inputbox,
  1305.                     MMI_PEN_EVENT_UP,
  1306.                     pos.x,
  1307.                     pos.y,
  1308.                     &EMS_input_box_event);
  1309.             if (ret)
  1310.             {
  1311.                 if (gPenEditorSelectCandidate && gPenEditorVKText.TextLength == 0)
  1312.                 {
  1313.                     mmi_pen_editor_confirm_selection();
  1314.                 }
  1315.                 if (GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR != EMS_input_box_event)
  1316.                 {
  1317.                     gui_show_EMS_input_box_ext(&MMI_EMS_inputbox, pos.x, pos.y);
  1318.                     wgui_EMS_set_text_format(MMI_EMS_inputbox.text_format);
  1319.                     redraw_EMS_inputbox();
  1320.                 }
  1321.                 return;
  1322.             }
  1323.             break;
  1324.         case PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX:
  1325.             ret = gui_multi_line_input_box_translate_pen_event(
  1326.                     &MMI_multiline_inputbox,
  1327.                     MMI_PEN_EVENT_UP,
  1328.                     pos.x,
  1329.                     pos.y,
  1330.                     &multi_line_input_box_event);
  1331.             if (ret)
  1332.             {
  1333.                 if (gPenEditorSelectCandidate && gPenEditorVKText.TextLength == 0)
  1334.                 {
  1335.                     mmi_pen_editor_confirm_selection();
  1336.                 }
  1337.                 if (GUI_MULTI_LINE_INPUT_BOX_PEN_SCROLL_BAR != multi_line_input_box_event)
  1338.                 {
  1339.                     gui_show_multi_line_input_box_ext(&MMI_multiline_inputbox, pos.x, pos.y);
  1340.                 }
  1341.                 redraw_multiline_inputbox();
  1342.                 return;
  1343.             }
  1344.             break;
  1345.         case PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX:
  1346.             ret = gui_single_line_input_box_translate_pen_event(
  1347.                     &MMI_singleline_inputbox,
  1348.                     MMI_PEN_EVENT_UP,
  1349.                     pos.x,
  1350.                     pos.y,
  1351.                     &single_line_input_box_event);
  1352.             if (ret)
  1353.             {
  1354.                 if (gPenEditorSelectCandidate)
  1355.                 {
  1356.                     mmi_pen_editor_confirm_selection();
  1357.                 }
  1358.                 gui_show_single_line_input_box_ext(&MMI_singleline_inputbox, pos.x, pos.y);
  1359.                 /* W06.15 Reloacate Curesor after moving cursor by pen */
  1360.                 gui_single_line_input_box_locate_cursor(&MMI_singleline_inputbox);
  1361.                 redraw_singleline_inputbox();
  1362.                 return;
  1363.             }
  1364.             break;
  1365.         case PEN_EDITOR_CONTROL_INLINE_TEXT:
  1366.             ret = gui_single_line_input_box_translate_pen_event(
  1367.                     &MMI_inline_singleline_inputbox,
  1368.                     MMI_PEN_EVENT_UP,
  1369.                     pos.x,
  1370.                     pos.y,
  1371.                     &single_line_input_box_event);
  1372.             if (ret)
  1373.             {
  1374.                 if (gPenEditorSelectCandidate)
  1375.                 {
  1376.                     mmi_pen_editor_confirm_selection();
  1377.                 }
  1378.                 gui_show_single_line_input_box_ext(&MMI_inline_singleline_inputbox, pos.x, pos.y);
  1379.                 /* W06.15 Reloacate Curesor after moving cursor by pen */
  1380.                 gui_single_line_input_box_locate_cursor(&MMI_inline_singleline_inputbox);
  1381.                 show_inline_singleline_inputbox();
  1382.                 return;
  1383.             }
  1384.             break;
  1385.         case PEN_EDITOR_CONTROL_DATE:
  1386.             if (gPenEditorSelectCandidate)
  1387.             {
  1388.                 mmi_pen_editor_confirm_selection();
  1389.             }
  1390.             date_input_move_to_x_y(current_date_input, pos.x, pos.y);
  1391.             if (ret)
  1392.             {
  1393.                 return;
  1394.             }
  1395.             break;
  1396.         case PEN_EDITOR_CONTROL_IP4:
  1397.             if (gPenEditorSelectCandidate)
  1398.             {
  1399.                 mmi_pen_editor_confirm_selection();
  1400.             }
  1401.             IP4_input_move_to_x_y(current_IP4_input, pos.x, pos.y);
  1402.             if (ret)
  1403.             {
  1404.                 return;
  1405.             }
  1406.             break;
  1407.         case PEN_EDITOR_CONTROL_TIME:
  1408.             if (gPenEditorSelectCandidate)
  1409.             {
  1410.                 mmi_pen_editor_confirm_selection();
  1411.             }
  1412.             time_input_move_to_x_y(current_time_input, pos.x, pos.y);
  1413.             if (ret)
  1414.             {
  1415.                 return;
  1416.             }
  1417.             break;
  1418.         case PEN_EDITOR_CONTROL_TIME_PERIOD:
  1419.             if (gPenEditorSelectCandidate)
  1420.             {
  1421.                 mmi_pen_editor_confirm_selection();
  1422.             }
  1423.             time_period_input_move_to_x_y(current_time_period_input, pos.x, pos.y);
  1424.             if (ret)
  1425.             {
  1426.                 return;
  1427.             }
  1428.             break;
  1429.         case PEN_EDITOR_CONTROL_SCROLL_BAR:
  1430.             break;
  1431.         case PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD:
  1432.             ret = gui_virtual_keyboard_translate_pen_event(
  1433.                     &MMI_virtual_keyboard,
  1434.                     pos.x,
  1435.                     pos.y,
  1436.                     MMI_PEN_EVENT_UP,
  1437.                     &vk_event,
  1438.                     &vk_para);
  1439.          //Jerry add on 2007-4-24 start
  1440.          #if defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)
  1441.          if(GUI_VIRTUAL_KEYBOARD_SYMBOL==MMI_virtual_keyboard.lang_type 
  1442.        &&(INPUT_MODE_TR_STROKE==MMI_current_input_mode 
  1443.           ||INPUT_MODE_SM_STROKE==MMI_current_input_mode)
  1444.   && gPenEditorVKCandidate)
  1445.          {
  1446.              mmi_pen_editor_hide_candidate_area();    
  1447.          }
  1448.          #endif
  1449.          //Jerry add on 2007-4-24 end
  1450.             if (ret)
  1451.             {
  1452.                 switch (vk_event)
  1453.                 {
  1454.                     case GUI_VKBD_PEN_BAKSPACE:
  1455.                         mmi_pen_editor_right_soft_key_handler();
  1456.                         break;
  1457.                     case GUI_VKBD_PEN_BRACKET:
  1458.                         mmi_pen_editor_bracket();
  1459.                         break;
  1460.                     case GUI_VKBD_PEN_CAPSLOCK:
  1461.                         mmi_pen_editor_vk_caps_lock();
  1462.                         break;
  1463.                     case GUI_VKBD_PEN_CHAR_I:
  1464.                         mmi_pen_editor_vk_insertcharacter(vk_para);
  1465.                         break;
  1466.                     case GUI_VKBD_PEN_DISPLAY_AREA:
  1467.                         break;
  1468.                     case GUI_VKBD_PEN_HIDE:
  1469.                         if (PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK == mmi_pen_editor_get_handwriting_style())
  1470.                         {
  1471.                             mmi_pen_editor_enable_multi_block_handwriting();
  1472.                         }
  1473.                         else
  1474.                         {
  1475.                             mmi_pen_editor_vk_hide();
  1476.                         }
  1477.                         break;
  1478.                     case GUI_VKBD_PEN_NEWLINE:
  1479.                         mmi_pen_editor_new_line();
  1480.                         break;
  1481.                     case GUI_VKBD_PEN_NONE:
  1482.                         ret = MMI_FALSE;
  1483.                         break;
  1484.                     case GUI_VKBD_PEN_SHOW:
  1485.                         if (PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK == mmi_pen_editor_get_handwriting_style())
  1486.                         {
  1487.                             mmi_pen_editor_disable_multi_block_handwriting();
  1488.                         }
  1489.                         else
  1490.                         {
  1491.                             mmi_pen_editor_vk_show();
  1492.                         }
  1493.                         break;
  1494.                     case GUI_VKBD_PEN_SPACE:
  1495.                         /* Code for ?? */
  1496.                         mmi_pen_editor_input_character(' ', MMI_FALSE);
  1497.                         break;
  1498.                     case GUI_VKBD_PEN_SYMBPICKER:
  1499.                         mmi_pen_editor_vk_symbol_picker();
  1500.                         break;
  1501.                     default:
  1502.                         MMI_ASSERT(0);
  1503.                 }
  1504.                 if (ret)
  1505.                 {
  1506.                     return;
  1507.                 }
  1508.             }
  1509.             break;
  1510.         case PEN_EDITOR_CONTROL_COMPOSITION_AREA:
  1511.             if (PEN_EDITOR_CANDIDATE_OFF != g_pen_editor_composition_state.candidate_state)
  1512.             {
  1513.                 if (g_pen_editor_composition_state.arrow_enable &&
  1514.                     PEN_EDITOR_MOVE_OUT != g_pen_editor_composition_state.pen_down_state)
  1515.                 {
  1516.                     if (PEN_EDITOR_ARROW_PRESS_DOWN == g_pen_editor_composition_state.right_arrow_state)
  1517.                     {
  1518.                         ret = PEN_CHECK_BOUND(
  1519.                                 pos.x,
  1520.                                 pos.y,
  1521.                                 g_pen_editor_composition_input_box.x + g_pen_editor_composition_input_box.width + (g_pen_editor_composition_input_box.grid_width >> 2) - 1,
  1522.                                 g_pen_editor_composition_input_box.y + (g_pen_editor_composition_input_box.height >> 3),
  1523.                                 g_pen_editor_composition_input_box.grid_width >> 1,
  1524.                                 ((g_pen_editor_composition_input_box.height << 1) + g_pen_editor_composition_input_box.height) >> 2);
  1525.                         if (ret)
  1526.                         {
  1527.                             gdi_layer_lock_frame_buffer();
  1528.                             mmi_pen_editor_smart_bpmf_pinyin_get_syllable_next();
  1529.                             gdi_layer_unlock_frame_buffer();
  1530.                             gdi_lcd_repaint_all();
  1531.                         }
  1532.                         //if (PEN_EDITOR_ARROW_DISABLE != g_pen_editor_composition_state.right_arrow_state)
  1533.                         //{
  1534.                         //    g_pen_editor_composition_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_UP;
  1535.                         //}
  1536.                     }
  1537.                     else if (PEN_EDITOR_ARROW_PRESS_DOWN == g_pen_editor_composition_state.left_arrow_state)
  1538.                     {
  1539.                         ret = PEN_CHECK_BOUND(
  1540.                                 pos.x,
  1541.                                 pos.y,
  1542.                                 g_pen_editor_composition_input_box.x - (((g_pen_editor_composition_input_box.grid_width << 1) + g_pen_editor_composition_input_box.grid_width) >> 2) - 1,
  1543.                                 g_pen_editor_composition_input_box.y + (g_pen_editor_composition_input_box.height >> 3),
  1544.                                 g_pen_editor_composition_input_box.grid_width >> 1,
  1545.                                 ((g_pen_editor_composition_input_box.height << 1) + g_pen_editor_composition_input_box.height) >> 2);
  1546.                         if (ret)
  1547.                         {
  1548.                             gdi_layer_lock_frame_buffer();
  1549.                             mmi_pen_editor_smart_bpmf_pinyin_get_syllable_prev();
  1550.                             gdi_layer_unlock_frame_buffer();
  1551.                             gdi_lcd_repaint_all();
  1552.                         }
  1553.                         //if (PEN_EDITOR_ARROW_DISABLE != g_pen_editor_composition_state.left_arrow_state)
  1554.                         //{
  1555.                         //    g_pen_editor_composition_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_UP;
  1556.                         //}
  1557.                     }
  1558.                 }
  1559.                 ret = gui_single_line_input_box_translate_pen_event(
  1560.                         &g_pen_editor_composition_input_box,
  1561.                         MMI_PEN_EVENT_UP,
  1562.                         pos.x,
  1563.                         pos.y,
  1564.                         &single_line_input_box_event);
  1565.                 if (ret)
  1566.                 {
  1567.                     gdi_layer_lock_frame_buffer();
  1568.                     gui_show_single_line_input_box_ext(&g_pen_editor_composition_input_box, pos.x, pos.y);
  1569.                     if ((INPUT_MODE_TR_BOPOMO == MMI_current_input_mode ||
  1570.                          INPUT_MODE_SM_PINYIN == MMI_current_input_mode) &&
  1571.                         PEN_EDITOR_CANDIDATE_ON_AND_FOCUS == g_pen_editor_composition_state.candidate_state)
  1572.                     {
  1573.                         g_pen_editor_composition_index = mmi_pen_editor_smart_bpmf_pinyin_set_syllable_by_position();
  1574.                         mmi_pen_editor_smart_bpmf_pinyin_set_syllable_by_index(g_pen_editor_composition_index);
  1575.                         mmi_pen_editor_smart_bpmf_pinyin_confirm_syllable();
  1576.                     }
  1577.                     gdi_layer_unlock_frame_buffer();
  1578.                     gdi_lcd_repaint_all();
  1579.                 }
  1580.             }
  1581.             break;
  1582.         case PEN_EDITOR_CONTROL_CANDIDATE_AREA:
  1583.             if (gPenEditorSelectCandidate)
  1584.             {
  1585.                 if (g_pen_editor_candidate_state.arrow_enable &&
  1586.                     PEN_EDITOR_MOVE_OUT != g_pen_editor_candidate_state.pen_down_state)
  1587.                 {
  1588.                     if (PEN_EDITOR_ARROW_PRESS_DOWN == g_pen_editor_candidate_state.right_arrow_state)
  1589.                     {
  1590.                         ret = PEN_CHECK_BOUND(
  1591.                                 pos.x,
  1592.                                 pos.y,
  1593.                                 gPenEditorCandidateInputBox.x + gPenEditorCandidateInputBox.width + (gPenEditorCandidateInputBox.grid_width >> 2) - 1,
  1594.                                 gPenEditorCandidateInputBox.y + (gPenEditorCandidateInputBox.height >> 3),
  1595.                                 gPenEditorCandidateInputBox.grid_width >> 1,
  1596.                                 ((gPenEditorCandidateInputBox.height << 1) + gPenEditorCandidateInputBox.height) >> 2);
  1597.                         if (ret)
  1598.                         {
  1599.                             mmi_pen_editor_get_candidates_next_page();
  1600.                         }
  1601.                         /* g_pen_editor_candidate_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_UP; */
  1602.                     }
  1603.                     else if (PEN_EDITOR_ARROW_PRESS_DOWN == g_pen_editor_candidate_state.left_arrow_state)
  1604.                     {
  1605.                         ret = PEN_CHECK_BOUND(
  1606.                                 pos.x,
  1607.                                 pos.y,
  1608.                                 gPenEditorCandidateInputBox.x - (((gPenEditorCandidateInputBox.grid_width << 1) + gPenEditorCandidateInputBox.grid_width) >> 2) - 1,
  1609.                                 gPenEditorCandidateInputBox.y + (gPenEditorCandidateInputBox.height >> 3),
  1610.                                 gPenEditorCandidateInputBox.grid_width >> 1,
  1611.                                 ((gPenEditorCandidateInputBox.height << 1) + gPenEditorCandidateInputBox.height) >> 2);
  1612.                         if (ret)
  1613.                         {
  1614.                             mmi_pen_editor_get_candidates_prev_page();
  1615.                         }
  1616.                         /* g_pen_editor_candidate_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_UP; */
  1617.                     }
  1618.                 }
  1619.                 ret = gui_single_line_input_box_translate_pen_event(
  1620.                         &gPenEditorCandidateInputBox,
  1621.                         MMI_PEN_EVENT_UP,
  1622.                         pos.x,
  1623.                         pos.y,
  1624.                         &single_line_input_box_event);
  1625.                 if (ret || g_pen_editor_candidate_state.selected_candidate)
  1626.                 {
  1627.                     UI_character_type ch, ch1, ch2;
  1628.                     gdi_layer_lock_frame_buffer();
  1629.                     /* W05.36 To Fix Candidates Lsit Issue Because of Font Type */
  1630.                     gPenEditorCandidateInputBox.text_offset_x = 0;
  1631.                     gui_show_single_line_input_box_ext(&gPenEditorCandidateInputBox, pos.x, pos.y);
  1632.                     if (!gui_single_line_input_box_test_last_position(&gPenEditorCandidateInputBox))
  1633.                     {
  1634.                         gui_single_line_input_box_next(&gPenEditorCandidateInputBox);
  1635.                     }
  1636.                     ch1 = *(gPenEditorCandidateInputBox.current_text_p - 2);
  1637.                     ch2 = *(gPenEditorCandidateInputBox.current_text_p - 1);
  1638.                     ch = ch1 | (ch2 << 8);
  1639.                     if (PEN_EDITOR_MOVE_OUT == g_pen_editor_candidate_state.pen_down_state)
  1640.                     {
  1641.                         ch = g_pen_editor_candidate_state.selected_candidate;
  1642.                     }
  1643.                     mmi_pen_editor_input_character(ch, MMI_FALSE);
  1644.                     switch (gPenEditorInputBoxType)
  1645.                     {
  1646.                         case PEN_EDITOR_EMS_INPUT_BOX:
  1647.                             wgui_set_EMS_inputbox_RSK();
  1648.                             break;
  1649.                         case PEN_EDITOR_MULTILINE_INPUT_BOX:
  1650.                         case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  1651.                             wgui_set_RSK();
  1652.                             break;
  1653.                         case PEN_EDITOR_INLINE_TEXT:
  1654.                             mmi_pen_editor_set_right_soft_key_inline_text();
  1655.                             break;
  1656.                         case PEN_EDITOR_DATE:
  1657.                         case PEN_EDITOR_IP4:
  1658.                         case PEN_EDITOR_TIME:
  1659.                         case PEN_EDITOR_TIME_PERIOD:
  1660.                             set_right_softkey_label(wgui_inline_edit_get_RSK_string());
  1661.                             set_right_softkey_icon(NULL);
  1662.                             register_right_softkey_handler();
  1663.                             set_right_softkey_function(execute_wgui_inline_edit_RSK_function, KEY_EVENT_UP);
  1664.                             redraw_right_softkey();
  1665.                             break;
  1666.                         default:
  1667.                             break;
  1668.                     }
  1669.                     /* Temp Solution for checking Chinese Characters */
  1670.                     mmi_pen_editor_check_phrase(ch);
  1671.                     /* W05.50 Exclude Virtual Keyboard Area from Handwriting Area */
  1672.                     mmi_pen_editor_change_handwriting_area();
  1673.                     gdi_layer_unlock_frame_buffer();
  1674.                     gdi_lcd_repaint_all();
  1675.                 }
  1676.             }
  1677.             g_pen_editor_candidate_state.selected_candidate = 0;
  1678.             break;
  1679.         case PEN_EDITOR_CONTROL_IME_BUTTON:
  1680.             if (ret)
  1681.             {
  1682.             }
  1683.             break;
  1684.         case PEN_EDITOR_CONTROL_MULTITAP:
  1685.             ret = gui_multitap_input_translate_pen_position(gPenEditorMultitapInput, pos.x, pos.y, &multitap_index);
  1686.             if (ret)
  1687.             {
  1688.             }
  1689.             break;
  1690.         case PEN_EDITOR_CONTROL_NONE:
  1691.             break;
  1692.         default:
  1693.             MMI_ASSERT(0);
  1694.             break;
  1695.     }
  1696.     if (MMI_FALSE == ret)
  1697.     {
  1698.         wgui_general_pen_up_hdlr(pos);
  1699.     }
  1700. }
  1701. /*****************************************************************************
  1702.  * FUNCTION
  1703.  *  mmi_pen_editor_pen_long_tap_handler
  1704.  * DESCRIPTION
  1705.  *  According to the control which pen long tap on, do the related action
  1706.  * PARAMETERS
  1707.  *  pos     [IN]        The position of the pen long tap event
  1708.  * RETURNS
  1709.  *  void
  1710.  *****************************************************************************/
  1711. void mmi_pen_editor_pen_long_tap_handler(mmi_pen_point_struct pos)
  1712. {
  1713.     /*----------------------------------------------------------------*/
  1714.     /* Local Variables                                                */
  1715.     /*----------------------------------------------------------------*/
  1716.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1717.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1718.     S32 multitap_index = 0;
  1719.     BOOL ret = MMI_FALSE;
  1720.     /*----------------------------------------------------------------*/
  1721.     /* Code Body                                                      */
  1722.     /*----------------------------------------------------------------*/
  1723.     switch (gPenEditorActiveControl)
  1724.     {
  1725.         case PEN_EDITOR_CONTROL_INFORMATION_BAR:
  1726.             if (ret)
  1727.             {
  1728.             }
  1729.             break;
  1730.         case PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX:
  1731.             ret = gui_multi_line_input_box_translate_pen_event(
  1732.                     &MMI_multiline_inputbox,
  1733.                     MMI_PEN_EVENT_LONG_TAP,
  1734.                     pos.x,
  1735.                     pos.y,
  1736.                     &multi_line_input_box_event);
  1737.             if (ret)
  1738.             {
  1739.             }
  1740.             break;
  1741.         case PEN_EDITOR_CONTROL_EMS_INPUT_BOX:
  1742.             ret = gui_EMS_input_box_translate_pen_event(
  1743.                     &MMI_EMS_inputbox,
  1744.                     MMI_PEN_EVENT_LONG_TAP,
  1745.                     pos.x,
  1746.                     pos.y,
  1747.                     &EMS_input_box_event);
  1748.             if (ret)
  1749.             {
  1750.             }
  1751.             break;
  1752.         case PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX:
  1753.             if (ret)
  1754.             {
  1755.             }
  1756.             break;
  1757.         case PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX:
  1758.             if (ret)
  1759.             {
  1760.             }
  1761.             break;
  1762.         case PEN_EDITOR_CONTROL_INLINE_TEXT:
  1763.             if (ret)
  1764.             {
  1765.             }
  1766.             break;
  1767.         case PEN_EDITOR_CONTROL_DATE:
  1768.             if (ret)
  1769.             {
  1770.             }
  1771.             break;
  1772.         case PEN_EDITOR_CONTROL_IP4:
  1773.             if (ret)
  1774.             {
  1775.             }
  1776.             break;
  1777.         case PEN_EDITOR_CONTROL_TIME:
  1778.             if (ret)
  1779.             {
  1780.             }
  1781.             break;
  1782.         case PEN_EDITOR_CONTROL_TIME_PERIOD:
  1783.             if (ret)
  1784.             {
  1785.             }
  1786.             break;
  1787.         case PEN_EDITOR_CONTROL_SCROLL_BAR:
  1788.             break;
  1789.         case PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD:
  1790.             if (ret)
  1791.             {
  1792.             }
  1793.             break;
  1794.         case PEN_EDITOR_CONTROL_COMPOSITION_AREA:
  1795.             break;
  1796.         case PEN_EDITOR_CONTROL_CANDIDATE_AREA:
  1797.             if (ret)
  1798.             {
  1799.             }
  1800.             break;
  1801.         case PEN_EDITOR_CONTROL_IME_BUTTON:
  1802.             if (ret)
  1803.             {
  1804.             }
  1805.             break;
  1806.         case PEN_EDITOR_CONTROL_MULTITAP:
  1807.             ret = gui_multitap_input_translate_pen_position(gPenEditorMultitapInput, pos.x, pos.y, &multitap_index);
  1808.             if (ret)
  1809.             {
  1810.             }
  1811.             break;
  1812.         case PEN_EDITOR_CONTROL_NONE:
  1813.             break;
  1814.         default:
  1815.             MMI_ASSERT(0);
  1816.             break;
  1817.     }
  1818.     if (MMI_FALSE == ret)
  1819.     {
  1820.         wgui_general_pen_long_tap_hdlr(pos);
  1821.     }
  1822. }
  1823. /*****************************************************************************
  1824.  * FUNCTION
  1825.  *  mmi_pen_editor_pen_repeat_handler
  1826.  * DESCRIPTION
  1827.  *  According to the control which pen repeat on, do the related action
  1828.  * PARAMETERS
  1829.  *  pos     [IN]        The position of the pen repeat event
  1830.  * RETURNS
  1831.  *  void
  1832.  *****************************************************************************/
  1833. void mmi_pen_editor_pen_repeat_handler(mmi_pen_point_struct pos)
  1834. {
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Local Variables                                                */
  1837.     /*----------------------------------------------------------------*/
  1838.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1839.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1840.     BOOL ret = MMI_FALSE;
  1841.     S32 multitap_index = 0;
  1842.     /*----------------------------------------------------------------*/
  1843.     /* Code Body                                                      */
  1844.     /*----------------------------------------------------------------*/
  1845.     switch (gPenEditorActiveControl)
  1846.     {
  1847.         case PEN_EDITOR_CONTROL_INFORMATION_BAR:
  1848.             break;
  1849.         case PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX:
  1850.             ret = gui_multi_line_input_box_translate_pen_event(
  1851.                     &MMI_multiline_inputbox,
  1852.                     MMI_PEN_EVENT_REPEAT,
  1853.                     pos.x,
  1854.                     pos.y,
  1855.                     &multi_line_input_box_event);
  1856.             break;
  1857.         case PEN_EDITOR_CONTROL_EMS_INPUT_BOX:
  1858.             ret = gui_EMS_input_box_translate_pen_event(
  1859.                     &MMI_EMS_inputbox,
  1860.                     MMI_PEN_EVENT_REPEAT,
  1861.                     pos.x,
  1862.                     pos.y,
  1863.                     &EMS_input_box_event);
  1864.             break;
  1865.         case PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX:
  1866.             break;
  1867.         case PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX:
  1868.             break;
  1869.         case PEN_EDITOR_CONTROL_INLINE_TEXT:
  1870.             break;
  1871.         case PEN_EDITOR_CONTROL_DATE:
  1872.             break;
  1873.         case PEN_EDITOR_CONTROL_IP4:
  1874.             break;
  1875.         case PEN_EDITOR_CONTROL_TIME:
  1876.             break;
  1877.         case PEN_EDITOR_CONTROL_TIME_PERIOD:
  1878.             break;
  1879.         case PEN_EDITOR_CONTROL_SCROLL_BAR:
  1880.             break;
  1881.         case PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD:
  1882.             break;
  1883.         case PEN_EDITOR_CONTROL_COMPOSITION_AREA:
  1884.             break;
  1885.         case PEN_EDITOR_CONTROL_CANDIDATE_AREA:
  1886.             break;
  1887.         case PEN_EDITOR_CONTROL_IME_BUTTON:
  1888.             break;
  1889.         case PEN_EDITOR_CONTROL_MULTITAP:
  1890.             ret = gui_multitap_input_translate_pen_position(gPenEditorMultitapInput, pos.x, pos.y, &multitap_index);
  1891.             if (ret)
  1892.             {
  1893.             }
  1894.             break;
  1895.         case PEN_EDITOR_CONTROL_NONE:
  1896.             break;
  1897.         default:
  1898.             MMI_ASSERT(0);
  1899.             break;
  1900.     }
  1901.     if (MMI_FALSE == ret)
  1902.     {
  1903.         wgui_general_pen_repeat_hdlr(pos);
  1904.     }
  1905. }
  1906. /*****************************************************************************
  1907.  * FUNCTION
  1908.  *  mmi_pen_editor_pen_abort_handler
  1909.  * DESCRIPTION
  1910.  *  According to the control which pen abort on, do the related action
  1911.  * PARAMETERS
  1912.  *  pos     [IN]        The position of the pen abort event
  1913.  * RETURNS
  1914.  *  void
  1915.  *****************************************************************************/
  1916. void mmi_pen_editor_pen_abort_handler(mmi_pen_point_struct pos)
  1917. {
  1918.     /*----------------------------------------------------------------*/
  1919.     /* Local Variables                                                */
  1920.     /*----------------------------------------------------------------*/
  1921.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1922.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1923.     BOOL ret = MMI_FALSE;
  1924.     S32 multitap_index = 0;
  1925.     /*----------------------------------------------------------------*/
  1926.     /* Code Body                                                      */
  1927.     /*----------------------------------------------------------------*/
  1928.     switch (gPenEditorActiveControl)
  1929.     {
  1930.         case PEN_EDITOR_CONTROL_INFORMATION_BAR:
  1931.             break;
  1932.         case PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX:
  1933.             ret = gui_multi_line_input_box_translate_pen_event(
  1934.                     &MMI_multiline_inputbox,
  1935.                     MMI_PEN_EVENT_ABORT,
  1936.                     pos.x,
  1937.                     pos.y,
  1938.                     &multi_line_input_box_event);
  1939.             break;
  1940.         case PEN_EDITOR_CONTROL_EMS_INPUT_BOX:
  1941.             ret = gui_EMS_input_box_translate_pen_event(
  1942.                     &MMI_EMS_inputbox,
  1943.                     MMI_PEN_EVENT_ABORT,
  1944.                     pos.x,
  1945.                     pos.y,
  1946.                     &EMS_input_box_event);
  1947.             break;
  1948.         case PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX:
  1949.             break;
  1950.         case PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX:
  1951.             break;
  1952.         case PEN_EDITOR_CONTROL_INLINE_TEXT:
  1953.             break;
  1954.         case PEN_EDITOR_CONTROL_DATE:
  1955.             break;
  1956.         case PEN_EDITOR_CONTROL_IP4:
  1957.             break;
  1958.         case PEN_EDITOR_CONTROL_TIME:
  1959.             break;
  1960.         case PEN_EDITOR_CONTROL_TIME_PERIOD:
  1961.             break;
  1962.         case PEN_EDITOR_CONTROL_SCROLL_BAR:
  1963.             break;
  1964.         case PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD:
  1965.         {
  1966.             gui_virtual_keyboard_pen_enum vk_event;
  1967.             gui_pen_event_param_struct vk_para;
  1968.             ret = gui_virtual_keyboard_translate_pen_event(
  1969.                     &MMI_virtual_keyboard,
  1970.                     pos.x,
  1971.                     pos.y,
  1972.                     MMI_PEN_EVENT_ABORT,
  1973.                     &vk_event,
  1974.                     &vk_para);
  1975.         }
  1976.             break;
  1977.         case PEN_EDITOR_CONTROL_COMPOSITION_AREA:
  1978.             break;
  1979.         case PEN_EDITOR_CONTROL_CANDIDATE_AREA:
  1980.             break;
  1981.         case PEN_EDITOR_CONTROL_IME_BUTTON:
  1982.             break;
  1983.         case PEN_EDITOR_CONTROL_MULTITAP:
  1984.             ret = gui_multitap_input_translate_pen_position(gPenEditorMultitapInput, pos.x, pos.y, &multitap_index);
  1985.             if (ret)
  1986.             {
  1987.             }
  1988.             break;
  1989.         case PEN_EDITOR_CONTROL_NONE:
  1990.             break;
  1991.         default:
  1992.             MMI_ASSERT(0);
  1993.             break;
  1994.     }
  1995.     gPenEditorActiveControl = PEN_EDITOR_CONTROL_NONE;
  1996.     if (MMI_FALSE == ret)
  1997.     {
  1998.         wgui_general_pen_abort_hdlr(pos);
  1999.     }
  2000. }
  2001. /*****************************************************************************
  2002.  * FUNCTION
  2003.  *  mmi_pen_editor_pen_move_handler
  2004.  * DESCRIPTION
  2005.  *  According to the control which pen move on, do the related action
  2006.  * PARAMETERS
  2007.  *  pos     [IN]        The position of the pen move event
  2008.  * RETURNS
  2009.  *  void
  2010.  *****************************************************************************/
  2011. void mmi_pen_editor_pen_move_handler(mmi_pen_point_struct pos)
  2012. {
  2013.     /*----------------------------------------------------------------*/
  2014.     /* Local Variables                                                */
  2015.     /*----------------------------------------------------------------*/
  2016.     gui_single_line_input_box_pen_enum single_line_input_box_event;
  2017.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  2018.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  2019.     S32 multitap_index = 0;
  2020.     BOOL ret = MMI_FALSE;
  2021.     gui_pen_event_param_struct vk_para;
  2022.     gui_virtual_keyboard_pen_enum vk_event;
  2023.     /*----------------------------------------------------------------*/
  2024.     /* Code Body                                                      */
  2025.     /*----------------------------------------------------------------*/
  2026.     switch (gPenEditorActiveControl)
  2027.     {
  2028.         case PEN_EDITOR_CONTROL_INFORMATION_BAR:
  2029.             break;
  2030.         case PEN_EDITOR_CONTROL_MULTILINE_INPUT_BOX:
  2031.             ret = gui_multi_line_input_box_translate_pen_event(
  2032.                     &MMI_multiline_inputbox,
  2033.                     MMI_PEN_EVENT_MOVE,
  2034.                     pos.x,
  2035.                     pos.y,
  2036.                     &multi_line_input_box_event);
  2037.             break;
  2038.         case PEN_EDITOR_CONTROL_EMS_INPUT_BOX:
  2039.             ret = gui_EMS_input_box_translate_pen_event(
  2040.                     &MMI_EMS_inputbox,
  2041.                     MMI_PEN_EVENT_MOVE,
  2042.                     pos.x,
  2043.                     pos.y,
  2044.                     &EMS_input_box_event);
  2045.             break;
  2046.         case PEN_EDITOR_CONTROL_INLINE_MULTILINE_INPUT_BOX:
  2047.             break;
  2048.         case PEN_EDITOR_CONTROL_SINGLE_LINE_INPU_BOX:
  2049.             break;
  2050.         case PEN_EDITOR_CONTROL_INLINE_TEXT:
  2051.             break;
  2052.         case PEN_EDITOR_CONTROL_DATE:
  2053.             break;
  2054.         case PEN_EDITOR_CONTROL_IP4:
  2055.             break;
  2056.         case PEN_EDITOR_CONTROL_TIME:
  2057.             break;
  2058.         case PEN_EDITOR_CONTROL_TIME_PERIOD:
  2059.             break;
  2060.         case PEN_EDITOR_CONTROL_SCROLL_BAR:
  2061.             break;
  2062.         case PEN_EDITOR_CONTROL_VIRTUAL_KEYBOARD:
  2063.             ret = gui_virtual_keyboard_translate_pen_event(
  2064.                     &MMI_virtual_keyboard,
  2065.                     pos.x,
  2066.                     pos.y,
  2067.                     MMI_PEN_EVENT_MOVE,
  2068.                     &vk_event,
  2069.                     &vk_para);
  2070.             break;
  2071.         case PEN_EDITOR_CONTROL_COMPOSITION_AREA:
  2072.             if (PEN_EDITOR_CANDIDATE_OFF != g_pen_editor_composition_state.candidate_state)
  2073.             {
  2074.                 if (g_pen_editor_composition_state.arrow_enable)
  2075.                 {
  2076.                     ret = PEN_CHECK_BOUND(
  2077.                             pos.x,
  2078.                             pos.y,
  2079.                             g_pen_editor_composition_input_box.x - (((g_pen_editor_composition_input_box.grid_width << 1) + g_pen_editor_composition_input_box.grid_width) >> 2) - 1,
  2080.                             g_pen_editor_composition_input_box.y + (g_pen_editor_composition_input_box.height >> 3),
  2081.                             g_pen_editor_composition_input_box.grid_width >> 1,
  2082.                             ((g_pen_editor_composition_input_box.height << 1) + g_pen_editor_composition_input_box.height) >> 2);
  2083.                     if (ret && g_pen_editor_composition_state.pen_down_state == PEN_EDITOR_IN_LEFT_ARROW)
  2084.                     {
  2085.                         g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_IN_LEFT_ARROW;
  2086.                         gdi_layer_lock_frame_buffer();
  2087.                         mmi_pen_editor_hide_candidate_area();
  2088.                         gui_show_single_line_input_box(&g_pen_editor_composition_input_box);
  2089.                         if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_composition_state.left_arrow_state)
  2090.                         {
  2091.                             g_pen_editor_composition_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  2092.                         }
  2093.                         mmi_pen_editor_draw_arrow(
  2094.                             PEN_EDITOR_ARROW_DIRECTION_LEFT,
  2095.                             g_pen_editor_composition_state.left_arrow_state,
  2096.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2097.                         mmi_pen_editor_draw_arrow(
  2098.                             PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  2099.                             g_pen_editor_composition_state.right_arrow_state,
  2100.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2101.                         gdi_layer_unlock_frame_buffer();
  2102.                         gdi_lcd_repaint_all();
  2103.                         return;
  2104.                     }
  2105.                     ret = PEN_CHECK_BOUND(
  2106.                             pos.x,
  2107.                             pos.y,
  2108.                             g_pen_editor_composition_input_box.x + g_pen_editor_composition_input_box.width + (g_pen_editor_composition_input_box.grid_width >> 2) - 1,
  2109.                             g_pen_editor_composition_input_box.y + (g_pen_editor_composition_input_box.height >> 3),
  2110.                             g_pen_editor_composition_input_box.grid_width >> 1,
  2111.                             ((g_pen_editor_composition_input_box.height << 1) + g_pen_editor_composition_input_box.height) >> 2);
  2112.                     if (ret && g_pen_editor_composition_state.pen_down_state == PEN_EDITOR_IN_RIGHT_ARROW)
  2113.                     {
  2114.                         g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_IN_RIGHT_ARROW;
  2115.                         gdi_layer_lock_frame_buffer();
  2116.                         mmi_pen_editor_hide_candidate_area();
  2117.                         gui_show_single_line_input_box(&g_pen_editor_composition_input_box);
  2118.                         if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_composition_state.right_arrow_state)
  2119.                         {
  2120.                             g_pen_editor_composition_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  2121.                         }
  2122.                         mmi_pen_editor_draw_arrow(
  2123.                             PEN_EDITOR_ARROW_DIRECTION_LEFT,
  2124.                             g_pen_editor_composition_state.left_arrow_state,
  2125.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2126.                         mmi_pen_editor_draw_arrow(
  2127.                             PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  2128.                             g_pen_editor_composition_state.right_arrow_state,
  2129.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2130.                         gdi_layer_unlock_frame_buffer();
  2131.                         gdi_lcd_repaint_all();
  2132.                         return;
  2133.                     }
  2134.                 }
  2135.                 ret = gui_single_line_input_box_translate_pen_event(
  2136.                         &g_pen_editor_composition_input_box,
  2137.                         MMI_PEN_EVENT_MOVE,
  2138.                         pos.x,
  2139.                         pos.y,
  2140.                         &single_line_input_box_event);
  2141.                 if (ret)
  2142.                 {
  2143.                     g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_IN_CONTROL;
  2144.                     gui_cancel_timer(mmi_pen_editor_confirm_selection);
  2145.                     gui_show_single_line_input_box_ext(&g_pen_editor_composition_input_box, pos.x, pos.y);
  2146.                     gdi_layer_lock_frame_buffer();
  2147.                     if ((INPUT_MODE_TR_BOPOMO == MMI_current_input_mode ||
  2148.                          INPUT_MODE_SM_PINYIN == MMI_current_input_mode) &&
  2149.                         PEN_EDITOR_CANDIDATE_ON_AND_FOCUS == g_pen_editor_composition_state.candidate_state)
  2150.                     {
  2151.                         g_pen_editor_composition_index = mmi_pen_editor_smart_bpmf_pinyin_set_syllable_by_position();
  2152.                         mmi_pen_editor_smart_bpmf_pinyin_set_syllable_by_index(g_pen_editor_composition_index);
  2153.                     }
  2154.                     gdi_layer_unlock_frame_buffer();
  2155.                     gdi_lcd_repaint_all();
  2156.                     return;
  2157.                 }
  2158.                 if (PEN_EDITOR_OUT_OF_RANGE != g_pen_editor_composition_state.pen_down_state)
  2159. {
  2160.                     g_pen_editor_composition_state.pen_down_state = PEN_EDITOR_MOVE_OUT;
  2161.                 }
  2162.                 if (g_pen_editor_composition_state.right_arrow_state == PEN_EDITOR_ARROW_PRESS_DOWN)
  2163.                 {
  2164.                     g_pen_editor_composition_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_UP;
  2165.                 }
  2166.                 if (g_pen_editor_composition_state.left_arrow_state == PEN_EDITOR_ARROW_PRESS_DOWN)
  2167.                 {
  2168.                     g_pen_editor_composition_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_UP;
  2169.                 }
  2170.             }
  2171.             break;
  2172.         case PEN_EDITOR_CONTROL_CANDIDATE_AREA:
  2173.             if (gPenEditorSelectCandidate)
  2174.             {
  2175.                 if (g_pen_editor_candidate_state.arrow_enable)
  2176.                 {
  2177.                     ret = PEN_CHECK_BOUND(
  2178.                             pos.x,
  2179.                             pos.y,
  2180.                             gPenEditorCandidateInputBox.x - (((gPenEditorCandidateInputBox.grid_width << 1) + gPenEditorCandidateInputBox.grid_width) >> 2) - 1,
  2181.                             gPenEditorCandidateInputBox.y + (gPenEditorCandidateInputBox.height >> 3),
  2182.                             gPenEditorCandidateInputBox.grid_width >> 1,
  2183.                             ((gPenEditorCandidateInputBox.height << 1) + gPenEditorCandidateInputBox.height) >> 2);
  2184.                     if (ret && g_pen_editor_candidate_state.pen_down_state == PEN_EDITOR_IN_LEFT_ARROW)
  2185.                     {
  2186.                         g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_IN_LEFT_ARROW;
  2187.                         gdi_layer_lock_frame_buffer();
  2188.                         mmi_pen_editor_hide_candidate_area();
  2189.                         gui_show_single_line_input_box(&gPenEditorCandidateInputBox);
  2190.                         if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_candidate_state.left_arrow_state)
  2191.                         {
  2192.                             g_pen_editor_candidate_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  2193.                         }
  2194.                         mmi_pen_editor_draw_arrow(
  2195.                             PEN_EDITOR_ARROW_DIRECTION_LEFT,
  2196.                             g_pen_editor_candidate_state.left_arrow_state,
  2197.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2198.                         mmi_pen_editor_draw_arrow(
  2199.                             PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  2200.                             g_pen_editor_candidate_state.right_arrow_state,
  2201.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2202.                         gdi_layer_unlock_frame_buffer();
  2203.                         gdi_lcd_repaint_all();
  2204.                         return;
  2205.                     }
  2206.                     ret = PEN_CHECK_BOUND(
  2207.                             pos.x,
  2208.                             pos.y,
  2209.                             gPenEditorCandidateInputBox.x + gPenEditorCandidateInputBox.width + (gPenEditorCandidateInputBox.grid_width >> 2) - 1,
  2210.                             gPenEditorCandidateInputBox.y + (gPenEditorCandidateInputBox.height >> 3),
  2211.                             gPenEditorCandidateInputBox.grid_width >> 1,
  2212.                             ((gPenEditorCandidateInputBox.height << 1) + gPenEditorCandidateInputBox.height) >> 2);
  2213.                     if (ret && g_pen_editor_candidate_state.pen_down_state == PEN_EDITOR_IN_RIGHT_ARROW)
  2214.                     {
  2215.                         g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_IN_RIGHT_ARROW;
  2216.                         gdi_layer_lock_frame_buffer();
  2217.                         mmi_pen_editor_hide_candidate_area();
  2218.                         gui_show_single_line_input_box(&gPenEditorCandidateInputBox);
  2219.                         if (PEN_EDITOR_ARROW_PRESS_UP == g_pen_editor_candidate_state.right_arrow_state)
  2220.                         {
  2221.                             g_pen_editor_candidate_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_DOWN;
  2222.                         }
  2223.                         mmi_pen_editor_draw_arrow(
  2224.                             PEN_EDITOR_ARROW_DIRECTION_LEFT,
  2225.                             g_pen_editor_candidate_state.left_arrow_state,
  2226.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2227.                         mmi_pen_editor_draw_arrow(
  2228.                             PEN_EDITOR_ARROW_DIRECTION_RIGHT,
  2229.                             g_pen_editor_candidate_state.right_arrow_state,
  2230.                             PEN_EDITOR_ARROW_FOR_CANDIDATE);
  2231.                         gdi_layer_unlock_frame_buffer();
  2232.                         gdi_lcd_repaint_all();
  2233.                         return;
  2234.                     }
  2235.                 }
  2236.                 ret = gui_single_line_input_box_translate_pen_event(
  2237.                         &gPenEditorCandidateInputBox,
  2238.                         MMI_PEN_EVENT_MOVE,
  2239.                         pos.x,
  2240.                         pos.y,
  2241.                         &single_line_input_box_event);
  2242.                 if (ret)
  2243.                 {
  2244.                     UI_character_type ch, ch1, ch2;
  2245.                     g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_IN_CONTROL;
  2246.                     gui_cancel_timer(mmi_pen_editor_confirm_selection);
  2247.                     gPenEditorActiveControl = PEN_EDITOR_CONTROL_CANDIDATE_AREA;
  2248.                     gui_show_single_line_input_box_ext(&gPenEditorCandidateInputBox, pos.x, pos.y);
  2249.                     if (!gui_single_line_input_box_test_last_position(&gPenEditorCandidateInputBox))
  2250.                     {
  2251.                         gui_single_line_input_box_next(&gPenEditorCandidateInputBox);
  2252.                     }
  2253.                     ch1 = *(gPenEditorCandidateInputBox.current_text_p - 2);
  2254.                     ch2 = *(gPenEditorCandidateInputBox.current_text_p - 1);
  2255.                     ch = ch1 | (ch2 << 8);
  2256.                     g_pen_editor_candidate_state.selected_candidate = ch;
  2257.                     gdi_layer_lock_frame_buffer();
  2258.                     if (mmi_pen_editor_check_input(ch))
  2259.                     {
  2260.                         switch (gPenEditorInputBoxType)
  2261.                         {
  2262.                                 /* W05.32 Fix typo error */
  2263.                             case PEN_EDITOR_MULTILINE_INPUT_BOX:
  2264.                             case PEN_EDITOR_DICT_MULTILINE_INPUT_BOX:
  2265.                             case PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX:
  2266.                                 multiline_inputbox_multitap_input(ch);
  2267.                                 break;
  2268.                             case PEN_EDITOR_EMS_INPUT_BOX:
  2269.                                 EMS_inputbox_multitap_input(ch);
  2270.                                 break;
  2271.                             default:
  2272.                                 break;
  2273.                         }
  2274.                     }
  2275.                     mmi_pen_editor_show_candidate_area(
  2276.                         g_pen_editor_candidate_state.arrow_enable,
  2277.                         g_pen_editor_candidate_state.candidate_state);
  2278.                     gdi_layer_unlock_frame_buffer();
  2279.                     gdi_lcd_repaint_all();
  2280.                     return;
  2281.                 }
  2282.                 if (PEN_EDITOR_OUT_OF_RANGE != g_pen_editor_candidate_state.pen_down_state)
  2283. {
  2284.                     g_pen_editor_candidate_state.pen_down_state = PEN_EDITOR_MOVE_OUT;
  2285.                 }
  2286.                 if (g_pen_editor_candidate_state.right_arrow_state == PEN_EDITOR_ARROW_PRESS_DOWN)
  2287.                 {
  2288.                     g_pen_editor_candidate_state.right_arrow_state = PEN_EDITOR_ARROW_PRESS_UP;
  2289.                 }
  2290.                 if (g_pen_editor_candidate_state.left_arrow_state == PEN_EDITOR_ARROW_PRESS_DOWN)
  2291.                 {
  2292.                     g_pen_editor_candidate_state.left_arrow_state = PEN_EDITOR_ARROW_PRESS_UP;
  2293.                 }
  2294.             }
  2295.             break;
  2296.         case PEN_EDITOR_CONTROL_IME_BUTTON:
  2297.             break;
  2298.         case PEN_EDITOR_CONTROL_MULTITAP:
  2299.             ret = gui_multitap_input_translate_pen_position(gPenEditorMultitapInput, pos.x, pos.y, &multitap_index);
  2300.             if (ret)
  2301.             {
  2302.             }
  2303.             break;
  2304.         case PEN_EDITOR_CONTROL_NONE:
  2305.             break;
  2306.         default:
  2307.             MMI_ASSERT(0);
  2308.             break;
  2309.     }
  2310.     if (MMI_FALSE == ret)
  2311.     {
  2312.         wgui_general_pen_move_hdlr(pos);
  2313.     }
  2314. }
  2315. #endif /* !defined(__MMI_HANDWRITING_PAD__) */ 
  2316. /*****************************************************************************
  2317.  * FUNCTION
  2318.  *  mmi_pen_editor_pen_set_stroke_color
  2319.  * DESCRIPTION
  2320.  *  Set the color of the stroke
  2321.  * PARAMETERS
  2322.  *  stroke_color        [IN]        The desired color of the stroke
  2323.  * RETURNS
  2324.  *  void
  2325.  *****************************************************************************/
  2326. void mmi_pen_editor_pen_set_stroke_color(color stroke_color)
  2327. {
  2328.     /*----------------------------------------------------------------*/
  2329.     /* Local Variables                                                */
  2330.     /*----------------------------------------------------------------*/
  2331.     /*----------------------------------------------------------------*/
  2332.     /* Code Body                                                      */
  2333.     /*----------------------------------------------------------------*/
  2334.     gPenEditorStrokeColor = stroke_color;
  2335. }
  2336. /*****************************************************************************
  2337.  * FUNCTION
  2338.  *  mmi_pen_editor_setup_input_box
  2339.  * DESCRIPTION
  2340.  *  Set the related setting for the handwriting componemt
  2341.  * PARAMETERS
  2342.  *  stroke_area                 [IN]        The original stroke area (most exculde the title, virtual keyboard, and soft key)
  2343.  *  ext_stroke                  [IN]        The stroke area after stroke (most the full screen)
  2344.  *  input_type                  [IN]        The current input type used to set the virtual keyboard and some functions
  2345.  *  information_bar_flag        [IN]        The information bar is enabled or not
  2346.  *  input_box_type              [IN]        Which kind of input box is active
  2347.  * RETURNS
  2348.  *  void
  2349.  *****************************************************************************/
  2350. void mmi_pen_editor_setup_input_box(
  2351.         mmi_pen_handwriting_area_struct *stroke_area,
  2352.         mmi_pen_handwriting_area_struct *ext_stroke,
  2353.         U16 input_type,
  2354.         U8 information_bar_flag,
  2355.         mmi_pen_editor_input_box_type_enum input_box_type)
  2356. {
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Local Variables                                                */
  2359.     /*----------------------------------------------------------------*/
  2360.     /* int i = 0; */
  2361.     int changed_height = 0;
  2362.     U16 input_type_only = input_type & INPUT_TYPE_MASK;
  2363.     static BOOL is_init = MMI_FALSE;
  2364.     int grid_width = 0;
  2365.     int font_height = 0;
  2366.     /*----------------------------------------------------------------*/
  2367.     /* Code Body                                                      */
  2368.     /*----------------------------------------------------------------*/
  2369. #if defined(__MMI_HANDWRITING_MULTI_BLOCK__)
  2370.     if (PEN_EDITOR_MULTILINE_INPUT_BOX == input_box_type||
  2371.         PEN_EDITOR_DICT_MULTILINE_INPUT_BOX == input_box_type||
  2372.         PEN_EDITOR_EMS_INPUT_BOX == input_box_type)
  2373.     {
  2374.         mmi_pen_editor_set_handwriting_style(PEN_EDITOR_HANDWRITING_STYLE_MULTI_BLOCK);