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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *  wgui_categories_MMS.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  Unified Composer Editor related categories. 
  48.  *
  49.  *  [Category280]       MMS/SMS Editor
  50.  *
  51.  * Author: Sukrit K Mehra (PMT0050)
  52.  * -------
  53.  * -------
  54.  * 
  55.  *============================================================================
  56.  *             HISTORY
  57.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  58.  *------------------------------------------------------------------------------
  59.  
  60.  *------------------------------------------------------------------------------
  61.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  62.  *============================================================================
  63.  ****************************************************************************/
  64. #include "MMI_features.h"
  65. #include "StdC.h"
  66. #include "L4Dr1.h"
  67. #ifdef __UI_UNIFIED_COMPOSER_EDITOR_CATEGORY__
  68. /* framework related include */
  69. #include "EventsGprot.h"
  70. #include "FrameworkStruct.h"
  71. #include "EventsDef.h"
  72. #include "Unicodexdcl.h"
  73. #include "DebugInitDef.h"
  74. #include "app_mem.h"
  75. #include "Gdi_include.h"
  76. #include "app_str.h"
  77. /* gui related include */
  78. #include "gui_themes.h"
  79. #include "wgui.h"
  80. #include "wgui_softkeys.h"
  81. #include "wgui_categories.h"
  82. #include "wgui_categories_defs.h"
  83. #include "wgui_categories_inputs.h"
  84. #include "wgui_categories_UCE.h"
  85. #include "wgui_draw_manager.h"
  86. #if defined(__MMI_AUDIO_PLAYER__) || defined (__MMI_VIDEO_PLAYER__)
  87. #include "mdi_datatype.h"
  88. #endif 
  89. #ifdef __MMI_VIDEO_PLAYER__
  90. #include "mdi_video.h"
  91. #endif 
  92. #if defined(__MMI_TOUCH_SCREEN__)
  93. #include "EditorPen.h"
  94. #endif 
  95. #ifdef __MMI_T9__
  96. extern void InuptMethodEnterCategory5(void);
  97. #elif defined __MMI_ZI__
  98. extern void ZiInuptMethodEnterCategory5(void);
  99. #elif defined __MMI_KA__
  100. extern void KonkaInuptMethodEnterCategory5(void);
  101. #elif defined __MMI_ITAP__
  102. /* under construction !*/
  103. #endif 
  104. /***************************************************************************** 
  105. * Define
  106. *****************************************************************************/
  107. #if defined(__MMI_MAINLCD_240X320__)
  108. #define CAT280_MIN_LINE_HEIGHT 26
  109. #define CAT280_VMARGIN 6
  110. #define CAT280_HMARGIN 4
  111. //#define CAT280_THUMBNAIL_FRAME_HEIGHT 80
  112. #elif defined(__MMI_MAINLCD_176X220__)
  113. #define CAT280_MIN_LINE_HEIGHT 20
  114. #define CAT280_VMARGIN 6
  115. #define CAT280_HMARGIN 6
  116. //#define CAT280_THUMBNAIL_FRAME_HEIGHT 80
  117. #elif defined(__MMI_MAINLCD_128X160__)
  118. #define CAT280_MIN_LINE_HEIGHT 19
  119. #define CAT280_VMARGIN 6
  120. #define CAT280_HMARGIN 3
  121. //#define CAT280_THUMBNAIL_FRAME_HEIGHT 50
  122. #else /* 128x128 display */
  123. //#define CAT280_THUMBNAIL_FRAME_HEIGHT 45
  124. #define CAT280_MIN_LINE_HEIGHT 19
  125. #define CAT280_VMARGIN 6
  126. #define CAT280_HMARGIN 3
  127. #endif 
  128. /***************************************************************************** 
  129. * Typedef 
  130. *****************************************************************************/
  131. /***************************************************************************** 
  132. * Local Variable
  133. *****************************************************************************/
  134. static wgui_uce_context_struct g_wgui_uce_cntx;
  135. static wgui_uce_text_change_callback g_wgui_uce_text_change_callback = NULL;
  136. static wgui_uce_get_message_size_callback g_wgui_uce_get_message_size_callback = NULL;
  137. #if defined (__MMI_WALLPAPER_ON_BOTTOM__)
  138. static MMI_ID_TYPE editor_scr_bg_ID;
  139. static S8 *editor_scr_bg_filename;
  140. static S32 editor_scr_bg_x, editor_scr_bg_y;
  141. static U8 editor_scr_bg_opacity;
  142. #endif /* defined (__MMI_WALLPAPER_ON_BOTTOM__) */ 
  143. /***************************************************************************** 
  144. * Local Function
  145. *****************************************************************************/
  146. /*
  147.  * GSM 7BIT EXTENSION CHARACTERS
  148.  * 
  149.  * 0x20AC => Euro Char
  150.  * 0x5E => ^
  151.  * 0x7B => {
  152.  * 0x7D => }
  153.  * 0x5C => 
  154.  * 0x5B => [
  155.  * 0x7E => ~
  156.  * 0x5D => ]
  157.  * 0x7C => |
  158.  * 
  159.  */
  160. #define UCE_TEST_GSM_EXTENDED(c) 
  161. (  (c==0x20AC)                   
  162. || (c==0x5E)                     
  163. || (c==0x7B)                     
  164. || (c==0x7D)                     
  165. || (c==0x5C)                     
  166. || (c==0x5B)                     
  167. || (c==0x7E)                     
  168. || (c==0x5D)                     
  169. || (c==0x7C)                     
  170. )
  171. /*****************************************************************************
  172.  * FUNCTION
  173.  *  category280_text_input_callback
  174.  * DESCRIPTION
  175.  * Used to validate input with application's using callbacks to application layer.
  176.  * This function itself is called on every character insertion/deletion from multiline input. 
  177.  * Always updates the category's text info context. 
  178.  * PARAMETERS
  179.  *  event       [IN]        
  180.  *  C           [IN]        
  181.  * RETURNS
  182.  *  
  183.  *****************************************************************************/
  184. static MMI_BOOL category280_text_input_callback(gui_multi_line_input_box_change_event_enum event, U16 C)
  185. {
  186.     /*----------------------------------------------------------------*/
  187.     /* Local Variables                                                */
  188.     /*----------------------------------------------------------------*/
  189.     wgui_uce_text_info_struct post_change;
  190.     wgui_uce_text_change_result_enum result = WGUI_UCE_TEXT_CHANGE_ALLOWED; /* for compile warning */
  191.     /*----------------------------------------------------------------*/
  192.     /* Code Body                                                      */
  193.     /*----------------------------------------------------------------*/
  194.     memcpy((void*)&post_change, (void*)&g_wgui_uce_cntx.text_info, sizeof(wgui_uce_text_info_struct));
  195.     switch (event)
  196.     {
  197.         case GUI_MULTI_LINE_INPUT_BOX_INSERT_CHAR:
  198.             ++post_change.char_count;
  199.             if (UCE_TEST_GSM_EXTENDED(C))
  200.             {
  201.                 ++post_change.extension_char_count;
  202.             }
  203.             else
  204.             {
  205.                 if ((C >> 8) != 0x00)
  206.                 {
  207.                     ++post_change.UCS2_count;
  208.                 }
  209.             }
  210.             post_change.utf8_msg_len += app_unicode_to_utf8_len(C); 
  211.             break;
  212.         case GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR:
  213.             --post_change.char_count;
  214.             if (UCE_TEST_GSM_EXTENDED(C))
  215.             {
  216.                 --post_change.extension_char_count;
  217.             }
  218.             else
  219.             {
  220.                 if ((C >> 8) != 0x00)
  221.                 {
  222.                     --post_change.UCS2_count;
  223.                 }
  224.             }
  225.             post_change.utf8_msg_len -= app_unicode_to_utf8_len(C);
  226.             break;
  227.         case GUI_MULTI_LINE_INPUT_BOX_DELETEALL:
  228.             memset((void*)&post_change, 0, sizeof(wgui_uce_text_info_struct));
  229.             memset((void*)g_wgui_uce_cntx.text_buffer, 0, sizeof(U16));        /* First two bytes are NULL that means string lenght is zero */
  230.             break;
  231.         default:
  232.             ASSERT(0);  /* Wrong Event Type From Multiline Input Box */
  233.     }
  234.     result = g_wgui_uce_text_change_callback(&post_change);
  235.     switch (result)
  236.     {
  237.         case WGUI_UCE_TEXT_CHANGE_ALLOWED:
  238.             memcpy((void*)&g_wgui_uce_cntx.text_info, (void*)&post_change, sizeof(wgui_uce_text_info_struct));        /* .: post change scenario accepted by UCA */
  239.             return MMI_TRUE;
  240.         case WGUI_UCE_TEXT_CHANGE_NOT_ALLOWED:
  241.             return MMI_TRUE;
  242.         default:
  243.             ASSERT(0);  /* Wrong Return Type From UCA */
  244.             return MMI_FALSE;
  245.     }
  246. }
  247. #define ICON_MARGIN_Y 1
  248. #define ICON_MARGIN_X 4
  249. /*****************************************************************************
  250.  * FUNCTION
  251.  *  category280_draw_msg_size
  252.  * DESCRIPTION
  253.  *  Used to draw message size in top right/left corner depending upon r2lMMIFlag
  254.  * PARAMETERS
  255.  *  x1      [IN]        
  256.  *  y1      [IN]        
  257.  *  x2      [IN]        
  258.  *  y2      [IN]        
  259.  * RETURNS
  260.  *  void
  261.  *****************************************************************************/
  262. static void category280_draw_msg_size(S32 x1, S32 y1, S32 x2, S32 y2)
  263. {
  264.     /*----------------------------------------------------------------*/
  265.     /* Local Variables                                                */
  266.     /*----------------------------------------------------------------*/
  267.     color info_bar_rbg = current_information_bar_theme->background_color;
  268.     color font_color = *current_MMI_theme->remaining_length_text_color;
  269.     U16 str[32];
  270.     U8 msgtypestr[16];
  271. #if defined(__MMI_TOUCH_SCREEN__)
  272.     stFontAttribute *f = &MMI_medium_font;
  273.     S32 w, h;
  274. #else /* defined(__MMI_TOUCH_SCREEN__) */ 
  275.     stFontAttribute *f = &MMI_small_font;
  276.     S32 w;
  277. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  278.     /*----------------------------------------------------------------*/
  279.     /* Code Body                                                      */
  280.     /*----------------------------------------------------------------*/
  281.     gui_lock_double_buffer();
  282.     if (r2lMMIFlag)
  283.     {
  284.         x2 -= ((x2 - x1) >> 1);
  285.     }
  286.     else
  287.     {
  288.         x1 += ((x2 - x1) >> 1);
  289.     }
  290.     gui_push_clip();
  291.     gui_set_clip(x1, y1, x2, y2);
  292.     gui_reset_text_clip();
  293.     gui_set_text_clip(x1, y1, x2, y2);
  294.     gui_set_font(f);
  295.     gui_set_text_color(font_color);
  296.     if (g_wgui_uce_cntx.msg_type == WGUI_UCE_MSG_TYPE_MMS)
  297.     {
  298.         FLOAT size = (FLOAT) g_wgui_uce_get_message_size_callback(&g_wgui_uce_cntx.text_info) / (FLOAT) 1024.0;
  299.         if (size != 0.0)
  300.         {
  301.             if (size < 0.1)
  302.             {
  303.                 size = (FLOAT) 0.1;
  304.             }
  305.         }
  306.         y2 -= ((y2 - y1) >> 1) + 2;
  307.         if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  308.         {
  309.             gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  310.         }
  311.         else
  312.         {
  313.             gui_fill_rectangle(x1, y1, x2, y2, info_bar_rbg);
  314.         }
  315.         UnicodeToAnsii((S8*)msgtypestr, GetString(WGUI_UCE_MMS_STRING_ID));
  316.         gui_sprintf(str, "%s: %.1f Kb", msgtypestr, size);
  317.     }
  318.     else
  319.     {
  320.         if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  321.         {
  322.             gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  323.         }
  324.         else
  325.         {
  326.             gui_fill_rectangle(x1, y1, x2, y2, info_bar_rbg);
  327.         }
  328.         UnicodeToAnsii((S8*)msgtypestr, GetString(WGUI_UCE_SMS_STRING_ID));
  329.         gui_sprintf(str, "%s: %d", msgtypestr, g_wgui_uce_get_message_size_callback(&g_wgui_uce_cntx.text_info));
  330.     }
  331. #if defined(__MMI_TOUCH_SCREEN__)
  332.     gui_measure_string(str, &w, &h);
  333. #else 
  334.     w = gui_get_string_width(str);
  335. #endif 
  336.     if (r2lMMIFlag)
  337.     {
  338.     #if defined(__MMI_TOUCH_SCREEN__)
  339.         gui_move_text_cursor(x1 + 2 + w, y1 + (y2 - y1 - h) / 2);
  340.     #else 
  341.         gui_move_text_cursor(x1 + 2 + w, y1 + 2);
  342.     #endif 
  343.     }
  344.     else
  345.     {
  346.     #if defined(__MMI_TOUCH_SCREEN__)
  347.         gui_move_text_cursor(x2 - 2 - w, y1 + (y2 - y1 - h) / 2);
  348.     #else 
  349.         gui_move_text_cursor(x2 - 2 - w, y1 + 2);
  350.     #endif 
  351.     }
  352.     gui_print_text(str);
  353.     gui_pop_clip();
  354.     gui_unlock_double_buffer();
  355.     gui_BLT_double_buffer(x1, y1, x2, y2);
  356. }
  357. /*****************************************************************************
  358.  * FUNCTION
  359.  *  category280_draw_info_bar
  360.  * DESCRIPTION
  361.  *  Used to draw info bar 
  362.  * PARAMETERS
  363.  *  x1      [IN]        
  364.  *  y1      [IN]        
  365.  *  x2      [IN]        
  366.  *  y2      [IN]        
  367.  * RETURNS
  368.  *  void
  369.  *****************************************************************************/
  370. static void category280_draw_info_bar(S32 x1, S32 y1, S32 x2, S32 y2)
  371. {
  372.     /*----------------------------------------------------------------*/
  373.     /* Local Variables                                                */
  374.     /*----------------------------------------------------------------*/
  375.     color info_bar_rbg = current_information_bar_theme->background_color;
  376.     color font_color = *current_MMI_theme->remaining_length_text_color;
  377.     U16 str[32];
  378.     U8 msgtypestr[16];
  379. #if defined(__MMI_TOUCH_SCREEN__)
  380.     stFontAttribute *f = &MMI_medium_font;
  381. #else 
  382.     stFontAttribute *f = &MMI_small_font;
  383. #endif 
  384.     S32 width, height;
  385.     /*----------------------------------------------------------------*/
  386.     /* Code Body                                                      */
  387.     /*----------------------------------------------------------------*/
  388.     gui_push_clip();
  389.     gui_set_clip(x1, y1, x2, y2);
  390.     /* Text */
  391.     gui_reset_text_clip();
  392.     gui_set_text_clip(x1, y1, x2, y2);
  393.     gui_set_font(f);
  394.     gui_set_text_color(font_color);
  395.     if (g_wgui_uce_cntx.msg_type == WGUI_UCE_MSG_TYPE_MMS)
  396.     {
  397.         FLOAT size = (FLOAT) g_wgui_uce_get_message_size_callback(&g_wgui_uce_cntx.text_info) / (FLOAT) 1024.0;
  398.         S32 icon_x1;
  399.         S32 icon_x2;
  400.         S32 icon_y1;
  401.         S32 icon_y2;
  402.         S32 y_offset = y1 + ((y2 - y1) >> 1) ;
  403.         color slide_info_rbg;
  404.         UI_HLS_color slide_info_hls;
  405.         gui_RGB_to_HLS(info_bar_rbg, &slide_info_hls);
  406.         slide_info_hls.l += 10;
  407.         gui_HLS_to_RGB(slide_info_hls, &slide_info_rbg);
  408.         if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  409.         {
  410.             gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  411.         }
  412.         else
  413.         {
  414.             gui_fill_rectangle(x1, y1, x2, y2, info_bar_rbg);
  415.             gui_fill_rectangle(x1, y1 + ((y2 - y1) >> 1), x2, y2, slide_info_rbg);
  416.         }
  417.         if (r2lMMIFlag)
  418.         {
  419.             wgui_multiline_inputbox_show_current_input_method(x2 - ((x2 - x1) >> 1), y1, x2, y2 - ((y2 - y1) >> 1));
  420.         }
  421.         else
  422.         {
  423.             wgui_multiline_inputbox_show_current_input_method(x1, y1, x2 - ((x2 - x1) >> 1), y2 - ((y2 - y1) >> 1));
  424.         }
  425.         /* Slide Number */
  426.         gui_sprintf(str, "(%d/%d)", g_wgui_uce_cntx.current_slide,g_wgui_uce_cntx.total_slides);
  427.         #if defined(__MMI_TOUCH_SCREEN__)
  428.         gui_measure_string(str, &width, &height);
  429.         #else 
  430.         width = gui_get_string_width(str);
  431.         #endif 
  432.         #if defined(__MMI_TOUCH_SCREEN__)
  433.         gui_move_text_cursor(x2 - 2 - width, y_offset + (y2 - y_offset - height) / 2);
  434.         #else 
  435.         gui_move_text_cursor(x2 - 2 - width, y_offset + 2);
  436.         #endif 
  437.         gui_print_text(str);
  438.         /* Slide Icons */
  439.         /* Show attachment icon */
  440.         gui_measure_image((PU8) GetImage(WGUI_UCE_ATTACHFILE_ICON_IMAGE_ID), &width, &height);
  441.         icon_x1 = current_MMI_theme->scrollbar_size;
  442.         icon_x2 = icon_x1 + width;
  443.         icon_y1 = y_offset + ICON_MARGIN_Y;
  444.         icon_y2 = icon_y1 + height;
  445.         gui_show_image(icon_x1, icon_y1, (PU8) GetImage(WGUI_UCE_ATTACHFILE_ICON_IMAGE_ID));
  446.         if (g_wgui_uce_cntx.is_attachment == MMI_FALSE)
  447.         {
  448.             gui_greyscale_rectangle(
  449.                 icon_x1,
  450.                 icon_y1,
  451.                 icon_x2,
  452.                 icon_y2,
  453.                 MMI_BG_GREYSCALE_VALUE,
  454.                 MMI_BG_GREYSCALE_BLACK_VALUE);
  455.         }
  456.         /* show audio icon */
  457.         gui_measure_image((PU8) GetImage(WGUI_UCE_AUDIO_ICON_IMAGE_ID), &width, &height);
  458.         icon_x1 = icon_x2 + ICON_MARGIN_X;
  459.         icon_x2 = icon_x1 + width;
  460.         gui_show_image(icon_x1, icon_y1, (PU8) GetImage(WGUI_UCE_AUDIO_ICON_IMAGE_ID));
  461.         if (g_wgui_uce_cntx.is_audio == MMI_FALSE)
  462.         {
  463.             gui_greyscale_rectangle(
  464.                 icon_x1,
  465.                 icon_y1,
  466.                 icon_x2,
  467.                 icon_y2,
  468.                 MMI_BG_GREYSCALE_VALUE,
  469.                 MMI_BG_GREYSCALE_BLACK_VALUE);
  470.         }
  471.         /* show icon for video or image */
  472.         if (g_wgui_uce_cntx.is_image == MMI_TRUE)
  473.         {
  474.             gui_measure_image((PU8) GetImage(WGUI_UCE_PICTURE_ICON_IMAGE_ID), &width, &height);
  475.             icon_x1 = icon_x2 + ICON_MARGIN_X;
  476.             icon_x2 = icon_x1 + width;
  477.             gui_show_image(icon_x1, icon_y1, (PU8) GetImage(WGUI_UCE_PICTURE_ICON_IMAGE_ID));
  478.         }
  479.         else if (g_wgui_uce_cntx.is_video == MMI_TRUE)
  480.         {
  481.             gui_measure_image((PU8) GetImage(WGUI_UCE_VIDEO_ICON_IMAGE_ID), &width, &height);
  482.             icon_x1 = icon_x2 + ICON_MARGIN_X;
  483.             icon_x2 = icon_x1 + width;
  484.             gui_show_image(icon_x1, icon_y1, (PU8) GetImage(WGUI_UCE_VIDEO_ICON_IMAGE_ID));
  485.         }
  486.         if (size != 0.0)
  487.         {
  488.             if (size < 0.1)
  489.             {
  490.                 size = (FLOAT) 0.1;
  491.             }
  492.         }
  493.         y2 -= ((y2 - y1) >> 1) + 2;
  494.         UnicodeToAnsii((S8*)msgtypestr, GetString(WGUI_UCE_MMS_STRING_ID));
  495.         gui_sprintf(str, "%s: %.1f Kb", msgtypestr, size);
  496.     }
  497.     else
  498.     {
  499.         UnicodeToAnsii((S8*)msgtypestr, GetString(WGUI_UCE_SMS_STRING_ID)); 
  500.         gui_sprintf(str, "%s: %d", msgtypestr, g_wgui_uce_get_message_size_callback(&g_wgui_uce_cntx.text_info));
  501.         if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  502.         {
  503.             gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  504.         }
  505.         else
  506.         {
  507.             gui_fill_rectangle(x1, y1, x2, y2, info_bar_rbg);
  508.         }
  509.         if (r2lMMIFlag)
  510.         {
  511.             wgui_multiline_inputbox_show_current_input_method(x2 - ((x2 - x1) >> 1), y1, x2, y2);
  512.         }
  513.         else
  514.         {
  515.             wgui_multiline_inputbox_show_current_input_method(x1, y1, x2 - ((x2 - x1) >> 1), y2);
  516.         }
  517.     }
  518. #if defined(__MMI_TOUCH_SCREEN__)
  519.     gui_measure_string(str, &width, &height);
  520. #else 
  521.     width = gui_get_string_width(str);
  522. #endif 
  523.     if (r2lMMIFlag)
  524.     {
  525.     #if defined(__MMI_TOUCH_SCREEN__)
  526.         gui_move_text_cursor(x1 + 2 + width, y1 + (y2 - y1 - height) / 2);
  527.     #else 
  528.         gui_move_text_cursor(x1 + 2 + width, y1 + 2);
  529.     #endif 
  530.     }
  531.     else
  532.     {
  533.     #if defined(__MMI_TOUCH_SCREEN__)
  534.         gui_move_text_cursor(x2 - 2 - width, y1 + (y2 - y1 - height) / 2);
  535.     #else 
  536.         gui_move_text_cursor(x2 - 2 - width, y1 + 2);
  537.     #endif 
  538.     }
  539.     gui_print_text(str);
  540.     gui_pop_clip();
  541. }
  542. /*****************************************************************************
  543.  * FUNCTION
  544.  *  wgui_uce_show_preview_from_cached_buffer
  545.  * DESCRIPTION
  546.  *  used to show the contents of thumbnail buffer
  547.  * PARAMETERS
  548.  *  x_offset        [IN]        
  549.  *  y_offset        [IN]        
  550.  *  width           [IN]        
  551.  *  height          [IN]        
  552.  * RETURNS
  553.  *  Whether able to display conents of thumbnail buffer
  554.  *****************************************************************************/
  555. static void wgui_uce_show_preview_from_cached_buffer(S32 x_offset, S32 y_offset, S32 width, S32 height)
  556. {
  557.     /*----------------------------------------------------------------*/
  558.     /* Local Variables                                                */
  559.     /*----------------------------------------------------------------*/
  560.     S32 clip_x1, clip_y1, clip_x2, clip_y2;
  561.     S32 x, y, y_multiple;
  562.     U16 *buf = (U16*) g_wgui_uce_cntx.thumbnail_buffer;
  563.     /*----------------------------------------------------------------*/
  564.     /* Code Body                                                      */
  565.     /*----------------------------------------------------------------*/
  566.     gdi_layer_get_clip(&clip_x1, &clip_y1, &clip_x2, &clip_y2);
  567.   if ((clip_x2 < x_offset) || (clip_x1 > x_offset + width - 1) || (clip_y2 < y_offset) ||
  568.         (clip_y1 > y_offset + height - 1))
  569.     {
  570.         return; 
  571. /* sometimes mutli line input would want to draw the preview outside clip area */  
  572.     }
  573.     if (clip_x1 < x_offset)
  574.     {
  575.         clip_x1 = x_offset;
  576.     }
  577.     if (clip_y1 < y_offset)
  578.     {
  579.         clip_y1 = y_offset;
  580.     }
  581.     if (clip_x2 > x_offset + width - 1)
  582.     {
  583.         clip_x2 = x_offset + width - 1;
  584.     }
  585.     if (clip_y2 > y_offset + height - 1)
  586.     {
  587.         clip_y2 = y_offset + height - 1;
  588.     }
  589.     clip_x1 -= x_offset;
  590.     clip_y1 -= y_offset;
  591.     clip_x2 -= x_offset;
  592.     clip_y2 -= y_offset;
  593.     for (y = clip_y1; y <= clip_y2; y++)
  594.     {
  595.         y_multiple = y * width;
  596.         for (x = clip_x1; x <= clip_x2; x++)
  597.         {
  598.             GDI_SET_BUFFER_PIXEL(x + x_offset, y + y_offset, buf[y_multiple + x]);
  599.         }
  600.     }
  601.     return;
  602. }
  603. /*****************************************************************************
  604.  * FUNCTION
  605.  *  wgui_uce_load_video_first_frame_into_cache
  606.  * DESCRIPTION
  607.  *  loads video first frame into category thumbnail buffer
  608.  * PARAMETERS
  609.  *  video_x             [IN]        
  610.  *  video_y             [IN]        
  611.  *  video_width         [IN]        
  612.  *  video_height        [IN]        
  613.  * RETURNS
  614.  *  Whether able to load video first frame into buffer
  615.  *****************************************************************************/
  616. static MMI_BOOL wgui_uce_load_video_first_frame_into_cache(S32 video_x, S32 video_y, S32 video_width, S32 video_height)
  617. {
  618. #ifdef __MMI_VIDEO_PLAYER__
  619.     /*----------------------------------------------------------------*/
  620.     /* Local Variables                                                */
  621.     /*----------------------------------------------------------------*/
  622.     MDI_RESULT mdi_ret;
  623.     mdi_video_info_struct video_clip;
  624.     gdi_handle cache_layer;
  625.     /*----------------------------------------------------------------*/
  626.     /* Code Body                                                      */
  627.     /*----------------------------------------------------------------*/
  628.     PRINT_INFORMATION(("UCE: Video Frame Width: %d Height: %d", video_width, video_height));
  629.     if (gdi_layer_create_using_outside_memory
  630.         (video_x, video_y, video_width, video_height, &cache_layer, (U8*) g_wgui_uce_cntx.thumbnail_buffer,
  631.          CAT280_THUMBNAIL_BUFFER_SIZE) != GDI_LAYER_SUCCEED)
  632.     {
  633.         return MMI_FALSE;
  634.     }
  635.     mdi_ret = mdi_video_ply_open_clip_file((S8*) g_wgui_uce_cntx.file_path, &video_clip);
  636.     if (mdi_ret == MDI_RES_VDOPLY_SUCCEED)
  637.     {
  638.         /* draw the first frame of the video */
  639.         mdi_video_ply_seek_and_get_frame((U64) 0, cache_layer);
  640.         mdi_video_ply_close_clip_file();
  641.     }
  642.     gdi_layer_free(cache_layer);
  643.     return MMI_TRUE;
  644. #else /* __MMI_VIDEO_PLAYER__ */ 
  645.     return MMI_FALSE;
  646. #endif /* __MMI_VIDEO_PLAYER__ */ 
  647. }
  648. /*****************************************************************************
  649.  * FUNCTION
  650.  *  wgui_uce_load_image_into_cache
  651.  * DESCRIPTION
  652.  *  Load image into category thumbnail buffer
  653.  * PARAMETERS
  654.  *  img_x           [IN]        
  655.  *  img_y           [IN]        
  656.  *  img_width       [IN]        
  657.  *  img_height      [IN]        
  658.  * RETURNS
  659.  *  Whether able to load image into category buffer
  660.  *****************************************************************************/
  661. static MMI_BOOL wgui_uce_load_image_into_cache(S32 img_x, S32 img_y, S32 img_width, S32 img_height)
  662. {
  663.     /*----------------------------------------------------------------*/
  664.     /* Local Variables                                                */
  665.     /*----------------------------------------------------------------*/
  666.     gdi_handle cache_layer;
  667. MMI_BOOL ret=MMI_TRUE;
  668.     /*----------------------------------------------------------------*/
  669.     /* Code Body                                                      */
  670.     /*----------------------------------------------------------------*/
  671.     /* If not enough memory in buffer than layer creation will assert */
  672.     PRINT_INFORMATION(("UCE: Video Frame Width: %d Height: %d", img_width, img_height));
  673.     if (gdi_layer_create_using_outside_memory
  674.         (0, 0, img_width, img_height, &cache_layer, (U8*) g_wgui_uce_cntx.thumbnail_buffer,
  675.          CAT280_THUMBNAIL_BUFFER_SIZE) != GDI_LAYER_SUCCEED)
  676.     {
  677.         return MMI_FALSE;
  678.     }
  679.     gdi_layer_push_and_set_active(cache_layer);
  680.     gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  681.     gdi_layer_set_clip(0, 0, img_width - 1, img_height - 1);
  682.     gdi_layer_set_position(img_x, img_y);
  683.     gdi_draw_solid_rect(0, 0, img_width - 1, img_height - 1, GDI_COLOR_WHITE);
  684. if (gdi_image_draw_resized_file(0, 0, img_width, img_height, (S8*) g_wgui_uce_cntx.file_path) != GDI_SUCCEED)
  685. {
  686. PRINT_INFORMATION(("UCE: GDI Failed to draw %s", (S8*) g_wgui_uce_cntx.file_path));
  687. ret = MMI_FALSE;
  688. }
  689.     gdi_layer_pop_and_restore_active();
  690.     gdi_layer_free(cache_layer);
  691.     return ret;
  692. }
  693. /*****************************************************************************
  694.  * FUNCTION
  695.  *  wgui_uce_show_object_preview
  696.  * DESCRIPTION
  697.  *  Show video first frame or image preview:
  698.  * PARAMETERS
  699.  *  preview_x           [IN]        
  700.  *  preview_y           [IN]        
  701.  *  preview_width       [IN]        
  702.  *  preview_height      [IN]        
  703.  * RETURNS
  704.  *  whether able to display preview
  705.  *****************************************************************************/
  706. static MMI_BOOL wgui_uce_show_object_preview(S32 preview_x, S32 preview_y, S32 preview_width, S32 preview_height)
  707. {
  708.     /*----------------------------------------------------------------*/
  709.     /* Local Variables                                                */
  710.     /*----------------------------------------------------------------*/
  711.     S32 img_width = 0, img_height = 0;
  712.     /*----------------------------------------------------------------*/
  713.     /* Code Body                                                      */
  714.     /*----------------------------------------------------------------*/
  715.     if (g_wgui_uce_cntx.is_image)
  716.     {
  717.         if (GDI_SUCCEED != gdi_image_get_dimension_file((S8*) g_wgui_uce_cntx.file_path, &img_width, &img_height))
  718.         {
  719.             return MMI_FALSE;
  720.         }
  721.     }
  722.     else if (g_wgui_uce_cntx.is_video)
  723.     {
  724.     #ifdef __MMI_VIDEO_PLAYER__
  725.         MDI_RESULT mdi_ret;
  726.         mdi_video_info_struct video_clip;
  727.         mdi_ret = mdi_video_ply_open_clip_file((S8*) g_wgui_uce_cntx.file_path, &video_clip);
  728.         if (mdi_ret == MDI_RES_VDOPLY_SUCCEED)
  729.         {
  730.             img_height = video_clip.height;
  731.             img_width = video_clip.width;
  732.             mdi_video_ply_close_clip_file();
  733.         }
  734.         else
  735.     #endif /* __MMI_VIDEO_PLAYER__ */ 
  736.         {
  737.             return MMI_FALSE;
  738.         }
  739.     }
  740. /* drawable region larger than image */
  741. if ( preview_width > img_width  && preview_height > img_height )
  742. {
  743. /* align image at the center of preview rectangle */
  744. preview_x += ((preview_width - img_width) >> 1);
  745. preview_width = img_width;
  746. preview_y += ((preview_height - img_height) >> 1);
  747. preview_height = img_height;
  748. }
  749. else
  750. {
  751. S32 resized_offset_x, resized_offset_y, resized_width, resized_height;
  752. gdi_image_util_fit_bbox(
  753. preview_width,
  754. preview_height,
  755. img_width,
  756. img_height,
  757. &resized_offset_x,
  758. &resized_offset_y,
  759. &resized_width,
  760. &resized_height);
  761. /* check resized width and height */
  762. if (resized_width == 0)
  763. {
  764. resized_width = 1;
  765. resized_offset_x--;
  766. }
  767. if (resized_height == 0)
  768. {
  769. resized_height = 1;
  770. resized_offset_y--;
  771. }
  772.         
  773. preview_width = resized_width;
  774. preview_height = resized_height;
  775. preview_x += resized_offset_x;
  776. preview_y += resized_offset_y;
  777. }
  778.     /* Get Memory for thumbnail */
  779.     if (g_wgui_uce_cntx.thumbnail_buffer == NULL)
  780.     {
  781.         /* If object is deleted, then screen has to be exited so the buffer will be deallocated in category exit */
  782.         g_wgui_uce_cntx.thumbnail_buffer = (U8*) applib_mem_screen_alloc(CAT280_THUMBNAIL_BUFFER_SIZE);
  783.         if (NULL == g_wgui_uce_cntx.thumbnail_buffer)
  784.         {
  785.             return MMI_FALSE;
  786.         }
  787.         if (g_wgui_uce_cntx.is_image)
  788.         {
  789.             if (MMI_FALSE == wgui_uce_load_image_into_cache(preview_x, preview_y, preview_width, preview_height))
  790.             {
  791.                 return MMI_FALSE;
  792.             }
  793.         }
  794.         else if (g_wgui_uce_cntx.is_video)
  795.         {
  796.             if (MMI_FALSE == wgui_uce_load_video_first_frame_into_cache(preview_x, preview_y, preview_width, preview_height))
  797.             {
  798.                 return MMI_FALSE;
  799.             }
  800.         }
  801.     }
  802.     wgui_uce_show_preview_from_cached_buffer(preview_x, preview_y, preview_width, preview_height);
  803.     
  804.     return MMI_TRUE;
  805. }
  806. /*****************************************************************************
  807.  * FUNCTION
  808.  *  wgui_uce_show_default_preview
  809.  * DESCRIPTION
  810.  *  show default preview based on image id
  811.  * PARAMETERS
  812.  *  preview_x           [IN]        
  813.  *  preview_y           [IN]        
  814.  *  preview_width       [IN]        
  815.  *  preview_height      [IN]        
  816.  * RETURNS
  817.  *  whether able to display preview or not
  818.  *****************************************************************************/
  819. static MMI_BOOL wgui_uce_show_default_preview(S32 preview_x, S32 preview_y, S32 preview_width, S32 preview_height)
  820. {
  821.     /*----------------------------------------------------------------*/
  822.     /* Local Variables                                                */
  823.     /*----------------------------------------------------------------*/
  824.     S32 img_width = 0;
  825.     S32 img_height = 0;
  826.     /*----------------------------------------------------------------*/
  827.     /* Code Body                                                      */
  828.     /*----------------------------------------------------------------*/
  829.     if (GDI_SUCCEED != gdi_image_get_dimension_id(g_wgui_uce_cntx.default_image_id, &img_width, &img_height))
  830.     {
  831.         return MMI_FALSE;
  832.     }
  833. /* drawable region larger than image */
  834. if ( preview_width > img_width  && preview_height > img_height )
  835. {
  836. /* align image at the center of preview rectangle */
  837. preview_x += ((preview_width - img_width) >> 1);
  838. preview_width = img_width;
  839. preview_y += ((preview_height - img_height) >> 1);
  840. preview_height = img_height;
  841. }
  842. else
  843. {
  844. S32 resized_offset_x, resized_offset_y, resized_width, resized_height;
  845. gdi_image_util_fit_bbox(
  846. preview_width,
  847. preview_height,
  848. img_width,
  849. img_height,
  850. &resized_offset_x,
  851. &resized_offset_y,
  852. &resized_width,
  853. &resized_height);
  854. preview_width = resized_width;
  855. preview_height = resized_height;
  856. preview_x += resized_offset_x;
  857. preview_y += resized_offset_y;
  858. }
  859.     if (GDI_SUCCEED != gdi_image_draw_resized_id(
  860.                         preview_x,
  861.                         preview_y,
  862.                         preview_width,
  863.                         preview_height,
  864.                         g_wgui_uce_cntx.default_image_id))
  865.     {
  866.         return MMI_FALSE;
  867.     }
  868.     return MMI_TRUE;
  869. }
  870. /*****************************************************************************
  871.  * FUNCTION
  872.  *  category280_draw_object_preview
  873.  * DESCRIPTION
  874.  *  Used to draw footer or header area of multiline input box
  875.  * PARAMETERS
  876.  *  yoffset     [IN]        
  877.  *  clip_x1     [IN]        
  878.  *  clip_y1     [IN]        
  879.  *  clip_x2     [IN]        
  880.  *  clip_y2     [IN]        
  881.  * RETURNS
  882.  *  void
  883.  *****************************************************************************/
  884. static void category280_draw_object_preview(S32 yoffset, S32 clip_x1, S32 clip_y1, S32 clip_x2, S32 clip_y2)
  885. {
  886.     /*----------------------------------------------------------------*/
  887.     /* Local Variables                                                */
  888.     /*----------------------------------------------------------------*/
  889.     color c;
  890.     S32 draw_x, draw_y, draw_width, draw_height;
  891.     MMI_BOOL error_code = MMI_TRUE;
  892.     /*----------------------------------------------------------------*/
  893.     /* Code Body                                                      */
  894.     /*----------------------------------------------------------------*/
  895.     ASSERT(g_wgui_uce_cntx.is_image || g_wgui_uce_cntx.is_video);       /* No Media still trying to preview ... assert */
  896.     /* Wire Frame Color */
  897.     c.alpha = current_MMI_theme->inputbox_selector_color->alpha;
  898.     c.r = current_MMI_theme->inputbox_selector_color->r;
  899.     c.g = current_MMI_theme->inputbox_selector_color->g;
  900.     c.b = current_MMI_theme->inputbox_selector_color->b;
  901.     gui_push_clip();
  902.     gui_set_clip(clip_x1, clip_y1, clip_x2, clip_y2);
  903.     /* Draw Wire Frame To Contain Image */
  904.     if (r2lMMIFlag)
  905.     {
  906.         draw_x = current_MMI_theme->scrollbar_size + CAT280_HMARGIN - 1;
  907.         draw_width = MMI_content_width - current_MMI_theme->scrollbar_size - (CAT280_HMARGIN << 1);
  908.     }
  909.     else
  910.     {
  911.         draw_x = CAT280_HMARGIN - 1;
  912.         draw_width = MMI_content_width - current_MMI_theme->scrollbar_size - (CAT280_HMARGIN << 1);
  913.     }
  914.     draw_y = yoffset + CAT280_VMARGIN;
  915.     draw_height = CAT280_THUMBNAIL_FRAME_HEIGHT - (CAT280_VMARGIN << 1);
  916.     gui_draw_rectangle(draw_x, draw_y, draw_x + draw_width, draw_y + draw_height, c);
  917.     /* Draw Preview Inside Frame */
  918.     draw_x += CAT280_HMARGIN;
  919.     draw_y += CAT280_VMARGIN;
  920.     draw_width -= (CAT280_HMARGIN << 1);
  921.     draw_height -= (CAT280_VMARGIN << 1);
  922.     if ( g_wgui_uce_cntx.default_image_id )
  923.     {
  924.         error_code = wgui_uce_show_default_preview(draw_x, draw_y, draw_width, draw_height);
  925.     }
  926.     else
  927.     {
  928.         error_code = wgui_uce_show_object_preview(draw_x, draw_y, draw_width, draw_height);
  929.     }
  930.     if (error_code == MMI_FALSE)
  931.     {
  932.         S32 img_width, img_height;
  933. /* Since Draw has failed once */
  934. g_wgui_uce_cntx.default_image_id = WGUI_DEFAULT_PREVIEW_IMAGE_ID; 
  935.         /* Draw Defualt Image Owned by UCE */
  936.         if (GDI_SUCCEED != gdi_image_get_dimension_id(WGUI_DEFAULT_PREVIEW_IMAGE_ID, &img_width, &img_height))
  937.         {
  938.             /* Check Resources */
  939.             ASSERT(0);
  940.         }
  941. if ( draw_width > img_width  && draw_height > img_height )
  942. {
  943. /* align image at the center of preview rectangle */
  944.             draw_x += ((draw_width - img_width) >> 1);
  945.             draw_width = img_width;
  946.             draw_y += ((draw_height - img_height) >> 1);
  947.             draw_height = img_height;
  948. }
  949. else
  950. {
  951. S32 resized_offset_x, resized_offset_y, resized_width, resized_height;
  952. gdi_image_util_fit_bbox(
  953. draw_width,
  954. draw_height,
  955. img_width,
  956. img_height,
  957. &resized_offset_x,
  958. &resized_offset_y,
  959. &resized_width,
  960. &resized_height);
  961. draw_width = resized_width;
  962. draw_height = resized_height;
  963. draw_x += resized_offset_x;
  964. draw_y += resized_offset_y;
  965. }
  966.         if (GDI_SUCCEED != gdi_image_draw_resized_id(draw_x, draw_y, draw_width, draw_height, WGUI_DEFAULT_PREVIEW_IMAGE_ID))
  967.         {
  968.             /* Check Resources: Image ID */
  969.             ASSERT(0);
  970.         }
  971.     }
  972.     gui_pop_clip();
  973. }
  974. /*****************************************************************************
  975.  * FUNCTION
  976.  *  ExitCategory280Screen
  977.  * DESCRIPTION
  978.  *  Called on exit category: releases screen based memory
  979.  * PARAMETERS
  980.  *  void
  981.  * RETURNS
  982.  *  void
  983.  *****************************************************************************/
  984. static void ExitCategory280Screen(void)
  985. {
  986.     /*----------------------------------------------------------------*/
  987.     /* Local Variables                                                */
  988.     /*----------------------------------------------------------------*/
  989.     /*----------------------------------------------------------------*/
  990.     /* Code Body                                                      */
  991.     /*----------------------------------------------------------------*/
  992.     set_MMI_current_input_type();
  993.     reset_softkeys();
  994.     reset_multitaps();
  995.     wgui_close_inputbox(); /* Calls *InputMethodExitCategory */
  996.     if (g_wgui_uce_cntx.thumbnail_buffer != NULL)
  997.     {
  998.         applib_mem_screen_free(g_wgui_uce_cntx.thumbnail_buffer);
  999.         g_wgui_uce_cntx.thumbnail_buffer = NULL;
  1000.     }
  1001. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1002.     dm_set_scr_bg_image_no_draw(
  1003.         editor_scr_bg_ID,
  1004.         editor_scr_bg_filename,
  1005.         editor_scr_bg_x,
  1006.         editor_scr_bg_y,
  1007.         editor_scr_bg_opacity);
  1008. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1009. }
  1010. /*****************************************************************************
  1011.  * FUNCTION
  1012.  *  GetCategory280History
  1013.  * DESCRIPTION
  1014.  *  return pointer to GUI buffer
  1015.  * PARAMETERS
  1016.  *  history_buffer      [IN]     
  1017.  * RETURNS
  1018.  *  pointer to history buffer
  1019.  *****************************************************************************/
  1020. static U8 *GetCategory280History(U8 *history_buffer)
  1021. {
  1022.     /*----------------------------------------------------------------*/
  1023.     /* Local Variables                                                */
  1024.     /*----------------------------------------------------------------*/
  1025.     /*----------------------------------------------------------------*/
  1026.     /* Code Body                                                      */
  1027.     /*----------------------------------------------------------------*/
  1028.     get_multiline_inputbox_category_history(MMI_CATEGORY280_ID, history_buffer, MMI_current_input_type);
  1029.     return history_buffer;
  1030. }
  1031. /*****************************************************************************
  1032.  * FUNCTION
  1033.  *  GetCategory280HistorySize
  1034.  * DESCRIPTION
  1035.  *  Get history size
  1036.  * PARAMETERS
  1037.  *  void
  1038.  * RETURNS
  1039.  *  
  1040.  *****************************************************************************/
  1041. static S32 GetCategory280HistorySize(void)
  1042. {
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Local Variables                                                */
  1045.     /*----------------------------------------------------------------*/
  1046.     /*----------------------------------------------------------------*/
  1047.     /* Code Body                                                      */
  1048.     /*----------------------------------------------------------------*/
  1049.     return sizeof(multiline_inputbox_category_history);
  1050. }
  1051. /*****************************************************************************
  1052.  * FUNCTION
  1053.  *  DrawCategory280ControlledArea
  1054.  * DESCRIPTION
  1055.  *  Draw Category Controlled Area
  1056.  * PARAMETERS
  1057.  *  coordinate      [IN]     
  1058.  * RETURNS
  1059.  *  void
  1060.  *****************************************************************************/
  1061. static void DrawCategory280ControlledArea(dm_coordinates *coordinate)
  1062. {
  1063.     /*----------------------------------------------------------------*/
  1064.     /* Local Variables                                                */
  1065.     /*----------------------------------------------------------------*/
  1066.     /*----------------------------------------------------------------*/
  1067.     /* Code Body                                                      */
  1068.     /*----------------------------------------------------------------*/
  1069.     /* MTK Elvis for redrawing spelling or candidate boxes */
  1070.     if (RedrawSpellingOrCandidateBoxesFunction)
  1071.     {
  1072.         RedrawSpellingOrCandidateBoxesFunction();
  1073.     }
  1074. }
  1075. /*****************************************************************************
  1076.  * FUNCTION
  1077.  *  category280_virtual_keypad_callback
  1078.  * DESCRIPTION
  1079.  *  resizes the multiline input box to accomodate editor
  1080.  * PARAMETERS
  1081.  *  void
  1082.  * RETURNS
  1083.  *  void
  1084.  *****************************************************************************/
  1085. static void category280_virtual_keypad_callback(void)
  1086. {
  1087.     /*----------------------------------------------------------------*/
  1088.     /* Local Variables                                                */
  1089.     /*----------------------------------------------------------------*/
  1090.     /*----------------------------------------------------------------*/
  1091.     /* Code Body                                                      */
  1092.     /*----------------------------------------------------------------*/
  1093. #if defined(__MMI_TOUCH_SCREEN__)
  1094.     mmi_pen_editor_resize_multiline_input_box_for_vk();
  1095. #endif 
  1096. }
  1097. /*****************************************************************************
  1098.  * FUNCTION
  1099.  *  category280_hide_multitap
  1100.  * DESCRIPTION
  1101.  *  Hides Multitap area
  1102.  * PARAMETERS
  1103.  *  void
  1104.  * RETURNS
  1105.  *  void
  1106.  *****************************************************************************/
  1107. static void category280_hide_multitap(void)
  1108. {
  1109.     /*----------------------------------------------------------------*/
  1110.     /* Local Variables                                                */
  1111.     /*----------------------------------------------------------------*/
  1112.     /* We fill the multitap bar across the screen instead of using MMI_multitap_x & MMI_multitap_width */
  1113.     color c = *(current_MMI_theme->information_bar_color);
  1114.     /*----------------------------------------------------------------*/
  1115.     /* Code Body                                                      */
  1116.     /*----------------------------------------------------------------*/
  1117.     gui_lock_double_buffer();
  1118.     gui_reset_clip();
  1119.     gui_fill_rectangle(0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height - 1, c);
  1120.     gui_unlock_double_buffer();
  1121.     gui_BLT_double_buffer(0, MMI_multitap_y, UI_device_width - 1, MMI_multitap_y + MMI_multitap_height + 1);
  1122. }
  1123. /***************************************************************************** 
  1124. * Global Variable
  1125. *****************************************************************************/
  1126. /***************************************************************************** 
  1127. * Global Function
  1128. *****************************************************************************/
  1129. /*****************************************************************************
  1130.  * FUNCTION
  1131.  *  wgui_uce_insert_text
  1132.  * DESCRIPTION
  1133.  *  Copied text into category buffer and updates the text info of category.
  1134.  *  APP will call this to start to edit a slide whose info APP already has
  1135.  * PARAMETERS
  1136.  *  text_info       [IN]     
  1137.  *  text_buffer     [IN]     
  1138.  * RETURNS
  1139.  *  void
  1140.  *****************************************************************************/
  1141. void wgui_uce_insert_text(wgui_uce_text_info_struct *text_info, U8 *text_buffer)
  1142. {
  1143.     /*----------------------------------------------------------------*/
  1144.     /* Local Variables                                                */
  1145.     /*----------------------------------------------------------------*/
  1146.     /*----------------------------------------------------------------*/
  1147.     /* Code Body                                                      */
  1148.     /*----------------------------------------------------------------*/
  1149.     /* Copy into text buffer for current slide */
  1150.     pfnUnicodeStrncpy((PS8) g_wgui_uce_cntx.text_buffer, (PS8) text_buffer, g_wgui_uce_cntx.text_buffer_size);
  1151.     /* Copy text info as current text info */
  1152.     memcpy(&g_wgui_uce_cntx.text_info, text_info, sizeof(wgui_uce_text_info_struct));
  1153. }
  1154. /*****************************************************************************
  1155.  * FUNCTION
  1156.  *  wgui_uce_get_current_text_info
  1157.  * DESCRIPTION
  1158.  *  APP uses this utility function to get the text info for current buffer
  1159.  * PARAMETERS
  1160.  *  current_text_info       [OUT]     
  1161.  * RETURNS
  1162.  *  void
  1163.  *****************************************************************************/
  1164. void wgui_uce_get_current_text_info(wgui_uce_text_info_struct *current_text_info)
  1165. {
  1166.     /*----------------------------------------------------------------*/
  1167.     /* Local Variables                                                */
  1168.     /*----------------------------------------------------------------*/
  1169.     /*----------------------------------------------------------------*/
  1170.     /* Code Body                                                      */
  1171.     /*----------------------------------------------------------------*/
  1172.     memcpy(current_text_info, &g_wgui_uce_cntx.text_info, sizeof(wgui_uce_text_info_struct));
  1173. }
  1174. /*****************************************************************************
  1175.  * FUNCTION
  1176.  *  wgui_uce_get_text_info_for_buffer
  1177.  * DESCRIPTION
  1178.  *  APP can use this utility function to get the text info of buffer.
  1179.  *  Note: This function is used with wgui_uce_insert_text, to edit a saved text sms/mms as fresh.
  1180.  *  To insert template use wgui_uce_insert_text_template 
  1181.  * PARAMETERS
  1182.  *  text_info       [OUT]     
  1183.  *  text_buffer     [IN]     
  1184.  * RETURNS
  1185.  *  void
  1186.  *****************************************************************************/
  1187. void wgui_uce_get_text_info_for_buffer(wgui_uce_text_info_struct *text_info, U8 *text_buffer)
  1188. {
  1189.     /*----------------------------------------------------------------*/
  1190.     /* Local Variables                                                */
  1191.     /*----------------------------------------------------------------*/
  1192.     U32 counter;
  1193.     U32 len;
  1194.     U16 C;
  1195.     /*----------------------------------------------------------------*/
  1196.     /* Code Body                                                      */
  1197.     /*----------------------------------------------------------------*/
  1198.     len = pfnUnicodeStrlen((PS8) text_buffer) ;
  1199.     /* What if the length of the text is more than the buffer the category has for insertion */
  1200.     /* We will update context only upto the limit we allow it to be inserted */
  1201.     if ((g_wgui_uce_cntx.text_buffer_size) < len)
  1202.     {
  1203.         len = g_wgui_uce_cntx.text_buffer_size;
  1204.     }
  1205.     text_info->char_count = len;
  1206.     for (counter = 0; counter < (len*ENCODING_LENGTH); counter += ENCODING_LENGTH)
  1207.     {
  1208.         /* text_buffer maybe at odd address so better get into a local */
  1209.         C = ((U16) text_buffer[counter + 1] << 8) | ((U8) text_buffer[counter]);
  1210.         if (UCE_TEST_GSM_EXTENDED(C))
  1211.         {
  1212.             ++text_info->extension_char_count;
  1213.         }
  1214.         else
  1215.         {
  1216.             if (text_buffer[counter + 1] != 0x00)
  1217.             {
  1218.                 ++text_info->UCS2_count;
  1219.             }
  1220.         }
  1221.         text_info->utf8_msg_len += app_unicode_to_utf8_len(C); // TODO: Optimize multiple function calls. Replace with one function
  1222.     }
  1223. }
  1224. /*
  1225.  * Inserts partially. Input callbacks will be called and text info will be updated.automatically 
  1226.  */
  1227. /*****************************************************************************
  1228.  * FUNCTION
  1229.  *  wgui_uce_insert_text_template
  1230.  * DESCRIPTION
  1231.  *  Inserts partially. Input callbacks will be called and text info will be updated.
  1232.  * PARAMETERS
  1233.  *  string          [IN]         
  1234.  *  no_of_char      [IN]        
  1235.  *  guibuffer       [IN]         
  1236.  * RETURNS
  1237.  *  number of characters inserted
  1238.  *****************************************************************************/
  1239. U32 wgui_uce_insert_text_template(U8 *string, U16 no_of_char, U8 *guibuffer)
  1240. {
  1241.     /*----------------------------------------------------------------*/
  1242.     /* Local Variables                                                */
  1243.     /*----------------------------------------------------------------*/
  1244.     U32 char_count_before_insertion = g_wgui_uce_cntx.text_info.char_count;
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     wgui_multiline_inputbox_append_string(
  1249.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  1250.         g_wgui_uce_cntx.text_buffer,
  1251.         g_wgui_uce_cntx.text_buffer_size,
  1252.         (U8*) string,
  1253.         guibuffer,
  1254.         MMI_CATEGORY280_ID,
  1255.         category280_text_input_callback);
  1256.     return (g_wgui_uce_cntx.text_info.char_count - char_count_before_insertion);
  1257. }
  1258. /*****************************************************************************
  1259.  * FUNCTION
  1260.  *  SetCategory280RightSoftkeyFunction
  1261.  * DESCRIPTION
  1262.  *  Used to set the right softkey function. This has to called by application.
  1263.  * PARAMETERS
  1264.  *  f       [IN]        
  1265.  *  k       [IN]        
  1266.  * RETURNS
  1267.  *  void
  1268.  *****************************************************************************/
  1269. void SetCategory280RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  1270. {
  1271.     /*----------------------------------------------------------------*/
  1272.     /* Local Variables                                                */
  1273.     /*----------------------------------------------------------------*/
  1274.     /*----------------------------------------------------------------*/
  1275.     /* Code Body                                                      */
  1276.     /*----------------------------------------------------------------*/
  1277.     UI_UNUSED_PARAMETER(k);
  1278.     wgui_inputbox_RSK_function = f;
  1279. }
  1280. /*****************************************************************************
  1281.  * FUNCTION
  1282.  *  wgui_uce_add_object
  1283.  * DESCRIPTION
  1284.  *  Used to add an object, screen has to re-enter after add object
  1285.  * PARAMETERS
  1286.  *  object                  [IN]        
  1287.  *  file_path               [IN]         
  1288.  *  default_image_id        [IN]        
  1289.  *  alignment_type          [IN]        
  1290.  * RETURNS
  1291.  *  void
  1292.  *****************************************************************************/
  1293. void wgui_uce_add_object(
  1294.         wgui_uce_msg_type_enum object,
  1295.         U16 *file_path,
  1296.         U16 default_image_id,
  1297.         wgui_uce_layout_type_enum alignment_type)
  1298. {
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Local Variables                                                */
  1301.     /*----------------------------------------------------------------*/
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Code Body                                                      */
  1304.     /*----------------------------------------------------------------*/
  1305.     switch (object)
  1306.     {
  1307.         case WGUI_UCE_OBJECT_TYPE_ATTACHMENT:
  1308.             g_wgui_uce_cntx.is_attachment = MMI_TRUE;
  1309.             break;
  1310.         case WGUI_UCE_OBJECT_TYPE_AUDIO:
  1311.             g_wgui_uce_cntx.is_audio = MMI_TRUE;
  1312.             break;
  1313.         case WGUI_UCE_OBJECT_TYPE_IMAGE:
  1314.             ASSERT(file_path || default_image_id);
  1315.             g_wgui_uce_cntx.is_image = MMI_TRUE;
  1316.             g_wgui_uce_cntx.layout = alignment_type;
  1317.             if (file_path)
  1318.             {
  1319.                 pfnUnicodeStrncpy((PS8) g_wgui_uce_cntx.file_path, (PS8) file_path, FMGR_MAX_PATH_LEN);
  1320.             }
  1321.             g_wgui_uce_cntx.default_image_id = default_image_id;
  1322.             break;
  1323.         case WGUI_UCE_OBJECT_TYPE_VIDEO:
  1324.             ASSERT(file_path || default_image_id);            
  1325.             g_wgui_uce_cntx.is_video = MMI_TRUE;
  1326.             g_wgui_uce_cntx.layout = alignment_type;
  1327.             if (file_path)
  1328.             {
  1329.                 pfnUnicodeStrncpy((PS8) g_wgui_uce_cntx.file_path, (PS8) file_path, FMGR_MAX_PATH_LEN);
  1330.             }            
  1331.             g_wgui_uce_cntx.default_image_id = default_image_id;
  1332.             break;
  1333.         default:
  1334.             ASSERT(0);
  1335.     }
  1336. }
  1337. /*****************************************************************************
  1338.  * FUNCTION
  1339.  *  wgui_uce_delete_object
  1340.  * DESCRIPTION
  1341.  *  This is used to delete an object, screen has to re-enter again.
  1342.  * PARAMETERS
  1343.  *  object      [IN]        
  1344.  * RETURNS
  1345.  *  void
  1346.  *****************************************************************************/
  1347. void wgui_uce_delete_object(wgui_uce_msg_type_enum object)
  1348. {
  1349.     /*----------------------------------------------------------------*/
  1350.     /* Local Variables                                                */
  1351.     /*----------------------------------------------------------------*/
  1352.     /*----------------------------------------------------------------*/
  1353.     /* Code Body                                                      */
  1354.     /*----------------------------------------------------------------*/
  1355.     switch (object)
  1356.     {
  1357.         case WGUI_UCE_OBJECT_TYPE_ATTACHMENT:
  1358.             g_wgui_uce_cntx.is_attachment = MMI_FALSE;
  1359.             break;
  1360.         case WGUI_UCE_OBJECT_TYPE_AUDIO:
  1361.             g_wgui_uce_cntx.is_audio = MMI_FALSE;
  1362.             break;
  1363.         case WGUI_UCE_OBJECT_TYPE_IMAGE:
  1364.             g_wgui_uce_cntx.is_image = MMI_FALSE;
  1365.             break;
  1366.         case WGUI_UCE_OBJECT_TYPE_VIDEO:
  1367.             g_wgui_uce_cntx.is_video = MMI_FALSE;
  1368.             break;
  1369.         default:
  1370.             ASSERT(0);
  1371.     }
  1372. }
  1373. /*****************************************************************************
  1374.  * FUNCTION
  1375.  *  wgui_uce_initialize_editor
  1376.  * DESCRIPTION
  1377.  *  Initialize the editor context called on entering new slides, editing saved msg etc
  1378.  * PARAMETERS
  1379.  *  text_buffer             [IN]         
  1380.  *  text_buffer_size        [IN]        
  1381.  *  new_slide_number        [IN]        
  1382.  *  total_slide_number      [IN]        
  1383.  *  get_msg_size            [IN]        
  1384.  *  text_change             [IN]        
  1385.  * RETURNS
  1386.  *  void
  1387.  *****************************************************************************/
  1388. void wgui_uce_initialize_editor(
  1389.         U8 *text_buffer,
  1390.         U16 text_buffer_size,
  1391.         U8 new_slide_number,
  1392.         U8 total_slide_number,
  1393.         wgui_uce_get_message_size_callback get_msg_size,
  1394.         wgui_uce_text_change_callback text_change)
  1395. {
  1396.     /*----------------------------------------------------------------*/
  1397.     /* Local Variables                                                */
  1398.     /*----------------------------------------------------------------*/
  1399.     /*----------------------------------------------------------------*/
  1400.     /* Code Body                                                      */
  1401.     /*----------------------------------------------------------------*/
  1402.     /* Tricky since the category is never uninitialised the callback remain forever active
  1403.        if user calls showcateogry w/o initialising, wrong callbacks will be called from showcategory */
  1404.     ASSERT(get_msg_size);
  1405.     ASSERT(text_change);
  1406.     memset(&g_wgui_uce_cntx, 0, sizeof(wgui_uce_context_struct));
  1407.     g_wgui_uce_cntx.current_slide = new_slide_number;
  1408.     g_wgui_uce_cntx.total_slides = total_slide_number;
  1409.     g_wgui_uce_cntx.text_buffer = text_buffer;
  1410.     g_wgui_uce_cntx.text_buffer_size = text_buffer_size;
  1411.     g_wgui_uce_text_change_callback = text_change;
  1412.     g_wgui_uce_get_message_size_callback = get_msg_size;
  1413.     g_wgui_uce_cntx.thumbnail_buffer = NULL;
  1414. }
  1415. /*****************************************************************************
  1416.  * FUNCTION
  1417.  *  ShowCategory280Screen
  1418.  * DESCRIPTION
  1419.  *  This the show category function, basically we set some options on basis on msg type here.
  1420.  *  wgui_uce_initialize_editor should be called once before we call ShowCategory280Screen
  1421.  * PARAMETERS
  1422.  *  title                   [IN]        
  1423.  *  title_icon              [IN]        
  1424.  *  left_softkey            [IN]        
  1425.  *  left_softkey_icon       [IN]        
  1426.  *  right_softkey           [IN]        
  1427.  *  right_softkey_icon      [IN]        
  1428.  *  msg_type                [IN]        
  1429.  *  input_method_type       [IN]        
  1430.  *  gui_buffer              [IN]         
  1431.  * RETURNS
  1432.  *  void
  1433.  *****************************************************************************/
  1434. void ShowCategory280Screen(
  1435.         U16 title,
  1436.         U16 title_icon,
  1437.         U16 left_softkey,
  1438.         U16 left_softkey_icon,
  1439.         U16 right_softkey,
  1440.         U16 right_softkey_icon,
  1441.         wgui_uce_msg_type_enum msg_type,
  1442.         S16 input_method_type,
  1443.         U8 *gui_buffer)
  1444. {
  1445.     /*----------------------------------------------------------------*/
  1446.     /* Local Variables                                                */
  1447.     /*----------------------------------------------------------------*/
  1448.     dm_data_struct dm_data;
  1449.     S32 inputbox_height;
  1450.     U16 header_height = 0;
  1451.     U16 footer_height = 0;
  1452.     /*----------------------------------------------------------------*/
  1453.     /* Code Body                                                      */
  1454.     /*----------------------------------------------------------------*/
  1455.     /* Setupcontext */
  1456.     g_wgui_uce_cntx.msg_type = msg_type;    /* we need to store it in msg_type because we need to draw info bar. */
  1457.     /* Setup layout */
  1458.     if (g_wgui_uce_cntx.msg_type == WGUI_UCE_MSG_TYPE_MMS)
  1459.     {
  1460.         if (g_wgui_uce_cntx.is_video || g_wgui_uce_cntx.is_image)
  1461.         {
  1462.             if (g_wgui_uce_cntx.layout == WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_TOP)
  1463.             {
  1464.                 header_height = CAT280_THUMBNAIL_FRAME_HEIGHT;
  1465.             }
  1466.             else if (g_wgui_uce_cntx.layout == WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_BOTTOM)
  1467.             {
  1468.                 footer_height = CAT280_THUMBNAIL_FRAME_HEIGHT;
  1469.             }
  1470.             else
  1471.             {
  1472.                 ASSERT(0);
  1473.             }
  1474.         }
  1475.     }
  1476.     gui_lock_double_buffer();
  1477.     /* Title */
  1478.     MMI_title_string = (PU16) get_string(title);
  1479.     MMI_title_icon = (PU8) get_image(title_icon);
  1480.     /* Short Cuts */
  1481.     MMI_menu_shortcut_number = -1;
  1482.     MMI_disable_title_shortcut_display = 1;
  1483.     /* Softkeys */
  1484.     change_left_softkey(left_softkey, left_softkey_icon);
  1485.     change_right_softkey(right_softkey, right_softkey_icon);
  1486.     SetupCategoryKeyHandlers();
  1487.     /* Input box */
  1488. #ifdef __MMI_T9__
  1489.     InuptMethodEnterCategory5();
  1490. #elif defined __MMI_ZI__
  1491.     ZiInuptMethodEnterCategory5();
  1492. #elif defined __MMI_KA__
  1493.     KonkaInuptMethodEnterCategory5();
  1494. #elif defined __MMI_ITAP__
  1495. /* under construction !*/
  1496. #endif 
  1497.     register_hide_multitap(category280_hide_multitap);
  1498.     wgui_setup_inputbox_ext(
  1499.         0,
  1500.         MMI_content_y,
  1501.         MMI_content_width,
  1502.         MMI_content_height - MMI_multitap_height,
  1503.         g_wgui_uce_cntx.text_buffer,
  1504.         g_wgui_uce_cntx.text_buffer_size,
  1505.         MMI_CATEGORY280_ID,
  1506.         get_string(right_softkey),
  1507.         get_image(right_softkey_icon),
  1508.         input_method_type,
  1509.         gui_buffer,
  1510.         1,
  1511.         UI_MULTI_LINE_INPUT_BOX_DRAW_UNDERLINE,
  1512.         (S16) (footer_height + header_height + CAT280_MIN_LINE_HEIGHT * 2),
  1513.         CAT280_MIN_LINE_HEIGHT,
  1514.         (S16) header_height,
  1515.         (S16) footer_height,
  1516.         NULL);
  1517.     inputbox_height = MMI_content_height - MMI_multitap_height - wgui_inputbox_information_bar_height;
  1518.     if (MMI_multiline_inputbox.height > inputbox_height)
  1519.     {
  1520.         gui_resize_multi_line_input_box(&MMI_multiline_inputbox, MMI_multiline_inputbox.width, inputbox_height);
  1521.     }
  1522.     /* Setup Input box Callbacks */
  1523.     wgui_multiline_inputbox_register_change_event_handler(category280_text_input_callback);
  1524.     if (g_wgui_uce_cntx.msg_type == WGUI_UCE_MSG_TYPE_MMS)
  1525.     {
  1526.         wgui_multiline_inputbox_register_infobar_callback(
  1527.             category280_draw_info_bar,
  1528.             category280_draw_msg_size,
  1529.             INFORMATION_BAR_HEIGHT << 1);
  1530.         if (g_wgui_uce_cntx.layout == WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_TOP)
  1531.         {
  1532.             MMI_multiline_inputbox.header_callback = category280_draw_object_preview;
  1533.         }
  1534.         else if (g_wgui_uce_cntx.layout == WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_BOTTOM)
  1535.         {
  1536.             MMI_multiline_inputbox.footer_callback = category280_draw_object_preview;
  1537.         }
  1538.     }
  1539.     else
  1540.     {
  1541.         wgui_multiline_inputbox_register_infobar_callback(
  1542.             category280_draw_info_bar,
  1543.             category280_draw_msg_size,
  1544.             INFORMATION_BAR_HEIGHT);
  1545.     }
  1546.     set_MMI_multitap_theme();
  1547. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1548.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  1549.     dm_get_scr_bg_image(
  1550.         &editor_scr_bg_ID,
  1551.         &editor_scr_bg_filename,
  1552.         &editor_scr_bg_x,
  1553.         &editor_scr_bg_y,
  1554.         &editor_scr_bg_opacity);
  1555.     dm_set_scr_bg_image(editor_scr_bg_ID, editor_scr_bg_filename, editor_scr_bg_x, editor_scr_bg_y, 150);
  1556. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1557.     gui_unlock_double_buffer();
  1558.     /* Setup standard category handler */
  1559.     ExitCategoryFunction = ExitCategory280Screen;
  1560.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory280History, GetCategory280HistorySize);
  1561.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1562.     dm_data.s32CatId = MMI_CATEGORY280_ID;
  1563.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1564.     dm_data.s32flags |= DM_SHOW_VKPAD;
  1565.     dm_setup_data(&dm_data);
  1566.     dm_register_category_controlled_callback(DrawCategory280ControlledArea);
  1567.     dm_register_vkpad_callback(category280_virtual_keypad_callback);
  1568.     dm_redraw_category_screen();
  1569. }
  1570. #endif /* __UI_UNIFIED_COMPOSER_EDITOR_CATEGORY__ */