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

MTK

开发平台:

C/C++

  1.         case INPUT_TYPE_SMART_LOWERCASE_FINNISH:
  2.             set_multiline_inputbox_mask(0);
  3.             change_multiline_inputbox_mode(INPUT_MODE_SMART_LOWERCASE_FINNISH);
  4.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  5.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  6.             MMI_current_input_mode = INPUT_MODE_SMART_LOWERCASE_FINNISH;
  7.             wgui_inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_LOGO);
  8.             break;
  9.         #endif /* defined(__MMI_ZI_FINNISH__) */ 
  10.         #if defined(__MMI_ZI_CZECH__)
  11.         case INPUT_TYPE_SMART_UPPERCASE_CZECH:
  12.             set_multiline_inputbox_mask(0);
  13.             change_multiline_inputbox_mode(INPUT_MODE_SMART_UPPERCASE_CZECH);
  14.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  15.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  16.             MMI_current_input_mode = INPUT_MODE_SMART_UPPERCASE_CZECH;
  17.             wgui_inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_LOGO);
  18.             break;
  19.         case INPUT_TYPE_SMART_LOWERCASE_CZECH:
  20.             set_multiline_inputbox_mask(0);
  21.             change_multiline_inputbox_mode(INPUT_MODE_SMART_LOWERCASE_CZECH);
  22.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  23.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  24.             MMI_current_input_mode = INPUT_MODE_SMART_LOWERCASE_CZECH;
  25.             wgui_inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_LOGO);
  26.             break;
  27.         #endif /* defined(__MMI_ZI_CZECH__) */ 
  28.         #if defined(__MMI_ZI_HUNGARIAN__)
  29.         case INPUT_TYPE_SMART_UPPERCASE_HUNGARIAN:
  30.             set_multiline_inputbox_mask(0);
  31.             change_multiline_inputbox_mode(INPUT_MODE_SMART_UPPERCASE_HUNGARIAN);
  32.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  33.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  34.             MMI_current_input_mode = INPUT_MODE_SMART_UPPERCASE_HUNGARIAN;
  35.             wgui_inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_LOGO);
  36.             break;
  37.         case INPUT_TYPE_SMART_LOWERCASE_HUNGARIAN:
  38.             set_multiline_inputbox_mask(0);
  39.             change_multiline_inputbox_mode(INPUT_MODE_SMART_LOWERCASE_HUNGARIAN);
  40.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  41.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  42.             MMI_current_input_mode = INPUT_MODE_SMART_LOWERCASE_HUNGARIAN;
  43.             wgui_inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_LOGO);
  44.             break;
  45.         #endif /* defined(__MMI_ZI_HUNGARIAN__) */ 
  46.                     //PERSIAN add by Ailsa start
  47.         #if defined(__MMI_ZI_PERSIAN__)
  48.         case INPUT_TYPE_SMART_PERSIAN:
  49.             set_multiline_inputbox_mask(0);
  50.             change_multiline_inputbox_mode(INPUT_MODE_SMART_PERSIAN);
  51.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  52.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  53.             MMI_current_input_mode = INPUT_MODE_SMART_PERSIAN;
  54.             wgui_inputbox_information_icon = get_image(WGUI_ZI_EZITEXT_LOGO);
  55.             break;
  56.         #endif /* defined(__MMI_ZI_PERSIAN) */
  57.             //PERSIAN add by Ailsa end
  58. //KP Jerry add on 2007-3-8 start
  59. #elif defined(__MMI_CSTAR__)
  60.         case INPUT_TYPE_TR_MULTITAP_BOPOMO:
  61.             change_multiline_inputbox_mode(INPUT_MODE_TR_MULTITAP_BOPOMO);
  62.             MMI_current_input_mode = INPUT_MODE_TR_MULTITAP_BOPOMO;
  63.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  64.             wgui_inputbox_information_icon = get_image(WGUI_IME_MULTITAP_BPMF_IMG);
  65.             break;
  66.         case INPUT_TYPE_SM_MULTITAP_PINYIN:
  67.             change_multiline_inputbox_mode(INPUT_MODE_SM_MULTITAP_PINYIN);
  68.             MMI_current_input_mode = INPUT_MODE_SM_MULTITAP_PINYIN;
  69.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  70.             wgui_inputbox_information_icon = get_image(WGUI_IME_MULTITAP_PINYIN_IMG);
  71.             break;
  72.         case INPUT_TYPE_TR_BOPOMO:
  73.             change_multiline_inputbox_mode(INPUT_MODE_TR_BOPOMO);
  74.             MMI_current_input_mode = INPUT_MODE_TR_BOPOMO;
  75.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  76.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_BPMF_IMG);
  77.             break;
  78.         case INPUT_TYPE_SM_PINYIN:
  79.             change_multiline_inputbox_mode(INPUT_MODE_SM_PINYIN);
  80.             MMI_current_input_mode = INPUT_MODE_SM_PINYIN;
  81.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  82.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_PINYIN_IMG);
  83.             break;
  84.         case INPUT_TYPE_TR_STROKE:
  85.             change_multiline_inputbox_mode(INPUT_MODE_TR_STROKE);
  86.             MMI_current_input_mode = INPUT_MODE_TR_STROKE;
  87.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  88.             wgui_inputbox_information_icon = get_image(WGUI_IME_TR_STROKE_IMG);
  89.             break;
  90.         case INPUT_TYPE_SM_STROKE:
  91.             change_multiline_inputbox_mode(INPUT_MODE_SM_STROKE);
  92.             MMI_current_input_mode = INPUT_MODE_SM_STROKE;
  93.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  94.             wgui_inputbox_information_icon = get_image(WGUI_IME_SM_STROKE_IMG);
  95.             break;
  96.         case INPUT_TYPE_SMART_UPPERCASE_ABC:
  97.             change_multiline_inputbox_mode(INPUT_MODE_SMART_UPPERCASE_ABC);
  98.             MMI_current_input_mode = INPUT_MODE_SMART_UPPERCASE_ABC;
  99.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  100.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_ENGLISH_IMG);
  101.             break;
  102.         case INPUT_TYPE_SMART_LOWERCASE_ABC:
  103.             change_multiline_inputbox_mode(INPUT_MODE_SMART_LOWERCASE_ABC);
  104.             MMI_current_input_mode = INPUT_MODE_SMART_LOWERCASE_ABC;
  105.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  106.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_ENGLISH_IMG);
  107.             break;
  108.         case INPUT_TYPE_SMART_UPPERCASE_VIETNAMESE:
  109.             set_multiline_inputbox_mask(0);
  110.             change_multiline_inputbox_mode(INPUT_MODE_SMART_UPPERCASE_VIETNAMESE);
  111.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  112.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  113.             MMI_current_input_mode = INPUT_MODE_SMART_UPPERCASE_VIETNAMESE;
  114.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_ENGLISH_IMG);
  115.             break;
  116.         case INPUT_TYPE_SMART_LOWERCASE_VIETNAMESE:
  117.             set_multiline_inputbox_mask(0);
  118.             change_multiline_inputbox_mode(INPUT_MODE_SMART_LOWERCASE_VIETNAMESE);
  119.             SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  120.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  121.             MMI_current_input_mode = INPUT_MODE_SMART_LOWERCASE_VIETNAMESE;
  122.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_ENGLISH_IMG);
  123.             break;
  124. //KP Jerry add on 2007-3-8 end
  125.         #elif defined(__MMI_KA__)
  126.         case INPUT_TYPE_SM_PINYIN:
  127.             change_multiline_inputbox_mode(INPUT_MODE_SM_PINYIN);
  128.             MMI_current_input_mode = INPUT_MODE_SM_PINYIN;
  129.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  130.             wgui_inputbox_information_icon = get_image(WGUI_IME_SMART_PINYIN_IMG);
  131.             break;
  132.         case INPUT_TYPE_SM_STROKE:
  133.             change_multiline_inputbox_mode(INPUT_MODE_SM_STROKE);
  134.             MMI_current_input_mode = INPUT_MODE_SM_STROKE;
  135.             inputbox_change_mode = change_multiline_inputbox_input_mode;
  136.             wgui_inputbox_information_icon = get_image(WGUI_IME_SM_STROKE_IMG);
  137.             break;
  138.         #endif 
  139.         default:
  140.             set_multiline_inputbox_mask(0);
  141.             change_multiline_inputbox_mode(INPUT_MODE_123);
  142.             MMI_current_input_mode = INPUT_MODE_123;
  143.             break;
  144.     }
  145.     if (!override_history_input_type && (saved_inputbox_flags & UI_MULTI_LINE_INPUT_BOX_MASK_CHARACTERS))
  146.     {
  147.         set_multiline_inputbox_mask(1);
  148.         if ((saved_input_type & INPUT_TYPE_MASK) != INPUT_TYPE_ALPHANUMERIC_PASSWORD)
  149.         {
  150.             ClearKeyHandler(KEY_POUND, KEY_EVENT_DOWN);
  151.         }
  152.     }
  153.     wgui_inputbox_RSK_label_icon = RSK_icon;
  154.     wgui_inputbox_RSK_label_string = RSK_label;
  155.     MMI_multiline_inputbox.change_callback = set_multiline_inputbox_change;
  156.     test_change_input_mode = wgui_multiline_inputbox_test_change_input_mode;
  157.     register_multiline_inputbox_input_callback(wgui_handle_inputbox_input);
  158. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  159.     ext_stroke.x1 = 0;
  160.     ext_stroke.y1 = 0;
  161.     ext_stroke.x2 = UI_device_width - 1;
  162.     ext_stroke.y2 = UI_device_height - 1;
  163. #if 0
  164. /* under construction !*/
  165. /* under construction !*/
  166. /* under construction !*/
  167. /* under construction !*/
  168. #else /* 0 */ 
  169.     stroke_area.x1 = MMI_content_x;
  170.     stroke_area.x2 = MMI_content_x + MMI_content_width - MMI_multiline_inputbox.vbar.width;
  171.     stroke_area.y1 = MMI_title_y;
  172.     stroke_area.y2 = MMI_title_y + MMI_content_height + MMI_title_height;
  173. #endif /* 0 */ 
  174.     mmi_pen_editor_setup_input_box(
  175.         &stroke_area,
  176.         &ext_stroke,
  177.         MMI_current_input_type,
  178.         MMI_TRUE,
  179.         PEN_EDITOR_INLINE_MULTILINE_INPUT_BOX);
  180. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  181.     show_multiline_inputbox_no_draw();
  182.     UI_UNUSED_PARAMETER(saved_MMI_current_input_mode);
  183. }
  184. /*****************************************************************************
  185.  * FUNCTION
  186.  *  category5_hide_multitap
  187.  * DESCRIPTION
  188.  *  Hide function for multitap
  189.  *  
  190.  *  Internal function
  191.  * PARAMETERS
  192.  *  void
  193.  * RETURNS
  194.  *  void
  195.  *****************************************************************************/
  196. void category5_hide_multitap(void)
  197. {
  198.     /*----------------------------------------------------------------*/
  199.     /* Local Variables                                                */
  200.     /*----------------------------------------------------------------*/
  201.     color c;
  202.     /*----------------------------------------------------------------*/
  203.     /* Code Body                                                      */
  204.     /*----------------------------------------------------------------*/
  205. #if(UI_DOUBLE_BUFFER_SUPPORT)
  206.     gui_lock_double_buffer();
  207. #endif 
  208.     /* micha1104 Chicago Feature */
  209. #ifdef __MMI_DEFAULT_THEME_3__
  210.     c.r = 206;
  211.     c.g = 206;
  212.     c.b = 206;
  213. #else /* __MMI_DEFAULT_THEME_3__ */ 
  214.     c.r = 255;
  215.     c.g = 255;
  216.     c.b = 255;
  217. #endif /* __MMI_DEFAULT_THEME_3__ */ 
  218.     c.alpha = 100;
  219.     gui_reset_clip();
  220.     /* MTK for modify the clear area because of one more pixel */
  221.     gui_fill_rectangle(0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height - 1, c);
  222. #if(UI_DOUBLE_BUFFER_SUPPORT)
  223.     gui_unlock_double_buffer();
  224.     gui_BLT_double_buffer(0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height + 1);
  225. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  226. }
  227. /*****************************************************************************
  228.  * FUNCTION
  229.  *  RedrawCategory5Screen
  230.  * DESCRIPTION
  231.  *  Redraws the category5 screen
  232.  * PARAMETERS
  233.  *  void
  234.  * RETURNS
  235.  *  void
  236.  *****************************************************************************/
  237. void RedrawCategory5Screen(void)
  238. {
  239.     /*----------------------------------------------------------------*/
  240.     /* Local Variables                                                */
  241.     /*----------------------------------------------------------------*/
  242.     /*----------------------------------------------------------------*/
  243.     /* Code Body                                                      */
  244.     /*----------------------------------------------------------------*/
  245.     gui_lock_double_buffer();
  246.     clear_screen();
  247.     show_title_status_icon();
  248.     draw_title();
  249.     wgui_show_inputbox();
  250.     show_softkey_background();
  251.     show_left_softkey();
  252.     show_right_softkey();
  253.     gui_unlock_double_buffer();
  254.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  255.     /* MTK Elvis for redrawing spelling or candidate boxes */
  256.     if (RedrawSpellingOrCandidateBoxesFunction)
  257.     {
  258.         RedrawSpellingOrCandidateBoxesFunction();
  259.     }
  260.     /* MTK end */
  261. }
  262. /*****************************************************************************
  263.  * FUNCTION
  264.  *  category5callback
  265.  * DESCRIPTION
  266.  *  
  267.  * PARAMETERS
  268.  *  coordinate      [?]     
  269.  * RETURNS
  270.  *  void
  271.  *****************************************************************************/
  272. void category5callback(dm_coordinates *coordinate)
  273. {
  274.     /*----------------------------------------------------------------*/
  275.     /* Local Variables                                                */
  276.     /*----------------------------------------------------------------*/
  277.     /*----------------------------------------------------------------*/
  278.     /* Code Body                                                      */
  279.     /*----------------------------------------------------------------*/
  280.     /* MTK Elvis for redrawing spelling or candidate boxes */
  281.     if (RedrawSpellingOrCandidateBoxesFunction)
  282.     {
  283.         RedrawSpellingOrCandidateBoxesFunction();
  284.     }
  285. }
  286. /*****************************************************************************
  287.  * FUNCTION
  288.  *  SetCategory5RightSoftkeyFunction
  289.  * DESCRIPTION
  290.  *  
  291.  * PARAMETERS
  292.  *  f       [IN]        
  293.  *  k       [IN]        
  294.  * RETURNS
  295.  *  void
  296.  *****************************************************************************/
  297. void SetCategory5RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  298. {
  299.     /*----------------------------------------------------------------*/
  300.     /* Local Variables                                                */
  301.     /*----------------------------------------------------------------*/
  302.     /*----------------------------------------------------------------*/
  303.     /* Code Body                                                      */
  304.     /*----------------------------------------------------------------*/
  305.     UI_UNUSED_PARAMETER(k);
  306.     wgui_inputbox_RSK_function = f;
  307. }
  308. /* Function to append a string to category 5 screen   */
  309. /*****************************************************************************
  310.  * FUNCTION
  311.  *  AppendCategory5String
  312.  * DESCRIPTION
  313.  *  append the string in category 5 (editor) text
  314.  * PARAMETERS
  315.  *  input_type          [IN]        Input ype
  316.  *  buffer              [IN]        Buffer
  317.  *  buffer_size         [IN]        Buffer isze
  318.  *  s                   [IN]        String
  319.  *  history_buffer      [IN]        History buffer
  320.  * RETURNS
  321.  *  void
  322.  *****************************************************************************/
  323. //PMT START PERSIAN
  324. #if defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__)
  325. //PMT END PERSIAN
  326. extern S32 IS_HINDI;
  327. extern S32 IS_ARABIC;
  328. #endif /* defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__) */ 
  329. void wgui_multiline_inputbox_append_string(
  330.                     S16 input_type, 
  331.                     U8 *buffer, 
  332.                     S32 buffer_size, 
  333.                     U8 *s, 
  334.                     U8 *history_buffer,
  335.                     U16 category_id,
  336.                     MMI_BOOL (*change_event_handler)(gui_multi_line_input_box_change_event_enum event,U16 C))
  337. {
  338.     /*----------------------------------------------------------------*/
  339.     /* Local Variables                                                */
  340.     /*----------------------------------------------------------------*/
  341.     S32 l, h, fh, i;
  342.     UI_string_type ts = (UI_string_type) s;
  343.     /*----------------------------------------------------------------*/
  344.     /* Code Body                                                      */
  345.     /*----------------------------------------------------------------*/
  346. //PMT START PERSIAN
  347. #if defined __MMI_LANG_HINDI__ && (defined __MMI_LANG_ARABIC__ || defined __MMI_LANG_PERSIAN__ )
  348. //PMT END PERSIAN
  349.     if (ARABIC_PRESENT || MMI_current_input_mode == INPUT_MODE_SMART_ARABIC || MMI_current_input_mode == INPUT_MODE_SMART_PERSIAN)
  350.     {
  351.         U16 unicode = 0;
  352.         U16 clFill = 0;
  353.         IS_HINDI = 0;
  354.         while ((s[clFill] != '' || s[clFill + 1] != '') && !IS_HINDI)
  355.         {
  356.             unicode = s[clFill];
  357.             unicode |= (s[clFill + 1] << 8);
  358.             if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
  359.             {
  360.                 IS_HINDI = 1;
  361.             }
  362.             clFill += 2;
  363.         }
  364.         if (IS_HINDI && ARABIC_PRESENT)
  365.         {
  366.             ts[0] = 0;
  367.             ts[1] = 0;
  368.         }
  369.         else if (IS_HINDI)
  370.         {
  371.             test_change_input_mode = wgui_multiline_inputbox_test_change_input_mode;
  372.             wgui_change_inputbox_mode_multitap_HINDI();
  373.         }
  374.     }
  375.     else if (HINDI_PRESENT || MMI_current_input_mode == INPUT_MODE_MULTITAP_HINDI)
  376.     {
  377.         U16 default_direction = 1;
  378.         U16 Count = 0;
  379.         U16 length = pfnUnicodeStrlen((const char*)s) * 2;
  380.         IS_ARABIC = 0;
  381.         for (Count = 0; Count < length; Count += 2)
  382.         {
  383.             bidi_get_char_type(s + Count, (U8*) & default_direction);
  384.             if ((default_direction == 5) || (default_direction == 3) || (default_direction == 2))
  385.             {
  386.                 IS_ARABIC = 1;
  387.             }
  388.         }
  389.         if (IS_ARABIC && HINDI_PRESENT)
  390.         {
  391.             ts[0] = 0;
  392.             ts[1] = 0;
  393.         }
  394.         else if (IS_ARABIC)
  395.         {
  396.             test_change_input_mode = wgui_multiline_inputbox_test_change_input_mode;
  397. //PMT START PERSIAN
  398. #if defined(__MMI_LANG_ARABIC__)
  399.             wgui_change_inputbox_mode_smart_arabic();
  400. #elif defined(__MMI_LANG_PERSIAN__)
  401.     wgui_change_inputbox_mode_smart_persian();
  402. #endif
  403. //PMT END PERSIAN
  404.         }
  405.     }
  406. #endif /* defined __MMI_LANG_HINDI__ && defined __MMI_LANG_ARABIC__ */ 
  407. #if(UI_DOUBLE_BUFFER_SUPPORT)
  408.     gui_lock_double_buffer();
  409. #endif 
  410.     l = gui_strlen((UI_string_type) buffer);
  411.     create_multiline_inputbox_set_buffer((UI_string_type) buffer, buffer_size, l, l);
  412.     gui_multi_line_input_box_register_change_event_handler(&MMI_multiline_inputbox,change_event_handler);
  413.     if (input_type & INPUT_TYPE_USE_ENCODING_BASED_LENGTH)
  414.     {
  415.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH;
  416.         if (input_type & INPUT_TYPE_ONE_LESS_CHARACTER)
  417.         {
  418.             MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_ONE_LESS_CHARACTER;
  419.             UI_TEST_UCS2_COUNT_SET_LENGTH_TYPE2(
  420.                 MMI_multiline_inputbox.UCS2_count,
  421.                 MMI_multiline_inputbox.allocated_length,
  422.                 MMI_multiline_inputbox.available_length);
  423.         }
  424.         else if (input_type & INPUT_TYPE_FORTY_FOUR_LESS_CHARACTER)
  425.         {
  426.             MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_FORTY_FOUR_LESS_CHARACTER;
  427.             UI_TEST_UCS2_COUNT_SET_LENGTH_TYPE3(
  428.                 MMI_multiline_inputbox.UCS2_count,
  429.                 MMI_multiline_inputbox.allocated_length,
  430.                 MMI_multiline_inputbox.available_length);
  431.         }
  432.         else
  433.         {
  434.             UI_TEST_UCS2_COUNT_SET_LENGTH(
  435.                 MMI_multiline_inputbox.UCS2_count,
  436.                 MMI_multiline_inputbox.allocated_length,
  437.                 MMI_multiline_inputbox.available_length);
  438.         }
  439.     }
  440. #ifdef __BW_MMI__
  441.     h = MMI_content_height - MMI_multitap_height;
  442. #else 
  443.     h = MMI_content_height - MMI_multitap_height - MULTILINE_INPUTBOX_EDIT_HEIGHT_PAD;
  444. #endif 
  445.     set_multiline_inputbox_category_history(category_id, history_buffer, &input_type);
  446.     show_multiline_inputbox_no_draw();
  447.     fh = get_multiline_inputbox_line_height();
  448.     h = ((h / fh) * fh) + MULTILINE_INPUTBOX_EDIT_HEIGHT_PAD;
  449.     resize_multiline_inputbox(MMI_multiline_inputbox.width, h);
  450.     l = gui_strlen(ts);
  451.     for (i = 0; i < l; i++)
  452.     {
  453.         if (MMI_multiline_inputbox.text_length >= MMI_multiline_inputbox.available_length)
  454.         {
  455.             gui_multi_line_input_box_insert_character(&MMI_multiline_inputbox, (UI_character_type) ts[i]);
  456.             break;
  457.         }
  458.         else
  459.         {
  460.             gui_multi_line_input_box_insert_character(&MMI_multiline_inputbox, (UI_character_type) ts[i]);
  461.         }
  462.     }
  463.     get_multiline_inputbox_category_history(category_id, history_buffer, input_type);
  464. #if(UI_DOUBLE_BUFFER_SUPPORT)
  465.     gui_unlock_double_buffer();
  466. #endif 
  467. }
  468. void AppendCategory5String(S16 input_type, U8 *buffer, S32 buffer_size, U8 *s, U8 *history_buffer)
  469. {
  470.     wgui_multiline_inputbox_append_string(input_type,buffer,buffer_size,s,history_buffer,MMI_CATEGORY5_ID,NULL);
  471. }
  472. /*****************************************************************************
  473.  * FUNCTION
  474.  *  cat5_virtual_keypad_callback
  475.  * DESCRIPTION
  476.  *  
  477.  * PARAMETERS
  478.  *  void
  479.  * RETURNS
  480.  *  void
  481.  *****************************************************************************/
  482. void cat5_virtual_keypad_callback(void)
  483. {
  484.     /*----------------------------------------------------------------*/
  485.     /* Local Variables                                                */
  486.     /*----------------------------------------------------------------*/
  487.     /*----------------------------------------------------------------*/
  488.     /* Code Body                                                      */
  489.     /*----------------------------------------------------------------*/
  490. #if defined(__MMI_TOUCH_SCREEN__)
  491.     mmi_pen_editor_resize_multiline_input_box_for_vk();
  492. #endif 
  493. }
  494. /*****************************************************************************
  495.  * FUNCTION
  496.  *  ShowCategory5Screen
  497.  * DESCRIPTION
  498.  *  Displays the category5 screen
  499.  * PARAMETERS
  500.  *  title                   [IN]        Title for the screen
  501.  *  title_icon              [IN]        Icon shown with the title
  502.  *  left_softkey            [IN]        Left softkey label
  503.  *  left_softkey_icon       [IN]        Icon for the left softkey
  504.  *  right_softkey           [IN]        Right softkey label
  505.  *  right_softkey_icon      [IN]        Icon for the right softkey
  506.  *  input_type              [IN]        Type of input to use
  507.  *  buffer                  [IN]        Buffer the input box should use.
  508.  *  buffer_size             [IN]        Size of the buffer.
  509.  *  history_buffer          [IN]        History buffer
  510.  *  For(?)                  [IN]        Example, 5 means only 5 characters can be input in this screen.
  511.  * RETURNS
  512.  *  void
  513.  *****************************************************************************/
  514. void ShowCategory5Screen(
  515.         U16 title,
  516.         U16 title_icon,
  517.         U16 left_softkey,
  518.         U16 left_softkey_icon,
  519.         U16 right_softkey,
  520.         U16 right_softkey_icon,
  521.         S16 input_type,
  522.         U8 *buffer,
  523.         S32 buffer_size,
  524.         U8 *history_buffer)
  525. {
  526.     /*----------------------------------------------------------------*/
  527.     /* Local Variables                                                */
  528.     /*----------------------------------------------------------------*/
  529.     /*----------------------------------------------------------------*/
  530.     /* Code Body                                                      */
  531.     /*----------------------------------------------------------------*/
  532.     /* Begin AP input mode set */
  533.     ShowCategory5Screen_ext(
  534.         title,
  535.         title_icon,
  536.         left_softkey,
  537.         left_softkey_icon,
  538.         right_softkey,
  539.         right_softkey_icon,
  540.         input_type,
  541.         buffer,
  542.         buffer_size,
  543.         history_buffer,
  544.         0,
  545.         NULL,
  546.         NULL);
  547.     /* End AP input mode set */
  548. }
  549. BOOL(*wgui_check_editor_buffer_need_flush) (void) = NULL;
  550. /*****************************************************************************
  551.  * FUNCTION
  552.  *  Register_cat5_editor_buffer_need_flush
  553.  * DESCRIPTION
  554.  *  
  555.  * PARAMETERS
  556.  *  FuncPtr     [IN]        
  557.  * RETURNS
  558.  *  void
  559.  *****************************************************************************/
  560. void Register_cat5_editor_buffer_need_flush(BOOL(*FuncPtr) (void))      /* rajbir */
  561. {
  562.     /*----------------------------------------------------------------*/
  563.     /* Local Variables                                                */
  564.     /*----------------------------------------------------------------*/
  565.     /*----------------------------------------------------------------*/
  566.     /* Code Body                                                      */
  567.     /*----------------------------------------------------------------*/
  568.     wgui_check_editor_buffer_need_flush = FuncPtr;
  569. }
  570. /* Begin AP input mode set */
  571. /*****************************************************************************
  572.  * FUNCTION
  573.  *  wgui_fill_AP_required_input_mode_set
  574.  * DESCRIPTION
  575.  *  fill AP requried input mode set into global array
  576.  * PARAMETERS
  577.  *  required_input_mode_set     [IN]        Required input mode array
  578.  * RETURNS
  579.  *  void
  580.  *****************************************************************************/
  581. void wgui_fill_AP_required_input_mode_set(S16 *required_input_mode_set)
  582. {
  583.     /*----------------------------------------------------------------*/
  584.     /* Local Variables                                                */
  585.     /*----------------------------------------------------------------*/
  586.     U16 i = 0;
  587.     /*----------------------------------------------------------------*/
  588.     /* Code Body                                                      */
  589.     /*----------------------------------------------------------------*/
  590.     while (1)
  591.     {
  592.         if (i > INPUT_MODE_MAX_NUM + 1)
  593.         {
  594.             MMI_ASSERT(0);
  595.             /*
  596.              * reason: (1) No of AP input mode set is more than INPUT_MODE_MAX_NUM+1
  597.              * (2) required_input_mode_set arrary is not ended with -1.
  598.              */
  599.         }
  600.         if (required_input_mode_set[i] == -1)
  601.         {
  602.             MMI_AP_required_input_mode_set[i] = -1;
  603.             break;
  604.         }
  605.         MMI_AP_required_input_mode_set[i] = required_input_mode_set[i];
  606.         i++;
  607.     }
  608. }
  609. /*****************************************************************************
  610.  * FUNCTION
  611.  *  wgui_set_AP_required_input_mode_set_flag
  612.  * DESCRIPTION
  613.  *  set MMI_AP_set_input_mode_set to true
  614.  * PARAMETERS
  615.  *  void
  616.  * RETURNS
  617.  *  void
  618.  *****************************************************************************/
  619. S16 MMI_saved_prefered_input_type = 0;
  620. extern void SetInputMethod(U16 index);
  621. extern U16 MMI_all_prefered_input_mode_set[INPUT_MODE_MAX_NUM];
  622. void wgui_set_AP_required_input_mode_set_flag(void)
  623. {
  624.     /*----------------------------------------------------------------*/
  625.     /* Local Variables                                                */
  626.     /*----------------------------------------------------------------*/
  627. #if defined(__MMI_PREFER_INPUT_METHOD__)
  628.     MMI_BOOL is_in_ap_required_input_mode = MMI_FALSE;
  629.     S32 i = 0;
  630.     S32 input_mode = -1;
  631. #endif
  632.     S32 curIndex = 0;
  633.     /*----------------------------------------------------------------*/
  634.     /* Code Body                                                      */
  635.     /*----------------------------------------------------------------*/
  636.     MMI_AP_set_input_mode_set = 1;
  637. #if defined(__MMI_PREFER_INPUT_METHOD__)
  638.     MMI_saved_prefered_input_type = MMI_prefered_input_type;
  639.     //Add by ailsa start : For applying prefered input type when AP_required_input_mode  
  640.     // search the input mode ID of MMI_saved_prefered_input_type
  641.     while (gIMEModeArray[i].IME_Mode_ID != (0xff))
  642.     {
  643.         if (gIMEModeArray[i].IME_Type_ID == MMI_saved_prefered_input_type)
  644.         {
  645.             input_mode = gIMEModeArray[i].IME_Mode_ID;
  646.             break;        
  647.         }
  648.         i++;
  649.     }
  650.     // input mode ID found, search to check if it is in MMI_AR_required_input_mode_set
  651.     if (input_mode !=-1)
  652.     {
  653.         for (i=0; MMI_AP_required_input_mode_set[i] != -1; i++)
  654.         {
  655.             if (MMI_AP_required_input_mode_set[i] == input_mode)
  656.             {
  657.                 is_in_ap_required_input_mode = MMI_TRUE;
  658.                 break;
  659.             }
  660.         }
  661.     }
  662.     if (is_in_ap_required_input_mode)
  663.     {
  664.         MMI_prefered_input_type = MMI_saved_prefered_input_type;
  665.     }
  666.     else
  667.     {
  668. #endif
  669.         // search the index in gIMEModeArray of which IME_Mode_ID equeal to MMI_AP_required_input_mode_set[0]  
  670.         i = 0;
  671.         while (gIMEModeArray[i].IME_Mode_ID != (0xff))
  672.         {
  673.             if (gIMEModeArray[i].IME_Mode_ID == MMI_AP_required_input_mode_set[0])
  674.             {
  675.                 curIndex = i;
  676.                 break;
  677.             }
  678.             i++;
  679.         }
  680.         SetInputMethod((U16)curIndex);
  681. #if defined(__MMI_PREFER_INPUT_METHOD__)
  682.     }
  683. #endif
  684.     
  685. }
  686. /*****************************************************************************
  687.  * FUNCTION
  688.  *  wgui_unset_AP_required_input_mode_set_flag
  689.  * DESCRIPTION
  690.  *  unset MMI_AP_set_input_mode_set to true
  691.  * PARAMETERS
  692.  *  void
  693.  * RETURNS
  694.  *  void
  695.  *****************************************************************************/
  696. void wgui_unset_AP_required_input_mode_set_flag(void)
  697. {
  698.     /*----------------------------------------------------------------*/
  699.     /* Local Variables                                                */
  700.     /*----------------------------------------------------------------*/
  701.     /*----------------------------------------------------------------*/
  702.     /* Code Body                                                      */
  703.     /*----------------------------------------------------------------*/
  704.     MMI_AP_set_input_mode_set = 0;
  705. #if defined(__MMI_PREFER_INPUT_METHOD__)
  706.     MMI_prefered_input_type = MMI_saved_prefered_input_type;
  707. #endif 
  708. }
  709. /* End AP input mode set */
  710. /* Begin AP Symbol table */
  711. /*****************************************************************************
  712.  * FUNCTION
  713.  *  wgui_fill_AP_No_Show_Symbol_List
  714.  * DESCRIPTION
  715.  *  fill AP No_Show_Symbol_List into global array
  716.  * PARAMETERS
  717.  *  no_show_symbol_list     [IN]        [] no show symbol list array
  718.  * RETURNS
  719.  *  void
  720.  *****************************************************************************/
  721. extern U8 *MMI_AP_No_Show_Symbol_List[];
  722. void wgui_fill_AP_No_Show_Symbol_List(U8 *no_show_symbol_list[])
  723. {
  724.     /*----------------------------------------------------------------*/
  725.     /* Local Variables                                                */
  726.     /*----------------------------------------------------------------*/
  727.     U16 i = 0;
  728.     /*----------------------------------------------------------------*/
  729.     /* Code Body                                                      */
  730.     /*----------------------------------------------------------------*/
  731.     while (1)
  732.     {
  733.         if (*no_show_symbol_list[i] == ((U8)0x00))
  734.         {
  735.             MMI_AP_No_Show_Symbol_List[i] = (U8*) "x00x00";
  736.             break;
  737.         }
  738.         MMI_AP_No_Show_Symbol_List[i] = no_show_symbol_list[i];
  739.         i++;
  740.     }
  741. }
  742. /*****************************************************************************
  743.  * FUNCTION
  744.  *  wgui_set_AP_No_Show_Symbol_List_flag
  745.  * DESCRIPTION
  746.  *  set MMI_AP_No_Show_Symbol_List_flag to true
  747.  * PARAMETERS
  748.  *  void
  749.  * RETURNS
  750.  *  void
  751.  *****************************************************************************/
  752. extern U8 MMI_AP_No_Show_Symbol_List_flag;
  753. void wgui_set_AP_No_Show_Symbol_List_flag(void)
  754. {
  755.     /*----------------------------------------------------------------*/
  756.     /* Local Variables                                                */
  757.     /*----------------------------------------------------------------*/
  758.     /*----------------------------------------------------------------*/
  759.     /* Code Body                                                      */
  760.     /*----------------------------------------------------------------*/
  761.     MMI_AP_No_Show_Symbol_List_flag = 1;
  762. }
  763. /*****************************************************************************
  764.  * FUNCTION
  765.  *  wgui_unset_AP_No_Show_Symbol_List_flag
  766.  * DESCRIPTION
  767.  *  unset MMI_AP_No_Show_Symbol_List_flag to true
  768.  * PARAMETERS
  769.  *  void
  770.  * RETURNS
  771.  *  void
  772.  *****************************************************************************/
  773. void wgui_unset_AP_No_Show_Symbol_List_flag(void)
  774. {
  775.     /*----------------------------------------------------------------*/
  776.     /* Local Variables                                                */
  777.     /*----------------------------------------------------------------*/
  778.     /*----------------------------------------------------------------*/
  779.     /* Code Body                                                      */
  780.     /*----------------------------------------------------------------*/
  781.     MMI_AP_No_Show_Symbol_List_flag = 0;
  782. }
  783. /* End AP Symbol table */
  784. /* Begin AP Symbol table */
  785. /*****************************************************************************
  786.  * FUNCTION
  787.  *  ShowCategory5Screen_ext
  788.  * DESCRIPTION
  789.  *  
  790.  * PARAMETERS
  791.  *  title                       [IN]        
  792.  *  title_icon                  [IN]        
  793.  *  left_softkey                [IN]        
  794.  *  left_softkey_icon           [IN]        
  795.  *  right_softkey               [IN]        
  796.  *  right_softkey_icon          [IN]        
  797.  *  input_type                  [IN]        
  798.  *  buffer                      [?]         
  799.  *  buffer_size                 [IN]        
  800.  *  history_buffer              [?]         
  801.  *  input_ext_type              [IN]        
  802.  *  required_input_mode_set     [?]         
  803.  *  no_show_symbol_list         [?]         
  804.  * RETURNS
  805.  *  void
  806.  *****************************************************************************/
  807. void ShowCategory5Screen_ext(
  808.         U16 title,
  809.         U16 title_icon,
  810.         U16 left_softkey,
  811.         U16 left_softkey_icon,
  812.         U16 right_softkey,
  813.         U16 right_softkey_icon,
  814.         S16 input_type,
  815.         U8 *buffer,
  816.         S32 buffer_size,
  817.         U8 *history_buffer,
  818.         S16 input_ext_type,
  819.         S16 *required_input_mode_set,
  820.         U8 *no_show_symbol_list[])
  821. /* End AP Symbol table */
  822. {
  823.     /*----------------------------------------------------------------*/
  824.     /* Local Variables                                                */
  825.     /*----------------------------------------------------------------*/
  826.     /*----------------------------------------------------------------*/
  827.     /* Code Body                                                      */
  828.     /*----------------------------------------------------------------*/
  829. #ifdef UI_SMALL_CATEGORY_EDITOR
  830.     if (whether_no_small_screen())
  831.     {
  832.         ShowCategory100Screen(
  833.             title,
  834.             title_icon,
  835.             left_softkey,
  836.             left_softkey_icon,
  837.             right_softkey,
  838.             right_softkey_icon,
  839.             input_type,
  840.             buffer,
  841.             buffer_size,
  842.             history_buffer);
  843.     }
  844.     else
  845. #endif /* UI_SMALL_CATEGORY_EDITOR */ 
  846.     {
  847.         dm_data_struct dm_data;
  848.         S32 inputbox_x = 0;
  849.         S32 inputbox_y = (MMI_title_y + MMI_title_height);
  850.         S32 inputbox_width = MMI_content_width;
  851.     #if defined(__MMI_FULL_SCREEN_EDITOR__)
  852.         S32 inputbox_height = MMI_content_height;
  853.     #else 
  854.         S32 inputbox_height = MMI_content_height - MMI_multitap_height;
  855.     #endif 
  856.         //      ADD_SCREEN_STRINGS((3,title,right_softkey,left_softkey));
  857.         //      ADD_SCREEN_IMAGES((3,title_icon,right_softkey_icon,left_softkey_icon));
  858.     #if(UI_DOUBLE_BUFFER_SUPPORT)
  859.         gui_lock_double_buffer();
  860.     #endif 
  861.         MMI_menu_shortcut_number = -1;
  862.         MMI_disable_title_shortcut_display = 1;
  863.         clear_category_screen_key_handlers();
  864.         change_left_softkey(left_softkey, left_softkey_icon);
  865.         change_right_softkey(right_softkey, right_softkey_icon);
  866.         clear_left_softkey();
  867.         clear_right_softkey();
  868.         register_left_softkey_handler();
  869.         register_right_softkey_handler();
  870.         register_default_hide_softkeys();
  871.         /* Begin AP input mode set */
  872.         if (required_input_mode_set != NULL)
  873.         {
  874.             wgui_fill_AP_required_input_mode_set(required_input_mode_set);
  875.             wgui_set_AP_required_input_mode_set_flag();
  876.         }
  877.         /* End AP input mode set */
  878.         /* MTK Add By Elvis for T9 */
  879.     #ifdef __MMI_T9__
  880.         InuptMethodEnterCategory5();
  881.     #elif defined __MMI_ZI__
  882.         ZiInuptMethodEnterCategory5();
  883. //KP Jerry add on 2007-3-8 start
  884.     #elif defined __MMI_CSTAR__
  885.         CstarInputMethodEnterCategory5();
  886. //KP Jerry add on 2007-3-8 end
  887.     #elif defined __MMI_KA__
  888.         KonkaInuptMethodEnterCategory5();
  889.     #elif defined __MMI_ITAP__
  890. /* under construction !*/
  891.     #endif 
  892.         /* MTK end */
  893.         MMI_title_string = (UI_string_type) get_string(title);
  894.         MMI_title_icon = (PU8) get_image(title_icon);
  895.         register_hide_multitap(category5_hide_multitap);
  896.         wgui_setup_inputbox(
  897.             inputbox_x,
  898.             inputbox_y,
  899.             inputbox_width,
  900.             inputbox_height,
  901.             buffer,
  902.             buffer_size,
  903.             MMI_CATEGORY5_ID,
  904.             get_string(right_softkey),
  905.             get_image(right_softkey_icon),
  906.             input_type,
  907.             history_buffer,
  908.             1);
  909.         /* Begin AP Symbol table */
  910.         if (no_show_symbol_list != NULL)
  911.         {
  912.             wgui_fill_AP_No_Show_Symbol_List(no_show_symbol_list);
  913.             wgui_set_AP_No_Show_Symbol_List_flag();
  914.         }
  915.         /* End AP Symbol table */
  916.         /* if input method changed from "option", and language changed then delete all character in case of dictionary */
  917.         if (wgui_check_editor_buffer_need_flush)
  918.         {
  919.             if (wgui_check_editor_buffer_need_flush())
  920.             {
  921.                 multiline_inputbox_delete_all_characters();
  922.                 set_right_softkey_function(GoBackHistory, KEY_EVENT_UP);
  923.             #ifdef __MMI_T9__
  924.                 T9SynT9WithInputBoxMultilineInputBox();
  925.             #endif 
  926.             }
  927.         }
  928.         if (input_ext_type != 0)
  929.         {
  930.             MMI_current_input_ext_type = input_ext_type;
  931.         }
  932.     #if defined(__MMI_FULL_SCREEN_EDITOR__)
  933.         inputbox_height = MMI_content_height - wgui_inputbox_information_bar_height;
  934.     #else 
  935.         inputbox_height = MMI_content_height - MMI_multitap_height - wgui_inputbox_information_bar_height;
  936.     #endif 
  937.         if (MMI_multiline_inputbox.height > inputbox_height)
  938.         {
  939.             gui_resize_multi_line_input_box(&MMI_multiline_inputbox, MMI_multiline_inputbox.width, inputbox_height);
  940.         }
  941.     #if UI_INCLUDE_INFORMATION_AREA_IN_MULTI_LINE
  942.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_INCLUDE_INFO_AREA;
  943.     #endif 
  944.     #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  945.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  946.     #endif 
  947.         gui_unlock_double_buffer();
  948.         ExitCategoryFunction = ExitCategory5Screen;
  949.         dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  950.         dm_data.s32flags |= DM_SHOW_VKPAD;
  951.         dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  952.         dm_register_category_controlled_callback(category5callback);
  953.         dm_data.s32ScrId = (S32) GetActiveScreenId();
  954.         dm_data.s32CatId = MMI_CATEGORY5_ID;
  955.         dm_setup_data(&dm_data);
  956.         dm_register_vkpad_callback(cat5_virtual_keypad_callback);
  957.         dm_redraw_category_screen();
  958.     }
  959. }
  960. /*****************************************************************************
  961.  * FUNCTION
  962.  *  ExitCategory5Screen
  963.  * DESCRIPTION
  964.  *  Exits the category5 screen
  965.  * PARAMETERS
  966.  *  void
  967.  * RETURNS
  968.  *  void
  969.  *****************************************************************************/
  970. void ExitCategory5Screen(void)
  971. {
  972.     /*----------------------------------------------------------------*/
  973.     /* Local Variables                                                */
  974.     /*----------------------------------------------------------------*/
  975.     /*----------------------------------------------------------------*/
  976.     /* Code Body                                                      */
  977.     /*----------------------------------------------------------------*/
  978.     set_MMI_current_input_type();
  979.     reset_softkeys();
  980.     reset_multitaps();
  981.     wgui_close_inputbox();
  982.     ExitCategoryFunction = MMI_dummy_function;
  983.     RedrawCategoryFunction = MMI_dummy_function;
  984.     GetCategoryHistory = dummy_get_history;
  985.     GetCategoryHistorySize = dummy_get_history_size;
  986.     wgui_check_editor_buffer_need_flush = NULL;
  987.     /* Begin AP input mode set */
  988.     if (MMI_AP_set_input_mode_set)
  989.     {
  990.         wgui_unset_AP_required_input_mode_set_flag();
  991.     }
  992.     /* End AP input mode set */
  993. #ifdef UI_SMALL_LIST_SCREEN
  994.     restore_small_screen();
  995. #endif 
  996. }
  997. /*****************************************************************************
  998.  * FUNCTION
  999.  *  GetCategory5HistorySize
  1000.  * DESCRIPTION
  1001.  *  Gets the size of the history buffer for category5 screen
  1002.  * PARAMETERS
  1003.  *  void
  1004.  * RETURNS
  1005.  *  size in U8s of the history buffer
  1006.  *****************************************************************************/
  1007. S32 GetCategory5HistorySize(void)
  1008. {
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Local Variables                                                */
  1011.     /*----------------------------------------------------------------*/
  1012.     /*----------------------------------------------------------------*/
  1013.     /* Code Body                                                      */
  1014.     /*----------------------------------------------------------------*/
  1015.     return (sizeof(multiline_inputbox_category_history));
  1016. }
  1017. /*****************************************************************************
  1018.  * FUNCTION
  1019.  *  GetCategory5History
  1020.  * DESCRIPTION
  1021.  *  Gets the history buffer for category5 screen
  1022.  * PARAMETERS
  1023.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1024.  * RETURNS
  1025.  *  Pointer to the history buffer
  1026.  *****************************************************************************/
  1027. U8 *GetCategory5History(U8 *history_buffer)
  1028. {
  1029.     /*----------------------------------------------------------------*/
  1030.     /* Local Variables                                                */
  1031.     /*----------------------------------------------------------------*/
  1032.     /*----------------------------------------------------------------*/
  1033.     /* Code Body                                                      */
  1034.     /*----------------------------------------------------------------*/
  1035.     get_multiline_inputbox_category_history(MMI_CATEGORY5_ID, history_buffer, MMI_current_input_type);
  1036.     return (history_buffer);
  1037. }
  1038. #ifdef UI_SMALL_CATEGORY_EDITOR
  1039. extern U16 title_bg_id;//092906 popup title
  1040. /*****************************************************************************
  1041.  * FUNCTION
  1042.  *  ShowCategory100Screen
  1043.  * DESCRIPTION
  1044.  *  
  1045.  * PARAMETERS
  1046.  *  title                   [IN]        
  1047.  *  title_icon              [IN]        
  1048.  *  left_softkey            [IN]        
  1049.  *  left_softkey_icon       [IN]        
  1050.  *  right_softkey           [IN]        
  1051.  *  right_softkey_icon      [IN]        
  1052.  *  input_type              [IN]        
  1053.  *  buffer                  [?]         
  1054.  *  buffer_size             [IN]        
  1055.  *  history_buffer          [?]         
  1056.  * RETURNS
  1057.  *  void
  1058.  *****************************************************************************/
  1059. void ShowCategory100Screen(
  1060.         U16 title,
  1061.         U16 title_icon,
  1062.         U16 left_softkey,
  1063.         U16 left_softkey_icon,
  1064.         U16 right_softkey,
  1065.         U16 right_softkey_icon,
  1066.         S16 input_type,
  1067.         U8 *buffer,
  1068.         S32 buffer_size,
  1069.         U8 *history_buffer)
  1070. {
  1071.     /*----------------------------------------------------------------*/
  1072.     /* Local Variables                                                */
  1073.     /*----------------------------------------------------------------*/
  1074.     dm_data_struct dm_data;
  1075.     color c = *(current_MMI_theme->UI_black_color);
  1076.     S32 inputbox_height;
  1077.     /*----------------------------------------------------------------*/
  1078.     /* Code Body                                                      */
  1079.     /*----------------------------------------------------------------*/
  1080.     MMI_multiline_inputbox_x = MMI_SMALL_SCREEN_X_OFFSET;
  1081.     MMI_multiline_inputbox_y = MMI_title_y + 2 * MMI_title_height + MMI_SMALL_SCREEN_Y_OFFSET;
  1082.     MMI_multiline_inputbox_width = MMI_content_width - 2 * MMI_SMALL_SCREEN_X_OFFSET + 1;
  1083.     MMI_multiline_inputbox_height = MMI_content_height - 2 * (MMI_SMALL_SCREEN_Y_OFFSET) - MMI_title_height + 1;
  1084.     MMI_multitap_x = MMI_SMALL_SCREEN_X_OFFSET + 1;
  1085.     MMI_multitap_y -= (MMI_SMALL_SCREEN_Y_OFFSET + 1);
  1086.     MMI_multitap_width = UI_DEVICE_WIDTH - 2 * MMI_SMALL_SCREEN_X_OFFSET - 1;
  1087.     g_small_editor_category_present = TRUE;
  1088. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1089.     set_small_screen();
  1090.     wgui_small_editor_information_flag = 1;
  1091.     gui_add_cleanup_hook(disable_resized_small_screen);
  1092. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  1093.     hide_status_icon_bar(0);//052906 early status icon
  1094. #if defined (__MMI_T9_SM_CHINESE__) || defined (__MMI_T9_TR_CHINESE__)
  1095.     T9TrResizeSelectionArea();
  1096. #elif defined (__MMI_ZI__)
  1097.     ZiResizeSelectionArea();    /* for testing only..remove comment before making build */
  1098. #endif 
  1099. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1100.     gui_lock_double_buffer();
  1101. #endif 
  1102.     MMI_menu_shortcut_number = -1;
  1103.     MMI_disable_title_shortcut_display = 1;
  1104.     clear_category_screen_key_handlers();
  1105.     change_left_softkey(left_softkey, left_softkey_icon);
  1106.     change_right_softkey(right_softkey, right_softkey_icon);
  1107.     clear_left_softkey();
  1108.     clear_right_softkey();
  1109.     register_left_softkey_handler();
  1110.     register_right_softkey_handler();
  1111.     register_default_hide_softkeys();
  1112.     /* MTK Add By Elvis for T9 */
  1113. #ifdef __MMI_T9__
  1114.     InuptMethodEnterCategory5();
  1115. #elif defined __MMI_ZI__
  1116.     ZiInuptMethodEnterCategory5();
  1117. //KP Jerry add on 2007-3-8 start
  1118. #elif defined __MMI_CSTAR__
  1119. CstarInputMethodEnterCategory5();
  1120. //KP Jerry add on 2007-3-8 end
  1121. #elif defined __MMI_KA__
  1122.     KonkaInuptMethodEnterCategory5();
  1123. #elif defined __MMI_ITAP__
  1124. /* under construction !*/
  1125. #endif 
  1126.     /* MTK end */
  1127.     MMI_title_string = (UI_string_type) get_string(title);
  1128.     MMI_title_icon = (PU8) get_image(title_icon);
  1129.     register_hide_multitap(category100_hide_multitap);
  1130.     wgui_setup_inputbox(
  1131.         MMI_multiline_inputbox_x,
  1132.         MMI_multiline_inputbox_y,
  1133.         MMI_multiline_inputbox_width,
  1134.         MMI_multiline_inputbox_height,
  1135.         buffer,
  1136.         buffer_size,
  1137.         MMI_CATEGORY100_ID,
  1138.         get_string(right_softkey),
  1139.         get_image(right_softkey_icon),
  1140.         input_type,
  1141.         history_buffer,
  1142.         1);
  1143.     inputbox_height =
  1144.         MMI_content_height - MMI_title_height - 2 * MMI_SMALL_SCREEN_Y_OFFSET - wgui_inputbox_information_bar_height +
  1145.         1;
  1146.     if (MMI_multiline_inputbox.height > inputbox_height)
  1147.     {
  1148.         gui_resize_multi_line_input_box(&MMI_multiline_inputbox, MMI_multiline_inputbox.width, inputbox_height);
  1149.     }
  1150.     
  1151. //#ifdef __MMI_WALLPAPER_ON_BOTTOM__//110306 popup title
  1152.     title_bg_id = IMG_FLEXIBLE_TITLEBAR_BG;
  1153. //#endif
  1154.     gui_unlock_double_buffer();
  1155.     ExitCategoryFunction = ExitCategory100Screen;
  1156.     dm_data.s32flags = /* DM_NO_FLAGS */ DM_NO_POPUP_BACKGROUND;
  1157.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1158.     dm_register_category_controlled_callback(category5callback);
  1159.     dm_add_rectangle(c, DM_RECTANGLE_FILL_GRAYSCALE);
  1160.     dm_add_rectangle(c, 0);
  1161.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1162.     dm_data.s32CatId = MMI_CATEGORY100_ID;
  1163.     dm_setup_data(&dm_data);
  1164.     dm_redraw_category_screen();
  1165. }
  1166. /*****************************************************************************
  1167.  * FUNCTION
  1168.  *  ExitCategory100Screen
  1169.  * DESCRIPTION
  1170.  *  
  1171.  * PARAMETERS
  1172.  *  void
  1173.  * RETURNS
  1174.  *  void
  1175.  *****************************************************************************/
  1176. void ExitCategory100Screen(void)
  1177. {
  1178.     /*----------------------------------------------------------------*/
  1179.     /* Local Variables                                                */
  1180.     /*----------------------------------------------------------------*/
  1181.     /*----------------------------------------------------------------*/
  1182.     /* Code Body                                                      */
  1183.     /*----------------------------------------------------------------*/
  1184.     MMI_multiline_inputbox_x = MMI_MULTILINE_INPUTBOX_X;
  1185.     MMI_multiline_inputbox_y = MMI_MULTILINE_INPUTBOX_Y;
  1186.     MMI_multiline_inputbox_height = UI_DEVICE_HEIGHT;
  1187.     MMI_multiline_inputbox_width = UI_DEVICE_WIDTH;
  1188.     wgui_small_editor_information_flag = 0;
  1189.     MMI_multitap_x = MMI_MULTITAP_X;
  1190.     MMI_multitap_y = /*(UI_device_height - MMI_BUTTON_BAR_HEIGHT - MMI_MULTITAP_HEIGHT);*/ MMI_MULTITAP_Y;
  1191.     MMI_multitap_width = UI_device_width - 4;
  1192.     g_small_editor_category_present = FALSE;
  1193. #if defined (__MMI_T9_SM_CHINESE__) || defined (__MMI_T9_TR_CHINESE__)
  1194.     T9TrResizeSelectionArea();
  1195. #elif defined (__MMI_ZI__)
  1196.     ZiResizeSelectionArea();
  1197. #endif 
  1198. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1199.     reset_small_screen();
  1200. #endif 
  1201. //#ifdef __MMI_WALLPAPER_ON_BOTTOM__//111306 popup title
  1202.     title_bg_id = 0;
  1203. //#endif
  1204.     show_status_icon_bar(0);//052906 early status icon
  1205.     set_MMI_current_input_type();
  1206.     reset_softkeys();
  1207.     reset_multitaps();
  1208.     wgui_close_inputbox();
  1209.     entry_full_screen();
  1210.     ExitCategoryFunction = MMI_dummy_function;
  1211.     RedrawCategoryFunction = MMI_dummy_function;
  1212.     GetCategoryHistory = dummy_get_history;
  1213.     GetCategoryHistorySize = dummy_get_history_size;
  1214. }
  1215. /*****************************************************************************
  1216.  * FUNCTION
  1217.  *  category100_hide_multitap
  1218.  * DESCRIPTION
  1219.  *  
  1220.  * PARAMETERS
  1221.  *  void
  1222.  * RETURNS
  1223.  *  void
  1224.  *****************************************************************************/
  1225. void category100_hide_multitap(void)
  1226. {
  1227.     /*----------------------------------------------------------------*/
  1228.     /* Local Variables                                                */
  1229.     /*----------------------------------------------------------------*/
  1230.     color c;
  1231. S32 x1,y1,x2,y2;
  1232.     /*----------------------------------------------------------------*/
  1233.     /* Code Body                                                      */
  1234.     /*----------------------------------------------------------------*/
  1235.     gui_lock_double_buffer();
  1236.     /* micha1104 Chicago Feature */
  1237. #ifdef __MMI_DEFAULT_THEME_3__
  1238.     c.r = 206;
  1239.     c.g = 206;
  1240.     c.b = 206;
  1241. #else /* __MMI_DEFAULT_THEME_3__ */ 
  1242.     c.r = 255;
  1243.     c.g = 255;
  1244.     c.b = 255;
  1245. #endif /* __MMI_DEFAULT_THEME_3__ */ 
  1246.     c.alpha = 100;
  1247.     gui_reset_clip();
  1248.     /* MTK for modify the clear area because of one more pixel */
  1249. x1 = MMI_multitap_x;
  1250.     y1 = MMI_multitap_y;
  1251.     x2 = MMI_multitap_x + MMI_multitap_width - 1;
  1252.     //PMT SUKRIT START MAUI_00226206
  1253. y2 = MMI_multitap_y + MMI_multitap_height;
  1254.     //PMT SUKRIT END MAUI_00226206
  1255.     gui_fill_rectangle(x1,y1,x2,y2,c);
  1256.     gui_unlock_double_buffer();
  1257.     gui_BLT_double_buffer(x1,y1,x2,y2);
  1258. }
  1259. #endif /* UI_SMALL_CATEGORY_EDITOR */ 
  1260. /* global variable of category35 multiline box */
  1261. multi_line_input_box cat35_message_box;
  1262. /*****************************************************************************
  1263.  * FUNCTION
  1264.  *  category35callback
  1265.  * DESCRIPTION
  1266.  *  
  1267.  * PARAMETERS
  1268.  *  coordinate      [?]     
  1269.  * RETURNS
  1270.  *  void
  1271.  *****************************************************************************/
  1272. void category35callback(dm_coordinates *coordinate)
  1273. {
  1274.     /*----------------------------------------------------------------*/
  1275.     /* Local Variables                                                */
  1276.     /*----------------------------------------------------------------*/
  1277.     /*----------------------------------------------------------------*/
  1278.     /* Code Body                                                      */
  1279.     /*----------------------------------------------------------------*/
  1280.     gui_show_multi_line_input_box(&cat35_message_box);
  1281.     coordinate->s16X = cat35_message_box.x;
  1282.     coordinate->s16Y = cat35_message_box.y;
  1283.     coordinate->s16Width = cat35_message_box.width;
  1284.     coordinate->s16Height = cat35_message_box.height;
  1285. }
  1286. /*****************************************************************************
  1287.  * FUNCTION
  1288.  *  SetCategory35RightSoftkeyFunction
  1289.  * DESCRIPTION
  1290.  *  register RSK function handler of category 35
  1291.  * PARAMETERS
  1292.  *  f       [IN]        
  1293.  *  k       [IN]        
  1294.  * RETURNS
  1295.  *  void
  1296.  *****************************************************************************/
  1297. void SetCategory35RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  1298. {
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Local Variables                                                */
  1301.     /*----------------------------------------------------------------*/
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Code Body                                                      */
  1304.     /*----------------------------------------------------------------*/
  1305.     UI_UNUSED_PARAMETER(k);
  1306.     wgui_inputbox_RSK_function = f;
  1307. }
  1308. /*****************************************************************************
  1309.  * FUNCTION
  1310.  *  category35_message_box_previous_line
  1311.  * DESCRIPTION
  1312.  *  move to previous line of multi line box of category 35
  1313.  * PARAMETERS
  1314.  *  void
  1315.  * RETURNS
  1316.  *  void
  1317.  *****************************************************************************/
  1318. void category35_message_box_previous_line(void)
  1319. {
  1320.     /*----------------------------------------------------------------*/
  1321.     /* Local Variables                                                */
  1322.     /*----------------------------------------------------------------*/
  1323.     /*----------------------------------------------------------------*/
  1324.     /* Code Body                                                      */
  1325.     /*----------------------------------------------------------------*/
  1326.     gui_multi_line_input_box_previous_line(&cat35_message_box);
  1327.     gui_show_multi_line_input_box(&cat35_message_box);
  1328. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1329.     gui_BLT_double_buffer(
  1330.         cat35_message_box.x,
  1331.         cat35_message_box.y,
  1332.         cat35_message_box.x + cat35_message_box.width - 1,
  1333.         cat35_message_box.y + cat35_message_box.height - 1);
  1334. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  1335. }
  1336. /*****************************************************************************
  1337.  * FUNCTION
  1338.  *  category35_message_box_next_line
  1339.  * DESCRIPTION
  1340.  *  move to next  line of multi line box of category 35
  1341.  * PARAMETERS
  1342.  *  void
  1343.  * RETURNS
  1344.  *  void
  1345.  *****************************************************************************/
  1346. void category35_message_box_next_line(void)
  1347. {
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Local Variables                                                */
  1350.     /*----------------------------------------------------------------*/
  1351.     /*----------------------------------------------------------------*/
  1352.     /* Code Body                                                      */
  1353.     /*----------------------------------------------------------------*/
  1354.     gui_multi_line_input_box_next_line(&cat35_message_box);
  1355.     gui_show_multi_line_input_box(&cat35_message_box);
  1356. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1357.     gui_BLT_double_buffer(
  1358.         cat35_message_box.x,
  1359.         cat35_message_box.y,
  1360.         cat35_message_box.x + cat35_message_box.width - 1,
  1361.         cat35_message_box.y + cat35_message_box.height - 1);
  1362. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  1363. }
  1364. /*****************************************************************************
  1365.  * FUNCTION
  1366.  *  category35_keyboard_key_handler
  1367.  * DESCRIPTION
  1368.  *  key board handling of category 35
  1369.  * PARAMETERS
  1370.  *  vkey_code       [IN]        
  1371.  *  key_state       [IN]        
  1372.  * RETURNS
  1373.  *  void
  1374.  *****************************************************************************/
  1375. void category35_keyboard_key_handler(S32 vkey_code, S32 key_state)
  1376. {
  1377. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1378.     /*----------------------------------------------------------------*/
  1379.     /* Local Variables                                                */
  1380.     /*----------------------------------------------------------------*/
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Code Body                                                      */
  1383.     /*----------------------------------------------------------------*/
  1384.     if (key_state)
  1385.     {
  1386.         switch (vkey_code)
  1387.         {
  1388.             case 37:
  1389.                 multiline_inputbox_previous_character();
  1390.                 break;
  1391.             case 39:
  1392.                 multiline_inputbox_next_character();
  1393.                 break;
  1394.             case 38:
  1395.                 category35_message_box_previous_line();
  1396.                 break;
  1397.             case 40:
  1398.                 category35_message_box_next_line();
  1399.                 break;
  1400.             case 45:
  1401.                 multiline_inputbox_toggle_insert_mode();
  1402.                 break;
  1403.             case 46:
  1404.                 multiline_inputbox_delete_current_character();
  1405.                 break;
  1406.         }
  1407.     }
  1408. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1409.     UI_UNUSED_PARAMETER(vkey_code);
  1410.     UI_UNUSED_PARAMETER(key_state);
  1411. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1412. }
  1413. /*****************************************************************************
  1414.  * FUNCTION
  1415.  *  cat35_virtual_keypad_callback
  1416.  * DESCRIPTION
  1417.  *  
  1418.  * PARAMETERS
  1419.  *  void
  1420.  * RETURNS
  1421.  *  void
  1422.  *****************************************************************************/
  1423. void cat35_virtual_keypad_callback(void)
  1424. {
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Local Variables                                                */
  1427.     /*----------------------------------------------------------------*/
  1428.     /*----------------------------------------------------------------*/
  1429.     /* Code Body                                                      */
  1430.     /*----------------------------------------------------------------*/
  1431. #if defined(__MMI_TOUCH_SCREEN__)
  1432.     mmi_pen_editor_resize_multiline_input_box_for_vk();
  1433. #endif 
  1434. }
  1435. /*****************************************************************************
  1436.  * FUNCTION
  1437.  *  ShowCategory35Screen
  1438.  * DESCRIPTION
  1439.  *  Displays the dynamic icon notification with user input screen
  1440.  * PARAMETERS
  1441.  *  left_softkey                                [IN]        Left softkey label
  1442.  *  left_softkey_icon                           [IN]        Icon for the left softkey
  1443.  *  right_softkey                               [IN]        Right softkey label
  1444.  *  right_softkey_icon                          [IN]        Icon for the right softkey
  1445.  *  message                                     [IN]        Notification message
  1446.  *  message_icon                                [IN]        
  1447.  *  input_type                                  [IN]        
  1448.  *  buffer                                      [IN]        Input buffer
  1449.  *  buffer_size                                 [IN]        Input buffer size
  1450.  *  history_buffer                              [IN]        History buffer
  1451.  *  INPUT_TYPE_ALPHANUMERIC_SENTENCECASE(?)     [IN]        
  1452.  *  INPUT_TYPE(?)                               [IN]        Can take the following values:
  1453.  *  INPUT_TYPE_ALPHANUMERIC_LOWERCASE(?)        [IN]        
  1454.  *  INPUT_TYPE_NUMERIC(?)                       [IN]        
  1455.  *  INPUT_TYPE_ALPHANUMERIC_PASSWORD(?)         [IN]        (rare).
  1456.  *  INPUT_TYPE_ALPHANUMERIC_UPPERCASE(?)        [IN]        
  1457.  *  INPUT_TYPE_NUMERIC_PASSWORD(?)              [IN]        
  1458.  *  IMAGE(?)                                    [IN]        Image          Notification image
  1459.  *  For(?)                                      [IN]        Example, 5 means only 5 characters can be input in this screen.
  1460.  * RETURNS
  1461.  *  void
  1462.  *****************************************************************************/
  1463. void ShowCategory35Screen(
  1464.         U8 *left_softkey,
  1465.         PU8 left_softkey_icon,
  1466.         U8 *right_softkey,
  1467.         PU8 right_softkey_icon,
  1468.         U8 *message,
  1469.         PU8 message_icon,
  1470.         S16 input_type,
  1471.         U8 *buffer,
  1472.         S32 buffer_size,
  1473.         U8 *history_buffer)
  1474. {
  1475.     /*----------------------------------------------------------------*/
  1476.     /* Local Variables                                                */
  1477.     /*----------------------------------------------------------------*/
  1478.     dm_data_struct dm_data;
  1479.     S32 l, x = 24;
  1480.     S32 inputbox_x, inputbox_y, inputbox_width, inputbox_height;
  1481.     /*----------------------------------------------------------------*/
  1482.     /* Code Body                                                      */
  1483.     /*----------------------------------------------------------------*/
  1484.     UI_UNUSED_PARAMETER(history_buffer);
  1485. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1486.     gui_lock_double_buffer();
  1487. #endif 
  1488.     MMI_menu_shortcut_number = -1;
  1489.     clear_category_screen_key_handlers();
  1490.     set_left_softkey_label((UI_string_type) left_softkey);
  1491.     set_left_softkey_icon(left_softkey_icon);
  1492.     set_right_softkey_label((UI_string_type) right_softkey);
  1493.     set_right_softkey_icon(right_softkey_icon);
  1494.     clear_left_softkey();
  1495.     clear_right_softkey();
  1496.     register_left_softkey_handler();
  1497.     register_right_softkey_handler();
  1498.     register_default_hide_softkeys();
  1499.     MMI_message_string = (UI_string_type) message;
  1500.     MMI_message_icon = message_icon;
  1501.     wgui_set_animation_image(x >> 1, (MMI_title_y + MMI_title_height), (PU8) message_icon);
  1502.     if (message_icon == NULL)
  1503.     {
  1504.         x = 0;
  1505.     }
  1506.     /* MTK Add By Elvis for T9 */
  1507. #ifdef __MMI_T9__
  1508.     InuptMethodEnterCategory5();
  1509. #elif defined __MMI_ZI__
  1510.     ZiInuptMethodEnterCategory5();
  1511. //KP Jerry add on 2007-3-8 start
  1512. #elif defined __MMI_CSTAR__
  1513.     CstarInputMethodEnterCategory5();
  1514. //KP Jerry add on 2007-3-8 end
  1515. #elif defined __MMI_KA__
  1516.     KonkaInuptMethodEnterCategory5();
  1517. #elif defined __MMI_ITAP__
  1518. /* under construction !*/
  1519. /* under construction !*/
  1520. #endif 
  1521.     /* MTK end */
  1522.     inputbox_x = 0;
  1523.     inputbox_y = (MMI_title_y + MMI_title_height) << 1;
  1524.     inputbox_width = UI_device_width;
  1525.     inputbox_height = MMI_content_height - (MMI_title_y + MMI_title_height) - (MMI_multitap_height << 1) + 4;
  1526.     register_hide_multitap(category5_hide_multitap);
  1527.     wgui_setup_inputbox(
  1528.         inputbox_x,
  1529.         inputbox_y,
  1530.         inputbox_width,
  1531.         inputbox_height,
  1532.         buffer,
  1533.         buffer_size,
  1534.         MMI_CATEGORY5_ID,
  1535.         (UI_string_type) right_softkey,
  1536.         (PU8) right_softkey_icon,
  1537.         input_type,
  1538.         history_buffer,
  1539.         1);
  1540.     l = gui_strlen(MMI_message_string);
  1541.     /* changed code vandana mehtani iheight +9 */
  1542.     gui_create_multi_line_input_box_set_buffer(
  1543.         &cat35_message_box,
  1544.         x,
  1545.         MMI_title_y,
  1546.         UI_device_width - x + 1,
  1547.         (MMI_title_height) << 1,
  1548.         MMI_message_string,
  1549.         l,
  1550.         l,
  1551.         0);
  1552.     /* end of changed code vandana mehtani */
  1553.     /* Add flags for input box here   */
  1554.     cat35_message_box.flags |=
  1555.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW | UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
  1556.          UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
  1557.     gui_show_multi_line_input_box(&cat35_message_box);
  1558.     cat35_message_box.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  1559.     register_keyboard_key_handler(category35_keyboard_key_handler);
  1560.     SetKeyHandler(category35_message_box_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1561.     SetKeyHandler(category35_message_box_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1562.     /* micha0106 */
  1563.     if (((input_type & INPUT_TYPE_MASK) != INPUT_TYPE_PHONE_NUMBER) &&
  1564.         ((input_type & INPUT_TYPE_MASK) != INPUT_TYPE_SAT_NUMERIC_PASSWORD))
  1565.     {
  1566.         ClearKeyHandler(KEY_POUND, KEY_EVENT_DOWN);
  1567.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1568.     }
  1569. #if !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
  1570.     if (((input_type & INPUT_TYPE_MASK) == INPUT_TYPE_ALPHANUMERIC_LOWERCASE) ||
  1571.         ((input_type & INPUT_TYPE_MASK) == INPUT_TYPE_ALPHANUMERIC_UPPERCASE) ||
  1572.         ((input_type & INPUT_TYPE_MASK) == INPUT_TYPE_ALPHANUMERIC_SENTENCECASE))
  1573.     {
  1574.         SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  1575.     }
  1576. #endif /* !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */ 
  1577.     inputbox_height =
  1578.         UI_device_height - MMI_button_bar_height - wgui_inputbox_information_bar_height - cat35_message_box.height -
  1579.         MMI_multitap_height;
  1580.     gui_resize_multi_line_input_box(&MMI_multiline_inputbox, MMI_multiline_inputbox.width, inputbox_height);
  1581. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1582.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  1583.     dm_get_scr_bg_image(
  1584.         &editor_scr_bg_ID,
  1585.         &editor_scr_bg_filename,
  1586.         &editor_scr_bg_x,
  1587.         &editor_scr_bg_y,
  1588.         &editor_scr_bg_opacity);
  1589.     dm_set_scr_bg_image(editor_scr_bg_ID, editor_scr_bg_filename, editor_scr_bg_x, editor_scr_bg_y, MMI_EDITOR_BG_OPACITY);     /* 100605 editor opacity Calvin */
  1590. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1591. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1592.     gui_unlock_double_buffer();
  1593. #endif 
  1594.     ExitCategoryFunction = ExitCategory35Screen;
  1595.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1596.     dm_register_category_controlled_callback(category35callback);
  1597.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1598.     dm_data.s32CatId = MMI_CATEGORY35_ID;
  1599.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1600.     dm_data.s32flags |= DM_SHOW_VKPAD;
  1601.     dm_setup_data(&dm_data);
  1602.     dm_register_vkpad_callback(cat35_virtual_keypad_callback);
  1603.     dm_redraw_category_screen();
  1604. }
  1605. /*****************************************************************************
  1606.  * FUNCTION
  1607.  *  ExitCategory35Screen
  1608.  * DESCRIPTION
  1609.  *  Exits the dynamic icon notification with user input screen
  1610.  * PARAMETERS
  1611.  *  void
  1612.  * RETURNS
  1613.  *  void
  1614.  *****************************************************************************/
  1615. void ExitCategory35Screen(void)
  1616. {
  1617.     /*----------------------------------------------------------------*/
  1618.     /* Local Variables                                                */
  1619.     /*----------------------------------------------------------------*/
  1620.     /*----------------------------------------------------------------*/
  1621.     /* Code Body                                                      */
  1622.     /*----------------------------------------------------------------*/
  1623.     set_MMI_current_input_type();
  1624. #if(UI_BLINKING_CURSOR_SUPPORT)
  1625.     //gui_cancel_timer(UI_inputbox_blink_cursor);
  1626.     StopMyTimer(BLINKING_CURSOR);
  1627. #endif /* (UI_BLINKING_CURSOR_SUPPORT) */ 
  1628.     reset_softkeys();
  1629.     reset_multitaps();
  1630.     wgui_close_inputbox();
  1631. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1632.     /* dm_set_scr_bg_image(editor_scr_bg_ID, editor_scr_bg_filename, editor_scr_bg_x, editor_scr_bg_y, editor_scr_bg_opacity);//092005 grayscale Calvin */
  1633.     dm_set_scr_bg_image_no_draw(
  1634.         editor_scr_bg_ID,
  1635.         editor_scr_bg_filename,
  1636.         editor_scr_bg_x,
  1637.         editor_scr_bg_y,
  1638.         editor_scr_bg_opacity);
  1639. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1640.     ExitCategoryFunction = MMI_dummy_function;
  1641.     RedrawCategoryFunction = MMI_dummy_function;
  1642.     GetCategoryHistory = dummy_get_history;
  1643.     GetCategoryHistorySize = dummy_get_history_size;
  1644. }
  1645. /* Category 171: SAT edit screen (Equivalent to Cat-35)           */
  1646. /*****************************************************************************
  1647.  * FUNCTION
  1648.  *  SetCategory171RightSoftkeyFunction
  1649.  * DESCRIPTION
  1650.  *  Redraws the dynamic icon notification with user input screen
  1651.  * PARAMETERS
  1652.  *  f       [IN]        
  1653.  *  k       [IN]        
  1654.  * RETURNS
  1655.  *  void
  1656.  *****************************************************************************/
  1657. void SetCategory171RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  1658. {
  1659.     /*----------------------------------------------------------------*/
  1660.     /* Local Variables                                                */
  1661.     /*----------------------------------------------------------------*/
  1662.     /*----------------------------------------------------------------*/
  1663.     /* Code Body                                                      */
  1664.     /*----------------------------------------------------------------*/
  1665.     UI_UNUSED_PARAMETER(k);
  1666.     wgui_inputbox_RSK_function = f;
  1667. }
  1668. /*****************************************************************************
  1669.  * FUNCTION
  1670.  *  cat171_virtual_keypad_callback
  1671.  * DESCRIPTION
  1672.  *  
  1673.  * PARAMETERS
  1674.  *  void
  1675.  * RETURNS
  1676.  *  void
  1677.  *****************************************************************************/
  1678. void cat171_virtual_keypad_callback(void)
  1679. {
  1680.     /*----------------------------------------------------------------*/
  1681.     /* Local Variables                                                */
  1682.     /*----------------------------------------------------------------*/
  1683.     /*----------------------------------------------------------------*/
  1684.     /* Code Body                                                      */
  1685.     /*----------------------------------------------------------------*/
  1686. #if defined(__MMI_TOUCH_SCREEN__)
  1687.     mmi_pen_editor_resize_multiline_input_box_for_vk();
  1688. #endif 
  1689. }
  1690. /*****************************************************************************
  1691.  * FUNCTION
  1692.  *  ShowCategory171Screen
  1693.  * DESCRIPTION
  1694.  *  Displays the dynamic icon notification with user input screen
  1695.  * PARAMETERS
  1696.  *  left_softkey            [IN]        Left softkey label
  1697.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1698.  *  right_softkey           [IN]        Right softkey label
  1699.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1700.  *  message                 [IN]        Notification message
  1701.  *  message_icon            [IN]        
  1702.  *  input_type              [IN]        
  1703.  *  buffer                  [IN]        Input buffer
  1704.  *  buffer_size             [IN]        Input buffer size
  1705.  *  history_buffer          [IN]        History buffer
  1706.  *  IMAGE(?)                [IN]        Image          Notification image
  1707.  *  For(?)                  [IN]        Example, 5 means only 5 characters can be input in this screen.
  1708.  * RETURNS
  1709.  *  void
  1710.  *****************************************************************************/
  1711. void ShowCategory171Screen(
  1712.         U8 *left_softkey,
  1713.         PU8 left_softkey_icon,
  1714.         U8 *right_softkey,
  1715.         PU8 right_softkey_icon,
  1716.         U8 *message,
  1717.         PU8 message_icon,
  1718.         S16 input_type,
  1719.         U8 *buffer,
  1720.         S32 buffer_size,
  1721.         U8 *history_buffer)
  1722. {
  1723.     /*----------------------------------------------------------------*/
  1724.     /* Local Variables                                                */
  1725.     /*----------------------------------------------------------------*/
  1726.     dm_data_struct dm_data;
  1727.     S32 inputbox_x, inputbox_y, inputbox_width, inputbox_height;
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Code Body                                                      */
  1730.     /*----------------------------------------------------------------*/
  1731.     UI_UNUSED_PARAMETER(history_buffer);
  1732. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1733.     gui_lock_double_buffer();
  1734. #endif 
  1735.     MMI_menu_shortcut_number = -1;
  1736.     clear_category_screen_key_handlers();
  1737.     set_left_softkey_label((UI_string_type) left_softkey);
  1738.     set_left_softkey_icon(left_softkey_icon);
  1739.     set_right_softkey_label((UI_string_type) right_softkey);
  1740.     set_right_softkey_icon(right_softkey_icon);
  1741.     clear_left_softkey();
  1742.     clear_right_softkey();
  1743.     register_left_softkey_handler();
  1744.     register_right_softkey_handler();
  1745.     register_default_hide_softkeys();
  1746.     MMI_title_string = (UI_string_type) message;
  1747.     MMI_title_icon = (PU8) message_icon;
  1748.     /* MTK Add By Elvis for T9 */
  1749. #ifdef __MMI_T9__
  1750.     InuptMethodEnterCategory5();
  1751. #elif defined __MMI_ZI__
  1752.     ZiInuptMethodEnterCategory5();
  1753. //KP Jerry add on 2007-3-8 start
  1754. #elif defined __MMI_CSTAR__
  1755.     CstarInputMethodEnterCategory5();
  1756. //KP Jerry add on 2007-3-8 end
  1757. #elif defined __MMI_KA__
  1758.     KonkaInuptMethodEnterCategory5();
  1759. #elif defined __MMI_ITAP__
  1760. /* under construction !*/
  1761. #endif 
  1762.     /* MTK end */
  1763.     inputbox_x = 0;
  1764.     inputbox_y = (MMI_title_y + MMI_title_height);
  1765.     inputbox_width = UI_device_width;
  1766. #if defined(__MMI_FULL_SCREEN_EDITOR__)
  1767.     inputbox_height = MMI_content_height - 12;
  1768. #else 
  1769.     inputbox_height = MMI_content_height - MMI_multitap_height - 12;
  1770. #endif 
  1771.     register_hide_multitap(category5_hide_multitap);
  1772.     wgui_setup_inputbox(
  1773.         inputbox_x,
  1774.         inputbox_y,
  1775.         inputbox_width,
  1776.         inputbox_height,
  1777.         buffer,
  1778.         buffer_size,
  1779.         MMI_CATEGORY171_ID,
  1780.         (UI_string_type) right_softkey,
  1781.         (PU8) right_softkey_icon,
  1782.         input_type,
  1783.         history_buffer,
  1784.         1);
  1785.     /* W05.41 Do not Clear Key Pound Function because it is used in some input method */
  1786. #if !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
  1787.     if (((input_type & INPUT_TYPE_MASK) != INPUT_TYPE_PHONE_NUMBER) &&
  1788.         ((input_type & INPUT_TYPE_MASK) != INPUT_TYPE_SAT_NUMERIC_PASSWORD))
  1789.     {
  1790.         ClearKeyHandler(KEY_POUND, KEY_EVENT_DOWN);
  1791.         ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1792.     }
  1793.     if (((input_type & INPUT_TYPE_MASK) == INPUT_TYPE_ALPHANUMERIC_LOWERCASE) ||
  1794.         ((input_type & INPUT_TYPE_MASK) == INPUT_TYPE_ALPHANUMERIC_UPPERCASE) ||
  1795.         ((input_type & INPUT_TYPE_MASK) == INPUT_TYPE_ALPHANUMERIC_SENTENCECASE))
  1796.     {
  1797.         SetKeyHandler(wgui_handle_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);
  1798.     }
  1799. #endif /* !defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */ 
  1800.     setup_scrolling_title();
  1801. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1802.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  1803.     dm_get_scr_bg_image(
  1804.         &editor_scr_bg_ID,
  1805.         &editor_scr_bg_filename,
  1806.         &editor_scr_bg_x,
  1807.         &editor_scr_bg_y,
  1808.         &editor_scr_bg_opacity);
  1809.     dm_set_scr_bg_image(editor_scr_bg_ID, editor_scr_bg_filename, editor_scr_bg_x, editor_scr_bg_y, MMI_EDITOR_BG_OPACITY);     /* 100605 editor opacity Calvin */
  1810. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1811. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1812.     gui_unlock_double_buffer();
  1813. #endif 
  1814.     ExitCategoryFunction = ExitCategory171Screen;
  1815.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1816.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1817.     dm_data.s32CatId = MMI_CATEGORY171_ID;
  1818.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND | DM_SCROLL_TITLE;
  1819.     dm_data.s32flags |= DM_SHOW_VKPAD;
  1820.     dm_setup_data(&dm_data);
  1821.     dm_register_vkpad_callback(cat171_virtual_keypad_callback);
  1822.     dm_redraw_category_screen();
  1823. }
  1824. /*****************************************************************************
  1825.  * FUNCTION
  1826.  *  ExitCategory171Screen
  1827.  * DESCRIPTION
  1828.  *  Exits the dynamic icon notification with user input screen
  1829.  * PARAMETERS
  1830.  *  void
  1831.  * RETURNS
  1832.  *  void
  1833.  *****************************************************************************/
  1834. void ExitCategory171Screen(void)
  1835. {
  1836.     /*----------------------------------------------------------------*/
  1837.     /* Local Variables                                                */
  1838.     /*----------------------------------------------------------------*/
  1839.     /*----------------------------------------------------------------*/
  1840.     /* Code Body                                                      */
  1841.     /*----------------------------------------------------------------*/
  1842.     set_MMI_current_input_type();
  1843. #if(UI_BLINKING_CURSOR_SUPPORT)
  1844.     //gui_cancel_timer(UI_inputbox_blink_cursor);
  1845.     StopMyTimer(BLINKING_CURSOR);
  1846. #endif /* (UI_BLINKING_CURSOR_SUPPORT) */ 
  1847.     close_scrolling_title();
  1848.     /* MTK Elvis 20040116 to reset softkeys and multitap status */
  1849.     reset_softkeys();
  1850.     reset_multitaps();
  1851.     /* MTK end */
  1852.     wgui_close_inputbox();
  1853. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1854.     /* dm_set_scr_bg_image(editor_scr_bg_ID, editor_scr_bg_filename, editor_scr_bg_x, editor_scr_bg_y, editor_scr_bg_opacity);//092005 grayscale Calvin */
  1855.     dm_set_scr_bg_image_no_draw(
  1856.         editor_scr_bg_ID,
  1857.         editor_scr_bg_filename,
  1858.         editor_scr_bg_x,
  1859.         editor_scr_bg_y,
  1860.         editor_scr_bg_opacity);
  1861. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1862.     ExitCategoryFunction = MMI_dummy_function;
  1863.     RedrawCategoryFunction = MMI_dummy_function;
  1864.     GetCategoryHistory = dummy_get_history;
  1865.     GetCategoryHistorySize = dummy_get_history_size;
  1866. }
  1867. /*****************************************************************************
  1868.  * FUNCTION
  1869.  *  SetInputboxLSKFunction
  1870.  * DESCRIPTION
  1871.  *  
  1872.  * PARAMETERS
  1873.  *  f       [IN]        
  1874.  * RETURNS
  1875.  *  void
  1876.  *****************************************************************************/
  1877. void SetInputboxLSKFunction(FuncPtr f)
  1878. {
  1879. #ifdef __MMI_T9__
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Local Variables                                                */
  1882.     /*----------------------------------------------------------------*/
  1883.     /*----------------------------------------------------------------*/
  1884.     /* Code Body                                                      */
  1885.     /*----------------------------------------------------------------*/
  1886.     T9SetInputboxLSKFunction(f);
  1887. #elif defined __MMI_ZI__
  1888.     ZiSetInputboxLSKFunction(f);
  1889. //KP Jerry add on 2007-3-8 start
  1890. #elif defined __MMI_CSTAR__
  1891.     CstarSetInputboxLSKFunction(f);
  1892. //KP Jerry add on 2007-3-8 end
  1893. #elif defined __MMI_KA__
  1894.     KonKaSetInputboxLSKFunction(f);
  1895. #elif defined __MMI_ITAP__
  1896. /* under construction !*/
  1897. #endif 
  1898. #if defined(__MMI_TOUCH_SCREEN__)
  1899.     mmi_pen_editor_set_inputbox_LSK_Function(f);
  1900. #endif 
  1901. }
  1902. #if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
  1903. // TODO: to be moved to wgui_categories_inputs.c
  1904. U8 *cat115buffer;
  1905. static void wgui_WCSS_inputbox_input_handler(MMI_key_code_type key_code, MMI_key_event_type key_event);
  1906. /* Return The Input Mode Respect To The Input Method Passed By User. */
  1907. /*****************************************************************************
  1908.  * FUNCTION
  1909.  *  WCSS_check_input_method
  1910.  * DESCRIPTION
  1911.  *  
  1912.  * PARAMETERS
  1913.  *  s       [?]     
  1914.  * RETURNS
  1915.  *  
  1916.  *****************************************************************************/
  1917. static U16 WCSS_check_input_method(U8 *s)
  1918. {
  1919.     /*----------------------------------------------------------------*/
  1920.     /* Local Variables                                                */
  1921.     /*----------------------------------------------------------------*/
  1922.     /*----------------------------------------------------------------*/
  1923.     /* Code Body                                                      */
  1924.     /*----------------------------------------------------------------*/
  1925.     switch (s[0] & 0x1F)
  1926.     {
  1927.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC:
  1928.             return INPUT_TYPE_ALPHABATIC_UPPERCASE;
  1929.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC:
  1930.             return INPUT_TYPE_ALPHABATIC_LOWERCASE;
  1931.         case INPUT_MODE_MULTITAP_UPPERCASE_ABC:
  1932.             return INPUT_TYPE_ALPHANUMERIC_UPPERCASE;
  1933.         case INPUT_MODE_MULTITAP_LOWERCASE_ABC:
  1934.             return INPUT_TYPE_ALPHANUMERIC_LOWERCASE;
  1935.         case INPUT_MODE_123:
  1936.             return INPUT_TYPE_NUMERIC;
  1937.         case INPUT_MODE_123_SYMBOLS:
  1938.             return INPUT_TYPE_NUMERIC_SYMBOL;
  1939.         default:
  1940.             return INPUT_TYPE_ALPHANUMERIC_UPPERCASE;
  1941.     }
  1942. }
  1943. /*****************************************************************************
  1944.  * FUNCTION
  1945.  *  RedrawCategory115Screen
  1946.  * DESCRIPTION
  1947.  *  Redraws the category115 screen
  1948.  * PARAMETERS
  1949.  *  void
  1950.  * RETURNS
  1951.  *  void
  1952.  *****************************************************************************/
  1953. void RedrawCategory115Screen(void)
  1954. {
  1955.     /*----------------------------------------------------------------*/
  1956.     /* Local Variables                                                */
  1957.     /*----------------------------------------------------------------*/
  1958.     /*----------------------------------------------------------------*/
  1959.     /* Code Body                                                      */
  1960.     /*----------------------------------------------------------------*/
  1961.     RedrawCategory5Screen();
  1962. }
  1963. /*****************************************************************************
  1964.  * FUNCTION
  1965.  *  SetCategory115RightSoftkeyFunction
  1966.  * DESCRIPTION
  1967.  *  
  1968.  * PARAMETERS
  1969.  *  f       [IN]        
  1970.  *  k       [IN]        
  1971.  * RETURNS
  1972.  *  void
  1973.  *****************************************************************************/
  1974. void SetCategory115RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  1975. {
  1976.     /*----------------------------------------------------------------*/
  1977.     /* Local Variables                                                */
  1978.     /*----------------------------------------------------------------*/
  1979.     /*----------------------------------------------------------------*/
  1980.     /* Code Body                                                      */
  1981.     /*----------------------------------------------------------------*/
  1982.     SetCategory5RightSoftkeyFunction(f, k);
  1983. }
  1984. /*****************************************************************************
  1985.  * FUNCTION
  1986.  *  ExitCategory115Screen
  1987.  * DESCRIPTION
  1988.  *  Exits the category5 screen
  1989.  * PARAMETERS
  1990.  *  void
  1991.  * RETURNS
  1992.  *  void
  1993.  *****************************************************************************/
  1994. void ExitCategory115Screen(void)
  1995. {
  1996.     /*----------------------------------------------------------------*/
  1997.     /* Local Variables                                                */
  1998.     /*----------------------------------------------------------------*/
  1999.     /*----------------------------------------------------------------*/
  2000.     /* Code Body                                                      */
  2001.     /*----------------------------------------------------------------*/
  2002.     /* Reference: ExitCategory5Screen() */
  2003.     set_MMI_current_input_type();
  2004.     reset_softkeys();
  2005.     reset_multitaps();
  2006.     wgui_close_inputbox();
  2007.     clear_key_input_handler();  /* Key input handler was registered before */
  2008.     ExitCategoryFunction = MMI_dummy_function;
  2009.     RedrawCategoryFunction = MMI_dummy_function;
  2010.     GetCategoryHistory = dummy_get_history;
  2011.     GetCategoryHistorySize = dummy_get_history_size;
  2012.     if (cat115buffer != NULL)
  2013.     {
  2014.         gui_free(cat115buffer);
  2015.         cat115buffer = NULL;
  2016.     }
  2017. }
  2018. /*****************************************************************************
  2019.  * FUNCTION
  2020.  *  GetCategory115HistorySize
  2021.  * DESCRIPTION
  2022.  *  Gets the size of the history buffer for category115 screen
  2023.  * PARAMETERS
  2024.  *  void
  2025.  * RETURNS
  2026.  *  size in U8s of the history buffer
  2027.  *****************************************************************************/
  2028. S32 GetCategory115HistorySize(void)
  2029. {
  2030.     /*----------------------------------------------------------------*/
  2031.     /* Local Variables                                                */
  2032.     /*----------------------------------------------------------------*/
  2033.     /*----------------------------------------------------------------*/
  2034.     /* Code Body                                                      */
  2035.     /*----------------------------------------------------------------*/
  2036.     return (sizeof(multiline_inputbox_category_history));
  2037. }
  2038. /*****************************************************************************
  2039.  * FUNCTION
  2040.  *  GetCategory115History
  2041.  * DESCRIPTION
  2042.  *  Gets the history buffer for category115 screen
  2043.  * PARAMETERS
  2044.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  2045.  *  buffer_size(?)      [IN]        In unicode (containing '')
  2046.  * RETURNS
  2047.  *  Pointer to the history buffer
  2048.  *****************************************************************************/
  2049. U8 *GetCategory115History(U8 *history_buffer)
  2050. {
  2051.     /*----------------------------------------------------------------*/
  2052.     /* Local Variables                                                */
  2053.     /*----------------------------------------------------------------*/
  2054.     /*----------------------------------------------------------------*/
  2055.     /* Code Body                                                      */
  2056.     /*----------------------------------------------------------------*/
  2057.     get_multiline_inputbox_category_history(MMI_CATEGORY5_ID, history_buffer, MMI_current_input_type);
  2058.     return (history_buffer);
  2059. }
  2060. #ifdef __MMI_T9__
  2061. extern void InuptMethodEnterCategory5(void);
  2062. #endif 
  2063. /*****************************************************************************
  2064.  * FUNCTION
  2065.  *  ShowCategory115Screen
  2066.  * DESCRIPTION
  2067.  *  Displays the category115 screen (WCSS editor)
  2068.  * PARAMETERS
  2069.  *  title                   [IN]        Title for the screen
  2070.  *  title_icon              [IN]        Icon shown with the title
  2071.  *  left_softkey            [IN]        Left softkey label
  2072.  *  left_softkey_icon       [IN]        Icon for the left softkey
  2073.  *  right_softkey           [IN]        Right softkey label
  2074.  *  right_softkey_icon      [IN]        Icon for the right softkey
  2075.  *  buffer                  [IN]        Buffer the input box should use.
  2076.  *  buffer_size             [IN]        UCS2 character count including ''
  2077.  *  input_format            [IN]        WAP input-format
  2078.  *  input_required          [IN]        Unused
  2079.  *  history_buffer          [IN]        History buffer
  2080.  * RETURNS
  2081.  *  void
  2082.  *****************************************************************************/
  2083. /*
  2084.  * Note: We do not handle Chinese input in ShowCategory115Screen to simplify the design.
  2085.  * * "*m" and "*M" is already handled in WAP. and "nnn*M" will only allow three digits, and 
  2086.  * * any number of western characters.
  2087.  */
  2088. void ShowCategory115Screen(
  2089.         U16 title,
  2090.         U16 title_icon,
  2091.         U16 left_softkey,
  2092.         U16 left_softkey_icon,
  2093.         U16 right_softkey,
  2094.         U16 right_softkey_icon,
  2095.         U8 *buffer,
  2096.         S32 buffer_size,
  2097.         U8 *input_format,
  2098.         U8 input_required,
  2099.         U8 *history_buffer)
  2100. {
  2101.     /*----------------------------------------------------------------*/
  2102.     /* Local Variables                                                */
  2103.     /*----------------------------------------------------------------*/
  2104.     /* Reference: ShowCategory5Screen() */
  2105.     dm_data_struct dm_data;//092906 cat115
  2106.     S32 inputbox_x = 0;
  2107.     S32 inputbox_y = (MMI_title_y + MMI_title_height);
  2108.     S32 inputbox_width = MMI_content_width;
  2109. #if defined(__MMI_FULL_SCREEN_EDITOR__)
  2110.     S32 inputbox_height = MMI_content_height;
  2111. #else 
  2112.     S32 inputbox_height = MMI_content_height - MMI_multitap_height;
  2113. #endif 
  2114.     S8 input_format_status = 0;
  2115.     S32 format_length;
  2116.     U16 input_type = INPUT_TYPE_ALPHANUMERIC_UPPERCASE;
  2117.     /*----------------------------------------------------------------*/
  2118.     /* Code Body                                                      */
  2119.     /*----------------------------------------------------------------*/
  2120.     // ADD_SCREEN_STRINGS((3,title,right_softkey,left_softkey));
  2121.     // ADD_SCREEN_IMAGES((3,title_icon,right_softkey_icon,left_softkey_icon));
  2122.     if (buffer_size > CAT115_MAXSIZE)   /* Maximum input char = CAT115_MAXSIZE - 1 */
  2123.     {
  2124.         buffer_size = CAT115_MAXSIZE;
  2125.     }
  2126.     format_length = get_category_115_format_buffer_length(input_format, buffer_size);
  2127.     if (format_length == -1)
  2128.     {
  2129.         /* Use as normat category 5. */
  2130.         input_format_status = (S8) (-1);
  2131.     }
  2132.     else if (format_length == 0)
  2133.     {
  2134.         /* Leave buffer_size unchanged */
  2135.     }
  2136.     else if (format_length < buffer_size)
  2137.     {
  2138.         /* Set the buffer length to the upper bound derived from input format */
  2139.         buffer_size = format_length + 1;
  2140.     }
  2141.     else if (format_length >= buffer_size)
  2142.     {
  2143.         /* Act as Category 5 */
  2144.         input_format_status = (S8) (-1);
  2145.     }
  2146.     if (input_format_status != -1)
  2147.     {
  2148.         /* Allocate fixed size of control buffer bucket because the size is controlled by
  2149.            external web pages; otherwise, it might exhaust some kind of control buffer */
  2150.         cat115buffer = gui_malloc(CAT115_MAXSIZE);
  2151.         if (gui_parse_WCSS_string
  2152.             ((U8*) input_format, (U8*) buffer, (U8*) cat115buffer, (S16) buffer_size,
  2153.              (U8) ((history_buffer || buffer[0] || buffer[1]) ? 1 : 0)) != 0)
  2154.         {
  2155.             PRINT_INFORMATION(("n --- Category 115 --- Invalid WCSS Format --- "));
  2156.             input_format_status = (S8) (-1);    /* In this case the editor will works as normal text editor. */
  2157.         }
  2158.     }
  2159.     if (input_format_status != -1)
  2160.     {
  2161.         extern void gui_reset_WCSS_cursor_position(void);
  2162.         /* Use INPUT_TYPE_OVERRIDE_DEFAULT to prevent overriden by default input method, which might be chinese input method (unsupported) */
  2163.         input_type = WCSS_check_input_method(cat115buffer) | INPUT_TYPE_OVERRIDE_DEFAULT;
  2164.         if (history_buffer == NULL)
  2165.         {
  2166.             is_fisrt_entry_WCSS_editor = MMI_TRUE;
  2167.         }
  2168.         else
  2169.         {
  2170.             is_fisrt_entry_WCSS_editor = MMI_FALSE;
  2171.         }
  2172.         gui_reset_WCSS_cursor_position();
  2173.     }
  2174. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2175.     gui_lock_double_buffer();
  2176. #endif 
  2177.     MMI_menu_shortcut_number = -1;
  2178.     MMI_disable_title_shortcut_display = 1;
  2179.     clear_category_screen_key_handlers();
  2180.     change_left_softkey(left_softkey, left_softkey_icon);
  2181.     change_right_softkey(right_softkey, right_softkey_icon);
  2182.     clear_left_softkey();
  2183.     clear_right_softkey();
  2184.     register_left_softkey_handler();
  2185.     register_right_softkey_handler();
  2186.     register_default_hide_softkeys();
  2187. #ifdef __MMI_T9__
  2188.     InuptMethodEnterCategory5();
  2189. #elif defined __MMI_ZI__
  2190.     ZiInuptMethodEnterCategory5();
  2191. //KP Jerry add on 2007-3-8 start
  2192. #elif defined __MMI_CSTAR__
  2193.     CstarInputMethodEnterCategory5();
  2194. //KP Jerry add on 2007-3-8 end
  2195. #elif defined __MMI_KA__
  2196.     KonkaInuptMethodEnterCategory5();
  2197. #elif defined __MMI_ITAP__
  2198. /* under construction !*/
  2199. #endif 
  2200.     MMI_title_string = (UI_string_type) get_string(title);
  2201.     MMI_title_icon = (PU8) get_image(title_icon);
  2202.     register_hide_multitap(category5_hide_multitap);
  2203.     wgui_setup_inputbox(
  2204.         inputbox_x,
  2205.         inputbox_y,
  2206.         inputbox_width,
  2207.         inputbox_height,
  2208.         buffer,
  2209.         buffer_size,
  2210.         MMI_CATEGORY5_ID,
  2211.         get_string(right_softkey),
  2212.         get_image(right_softkey_icon),
  2213.         input_type,
  2214.         history_buffer,
  2215.         1);
  2216.     MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;
  2217.     if (input_format_status != -1)
  2218.     {
  2219.         register_key_input_handler(wgui_WCSS_inputbox_input_handler);
  2220.     }
  2221. #if defined(__MMI_FULL_SCREEN_EDITOR__)
  2222.     inputbox_height = MMI_content_height - wgui_inputbox_information_bar_height;
  2223. #else 
  2224.     inputbox_height = MMI_content_height - MMI_multitap_height - wgui_inputbox_information_bar_height;
  2225. #endif 
  2226.     if (MMI_multiline_inputbox.height > inputbox_height)
  2227.     {
  2228.         gui_resize_multi_line_input_box(&MMI_multiline_inputbox, MMI_multiline_inputbox.width, inputbox_height);
  2229.     }
  2230. #if UI_INCLUDE_INFORMATION_AREA_IN_MULTI_LINE
  2231.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_INCLUDE_INFO_AREA;
  2232. #endif 
  2233.     if (input_format_status != -1)
  2234.     {
  2235.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_OVERWRITE_MODE;
  2236.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE;
  2237.         /* Disable word-wrapping for WCSS editor */
  2238.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_WRAPPING_BY_WORD;
  2239.     }
  2240. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2241.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  2242. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  2243. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2244.     gui_unlock_double_buffer();
  2245. #endif 
  2246.     if (input_format_status != -1 && history_buffer == NULL)
  2247.     {
  2248.         /* We hope to edit from the beginning even with default input values, 
  2249.            and we just configured the input format for the first character */
  2250.         MMI_multiline_inputbox.cursor_p = MMI_multiline_inputbox.text;
  2251.         MMI_multiline_inputbox.cursor_line_position_counter = 0;
  2252.         show_multiline_inputbox_no_draw();
  2253.     }
  2254. #if 0//092006 cat115
  2255. /* under construction !*/
  2256. /* under construction !*/
  2257. /* under construction !*/
  2258. /* under construction !*/
  2259. /* under construction !*/
  2260. #else
  2261.     ExitCategoryFunction = ExitCategory115Screen;
  2262.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2263.     dm_data.s32flags |= DM_SHOW_VKPAD;
  2264.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  2265.     dm_register_category_controlled_callback(category5callback);
  2266.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2267.     dm_data.s32CatId = MMI_CATEGORY5_ID;
  2268.     dm_setup_data(&dm_data);
  2269.     dm_register_vkpad_callback(cat5_virtual_keypad_callback);
  2270.     dm_redraw_category_screen();
  2271. #endif
  2272. }
  2273. /*****************************************************************************
  2274.  * FUNCTION
  2275.  *  wgui_WCSS_inputbox_input_handler
  2276.  * DESCRIPTION
  2277.  *  
  2278.  * PARAMETERS
  2279.  *  key_code        [IN]        
  2280.  *  key_event       [IN]        
  2281.  * RETURNS
  2282.  *  void
  2283.  *****************************************************************************/
  2284. static void wgui_WCSS_inputbox_input_handler(MMI_key_code_type key_code, MMI_key_event_type key_event)
  2285. {
  2286.     /*----------------------------------------------------------------*/
  2287.     /* Local Variables                                                */
  2288.     /*----------------------------------------------------------------*/
  2289.     /*----------------------------------------------------------------*/
  2290.     /* Code Body                                                      */
  2291.     /*----------------------------------------------------------------*/
  2292.     /* 
  2293.      * When input method is changed before controlled by Multitap Input
  2294.      * We cannot switch input method automatically unless multitap is discarded.
  2295.      * For example: assume we do not do this, we may get string "ad" from input format "xn" when pressing '2' and '3' successively.
  2296.      */
  2297. #if 1
  2298.     if (MMI_multiline_inputbox.flags & UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE)
  2299. #else 
  2300. /* under construction !*/
  2301. #endif 
  2302.     {
  2303.         if (MMI_active_multitap != key_code)
  2304.         {
  2305.             if (!gui_WCSS_check_next_multitap_input(&MMI_multiline_inputbox))
  2306.             {
  2307.                 /* If the next character does not use multitap, disable multitap */
  2308.                 disable_active_multitap();
  2309.             }
  2310.         }
  2311.     }
  2312. }
  2313. #endif /* defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__) */ 
  2314. #if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
  2315. /*****************************************************************************
  2316.  * FUNCTION
  2317.  *  mmi_nsm2_get_remaining_len
  2318.  * DESCRIPTION
  2319.  *  
  2320.  * PARAMETERS
  2321.  *  void
  2322.  * RETURNS
  2323.  *  
  2324.  *****************************************************************************/
  2325. S32 mmi_nsm2_get_remaining_len(void)
  2326. {
  2327.     /*----------------------------------------------------------------*/
  2328.     /* Local Variables                                                */
  2329.     /*----------------------------------------------------------------*/
  2330.     /*----------------------------------------------------------------*/
  2331.     /* Code Body                                                      */
  2332.     /*----------------------------------------------------------------*/
  2333.     if (g_nsm_msg_context.UCS2_count > 0)
  2334.     {
  2335.         if (g_nsm_msg_context.is_picmsg == TRUE)
  2336.         {
  2337.             /* 64 */
  2338.             g_nsm_msg_context.remaining_length = (MAX_PICMSG_UCS2_DCS_TEXT_LEN) + 1;
  2339.         }
  2340.         else
  2341.         {
  2342.             /* 306 */
  2343.             g_nsm_msg_context.remaining_length = (UCS2_DCS_ALLOCATED_LENGTH) + 1;
  2344.         }
  2345.     }
  2346.     else    /* No UCS Character */
  2347.     {
  2348.         if (g_nsm_msg_context.is_picmsg == TRUE)
  2349.         {
  2350.             /* 128 */
  2351.             g_nsm_msg_context.remaining_length = (MAX_PICMSG_DEFAULT_DCS_TEXT_LEN) + 1;
  2352.         }
  2353.         else
  2354.         {
  2355.             /* 612 */
  2356.             g_nsm_msg_context.remaining_length = (DEFAULT_DCS_ALLOCATED_LENGTH) + 1;
  2357.         }
  2358.     }
  2359.     return (g_nsm_msg_context.remaining_length * 2);
  2360. }
  2361. #endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */ 
  2362. #ifdef __MMI_MESSAGES_CHAT__
  2363. /* only used in cat305(ChatApp) */
  2364. UI_filled_area greenwgui_color_dialog_background = {UI_FILLED_AREA_TYPE_COLOR,
  2365.     UI_NULL_IMAGE,
  2366.     NULL,
  2367.     {200, 255, 145, 100},
  2368.     {0, 0, 0, 0},
  2369.     {0, 0, 0, 100},
  2370.     {50, 50, 50, 100},
  2371.     0
  2372. };
  2373. /********** MS CHAT SCREEN START **********/
  2374. #define LOCAL     0
  2375. #define SENDER    1
  2376. #define  RECEIVER_TRUNCATED      2
  2377. #define  SENDER_TRUNCATED     3
  2378. UI_filled_area SMSChat_inputbox_BG_filler = 
  2379. {
  2380.     UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_DOUBLE_BORDER | UI_FILLED_AREA_ROUNDED_BORDER |
  2381.         UI_FILLED_AREA_SHADOW_DOUBLE_LINE | UI_FILLED_AREA_SHADOW,
  2382.     UI_NULL_IMAGE,
  2383.     NULL,
  2384.     {255, 255, 217, 100},
  2385.     {0, 0, 0, 0},
  2386.     {107, 215, 0, 100},
  2387.     {84, 84, 84, 100},
  2388.     0
  2389. };
  2390. UI_multi_line_input_box_theme SMSChat_MMI_multiline_inputbox_theme = { (UI_filled_area *)&SMSChat_inputbox_BG_filler,
  2391.     (UI_filled_area *)&SMSChat_inputbox_BG_filler,
  2392.     (UI_filled_area *)&SMSChat_inputbox_BG_filler,
  2393.     {0, 0, 0, 100},
  2394.     {0, 0, 0, 100},
  2395.     {128, 128, 128, 100},
  2396.     {0, 0, 0, 100},
  2397.     {255, 255, 255, 100},
  2398.     {51, 88, 171, 100},
  2399.     {255, 0, 0, 100},
  2400.     {255, 0, 0, 100},
  2401.     &(UI_DEFAULT_FONT),
  2402.     1,
  2403.     0,
  2404.     '*',
  2405.     5
  2406. };
  2407. //U8 chat_message[CHAT_MESSAGE_BUFFER];
  2408. U8 *chat_message = NULL;
  2409. const S8 uni_str_new_line[4] = { 'n', '', '', '' };
  2410. const S8 uni_grp_ch[4] = {0x1d, 0x00, 0x00, 0x00};
  2411. const S8 uni_file_ch[4] = {0x1c, 0x00, 0x00, 0x00};
  2412. const S8 uni_sender_truncate[4] = {0x1e, 0x00, 0x00, 0x00};
  2413. const S8 uni_receiver_truncate[4] = {0x1f, 0x00, 0x00, 0x00};
  2414. const S8 gChatTruncateSymbol[] = { '(', '', '.', '', '.', '', ')', '', '', '' };
  2415. scrolling_text wgui_category305_scrolling_text;
  2416. #define  MAX_CHAT_NICKNAME_SIZE  12
  2417. U8 *last_char = NULL, *current_pos = NULL;