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

MTK

开发平台:

C/C++

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