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

MTK

开发平台:

C/C++

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