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

MTK

开发平台:

C/C++

  1. void Cat230DrawIndex(void)
  2. {
  3.     S32 width, height, iwidth, iheight;
  4.     color bg_color, text_color;
  5.     U8 i;
  6.     
  7.     gui_reset_clip();
  8.     gui_reset_text_clip();
  9.     gui_lock_double_buffer();
  10.     
  11.     gui_set_font(&MMI_default_font);
  12.     gui_measure_image(get_image(LEFT_ARROW_UP), &iwidth, &iheight);
  13.     for (i=0; i<Cat230NumberofIndex; i++)
  14.     {
  15.         width = height = 0;
  16.         if (i == Cat230HighlightedIndex)
  17.         {
  18.             bg_color = Cat230Index_bg_highlight;
  19.             text_color = Cat230Index_fg_highlight;
  20.         }
  21.         else
  22.         {
  23.             bg_color = Cat230Index_bg;
  24.             text_color = Cat230Index_fg;
  25.         }
  26.         
  27.         //draw background
  28.         gdi_draw_solid_rect(0, MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i, UI_device_width-1, MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*(i+1)-1, gdi_act_color_from_rgb(bg_color.alpha, bg_color.r, bg_color.g, bg_color.b));
  29.         
  30.         //draw fg text
  31.         gui_measure_string((UI_string_type)Cat230IndexInfoString[i], &width, &height);
  32.         
  33.         if (r2lMMIFlag)
  34.         {
  35.             gui_move_text_cursor(((UI_device_width - width) >> 1) + width, MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i + ((CAT230_INDEX_HEIGHT-height)>>1));
  36.         }
  37.         else
  38.         {
  39.             gui_move_text_cursor((UI_device_width - width) >> 1, MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i + ((CAT230_INDEX_HEIGHT-height)>>1));
  40.         }
  41.         gui_set_text_color(text_color);
  42.         gui_print_text((UI_string_type)Cat230IndexInfoString[i]);
  43.         //draw left arrow
  44.     #ifdef __MMI_TOUCH_SCREEN__
  45.         if (Cat230PenEvent == CAT230_TOUCH_ON_LEFT_ARROW_DOWN && i == Cat230HighlightedIndex)
  46.         {
  47.             gui_show_transparent_image(
  48.                 CAT230_ARROW_OFFSET,
  49.                 MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i + ((CAT230_INDEX_HEIGHT-iheight) >> 1) - 1,
  50.                 get_image(LEFT_ARROW_DOWN),
  51.                 0);
  52.         }
  53.         else
  54.     #endif
  55.         {
  56.             gui_show_transparent_image(
  57.                 CAT230_ARROW_OFFSET,
  58.                 MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i + ((CAT230_INDEX_HEIGHT-iheight) >> 1) - 1,
  59.                 get_image(LEFT_ARROW_UP),
  60.                 0);
  61.         }
  62.     
  63.         //draw right arrow
  64.     #ifdef __MMI_TOUCH_SCREEN__
  65.         if (Cat230PenEvent == CAT230_TOUCH_ON_RIGHT_ARROW_DOWN && i == Cat230HighlightedIndex)
  66.         {
  67.             gui_show_transparent_image(
  68.                 UI_device_width - iwidth - 1 - CAT230_ARROW_OFFSET,
  69.                 MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i + ((CAT230_INDEX_HEIGHT-iheight) >> 1) - 1,
  70.                 get_image(RIGHT_ARROW_DOWN),
  71.                 0);
  72.         }
  73.         else
  74.     #endif
  75.         {
  76.             gui_show_transparent_image(
  77.                 UI_device_width - iwidth - 1 - CAT230_ARROW_OFFSET,
  78.                 MMI_status_bar_height+CAT230_TITLE_HEIGHT+CAT230_INDEX_HEIGHT*i + ((CAT230_INDEX_HEIGHT-iheight) >> 1) - 1,
  79.                 get_image(RIGHT_ARROW_UP),
  80.                 0);
  81.         }
  82.     }
  83.     gui_unlock_double_buffer();
  84.     gui_BLT_double_buffer(0, MMI_status_bar_height+CAT230_TITLE_HEIGHT, UI_device_width-1, Cat230Paint_y-1);
  85. }
  86. static void Cat230RedrawPaint_WC(void)
  87. {
  88.     /*----------------------------------------------------------------*/
  89.     /* Local Variables                                                */
  90.     /*----------------------------------------------------------------*/
  91.     color dynamic_time_bg = {255, 113, 21, 255};
  92.     color dynamic_time_fg = {0, 0, 0, 255};
  93.     color static_time_bg = {82, 22, 48, 255};
  94.     color static_time_fg = {255, 255, 255, 255};
  95.     color city_bg = {0, 0, 0, 255};
  96.     color city_fg = {255, 255, 255, 255};
  97.     color hint_fg = {150, 150, 150, 255};
  98.     color dynamic_line = {255, 0, 0, 255};
  99.     color static_line = {0, 0, 0, 255};
  100.     S32 width = 0;
  101.     S32 height = 0;
  102.     S32 width1 = 0;
  103.     S32 height1 = 0;
  104.     S32 start_y = 0;
  105.     cat230_paint_wc_info_struct wc_info;
  106.     MMI_ASSERT(Cat230GetPaintInfo!=NULL);
  107.     Cat230GetPaintInfo((void *)(&wc_info));
  108.     /*----------------------------------------------------------------*/
  109.     /* Code Body                                                      */
  110.     /*----------------------------------------------------------------*/
  111.     /* 060706 NITZ category Calvin Start */
  112.     if (!wc_info.need_redraw)
  113.     {
  114.         return;
  115.     }
  116.     /* 060706 NITZ category Calvin End */
  117.     
  118.     gui_reset_clip();
  119.     gui_reset_text_clip();
  120.     gui_lock_double_buffer();
  121.     
  122.     gui_set_font(&MMI_small_font);
  123.     //draw dynamic time
  124.     start_y = Cat230Paint_y;
  125.     gui_measure_string((UI_string_type)wc_info.dynamic_string, &width, &height);
  126.     gdi_draw_solid_rect(0, start_y, UI_device_width-1, start_y+CAT230_TIME_HEIGHT-1, gdi_act_color_from_rgb(dynamic_time_bg.alpha, dynamic_time_bg.r, dynamic_time_bg.g, dynamic_time_bg.b));
  127.     if (r2lMMIFlag)
  128.     {
  129.         gui_move_text_cursor(((UI_device_width - width) >> 1) + width, start_y + ((CAT230_TIME_HEIGHT-height)>>1));
  130.     }
  131.     else
  132.     {
  133.         gui_move_text_cursor((UI_device_width - width) >> 1, start_y + ((CAT230_TIME_HEIGHT-height)>>1));
  134.     }
  135.     gui_set_text_color(dynamic_time_fg);
  136.     gui_print_text((UI_string_type)wc_info.dynamic_string);
  137.     
  138.     //draw city
  139.     start_y = UI_device_height-MMI_button_bar_height-CAT230_TIME_HEIGHT-CAT230_CITY_HEIGHT;
  140.     gui_measure_string((UI_string_type)wc_info.hint_string, &width, &height);
  141.     gui_measure_string((UI_string_type)wc_info.city_string, &width1, &height1);
  142.     gdi_draw_solid_rect(0, start_y, UI_device_width-1, start_y+CAT230_CITY_HEIGHT-1, gdi_act_color_from_rgb(city_bg.alpha, city_bg.r, city_bg.g, city_bg.b));
  143.     if (r2lMMIFlag)
  144.     {
  145.         gui_move_text_cursor(((UI_device_width - (width+5+width1)) >> 1) + width+5+width1, start_y + ((CAT230_CITY_HEIGHT-height)>>1));
  146.     }
  147.     else
  148.     {
  149.         gui_move_text_cursor((UI_device_width - (width+5+width1)) >> 1, start_y + ((CAT230_CITY_HEIGHT-height)>>1));
  150.     }
  151.     gui_set_text_color(hint_fg);
  152.     gui_print_text((UI_string_type)wc_info.hint_string);
  153.     if (r2lMMIFlag)
  154.     {
  155.         gui_move_text_cursor(((UI_device_width - (width+5+width1)) >> 1) + width, start_y + ((CAT230_CITY_HEIGHT-height1)>>1));
  156.     }
  157.     else
  158.     {
  159.         gui_move_text_cursor(((UI_device_width - (width+5+width1)) >> 1) + width+5, start_y + ((CAT230_CITY_HEIGHT-height1)>>1));
  160.     }
  161.     gui_set_text_color(city_fg);
  162.     gui_print_text((UI_string_type)wc_info.city_string);
  163.     
  164.     //draw static time
  165.     start_y = UI_device_height-MMI_button_bar_height-CAT230_TIME_HEIGHT;
  166.     gui_measure_string((UI_string_type)wc_info.static_string, &width, &height);
  167.     gdi_draw_solid_rect(0, start_y, UI_device_width-1, start_y+CAT230_TIME_HEIGHT-1, gdi_act_color_from_rgb(static_time_bg.alpha, static_time_bg.r, static_time_bg.g, static_time_bg.b));
  168.     if (r2lMMIFlag)
  169.     {
  170.         gui_move_text_cursor(((UI_device_width - width) >> 1) + width, start_y + ((CAT230_TIME_HEIGHT-height)>>1));
  171.     }
  172.     else
  173.     {
  174.         gui_move_text_cursor((UI_device_width - width) >> 1, start_y + ((CAT230_TIME_HEIGHT-height)>>1));
  175.     }
  176.     gui_set_text_color(static_time_fg);
  177.     gui_print_text((UI_string_type)wc_info.static_string);
  178.     //draw map
  179.     start_y = Cat230Paint_y + CAT230_TIME_HEIGHT;
  180.     if (Cat230FirstEnter == MMI_TRUE)
  181.     {
  182.         dm_create_layer(0, start_y, UI_device_width, Cat230Paint_height-CAT230_TIME_HEIGHT*2-CAT230_CITY_HEIGHT, &Cat230PaintLayer, DM_LAYER_BOTTOM);
  183.         gdi_layer_push_and_set_active(Cat230PaintLayer);
  184.         gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  185.         gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  186.         gdi_layer_reset_clip();
  187.         /* draw fix list backgroud */
  188.         gdi_image_draw_id(0, 0, WORLD_CLOCK_IMAGE1);
  189.         gdi_layer_pop_and_restore_active();
  190.         Cat230FirstEnter = MMI_FALSE;
  191.     }
  192.     //draw line indication
  193.     gdi_layer_push_clip();
  194.     gdi_layer_set_clip(0, start_y, UI_device_width-1, UI_device_height-MMI_button_bar_height-CAT230_TIME_HEIGHT-CAT230_CITY_HEIGHT-1);
  195.     gdi_draw_solid_rect(0, start_y, UI_device_width-1, UI_device_height-MMI_button_bar_height-CAT230_TIME_HEIGHT-CAT230_CITY_HEIGHT-1, GDI_COLOR_TRANSPARENT);
  196.     gui_draw_vertical_line(start_y, UI_device_height-MMI_button_bar_height-CAT230_TIME_HEIGHT-CAT230_CITY_HEIGHT-1, wc_info.static_x, static_line);
  197.     gui_draw_horizontal_line(0, UI_device_width-1, start_y+wc_info.static_y, static_line);
  198.     gui_draw_vertical_line(start_y, UI_device_height-MMI_button_bar_height-CAT230_TIME_HEIGHT-CAT230_CITY_HEIGHT-1, wc_info.dynamic_x, dynamic_line);
  199.     gui_draw_horizontal_line(0, UI_device_width-1, start_y+wc_info.dynamic_y, dynamic_line);
  200.     gdi_layer_pop_clip();
  201.     gui_unlock_double_buffer();
  202.     gui_BLT_double_buffer(0, Cat230Paint_y, UI_device_width-1, Cat230Paint_y+Cat230Paint_height-1);
  203.     
  204. }
  205. static void RedrawCategory230Screen(void)
  206. {
  207.     Cat230DrawTitle();
  208.     Cat230DrawIndex();
  209.     MMI_ASSERT(Cat230RedrawPaint!=NULL);
  210.     Cat230RedrawPaint();
  211. }
  212. /*****************************************************************************
  213.  * FUNCTION
  214.  *  RedrawCategoryControlledArea230Screen
  215.  * DESCRIPTION
  216.  *  redraw category200
  217.  * PARAMETERS
  218.  *  coordinate      [?]     
  219.  * RETURNS
  220.  *  void
  221.  *****************************************************************************/
  222. void RedrawCategoryControlledArea230Screen(dm_coordinates *coordinate)
  223. {
  224.     RedrawCategory230Screen();
  225. }
  226. /*****************************************************************************
  227.  * FUNCTION
  228.  *  ShowCategory230Screen
  229.  * DESCRIPTION
  230.  *  category screen of phone search
  231.  * PARAMETERS
  232.  *  title                   [IN]        Title string
  233.  *  number_of_index         [IN]        number of index
  234.  *  highlighted_index       [IN]        highlighted index
  235.  *  screen_type             [IN]        screen type
  236.  *  left_key_handler        [IN]        function pointer to app left key handler
  237.  *  left_key_handler        [IN]        function pointer to app right key handler
  238.  *  redraw_paint            [IN]        function pointer to redraw non-index area
  239.  *  get_paint_info          [IN]        function pointer to get info of non-index area
  240.  * RETURNS
  241.  *  void
  242.  *****************************************************************************/
  243. void ShowCategory230Screen(
  244.         U8 *title,
  245.         U8 number_of_index,
  246.         U8 **index_info,
  247.         U8 highlighted_index,
  248.         U8 screen_type,
  249.         void (*left_key_handler) (U8 index_num),
  250.         void (*right_key_handler) (U8 index_num),
  251.         //void (*redraw_paint) (void), 
  252.         void (*get_paint_info) (void *paint_info))
  253. {
  254.     /*----------------------------------------------------------------*/
  255.     /* Local Variables                                                */
  256.     /*----------------------------------------------------------------*/
  257.     dm_data_struct dm_data;
  258.     U8 i;
  259.     /*----------------------------------------------------------------*/
  260.     /* Code Body                                                      */
  261.     /*----------------------------------------------------------------*/
  262.     Cat230TitleString = title;
  263.     Cat230NumberofIndex = number_of_index;
  264.     for(i=0; i<MAX_CAT230_INDEX; i++)
  265.     {
  266.         Cat230IndexInfoString[i] = index_info[i];
  267.     }
  268.     Cat230HighlightedIndex = highlighted_index;
  269.     Cat230AppLeftKeyHandler = left_key_handler;
  270.     Cat230AppRightKeyHandler = right_key_handler;
  271.     Cat230RedrawPaint = Cat230RedrawPaintArray[screen_type];
  272. #ifdef __MMI_TOUCH_SCREEN__
  273.     Cat230PaintPenEventHandler = Cat230PaintPenEventHandlerArray[screen_type];
  274. #endif
  275.     Cat230GetPaintInfo = get_paint_info;
  276.     Cat230Paint_y = MMI_status_bar_height + CAT230_TITLE_HEIGHT + CAT230_INDEX_HEIGHT*Cat230NumberofIndex;
  277.     Cat230Paint_height = UI_device_height - Cat230Paint_y - MMI_button_bar_height;
  278.     //Cat230FirstEnter = MMI_TRUE;
  279.    
  280.     SetupCategoryKeyHandlers();
  281.     dm_register_category_controlled_callback(RedrawCategoryControlledArea230Screen);
  282.     SetKeyHandler(Cat230HandleKeyLeft, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  283.     SetKeyHandler(Cat230HandleKeyLeft, KEY_LEFT_ARROW, KEY_LONG_PRESS);
  284.     SetKeyHandler(Cat230HandleKeyRight, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  285.     SetKeyHandler(Cat230HandleKeyRight, KEY_RIGHT_ARROW, KEY_LONG_PRESS);
  286.     SetKeyHandler(Cat230HandleKeyUp, KEY_UP_ARROW, KEY_EVENT_DOWN);
  287.     SetKeyHandler(Cat230HandleKeyUp, KEY_UP_ARROW, KEY_LONG_PRESS);
  288.     SetKeyHandler(Cat230HandleKeyDown, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  289.     SetKeyHandler(Cat230HandleKeyDown, KEY_DOWN_ARROW, KEY_LONG_PRESS);
  290.     
  291. #ifdef __MMI_TOUCH_SCREEN__
  292.     wgui_register_category_screen_control_area_pen_handlers(Cat230PenDownHandler, MMI_PEN_EVENT_DOWN);
  293.     wgui_register_category_screen_control_area_pen_handlers(Cat230PenUpHandler, MMI_PEN_EVENT_UP);
  294.     wgui_register_category_screen_control_area_pen_handlers(Cat230PenRepeatHandler, MMI_PEN_EVENT_REPEAT);
  295.     wgui_register_category_screen_control_area_pen_handlers(Cat230PenMoveHandler, MMI_PEN_EVENT_MOVE);
  296. #endif /* __MMI_TOUCH_SCREEN__ */ 
  297.     /* 060706 NITZ category Calvin Start */
  298.     ExitCategoryFunction = ExitCategory230Screen;
  299.     RedrawCategoryFunction = dm_redraw_category_screen;
  300.     GetCategoryHistory = GetCategory230History;
  301.     GetCategoryHistorySize = GetCategory230HistorySize;
  302.     /* 060706 NITZ category Calvin End */
  303.     dm_data.s32CatId = MMI_CATEGORY230_ID;
  304.     dm_data.s32ScrId = GetActiveScreenId();
  305.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  306.     dm_setup_data(&dm_data);
  307.     dm_redraw_category_screen();
  308. }
  309. #endif
  310. /* 052206 NITZ category Calvin End */
  311. /*****************************************************************************
  312.  * FUNCTION
  313.  *  DrawCatEMSCategoryControlledArea
  314.  * DESCRIPTION
  315.  *  
  316.  * PARAMETERS
  317.  *  coordinates     [?]     
  318.  * RETURNS
  319.  *  void
  320.  *****************************************************************************/
  321. void DrawCatEMSCategoryControlledArea(dm_coordinates *coordinates)
  322. {
  323.     /*----------------------------------------------------------------*/
  324.     /* Local Variables                                                */
  325.     /*----------------------------------------------------------------*/
  326.     /*----------------------------------------------------------------*/
  327.     /* Code Body                                                      */
  328.     /*----------------------------------------------------------------*/
  329.     show_singleline_inputbox();
  330. }   /* end of DrawCatEMSCategoryControlledArea */
  331. /***************************************************************************
  332. Function Name: EMS_matrix_highlight_handler
  333. ***************************************************************************/
  334. /*****************************************************************************
  335.  * FUNCTION
  336.  *  EMS_matrix_highlight_handler
  337.  * DESCRIPTION
  338.  *  
  339.  * PARAMETERS
  340.  *  item_index      [IN]        
  341.  * RETURNS
  342.  *  void
  343.  *****************************************************************************/
  344. void EMS_matrix_highlight_handler(S32 item_index)
  345. {
  346.     /*----------------------------------------------------------------*/
  347.     /* Local Variables                                                */
  348.     /*----------------------------------------------------------------*/
  349.     extern color MMI_white_color;
  350.     /*----------------------------------------------------------------*/
  351.     /* Code Body                                                      */
  352.     /*----------------------------------------------------------------*/
  353.     MMI_menu_shortcut_number = item_index + 1;
  354.     MMI_highlighted_item_text = get_item_text(item_index);
  355.     MMI_singleline_inputbox.text = (U8*) MMI_highlighted_item_text;
  356.     //PMT START FIX HINDI ISSUES 20060604
  357.     //It is necessary to set the last_position_p also when the text pointer is changed.
  358.     MMI_singleline_inputbox.last_position_p =
  359.         MMI_singleline_inputbox.text + (gui_strlen((UI_string_type) MMI_singleline_inputbox.text) << 1);
  360.     /* PMT START FIX HINDI ISSUES 20060604 */
  361.     gui_fill_rectangle(
  362.         MMI_singleline_inputbox.x,
  363.         MMI_singleline_inputbox.y,
  364.         MMI_singleline_inputbox.x + MMI_singleline_inputbox.width,
  365.         MMI_singleline_inputbox.y + MMI_singleline_inputbox.height,
  366.         MMI_white_color);
  367.     redraw_singleline_inputbox();
  368.     MMI_matrix_highlight_handler(item_index);
  369. }
  370. /***************************************************************************
  371. Function Name: ShowCategoryEMSScreen
  372. ***************************************************************************/
  373. /*****************************************************************************
  374.  * FUNCTION
  375.  *  ShowCategoryEMSScreen
  376.  * DESCRIPTION
  377.  *  
  378.  * PARAMETERS
  379.  *  title                   [IN]        
  380.  *  title_icon              [IN]        
  381.  *  left_softkey            [IN]        
  382.  *  left_softkey_icon       [IN]        
  383.  *  right_softkey           [IN]        
  384.  *  right_softkey_icon      [IN]        
  385.  *  num_of_symbols          [IN]        
  386.  *  symbols                 [?]         
  387.  *  descriptions            [?]         
  388.  *  highlighted_item        [IN]        
  389.  *  history_buffer          [?]         
  390.  * RETURNS
  391.  *  void
  392.  *****************************************************************************/
  393. void ShowCategoryEMSScreen(
  394.         U16 title,
  395.         U16 title_icon,
  396.         U16 left_softkey,
  397.         U16 left_softkey_icon,
  398.         U16 right_softkey,
  399.         U16 right_softkey_icon,
  400.         S32 num_of_symbols,
  401.         MMI_ID_TYPE *symbols,
  402.         MMI_ID_TYPE *descriptions,
  403.         S32 highlighted_item,
  404.         U8 *history_buffer)
  405. {
  406.     /*----------------------------------------------------------------*/
  407.     /* Local Variables                                                */
  408.     /*----------------------------------------------------------------*/
  409.     dm_data_struct dm_data;
  410.     S32 i, symbol_width = 0, symbol_height = 0, width = 0, height = 0;
  411.     U8 h_flag;
  412.     /*----------------------------------------------------------------*/
  413.     /* Code Body                                                      */
  414.     /*----------------------------------------------------------------*/
  415.     gdi_layer_lock_frame_buffer();
  416.     MMI_menu_shortcut_number = -1;
  417.     change_left_softkey(left_softkey, left_softkey_icon);
  418.     change_right_softkey(right_softkey, right_softkey_icon);
  419.     SetupCategoryKeyHandlers();
  420.     MMI_title_string = get_string(title);
  421.     create_fixed_icontext_menuitems();
  422.     associate_fixed_icontext_matrix();
  423.     for (i = 0; i < num_of_symbols; i++)
  424.     {
  425.         PU8 img = (PU8) get_image(symbols[i]);
  426.         add_fixed_icontext_item((UI_string_type) get_string(descriptions[i]), img);
  427.         gui_measure_image(img, &symbol_width, &symbol_height);
  428.         if (symbol_width > width)
  429.         {
  430.             width = symbol_width;
  431.         }
  432.         if (symbol_height > height)
  433.         {
  434.             height = symbol_width;
  435.         }
  436.     }
  437.     configure_fixed_matrix(width, height, 0, 0);
  438.     MMI_fixed_matrix_menu.height =
  439.         MMI_fixed_matrix_menu.n_rows * (MMI_fixed_matrix_menu.width / MMI_fixed_matrix_menu.n_columns);
  440.     MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE | UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  441.     register_fixed_matrix_loop_keys();
  442.     register_fixed_matrix_highlight_handler(EMS_matrix_highlight_handler);
  443.     MMI_current_menu_type = MATRIX_MENU_EMS;
  444.     MMI_fixed_matrix_menu.flags |= UI_MATRIX_MENU_LOOP;
  445.     h_flag = set_matrix_menu_category_history(MMI_CATEGORY22_ID, history_buffer);
  446.     if (h_flag)
  447.     {
  448.         MMI_highlighted_item_text = get_item_text(MMI_fixed_matrix_menu.highlighted_item);
  449.         create_singleline_inputbox_set_buffer(
  450.             (UI_string_type) MMI_highlighted_item_text,
  451.             gui_strlen((UI_string_type) MMI_highlighted_item_text) + 1,
  452.             gui_strlen((UI_string_type) MMI_highlighted_item_text),
  453.             gui_strlen((UI_string_type) MMI_highlighted_item_text));
  454.         set_singleline_inputbox_mask(0);
  455.         MMI_singleline_inputbox.flags |=
  456.             (UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND | UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
  457.              UI_SINGLE_LINE_INPUT_BOX_CENTER_JUSTIFY);
  458.         fixed_matrix_goto_item_no_redraw(MMI_fixed_matrix_menu.highlighted_item);
  459.     }
  460.     else
  461.     {
  462.         MMI_highlighted_item_text = get_item_text(highlighted_item);
  463.         create_singleline_inputbox_set_buffer(
  464.             (UI_string_type) MMI_highlighted_item_text,
  465.             gui_strlen((UI_string_type) MMI_highlighted_item_text) + 1,
  466.             gui_strlen((UI_string_type) MMI_highlighted_item_text),
  467.             gui_strlen((UI_string_type) MMI_highlighted_item_text));
  468.         set_singleline_inputbox_mask(0);
  469.         MMI_singleline_inputbox.flags |=
  470.             (UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND | UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
  471.              UI_SINGLE_LINE_INPUT_BOX_CENTER_JUSTIFY);
  472.         fixed_matrix_goto_item_no_redraw(highlighted_item);
  473.     }
  474.     MMI_disable_title_shortcut_display = 1;
  475.     gdi_layer_unlock_frame_buffer();
  476.     ExitCategoryFunction = ExitCategory22Screen;
  477.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  478.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  479.     dm_data.s32CatId = MMI_CATEGORY_EMS_ID;
  480.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  481.     dm_setup_data(&dm_data);
  482.     dm_register_category_controlled_callback(DrawCatEMSCategoryControlledArea);
  483.     dm_redraw_category_screen();
  484. }   /* end of ShowCategoryEMSScreen */
  485. /*****************************************************************************
  486.  * FUNCTION
  487.  *  GetCategory400History
  488.  * DESCRIPTION
  489.  *  
  490.  * PARAMETERS
  491.  *  history_buffer      [?]     
  492.  * RETURNS
  493.  *  
  494.  *****************************************************************************/
  495. U8 *GetCategory400History(U8 *history_buffer)
  496. {
  497.     /*----------------------------------------------------------------*/
  498.     /* Local Variables                                                */
  499.     /*----------------------------------------------------------------*/
  500.     /*----------------------------------------------------------------*/
  501.     /* Code Body                                                      */
  502.     /*----------------------------------------------------------------*/
  503.     return history_buffer;
  504. }
  505. /*****************************************************************************
  506.  * FUNCTION
  507.  *  GetCategory400HistorySize
  508.  * DESCRIPTION
  509.  *  
  510.  * PARAMETERS
  511.  *  void
  512.  * RETURNS
  513.  *  
  514.  *****************************************************************************/
  515. S32 GetCategory400HistorySize(void)
  516. {
  517.     /*----------------------------------------------------------------*/
  518.     /* Local Variables                                                */
  519.     /*----------------------------------------------------------------*/
  520.     /*----------------------------------------------------------------*/
  521.     /* Code Body                                                      */
  522.     /*----------------------------------------------------------------*/
  523.     return 0;
  524. }
  525. /*****************************************************************************
  526.  * FUNCTION
  527.  *  RedrawCategory400Screen
  528.  * DESCRIPTION
  529.  *  
  530.  * PARAMETERS
  531.  *  void
  532.  * RETURNS
  533.  *  void
  534.  *****************************************************************************/
  535. void RedrawCategory400Screen(void)
  536. {
  537.     /*----------------------------------------------------------------*/
  538.     /* Local Variables                                                */
  539.     /*----------------------------------------------------------------*/
  540.     color cb = gui_color(0, 0, 0);
  541.     /*----------------------------------------------------------------*/
  542.     /* Code Body                                                      */
  543.     /*----------------------------------------------------------------*/
  544.     gdi_layer_lock_frame_buffer();
  545.     gdi_layer_push_clip();
  546.     gdi_layer_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
  547.     clear_screen();
  548.     show_title_status_icon();
  549.     draw_title();
  550.     gui_draw_rectangle(
  551.         MMI_content_x,
  552.         MMI_content_y,
  553.         MMI_content_x + MMI_content_width - 1,
  554.         MMI_content_y + MMI_content_height - 1,
  555.         cb);
  556.     show_softkey_background();
  557.     show_left_softkey();
  558.     show_right_softkey();
  559.     gdi_layer_pop_clip();
  560.     gdi_layer_unlock_frame_buffer();
  561.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  562. }
  563. /*****************************************************************************
  564.  * FUNCTION
  565.  *  ExitCategory400Screen
  566.  * DESCRIPTION
  567.  *  
  568.  * PARAMETERS
  569.  *  void
  570.  * RETURNS
  571.  *  void
  572.  *****************************************************************************/
  573. void ExitCategory400Screen(void)
  574. {
  575.     /*----------------------------------------------------------------*/
  576.     /* Local Variables                                                */
  577.     /*----------------------------------------------------------------*/
  578.     /*----------------------------------------------------------------*/
  579.     /* Code Body                                                      */
  580.     /*----------------------------------------------------------------*/
  581.     MMI_disable_title_shortcut_display = 0;
  582.     disable_menu_shortcut_box_display = 0;
  583.     reset_softkeys();
  584.     ExitCategoryFunction = MMI_dummy_function;
  585.     RedrawCategoryFunction = MMI_dummy_function;
  586.     GetCategoryHistory = dummy_get_history;
  587.     GetCategoryHistorySize = dummy_get_history_size;
  588. }
  589. /*****************************************************************************
  590.  * FUNCTION
  591.  *  ShowCategory400Screen
  592.  * DESCRIPTION
  593.  *  
  594.  * PARAMETERS
  595.  *  title                   [IN]        
  596.  *  title_icon              [IN]        
  597.  *  left_softkey            [IN]        
  598.  *  left_softkey_icon       [IN]        
  599.  *  right_softkey           [IN]        
  600.  *  right_softkey_icon      [IN]        
  601.  *  history_buffer          [?]         
  602.  * RETURNS
  603.  *  void
  604.  *****************************************************************************/
  605. void ShowCategory400Screen(
  606.         U16 title,
  607.         U16 title_icon,
  608.         U16 left_softkey,
  609.         U16 left_softkey_icon,
  610.         U16 right_softkey,
  611.         U16 right_softkey_icon,
  612.         U8 *history_buffer)
  613. {
  614.     /*----------------------------------------------------------------*/
  615.     /* Local Variables                                                */
  616.     /*----------------------------------------------------------------*/
  617.     /*----------------------------------------------------------------*/
  618.     /* Code Body                                                      */
  619.     /*----------------------------------------------------------------*/
  620.     MMI_disable_title_shortcut_display = 1;
  621.     disable_menu_shortcut_box_display = 1;
  622.     gdi_layer_lock_frame_buffer();
  623.     clear_category_screen_key_handlers();
  624.     change_left_softkey(left_softkey, left_softkey_icon);
  625.     change_right_softkey(right_softkey, right_softkey_icon);
  626.     clear_left_softkey();
  627.     clear_right_softkey();
  628.     register_left_softkey_handler();
  629.     register_right_softkey_handler();
  630.     register_default_hide_softkeys();
  631.     MMI_title_string = (UI_string_type) get_string(title);
  632.     MMI_title_icon = (PU8) get_image(title_icon);
  633.     gdi_layer_unlock_frame_buffer();
  634.     ExitCategoryFunction = ExitCategory400Screen;
  635.     RedrawCategoryFunction = RedrawCategory400Screen;
  636.     GetCategoryHistory = GetCategory400History;
  637.     GetCategoryHistorySize = GetCategory400HistorySize;
  638.     RedrawCategory400Screen();
  639. }
  640. #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__)
  641. /*****************************************************************************
  642.  * FUNCTION
  643.  *  mmi_nsm2_category275_draw_tile
  644.  * DESCRIPTION
  645.  *  
  646.  * PARAMETERS
  647.  *  strID       [IN]        
  648.  * RETURNS
  649.  *  void
  650.  *****************************************************************************/
  651. void mmi_nsm2_category275_draw_tile(U32 strID)
  652. {
  653.     /*----------------------------------------------------------------*/
  654.     /* Local Variables                                                */
  655.     /*----------------------------------------------------------------*/
  656.     S32 iwidth, iheight, character_height, tx, w, iwidth2;
  657.     /*----------------------------------------------------------------*/
  658.     /* Code Body                                                      */
  659.     /*----------------------------------------------------------------*/
  660.     gdi_layer_lock_frame_buffer();
  661.     /* ADDED FOR NSM PHASE-II */
  662.     MMI_title_string = get_string((MMI_ID_TYPE) strID);
  663.     gdi_layer_push_clip();
  664.     if ((gOnFullScreen & MMI_IN_FULL_SCREEN) && !(gOnFullScreen & MMI_LEAVE_FULL_IDLE_SCREEN) &&
  665.         !(gOnFullScreen & MMI_IN_NORMAL_SCREEN_WITHOUT_STATUSBAR))
  666.     {
  667.         gdi_layer_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
  668.         /* PMT VIKAS START 20050707 */
  669.     #if defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__)
  670.         /* To show proper Title & title image display */
  671.         ShowStatusIconsTitle();
  672.         arrange_status_icons();
  673.         show_status_icons();
  674.         gdi_layer_set_clip(
  675.             MMI_title_x,
  676.             MMI_title_y,
  677.             MMI_title_x + MMI_title_width - 1,
  678.             MMI_title_y + MMI_title_height - 1);
  679.         /* gui_draw_filled_area(MMI_title_x,MMI_title_y,MMI_title_x+MMI_title_width-1,MMI_title_height-1,current_MMI_theme->title_filler); */
  680.         gui_draw_filled_area(
  681.             MMI_title_x,
  682.             MMI_title_y,
  683.             MMI_title_x + MMI_title_width - 1,
  684.             MMI_title_y + MMI_title_height - 1,
  685.             current_UI_theme->window_title_theme->active_filler);
  686.     #else /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  687.         gdi_layer_set_clip(MMI_title_x, 0, MMI_title_x + MMI_title_width - 1, MMI_title_height - 1);
  688.         /* PMT NEERAJ START 20050616 */
  689.         gui_draw_filled_area(
  690.             MMI_title_x,
  691.             0,
  692.             MMI_title_x + MMI_title_width - 1,
  693.             MMI_title_height - 1,
  694.             current_UI_theme->window_title_theme->active_filler);
  695.         /* PMT NEERAJ END 20050616 */
  696.     #endif /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  697.         /* PMT VIKAS END 20050707 */
  698.     }
  699.     else
  700.     {
  701.         gdi_layer_set_clip(0, MMI_title_y, UI_device_width - 1, MMI_title_y + MMI_title_height - 1);
  702.         /* PMT VIKAS START 20050707 */
  703.     #if defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__)
  704.         /* Draw title image. */
  705.         gui_draw_filled_area(
  706.             MMI_title_x,
  707.             MMI_title_y,
  708.             MMI_title_x + MMI_title_width - 1,
  709.             MMI_title_y + MMI_title_height - 1,
  710.             current_UI_theme->window_title_theme->active_filler);
  711.     #else /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  712.         /* PMT NEERAJ START 20050616 */
  713.         gui_draw_filled_area(
  714.             MMI_title_x,
  715.             MMI_title_y,
  716.             MMI_title_x + MMI_title_width - 1,
  717.             MMI_title_y + MMI_title_height - 1,
  718.             current_UI_theme->window_title_theme->active_filler);
  719.         /* /PMT NEERAJ END 20050616 */
  720.     #endif /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  721.         /* PMT VIKAS END 20050707 */
  722.     }
  723.     if (MMI_title_icon != NULL)
  724.     {
  725.         gui_measure_image(MMI_title_icon, &iwidth, &iheight);
  726.         /* MTK Elvis for R2L characters */
  727.         if (!r2lMMIFlag)
  728.         {
  729.             gui_show_transparent_image(
  730.                 MMI_title_x + 1,
  731.                 MMI_title_y + ((MMI_title_height >> 1) - (iheight >> 1)),
  732.                 MMI_title_icon,
  733.                 gui_transparent_color(0, 0, 0));
  734.             if ((iwidth == 0) || (iheight == 0))
  735.             {
  736.                 tx = 2;
  737.             }
  738.             else
  739.             {
  740.                 tx = iwidth + 3;
  741.             }
  742.         }
  743.         else
  744.         {
  745.             gui_show_transparent_image(
  746.                 MMI_title_width - iwidth - 1,
  747.                 MMI_title_y + ((MMI_title_height >> 1) - (iheight >> 1)),
  748.                 MMI_title_icon,
  749.                 gui_transparent_color(0, 0, 0));
  750.             if ((iwidth == 0) || (iheight == 0))
  751.             {
  752.                 tx = MMI_title_width - 2;
  753.             }
  754.             else
  755.             {
  756.                 tx = MMI_title_width - iwidth - 3;
  757.             }
  758.         }
  759.         /* MTK end */
  760.     }
  761.     else
  762.     {
  763.         /* MTK Elvis for R2L characters */
  764.         if (!r2lMMIFlag)
  765.         {
  766.             tx = 2;
  767.         }
  768.         else
  769.         {
  770.             tx = MMI_title_width - 2;
  771.         }
  772.         /* MTK end */
  773.     }
  774.     if (MMI_title_icon2 != NULL)
  775.     {
  776.         gui_measure_image(MMI_title_icon2, &iwidth2, &iheight);
  777.         if (iwidth2 > 0 && iheight > 0)
  778.         {
  779.             gui_show_transparent_image(
  780.                 MMI_title_x + MMI_title_width - iwidth2 - 1 /* leave one pixel */ ,
  781.                 MMI_title_y + ((MMI_title_height >> 1) - (iheight >> 1)),
  782.                 MMI_title_icon2,
  783.                 gui_transparent_color(0, 0, 0));
  784.         }
  785.     }
  786.     if (MMI_title_string != NULL)   /* Fix for long titles  */
  787.     {
  788.         /* MTK Elvis for R2L characters */
  789.         S32 tw;
  790.         if (!r2lMMIFlag)
  791.         {
  792.             tw = MMI_title_width - tx;
  793.         }
  794.         else
  795.         {
  796.             tw = tx;
  797.         }
  798.         /* MTK end */
  799.         gui_set_font((UI_font_type) (current_MMI_theme->window_title_font));
  800.         gui_measure_string(MMI_title_string, &w, &character_height);
  801.         w += 2; /* for bordered text display */
  802.         gui_set_text_color(*current_MMI_theme->title_text_color);
  803.         if ((gOnFullScreen & MMI_IN_FULL_SCREEN || gOnFullScreen & MMI_LEAVE_FULL_SCREEN) &&
  804.             !(gOnFullScreen & MMI_LEAVE_FULL_IDLE_SCREEN))
  805.             /* PMT VIKAS START 20050707 */
  806.     #if defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__)
  807.             /* to move at right point */
  808.             gui_move_text_cursor(MMI_title_x + tx, MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)));
  809.     #else /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  810.             gui_move_text_cursor(MMI_title_x + tx, ((MMI_title_height >> 1) - (character_height >> 1)));
  811.     #endif /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  812.         /* PMT VIKAS END 20050707 */
  813.         else
  814.         {
  815.             gui_move_text_cursor(MMI_title_x + tx, MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)));
  816.         }
  817.         if (MMI_title_icon2 && iwidth2 > 0 && iheight > 0)
  818.         {
  819.             tw -= (iwidth2 + 1 + 4);
  820.             if (w < tw)
  821.             {
  822.                 S32 _tx = tx;
  823.                 tx = tx + (tw >> 1) - (w >> 1);
  824.                 if (tx < _tx)
  825.                 {
  826.                     tx = _tx;
  827.                 }
  828.             }
  829.         }
  830.         else if (!MMI_disable_title_shortcut_display && MMI_menu_shortcut_number >= 0)
  831.         {
  832.             tw -= MMI_menu_shortcut_box.width;
  833.             if (w < tw)
  834.             {
  835.                 S32 _tx = tx;
  836.                 /* MTK Elvis for R2L characters */
  837.                 if (!r2lMMIFlag)
  838.                 {
  839.                     tx = tx + (tw >> 1) - (w >> 1);
  840.                     if (tx < _tx)
  841.                     {
  842.                         tx = _tx;
  843.                     }
  844.                 }
  845.                 else
  846.                 {
  847.                     tx = tx - ((tw >> 1) - (w >> 1));
  848.                     if (tx > _tx)
  849.                     {
  850.                         tx = _tx;
  851.                     }
  852.                 }
  853.                 /* MTK end */
  854.             }
  855.         }
  856.         else
  857.         {
  858.             if (w < tw)
  859.             {
  860.                 S32 _tx = tx;
  861.                 /* MTK Elvis for R2L characters */
  862.                 if (!r2lMMIFlag)
  863.                 {
  864.                     tx = tx + (tw >> 1) - (w >> 1);
  865.                     if (tx < _tx)
  866.                     {
  867.                         tx = _tx;
  868.                     }
  869.                 }
  870.                 else
  871.                 {
  872.                     tx = tx - ((tw >> 1) - (w >> 1));
  873.                     if (tx > _tx)
  874.                     {
  875.                         tx = _tx;
  876.                     }
  877.                 }
  878.                 /* MTK end */
  879.             }
  880.         }
  881.     #if defined(__MMI_DEFAULT_THEME_3__) || defined(__MMI_DEFAULT_THEME_1__)
  882.         gui_set_text_border_color(*current_MMI_theme->title_text_border_color);
  883.         if ((gOnFullScreen & MMI_IN_FULL_SCREEN || gOnFullScreen & MMI_LEAVE_FULL_SCREEN) &&
  884.             !(gOnFullScreen & MMI_LEAVE_FULL_IDLE_SCREEN))
  885.             /* PMT VIKAS START 20050707 */
  886.     #if defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__)
  887.             /* To print title text on title bar with title icon. */
  888.             gui_print_truncated_borderd_text(
  889.                 MMI_title_x + tx,
  890.                 MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)),
  891.                 tw,
  892.                 MMI_title_string);
  893.     #else /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  894.             gui_print_truncated_borderd_text(
  895.                 MMI_title_x + tx,
  896.                 ((MMI_title_height >> 1) - (character_height >> 1)),
  897.                 tw,
  898.                 MMI_title_string);
  899.     #endif /* defined(__MMI_UI_DALMATIAN_STATUSBAR__) || defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_MAINMENU__) || defined(__MMI_UI_DALMATIAN_FIXEDLIST__) || defined(__MMI_UI_DALMATIAN_EDITOR__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) */ 
  900.         /* PMT VIKAS END 20050707 */
  901.         else
  902.         {
  903.             gui_print_truncated_borderd_text(
  904.                 MMI_title_x + tx,
  905.                 MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)),
  906.                 tw,
  907.                 MMI_title_string);
  908.         }
  909.     #else /* defined(__MMI_DEFAULT_THEME_3__) || defined(__MMI_DEFAULT_THEME_1__) */ 
  910.         if ((gOnFullScreen & MMI_IN_FULL_SCREEN || gOnFullScreen & MMI_LEAVE_FULL_SCREEN) &&
  911.             !(gOnFullScreen & MMI_LEAVE_FULL_IDLE_SCREEN))
  912.         {
  913.             gui_print_truncated_text(
  914.                 MMI_title_x + tx,
  915.                 ((MMI_title_height >> 1) - (character_height >> 1)),
  916.                 tw,
  917.                 MMI_title_string);
  918.         }
  919.         else
  920.         {
  921.             gui_print_truncated_text(
  922.                 MMI_title_x + tx,
  923.                 MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)),
  924.                 tw,
  925.                 MMI_title_string);
  926.         }
  927.     #endif /* defined(__MMI_DEFAULT_THEME_3__) || defined(__MMI_DEFAULT_THEME_1__) */ 
  928.     }
  929.     gdi_layer_pop_clip();
  930.     gdi_layer_unlock_frame_buffer();
  931.     if (MMI_title_icon2 == NULL)
  932.     {
  933.         gui_hide_menu_shortcut();
  934.         show_menu_shortcut();
  935.     }
  936.     if ((gOnFullScreen & MMI_IN_FULL_SCREEN || gOnFullScreen & MMI_LEAVE_FULL_SCREEN) &&
  937.         !(gOnFullScreen & MMI_LEAVE_FULL_IDLE_SCREEN))
  938.     {
  939.         gdi_layer_blt_previous(MMI_title_x, 0, MMI_title_x + MMI_title_width - 1, MMI_title_height - 1);
  940.     }
  941.     else
  942.     {
  943.         gdi_layer_blt_previous(
  944.             MMI_title_x,
  945.             MMI_title_y,
  946.             MMI_title_x + MMI_title_width - 1,
  947.             MMI_title_y + MMI_title_height - 1);
  948.     }
  949. }
  950. extern U8 gNSMBuffer[];
  951. /*****************************************************************************
  952.  * FUNCTION
  953.  *  mmi_nsm2_category275_draw_inbox_header
  954.  * DESCRIPTION
  955.  *  
  956.  * PARAMETERS
  957.  *  yy      [IN]        
  958.  *  x1      [IN]        
  959.  *  y1      [IN]        
  960.  *  x2      [IN]        
  961.  *  y2      [IN]        
  962.  * RETURNS
  963.  *  void
  964.  *****************************************************************************/
  965. void mmi_nsm2_category275_draw_inbox_header(S32 yy, S32 x1, S32 y1, S32 x2, S32 y2)
  966. {
  967.     /*----------------------------------------------------------------*/
  968.     /* Local Variables                                                */
  969.     /*----------------------------------------------------------------*/
  970.     S32 pic_offset;
  971.     /*----------------------------------------------------------------*/
  972.     /* Code Body                                                      */
  973.     /*----------------------------------------------------------------*/
  974.     pic_offset = ((LCD_WIDTH - current_MMI_theme->scrollbar_size) >> 1) - 36;   /* To align nsm picture in centre */
  975.     gui_show_image(x1 + pic_offset, y1 + MMI_multiline_inputbox.text_offset_y + 1, (U8*) gNSMBuffer);
  976. }
  977. #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__) */ 
  978. #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
  979. extern nsm_msg_struct g_nsm_msg_context;    /* PMT JAI : 06012005 */
  980. /*****************************************************************************
  981.  * FUNCTION
  982.  *  mmi_nsm2_category275_draw_header
  983.  * DESCRIPTION
  984.  *  
  985.  * PARAMETERS
  986.  *  identifier      [IN]        
  987.  *  y_offset        [IN]        
  988.  *  x1              [IN]        
  989.  *  y1              [IN]        
  990.  *  x2              [IN]        
  991.  *  y2              [IN]        
  992.  * RETURNS
  993.  *  void
  994.  *****************************************************************************/
  995. void mmi_nsm2_category275_draw_header(U32 identifier, S32 y_offset, S32 x1, S32 y1, S32 x2, S32 y2)
  996. {
  997.     /*----------------------------------------------------------------*/
  998.     /* Local Variables                                                */
  999.     /*----------------------------------------------------------------*/
  1000.     S32 pic_offset;
  1001.     /*----------------------------------------------------------------*/
  1002.     /* Code Body                                                      */
  1003.     /*----------------------------------------------------------------*/
  1004.     pic_offset = ((LCD_WIDTH - current_MMI_theme->scrollbar_size) >> 1) - 36;
  1005.     gui_show_image(x1 + pic_offset, y1 + MMI_multiline_inputbox.text_offset_y + 1, (U8*) g_nsm_msg_context.picbuffer);
  1006. }
  1007. #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */ 
  1008. /*****************************************************************************
  1009.  * FUNCTION
  1010.  *  ShowCategory354Screen
  1011.  * DESCRIPTION
  1012.  *  Displays the category354 screen ( List menu with two text rows )
  1013.  * PARAMETERS
  1014.  *  title                   [IN]        Title for the screen
  1015.  *  title_icon              [IN]        Icon displayed with the title
  1016.  *  left_softkey            [IN]        Left softkey label
  1017.  *  left_softkey_icon       [IN]        Left softkey icon
  1018.  *  right_softkey           [IN]        Right softkey label
  1019.  *  right_softkey_icon      [IN]        Right softkey icon
  1020.  *  number_of_items         [IN]        Number of items in the menu
  1021.  *  list_of_items1          [IN]        String array1 of items
  1022.  *  list_of_items2          [IN]        String array2 of items
  1023.  *  list_of_icons           [IN]        Array of icons
  1024.  *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
  1025.  *  history_buffer          [IN]        History buffer
  1026.  * RETURNS
  1027.  *  void
  1028.  *****************************************************************************/
  1029. void ShowCategory354Screen(
  1030.         U8 *title,
  1031.         U16 title_icon,
  1032.         U16 left_softkey,
  1033.         U16 left_softkey_icon,
  1034.         U16 right_softkey,
  1035.         U16 right_softkey_icon,
  1036.         S32 number_of_items,
  1037.         U8 **list_of_items1,
  1038.         U8 **list_of_items2,
  1039.         U16 *list_of_icons,
  1040.         S32 highlighted_item,
  1041.         U8 *history_buffer)
  1042. {
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Local Variables                                                */
  1045.     /*----------------------------------------------------------------*/
  1046.     dm_data_struct dm_data;
  1047.     S32 i;
  1048.     S32 img_width, img_height;
  1049.     S32 str_width, str_height;
  1050.     U8 h_flag;
  1051.     /*----------------------------------------------------------------*/
  1052.     /* Code Body                                                      */
  1053.     /*----------------------------------------------------------------*/
  1054.     gdi_layer_lock_frame_buffer();
  1055.     create_fixed_icontext_list_menuitems(2, 1);
  1056.     associate_fixed_icontext_list_list();
  1057.     ShowListCategoryScreen(
  1058.         (UI_string_type) title,
  1059.         get_image(title_icon),
  1060.         get_string(left_softkey),
  1061.         get_image(left_softkey_icon),
  1062.         get_string(right_softkey),
  1063.         get_image(right_softkey_icon),
  1064.         number_of_items);
  1065.     /* we need two lines */
  1066.     resize_fixed_icontext_list_menuitems(0, get_menu_item_height() << 1);
  1067.     gdi_image_get_dimension_id(list_of_icons[0], &img_width, &img_height);
  1068.     gui_measure_string((UI_string_type) list_of_items1[0], &str_width, &str_height);
  1069.     set_fixed_icontext_list_icon_coordinates(0, 1, 1, img_width, img_height);
  1070.     set_fixed_icontext_list_text_coordinates(
  1071.         0,
  1072.         20,
  1073.         (get_menu_item_height() - str_height) >> 1,
  1074.         MMI_fixed_icontext_list_menuitem.width - 20,
  1075.         get_menu_item_height());
  1076.     set_fixed_icontext_list_text_coordinates(
  1077.         1,
  1078.         20,
  1079.         get_menu_item_height() + ((get_menu_item_height() - str_height) >> 1),
  1080.         MMI_fixed_icontext_list_menuitem.width - 20,
  1081.         get_menu_item_height());
  1082.     for (i = 0; i < number_of_items; i++)
  1083.     {
  1084.         fixed_icontext_list_item_insert(i);
  1085.         add_fixed_icontext_list_item_icon(i, 0, wgui_get_list_menu_icon(i, list_of_icons[i]));
  1086.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) list_of_items1[i]);
  1087.         add_fixed_icontext_list_item_text(i, 1, (UI_string_type) list_of_items2[i]);
  1088.         wgui_pop_up_description_strings[i].text_strings[0] = NULL;
  1089.     }
  1090.     MMI_fixed_icontext_list_menuitem.flags &= ~UI_MENUITEM_CENTER_TEXT_Y;
  1091.     MMI_fixed_icontext_list_menuitem.flags &= ~UI_MENUITEM_CENTER_ICON_Y;
  1092.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_MARQUEE_SCROLL;
  1093.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_AUTO_CHOOSE_MARQUEE;
  1094.     h_flag = set_list_menu_category_history(MMI_CATEGORY52_ID, history_buffer);
  1095.     if (h_flag)
  1096.     {
  1097.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  1098.     }
  1099.     else
  1100.     {
  1101.         fixed_list_goto_item_no_redraw(highlighted_item);
  1102.     }
  1103.     MMI_title_string = (UI_string_type) title;
  1104.     MMI_title_icon = (PU8) get_image(title_icon);
  1105.     gdi_layer_unlock_frame_buffer();
  1106.     ExitCategoryFunction = ExitCategory354Screen;
  1107.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1108.     dm_data.s32flags = 0;
  1109.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1110.     dm_data.s32CatId = MMI_CATEGORY52_ID;
  1111.     dm_data.s32flags = 0;
  1112.     dm_setup_data(&dm_data);
  1113.     dm_redraw_category_screen();
  1114. }   /* end of ShowCategory354Screen */
  1115. /*****************************************************************************
  1116.  * FUNCTION
  1117.  *  ExitCategory354Screen
  1118.  * DESCRIPTION
  1119.  *  Exits the category354 screen
  1120.  * PARAMETERS
  1121.  *  void
  1122.  * RETURNS
  1123.  *  void
  1124.  *****************************************************************************/
  1125. void ExitCategory354Screen(void)
  1126. {
  1127.     /*----------------------------------------------------------------*/
  1128.     /* Local Variables                                                */
  1129.     /*----------------------------------------------------------------*/
  1130.     /*----------------------------------------------------------------*/
  1131.     /* Code Body                                                      */
  1132.     /*----------------------------------------------------------------*/
  1133.     ClearHighlightHandler();
  1134.     reset_softkeys();
  1135.     reset_menu_shortcut_handler();
  1136.     reset_fixed_list();
  1137.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_CENTER_TEXT_Y;
  1138.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_CENTER_ICON_Y;
  1139.     MMI_fixed_icontext_list_menuitem.flags &= ~UI_MENUITEM_MARQUEE_SCROLL;
  1140.     MMI_fixed_icontext_list_menuitem.flags &= ~UI_MENUITEM_AUTO_CHOOSE_MARQUEE;
  1141. }
  1142. /* PMT Pankaj Start ---- For Editable Equalizer Settings Support. */
  1143. #ifdef __MMI_EDITABLE_AUDIO_EQUALIZER__
  1144. /*****************************************************************************
  1145.  * FUNCTION
  1146.  *  RedrawCategory334Screen
  1147.  * DESCRIPTION
  1148.  *  Redraws the category334 screen
  1149.  * PARAMETERS
  1150.  *  void
  1151.  * RETURNS
  1152.  *  void
  1153.  *****************************************************************************/
  1154. void RedrawCategory334Screen()
  1155. {
  1156.     /*----------------------------------------------------------------*/
  1157.     /* Local Variables                                                */
  1158.     /*----------------------------------------------------------------*/
  1159.     PU8 aud_eq_bg_img = NULL;
  1160.     PU8 aud_eq_active_bar_img = NULL;
  1161.     PU8 aud_eq_sound_level_ind_img = NULL;
  1162.     S32 index;
  1163.     S32 width = 0, height = 0, width_active = 0, height_active = 0;
  1164.     long start_x_slider, middle_point_y_of_bar;
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Code Body                                                      */
  1167.     /*----------------------------------------------------------------*/
  1168.     gdi_layer_lock_frame_buffer();
  1169.     clear_screen();
  1170.     show_title_status_icon();
  1171.     draw_title();
  1172.     /* get the images required */
  1173.     aud_eq_bg_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_BG);
  1174.     aud_eq_active_bar_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_ACTIVE_BAR);
  1175.     aud_eq_sound_level_ind_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_VAL_INDICATOR);
  1176.     /* calcualte how much one pixel represents in a bar */
  1177.     temp_float_var = (float)256 / (float)g_audio_equalizer_scrollable_ht;
  1178.     one_pixel_represents = 10 * temp_float_var;
  1179.     gdi_layer_push_clip();
  1180.     /* show the background image */
  1181.     if (!wgui_category_screen_no_buttons)
  1182.     {
  1183.         gdi_layer_set_clip(
  1184.             0,
  1185.             (MMI_title_y + MMI_title_height),
  1186.             UI_device_width - 1,
  1187.             (UI_device_height - MMI_button_bar_height));
  1188.         gui_show_transparent_image(0, (MMI_title_y + MMI_title_height), aud_eq_bg_img, gui_transparent_color(0, 0, 0));
  1189.         show_softkey_background();
  1190.         show_left_softkey();
  1191.         show_right_softkey();
  1192.     }
  1193.     else
  1194.     {
  1195.         gdi_layer_set_clip(0, (MMI_title_y + MMI_title_height), UI_device_width - 1, (UI_device_height - 1));
  1196.         gui_show_transparent_image(0, (MMI_title_y + MMI_title_height), aud_eq_bg_img, gui_transparent_color(0, 0, 0));
  1197.     }
  1198.     /* measure the slider image. */
  1199.     gui_measure_image(aud_eq_sound_level_ind_img, &width, &height);
  1200.     /* show the active bar...the x coordinate is based on the difference in width of the active and inactive bar. */
  1201.     gui_measure_image(aud_eq_active_bar_img, &width_active, &height_active);
  1202.     gui_show_image(
  1203.         g_audio_equalizer_bar_start_x - (width_active - g_audio_equalizer_bar_width) / 2 + g_audio_equalizer_current_setting_info.active_bar * (g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars),
  1204.         (MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y),
  1205.         aud_eq_active_bar_img);
  1206.     //show the indicator for sound levels.
  1207.     //calculate the middle point of a bar
  1208.     middle_point_y_of_bar =
  1209.         MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y + (g_audio_equalizer_bar_height - 1) / 2;
  1210.     start_x_slider = g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2;
  1211.     for (index = 0; index < NUM_OF_BARS_IN_A_SETTING; index++)
  1212.     {
  1213.         long y_coord =
  1214.             middle_point_y_of_bar -
  1215.             (long)((float)g_audio_equalizer_current_setting_info.sound_level[index] / one_pixel_represents) -
  1216.             height / 2;
  1217.         if (g_audio_equalizer_current_setting_info.sound_level[index] == 0 ||
  1218.             g_audio_equalizer_current_setting_info.sound_level[index] > 0)
  1219.         {
  1220.             y_coord++;
  1221.         }
  1222.         gui_show_image(start_x_slider, y_coord, aud_eq_sound_level_ind_img);
  1223.         start_x_slider += (g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars);
  1224.     }
  1225.     gdi_layer_pop_clip();
  1226.     gdi_layer_unlock_frame_buffer();
  1227.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  1228. }
  1229. /*****************************************************************************
  1230.  * FUNCTION
  1231.  *  ExitCategory334Screen
  1232.  * DESCRIPTION
  1233.  *  Exitss the category334 screen
  1234.  * PARAMETERS
  1235.  *  void
  1236.  * RETURNS
  1237.  *  void
  1238.  *****************************************************************************/
  1239. void ExitCategory334Screen(void)
  1240. {
  1241.     /*----------------------------------------------------------------*/
  1242.     /* Local Variables                                                */
  1243.     /*----------------------------------------------------------------*/
  1244.     /*----------------------------------------------------------------*/
  1245.     /* Code Body                                                      */
  1246.     /*----------------------------------------------------------------*/
  1247. }
  1248. #ifdef __MMI_DRAW_MANAGER__
  1249. /*****************************************************************************
  1250.  * FUNCTION
  1251.  *  dm_category_334_controlled_area
  1252.  * DESCRIPTION
  1253.  *  Redraws the category334 screen using Draw Manager
  1254.  * PARAMETERS
  1255.  *  coordinate      [?]     
  1256.  * RETURNS
  1257.  *  void
  1258.  *****************************************************************************/
  1259. void dm_category_334_controlled_area(dm_coordinates *coordinate)
  1260. {
  1261.     /*----------------------------------------------------------------*/
  1262.     /* Local Variables                                                */
  1263.     /*----------------------------------------------------------------*/
  1264.     /*----------------------------------------------------------------*/
  1265.     /* Code Body                                                      */
  1266.     /*----------------------------------------------------------------*/
  1267.     RedrawCategory334Screen();
  1268. }
  1269. #endif /* __MMI_DRAW_MANAGER__ */ 
  1270. #ifdef __MMI_TOUCH_SCREEN__
  1271. /*****************************************************************************
  1272.  * FUNCTION
  1273.  *  category334_get_bar_index
  1274.  * DESCRIPTION
  1275.  *  Gets the bar index of the bar which contains the input point.
  1276.  * PARAMETERS
  1277.  *  point       [IN]        
  1278.  * RETURNS
  1279.  *  S8 index of the bar
  1280.  *****************************************************************************/
  1281. S8 category334_get_bar_index(mmi_pen_point_struct point)
  1282. {
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Local Variables                                                */
  1285.     /*----------------------------------------------------------------*/
  1286.     S8 i, j;
  1287.     S16 dx;
  1288.     S32 width, height;
  1289.     PU8 aud_eq_sound_level_ind_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_VAL_INDICATOR);
  1290.     mmi_pen_polygon_area_struct bar_area;
  1291.     mmi_pen_point_struct bar_vertex[4];
  1292.     /*----------------------------------------------------------------*/
  1293.     /* Code Body                                                      */
  1294.     /*----------------------------------------------------------------*/
  1295.     gui_measure_image(aud_eq_sound_level_ind_img, &width, &height);
  1296.     /* the limits of the width of a bar are taken as the width of the slider. slider width is assumed to be the maximum, bcos it should be. */
  1297.     if (width < g_audio_equalizer_bar_width)
  1298.     {
  1299.         width = g_audio_equalizer_bar_width;
  1300.     }
  1301.     /* set bar area */
  1302.     bar_area.num = 4;
  1303.     bar_area.points = (mmi_pen_point_struct*) & bar_vertex;
  1304.     bar_vertex[0].x = (S16) g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2;
  1305.     bar_vertex[0].y = (S16) MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y;
  1306.     bar_vertex[1].x = bar_vertex[0].x + width - 1;
  1307.     bar_vertex[1].y = bar_vertex[0].y;
  1308.     bar_vertex[2].x = bar_vertex[1].x;
  1309.     bar_vertex[2].y = bar_vertex[0].y + g_audio_equalizer_bar_height - 1;
  1310.     bar_vertex[3].x = bar_vertex[0].x;
  1311.     bar_vertex[3].y = bar_vertex[2].y;
  1312.     dx = (S16) g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars;
  1313.     for (i = 0; i < NUM_OF_BARS_IN_A_SETTING; i++)
  1314.     {
  1315.         if (mmi_pen_check_inside_polygon(&bar_area, point))
  1316.         {
  1317.             return i;
  1318.         }
  1319.         for (j = 0; j < 4; j++)
  1320.         {
  1321.             bar_vertex[j].x += dx;
  1322.         }
  1323.     }
  1324.     return (S8) - 1;
  1325. }
  1326. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1327. /*****************************************************************************
  1328.  * FUNCTION
  1329.  *  wgui_audio_equalizer_activate_bar
  1330.  * DESCRIPTION
  1331.  *  Activates the bar having index same as the input argument.
  1332.  * PARAMETERS
  1333.  *  bar_index       [IN]        
  1334.  * RETURNS
  1335.  *  void
  1336.  *****************************************************************************/
  1337. void wgui_audio_equalizer_activate_bar(U8 bar_index)
  1338. {
  1339.     /*----------------------------------------------------------------*/
  1340.     /* Local Variables                                                */
  1341.     /*----------------------------------------------------------------*/
  1342.     long start_x_img, start_y_img, middle_pt_y_in_bar;
  1343.     S16 dx;
  1344.     S32 bar_width, width, height, width_active, height_active;
  1345.     PU8 aud_eq_active_bar_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_ACTIVE_BAR);
  1346.     PU8 aud_eq_sound_level_ind_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_VAL_INDICATOR);
  1347.     PU8 aud_eq_bg_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_BG);
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Code Body                                                      */
  1350.     /*----------------------------------------------------------------*/
  1351.     gdi_layer_lock_frame_buffer();
  1352.     gdi_layer_push_clip();
  1353.     /* miscellaneous calculations */
  1354.     gui_measure_image(aud_eq_sound_level_ind_img, &width, &height);
  1355.     bar_width = g_audio_equalizer_bar_width;
  1356.     if (width > g_audio_equalizer_bar_width)
  1357.     {
  1358.         bar_width = width;
  1359.     }
  1360.     dx = (S16) g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars;
  1361.     /* inactivate the already active bar. */
  1362.     start_x_img =
  1363.         g_audio_equalizer_bar_start_x - (bar_width - g_audio_equalizer_bar_width) / 2 +
  1364.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1365.     start_y_img = MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y;
  1366.     middle_pt_y_in_bar = start_y_img + (g_audio_equalizer_bar_height - 1) / 2;
  1367.     gdi_layer_set_clip(
  1368.         start_x_img,
  1369.         start_y_img,
  1370.         start_x_img + bar_width - 1,
  1371.         start_y_img + g_audio_equalizer_bar_height - 1);
  1372.     /* 1. show the inactive bar in place of active bar... */
  1373.     gui_show_transparent_image(0, MMI_title_y + MMI_title_height, aud_eq_bg_img, gui_transparent_color(0, 0, 0));
  1374.     /* 2. show the slider control */
  1375.     start_x_img =
  1376.         g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2 +
  1377.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1378.     start_y_img =
  1379.         middle_pt_y_in_bar -
  1380.         (long)((float)g_audio_equalizer_current_setting_info.
  1381.                sound_level[g_audio_equalizer_current_setting_info.active_bar] / one_pixel_represents + height / 2);
  1382.     if (g_audio_equalizer_current_setting_info.sound_level[g_audio_equalizer_current_setting_info.active_bar] >= 0)
  1383.     {
  1384.         start_y_img++;
  1385.     }
  1386.     gui_show_image(start_x_img, start_y_img, aud_eq_sound_level_ind_img);
  1387.     /* activate the new bar */
  1388.     g_audio_equalizer_current_setting_info.active_bar = bar_index;
  1389.     start_x_img =
  1390.         g_audio_equalizer_bar_start_x - (bar_width - g_audio_equalizer_bar_width) / 2 +
  1391.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1392.     start_y_img = MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y;
  1393.     gdi_layer_set_clip(
  1394.         start_x_img,
  1395.         start_y_img,
  1396.         start_x_img + bar_width - 1,
  1397.         start_y_img + g_audio_equalizer_bar_height - 1);
  1398.     /* Step 1.paste the inactive bar image.... */
  1399.     gui_show_transparent_image(0, MMI_title_y + MMI_title_height, aud_eq_bg_img, gui_transparent_color(0, 0, 0));
  1400.     /* Step 2.paste the active bar image */
  1401.     gui_measure_image(aud_eq_active_bar_img, &width_active, &height_active);
  1402.     start_x_img =
  1403.         g_audio_equalizer_bar_start_x - (width_active - g_audio_equalizer_bar_width) / 2 +
  1404.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1405.     gui_show_image(start_x_img, start_y_img, aud_eq_active_bar_img);
  1406.     /* Step 3.paste the slider */
  1407.     start_x_img =
  1408.         g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2 +
  1409.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1410.     start_y_img =
  1411.         middle_pt_y_in_bar -
  1412.         (long)((float)g_audio_equalizer_current_setting_info.
  1413.                sound_level[g_audio_equalizer_current_setting_info.active_bar] / one_pixel_represents + height / 2);
  1414.     if (g_audio_equalizer_current_setting_info.sound_level[g_audio_equalizer_current_setting_info.active_bar] >= 0)
  1415.     {
  1416.         start_y_img++;
  1417.     }
  1418.     gui_show_image(start_x_img, start_y_img, aud_eq_sound_level_ind_img);
  1419.     gdi_layer_pop_clip();
  1420.     gdi_layer_unlock_frame_buffer();
  1421.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  1422. }
  1423. /*****************************************************************************
  1424.  * FUNCTION
  1425.  *  wgui_audio_equalizer_change_sound_level
  1426.  * DESCRIPTION
  1427.  *  change the sound level on the screen using the sound level value.
  1428.  * PARAMETERS
  1429.  *  void
  1430.  * RETURNS
  1431.  *  void
  1432.  *****************************************************************************/
  1433. void wgui_audio_equalizer_change_sound_level(void)
  1434. {
  1435.     /*----------------------------------------------------------------*/
  1436.     /* Local Variables                                                */
  1437.     /*----------------------------------------------------------------*/
  1438.     PU8 aud_eq_active_bar_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_ACTIVE_BAR);
  1439.     PU8 aud_eq_sound_level_ind_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_VAL_INDICATOR);
  1440.     PU8 aud_eq_bg_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_BG);
  1441.     long start_x_img, start_y_img, middle_pt_y_in_bar;
  1442.     S32 bar_width, width, height, width_active, height_active;
  1443.     S16 dx = (S16) (g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars);
  1444.     /*----------------------------------------------------------------*/
  1445.     /* Code Body                                                      */
  1446.     /*----------------------------------------------------------------*/
  1447.     gdi_layer_lock_frame_buffer();
  1448.     gdi_layer_push_clip();
  1449.     /* miscellaneous calculations */
  1450.     gui_measure_image(aud_eq_sound_level_ind_img, &width, &height);
  1451.     bar_width = g_audio_equalizer_bar_width;
  1452.     if (width > g_audio_equalizer_bar_width)
  1453.     {
  1454.         bar_width = width;
  1455.     }
  1456.     /* firt paste the inactive image on the active bar. */
  1457.     start_x_img =
  1458.         g_audio_equalizer_bar_start_x - (bar_width - g_audio_equalizer_bar_width) / 2 +
  1459.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1460.     start_y_img = MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y;
  1461.     middle_pt_y_in_bar = start_y_img + (g_audio_equalizer_bar_height - 1) / 2;
  1462.     gdi_layer_set_clip(
  1463.         start_x_img,
  1464.         start_y_img,
  1465.         start_x_img + bar_width - 1,
  1466.         start_y_img + g_audio_equalizer_bar_height - 1);
  1467.     gui_show_transparent_image(0, MMI_title_y + MMI_title_height, aud_eq_bg_img, gui_transparent_color(0, 0, 0));
  1468.     /* paste the active bar image on the already active bar */
  1469.     gui_measure_image(aud_eq_active_bar_img, &width_active, &height_active);
  1470.     start_x_img =
  1471.         g_audio_equalizer_bar_start_x - (width_active - g_audio_equalizer_bar_width) / 2 +
  1472.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1473.     gui_show_image(start_x_img, start_y_img, aud_eq_active_bar_img);
  1474.     /* paste the slider */
  1475.     start_x_img =
  1476.         g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2 +
  1477.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1478.     start_y_img =
  1479.         middle_pt_y_in_bar -
  1480.         (long)((float)g_audio_equalizer_current_setting_info.
  1481.                sound_level[g_audio_equalizer_current_setting_info.active_bar] / one_pixel_represents + height / 2);
  1482.     if (g_audio_equalizer_current_setting_info.sound_level[g_audio_equalizer_current_setting_info.active_bar] >= 0)
  1483.     {
  1484.         start_y_img++;
  1485.     }
  1486.     gui_show_image(start_x_img, start_y_img, aud_eq_sound_level_ind_img);
  1487.     gdi_layer_pop_clip();
  1488.     gdi_layer_unlock_frame_buffer();
  1489.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  1490. }
  1491. #ifdef __MMI_TOUCH_SCREEN__
  1492. /*****************************************************************************
  1493.  * FUNCTION
  1494.  *  category334_pen_down_handler
  1495.  * DESCRIPTION
  1496.  *  Handler for pen down event.
  1497.  * PARAMETERS
  1498.  *  point       [IN]        
  1499.  * RETURNS
  1500.  *  MMI_BOOL
  1501.  *****************************************************************************/
  1502. MMI_BOOL category334_pen_down_handler(mmi_pen_point_struct point)
  1503. {
  1504.     /*----------------------------------------------------------------*/
  1505.     /* Local Variables                                                */
  1506.     /*----------------------------------------------------------------*/
  1507.     S8 bar_index;
  1508.     S16 dx;
  1509.     S32 width, height;
  1510.     PU8 aud_eq_sound_level_ind_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_VAL_INDICATOR);
  1511.     mmi_pen_polygon_area_struct area;
  1512.     mmi_pen_point_struct vertex[4];
  1513.     /*----------------------------------------------------------------*/
  1514.     /* Code Body                                                      */
  1515.     /*----------------------------------------------------------------*/
  1516.     /* measure the slider image. */
  1517.     gui_measure_image(aud_eq_sound_level_ind_img, &width, &height);
  1518.     if (width < g_audio_equalizer_bar_width)
  1519.     {
  1520.         width = (S32) g_audio_equalizer_bar_width;
  1521.     }
  1522.     /* set bar area */
  1523.     dx = (S16) g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars;
  1524.     area.num = 4;
  1525.     area.points = (mmi_pen_point_struct*) & vertex;
  1526.     vertex[0].x = (S16) g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2;
  1527.     vertex[0].y = (S16) MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y;
  1528.     vertex[1].x = vertex[0].x + dx * (NUM_OF_BARS_IN_A_SETTING - 1) + width - 1;
  1529.     vertex[1].y = vertex[0].y;
  1530.     vertex[2].x = vertex[1].x;
  1531.     vertex[2].y = vertex[0].y + g_audio_equalizer_bar_height - 1;
  1532.     vertex[3].x = vertex[0].x;
  1533.     vertex[3].y = vertex[2].y;
  1534.     /* check if hit in the bar area: */
  1535.     if (!mmi_pen_check_inside_polygon(&area, point))
  1536.     {
  1537.         return FALSE;
  1538.     }
  1539.     //now since the pen down has been done in the bar area.
  1540.     //check whether some frequency bar has been hit or not...if hit then activate it(if not activated earlier). 
  1541.     if ((bar_index = category334_get_bar_index(point)) != (S8) - 1)
  1542.     {
  1543.         S16 middle_pt_y_in_bar, slider_center_y, slider_start_y, slider_end_y, start_x;
  1544.         /* activate the bar if not active... */
  1545.         if (bar_index != g_audio_equalizer_current_setting_info.active_bar)
  1546.         {
  1547.             wgui_audio_equalizer_activate_bar(bar_index);
  1548.         }
  1549.         //change the sound level if the bar has been hit at a place which is different from original sound level of the bar
  1550.         //1. check if the pen down been done on the slider itself or some other place on the bar.
  1551.         //get the original position of the slider from sound level.
  1552.         middle_pt_y_in_bar = vertex[0].y + (g_audio_equalizer_bar_height - 1) / 2;
  1553.         slider_center_y =
  1554.             middle_pt_y_in_bar -
  1555.             (S16) ((float)g_audio_equalizer_current_setting_info.sound_level[bar_index] / one_pixel_represents);
  1556.         slider_start_y = slider_center_y - height / 2;
  1557.         slider_end_y = slider_center_y + height / 2;
  1558.         start_x = vertex[0].x + dx * bar_index;
  1559.         if (((point.x >= start_x) && (point.x < start_x + width)) &&
  1560.             ((point.y >= slider_start_y) && (point.y <= slider_end_y)))
  1561.         {
  1562.             return TRUE;    /* we don't need to do anything in this case since pen down is on the slider itself */
  1563.         }                   /* if hit on the slider area. */
  1564.         else                /* if hit somewhere else on the bar.then the slider is to be shifted to new position. */
  1565.         {
  1566.             /* find the difference between new and original. */
  1567.             S16 difference;
  1568.             /* modify point.y if it is between the start y of the bar and the start y + height/2, where height is height of the slider. */
  1569.             if (point.y < middle_pt_y_in_bar - (g_audio_equalizer_scrollable_ht) / 2)
  1570.             {
  1571.                 point.y = middle_pt_y_in_bar - (g_audio_equalizer_scrollable_ht) / 2;
  1572.             }
  1573.             else if (point.y > middle_pt_y_in_bar + (g_audio_equalizer_scrollable_ht) / 2)
  1574.             {
  1575.                 point.y = middle_pt_y_in_bar + (g_audio_equalizer_scrollable_ht) / 2;
  1576.             }
  1577.             /* find the difference between the place hit and the currenly occupied coordinates of slider. */
  1578.             difference = slider_center_y - point.y;
  1579.             mmi_settings_audio_equalizer_change_sound_level((S16) ((float)difference * one_pixel_represents));
  1580.             return TRUE;
  1581.         }
  1582.     }
  1583.     else
  1584.     {
  1585.         return FALSE;
  1586.     }
  1587. }
  1588. /*****************************************************************************
  1589.  * FUNCTION
  1590.  *  category334_pen_move_handler
  1591.  * DESCRIPTION
  1592.  *  Handler for pen move event.
  1593.  * PARAMETERS
  1594.  *  point       [IN]        
  1595.  * RETURNS
  1596.  *  MMI_BOOL
  1597.  *****************************************************************************/
  1598. MMI_BOOL category334_pen_move_handler(mmi_pen_point_struct point)
  1599. {
  1600.     /*----------------------------------------------------------------*/
  1601.     /* Local Variables                                                */
  1602.     /*----------------------------------------------------------------*/
  1603.     S16 bar_start_x, bar_start_y, middle_pt_y_in_bar, dx;
  1604.     S32 width, height;
  1605.     PU8 aud_eq_sound_level_ind_img = (PU8) GetImage(SOUND_EFFECT_AUDIO_EQ_VAL_INDICATOR);
  1606.     /*----------------------------------------------------------------*/
  1607.     /* Code Body                                                      */
  1608.     /*----------------------------------------------------------------*/
  1609.     /* measure the slider image. */
  1610.     gui_measure_image(aud_eq_sound_level_ind_img, &width, &height);
  1611.     if (width < g_audio_equalizer_bar_width)
  1612.     {
  1613.         width = (S32) g_audio_equalizer_bar_width;
  1614.     }
  1615.     dx = (S16) (g_audio_equalizer_bar_width + g_audio_equalizer_dist_btw_bars);
  1616.     bar_start_x =
  1617.         g_audio_equalizer_bar_start_x - (width - g_audio_equalizer_bar_width) / 2 +
  1618.         dx * g_audio_equalizer_current_setting_info.active_bar;
  1619.     bar_start_y = MMI_title_y + MMI_title_height + g_audio_equalizer_bar_start_y;
  1620.     //check that whether the point is inside the active bar area.
  1621.     //the concept being used is that the slider movement is to be done only in case the point is with in bar area
  1622.     //and only vertical component is to be used for movement.
  1623.     middle_pt_y_in_bar = bar_start_y + (g_audio_equalizer_bar_height - 1) / 2;
  1624.     if (point.x >= bar_start_x && point.x < bar_start_x + width &&
  1625.         point.y >= (middle_pt_y_in_bar - g_audio_equalizer_scrollable_ht / 2) &&
  1626.         point.y <= (middle_pt_y_in_bar + g_audio_equalizer_scrollable_ht / 2))
  1627.     {
  1628.         /* 1. Find the the middle point of the slider present on the bar. */
  1629.         S16 mid_pt_slider =
  1630.             middle_pt_y_in_bar -
  1631.             (S16) ((float)g_audio_equalizer_current_setting_info.
  1632.                    sound_level[g_audio_equalizer_current_setting_info.active_bar] / one_pixel_represents);
  1633.         if (mid_pt_slider != point.y)   /* the case when the sound level is to be modified and the slider shifted. */
  1634.         {
  1635.             mmi_settings_audio_equalizer_change_sound_level((S16)
  1636.                                                             ((float)(mid_pt_slider - point.y) * one_pixel_represents));
  1637.             return TRUE;
  1638.         }
  1639.         else
  1640.         {
  1641.             return FALSE;
  1642.         }
  1643.     }
  1644.     else
  1645.     {
  1646.         return FALSE;
  1647.     }
  1648. }
  1649. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1650. /*****************************************************************************
  1651.  * FUNCTION
  1652.  *  ShowCategory334Screen
  1653.  * DESCRIPTION
  1654.  *  Show category funciton for equalizer screen
  1655.  * PARAMETERS
  1656.  *  title                   [IN]        
  1657.  *  title_icon              [IN]        
  1658.  *  left_softkey            [IN]        
  1659.  *  left_softkey_icon       [IN]        
  1660.  *  right_softkey           [IN]        
  1661.  *  right_softkey_icon      [IN]        
  1662.  *  values                  [?]         
  1663.  *  history_buffer          [?]         
  1664.  * RETURNS
  1665.  *  void
  1666.  *****************************************************************************/
  1667. void ShowCategory334Screen(
  1668.         U16 title,
  1669.         U16 title_icon,
  1670.         U16 left_softkey,
  1671.         U16 left_softkey_icon,
  1672.         U16 right_softkey,
  1673.         U16 right_softkey_icon,
  1674.         signed char *values,
  1675.         U8 *history_buffer)
  1676. {
  1677.     /*----------------------------------------------------------------*/
  1678.     /* Local Variables                                                */
  1679.     /*----------------------------------------------------------------*/
  1680. #ifdef __MMI_DRAW_MANAGER__
  1681.     dm_data_struct dm_data;
  1682. #endif 
  1683.     S8 index;
  1684.     /*----------------------------------------------------------------*/
  1685.     /* Code Body                                                      */
  1686.     /*----------------------------------------------------------------*/
  1687.     UI_UNUSED_PARAMETER(history_buffer);
  1688.     gdi_layer_lock_frame_buffer();
  1689.     SetupCategoryKeyHandlers();
  1690.     change_left_softkey(left_softkey, left_softkey_icon);
  1691.     change_right_softkey(right_softkey, right_softkey_icon);
  1692.     MMI_title_string = (UI_string_type) get_string(title);
  1693.     MMI_title_icon = (PU8) get_image(title_icon);
  1694.     MMI_menu_shortcut_number = -1;
  1695.     if ((left_softkey == 0) && (left_softkey_icon == 0) && (right_softkey == 0) && (right_softkey_icon == 0))
  1696.     {
  1697.         wgui_category_screen_no_buttons = 1;
  1698.     }
  1699.     else
  1700.     {
  1701.         wgui_category_screen_no_buttons = 0;
  1702.     }
  1703.     for (index = 0; index < NUM_OF_BARS_IN_A_SETTING; index++)
  1704.     {
  1705.         g_audio_equalizer_current_setting_info.sound_level[index] = 10 * values[index];
  1706.     }
  1707.     gdi_layer_unlock_frame_buffer();
  1708. #ifndef __MMI_DRAW_MANAGER__
  1709.     ExitCategoryFunction = ExitCategory334Screen;
  1710.     RedrawCategoryFunction = RedrawCategory334Screen;
  1711.     GetCategoryHistory = dummy_get_history;
  1712.     GetCategoryHistorySize = dummy_get_history_size;
  1713.     RedrawCategoryFunction();
  1714. #else /* __MMI_DRAW_MANAGER__ */ 
  1715. #if (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_DRAW_MANAGER__)
  1716.     wgui_register_category_screen_control_area_pen_handlers(category334_pen_down_handler, MMI_PEN_EVENT_DOWN);
  1717.     wgui_register_category_screen_control_area_pen_handlers(category334_pen_move_handler, MMI_PEN_EVENT_MOVE);
  1718. #endif /* (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_DRAW_MANAGER__) */ 
  1719.     ExitCategoryFunction = ExitCategory334Screen;
  1720.     GetCategoryHistory = dummy_get_history;
  1721.     GetCategoryHistorySize = dummy_get_history_size;
  1722.     RedrawCategoryFunction = dm_redraw_category_screen;
  1723.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1724.     dm_data.s32CatId = MMI_CATEGORY334_ID;
  1725.     dm_data.s32flags = 0;
  1726.     dm_setup_data(&dm_data);
  1727.     dm_register_category_controlled_callback(dm_category_334_controlled_area);
  1728.     dm_redraw_category_screen();
  1729. #endif /* __MMI_DRAW_MANAGER__ */ 
  1730. }
  1731. #endif /* __MMI_EDITABLE_AUDIO_EQUALIZER__ */ 
  1732. /* PMT Pankaj End ---- For Editable Equalizer Settings Support. */
  1733. /*****************************************************************************
  1734.  * FUNCTION
  1735.  *  ShowCategory401Screen
  1736.  * DESCRIPTION
  1737.  *  
  1738.  * PARAMETERS
  1739.  *  percentage      [IN]        
  1740.  * RETURNS
  1741.  *  void
  1742.  *****************************************************************************/
  1743. void ShowCategory401Screen(U16 percentage)
  1744. {
  1745. #if (defined(__MTK_TARGET__) && !defined(__MAUI_BASIC__) && !defined(__L1_STANDALONE__) && !defined(EMPTY_MMI))
  1746.     /*----------------------------------------------------------------*/
  1747.     /* Local Variables                                                */
  1748.     /*----------------------------------------------------------------*/
  1749.     S32 bar_width = 0, bar_height = 0;
  1750.     S32 bar_x = 0, bar_y = 0;
  1751.     S32 fill_width = 0;
  1752.     S32 str_width = 0, str_height = 0;
  1753.     S32 str_x = 0, str_y = 0;
  1754.     U8 *bar_bg_image = nfb_progress_images[0];
  1755.     U16 digit[3], idx = 0;
  1756.     S32 digit_width[3];
  1757.     S32 digit_height[3];
  1758.     static U8 isInited = 0;
  1759.     /*----------------------------------------------------------------*/
  1760.     /* Code Body                                                      */
  1761.     /*----------------------------------------------------------------*/
  1762.     if (bmt_is_wdt_power() == KAL_TRUE || BMT.PWRon == RTCPWRON)
  1763.     {
  1764.         return;
  1765.     }
  1766.     if (!isInited)
  1767.     {
  1768.         isInited = 1;
  1769.         gdi_init();
  1770.         custom_cfg_gpio_set_level(GPIO_DEV_LED_MAINLCD, 5);
  1771.         setup_UI_wrappers();
  1772.     }
  1773.     gdi_layer_lock_frame_buffer();
  1774.     gdi_layer_clear(GDI_COLOR_WHITE);
  1775.     gdi_layer_push_clip();
  1776.     gdi_layer_reset_clip();
  1777.     /* percentage images */
  1778.     /* decide which images are used */
  1779.     if (percentage == 100)
  1780.     {
  1781.         digit[2] = 1;
  1782.         digit[1] = 0;
  1783.         digit[0] = 0;
  1784.     }
  1785.     else if (percentage == 0)
  1786.     {
  1787.         digit[2] = 0;
  1788.         digit[1] = 0;
  1789.         digit[0] = 0;
  1790.     }
  1791.     else if (percentage > 0 && percentage < 100)
  1792.     {
  1793.         digit[2] = 0;
  1794.         digit[1] = percentage / 10;
  1795.         digit[0] = percentage - (digit[1] * 10);
  1796.     }
  1797.     else
  1798.     {
  1799.         MMI_ASSERT(percentage <= 100);
  1800.     }
  1801.     /* calculate digit image width and height */
  1802.     gdi_image_get_dimension(nfb_progress_images[11], &str_width, &str_height);
  1803.     for (idx = 2; idx > 0; idx--)
  1804.     {
  1805.         if (digit[idx] != 0 || digit[2] == 1)
  1806.         {
  1807.             gdi_image_get_dimension(nfb_progress_images[digit[idx] + 1], &digit_width[idx], &digit_height[idx]);
  1808.             str_width += digit_width[idx];
  1809.         }
  1810.     }
  1811.     gdi_image_get_dimension(nfb_progress_images[digit[0] + 1], &digit_width[0], &digit_height[0]);
  1812.     /* decide digit images position */
  1813.     str_x = (UI_device_width - str_width) >> 1;
  1814.     str_y = (UI_device_height >> 1) + 2;
  1815.     /* show the digit images */
  1816.     for (idx = 2; idx > 0; idx--)
  1817.     {
  1818.         if (digit[idx] != 0 || digit[2] == 1)
  1819.         {
  1820.             gdi_image_draw(str_x, str_y, nfb_progress_images[digit[idx] + 1]);
  1821.             str_x += digit_width[idx];
  1822.         }
  1823.     }
  1824.     gdi_image_draw(str_x, str_y, nfb_progress_images[digit[0] + 1]);
  1825.     str_x += digit_width[0];
  1826.     gdi_image_draw(str_x, str_y, nfb_progress_images[11]);
  1827.     /* Progress bar background image */
  1828.     gdi_image_get_dimension(bar_bg_image, &bar_width, &bar_height);
  1829.     bar_x = (UI_device_width - bar_width - 2 /* gap */ ) >> 1;
  1830.     bar_y = (UI_device_height >> 1) - bar_height;
  1831.     gdi_layer_set_clip(bar_x, bar_y, bar_x + bar_width - 1, bar_y + bar_height - 1);
  1832.     /* Progress bar fill area */
  1833.     fill_width = ((bar_width - (MMI_CAT401_X_OFFSET << 1)) * (S32) percentage) / 100;
  1834.     gdi_draw_solid_rect(
  1835.         bar_x + MMI_CAT401_X_OFFSET,
  1836.         bar_y,
  1837.         bar_x + MMI_CAT401_X_OFFSET + fill_width - 1,
  1838.         bar_y + bar_height - 1,
  1839.         GDI_COLOR_RED);
  1840.     gdi_image_draw(bar_x, bar_y, bar_bg_image);
  1841.     gdi_layer_pop_clip();
  1842.     gdi_layer_unlock_frame_buffer();
  1843.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  1844. #endif /* (defined(__MTK_TARGET__) && !defined(__MAUI_BASIC__) && !defined(__L1_STANDALONE__) && !defined(EMPTY_MMI)) */ 
  1845. }
  1846. /*****************************************************************************
  1847.  * FUNCTION
  1848.  *  cat201_register_language_changed_indicator
  1849.  * DESCRIPTION
  1850.  *  
  1851.  * PARAMETERS
  1852.  *  FuncPtr     [IN]        
  1853.  * RETURNS
  1854.  *  void
  1855.  *****************************************************************************/
  1856. BOOL(*wgui_check_language_changed) (U8 input_type) = NULL;
  1857. void cat201_register_language_changed_indicator(BOOL(*FuncPtr) (U8 input_type))
  1858. {
  1859.     /*----------------------------------------------------------------*/
  1860.     /* Local Variables                                                */
  1861.     /*----------------------------------------------------------------*/
  1862.     /*----------------------------------------------------------------*/
  1863.     /* Code Body                                                      */
  1864.     /*----------------------------------------------------------------*/
  1865.     wgui_check_language_changed = FuncPtr;
  1866. }
  1867. /*****************************************************************************
  1868.  * FUNCTION
  1869.  *  ExitCategory201Screen
  1870.  * DESCRIPTION
  1871.  *  exit function of category201
  1872.  * PARAMETERS
  1873.  *  void
  1874.  * RETURNS
  1875.  *  void
  1876.  *****************************************************************************/
  1877. /* Begin AP input mode set */
  1878. extern U8 MMI_AP_set_input_mode_set;
  1879. /* End AP input mode set */
  1880. void ExitCategory201Screen(void)
  1881. {
  1882.     /*----------------------------------------------------------------*/
  1883.     /* Local Variables                                                */
  1884.     /*----------------------------------------------------------------*/
  1885.     /*----------------------------------------------------------------*/
  1886.     /* Code Body                                                      */
  1887.     /*----------------------------------------------------------------*/
  1888.     ClearHighlightHandler();
  1889.     reset_softkeys();
  1890.     reset_menu_shortcut_handler();
  1891.     reset_fixed_list();
  1892.     set_MMI_current_input_type();
  1893.     reset_multitaps();
  1894.     reset_dynamic_list();
  1895.     reset_pop_up_descriptions();
  1896.     wgui_close_inputbox();
  1897.     /* Begin AP input mode set */
  1898.     if (MMI_AP_set_input_mode_set)
  1899.     {
  1900.         wgui_unset_AP_required_input_mode_set_flag();
  1901.     }
  1902.     /* End AP input mode set */
  1903.     cat200_search_function = NULL;
  1904.     wgui_check_language_changed = NULL;
  1905.     wgui_reset_multiline_inputbox_register_up_down_key_funcptr();
  1906.     ExitCategoryFunction = MMI_dummy_function;
  1907.     RedrawCategoryFunction = MMI_dummy_function;
  1908.     GetCategoryHistory = dummy_get_history;
  1909.     GetCategoryHistorySize = dummy_get_history_size;
  1910. }
  1911. /*****************************************************************************
  1912.  * FUNCTION
  1913.  *  GetCategory201HistorySize
  1914.  * DESCRIPTION
  1915.  *  Gets the history buffer size of category 200
  1916.  * PARAMETERS
  1917.  *  void
  1918.  * RETURNS
  1919.  *  size in U8s of the history buffer
  1920.  *****************************************************************************/
  1921. S32 GetCategory201HistorySize(void)
  1922. {
  1923.     /*----------------------------------------------------------------*/
  1924.     /* Local Variables                                                */
  1925.     /*----------------------------------------------------------------*/
  1926.     /*----------------------------------------------------------------*/
  1927.     /* Code Body                                                      */
  1928.     /*----------------------------------------------------------------*/
  1929.     /* MTK Terry for History issue */
  1930.     return (((sizeof(list_menu_category_history) + 3) / 4) * 4 + sizeof(multiline_inputbox_category_history));
  1931. }
  1932. /*****************************************************************************
  1933.  * FUNCTION
  1934.  *  GetCategory201History
  1935.  * DESCRIPTION
  1936.  *  Gets the history buffer of category200
  1937.  * PARAMETERS
  1938.  *  history_buffer      [?]     
  1939.  * RETURNS
  1940.  *  return history buffer
  1941.  *****************************************************************************/
  1942. U8 *GetCategory201History(U8 *history_buffer)
  1943. {
  1944.     /*----------------------------------------------------------------*/
  1945.     /* Local Variables                                                */
  1946.     /*----------------------------------------------------------------*/
  1947.     /* MTK Terry for History Issue */
  1948.     S32 s;
  1949.     /*----------------------------------------------------------------*/
  1950.     /* Code Body                                                      */
  1951.     /*----------------------------------------------------------------*/
  1952.     get_list_menu_category_history(MMI_CATEGORY201_ID, history_buffer);
  1953.     s = sizeof(list_menu_category_history);
  1954.     s = (s + 3) / 4;
  1955.     s *= 4;
  1956.     get_multiline_inputbox_category_history(MMI_CATEGORY201_ID, (U8*) (history_buffer + s), MMI_current_input_type);
  1957.     return (history_buffer);
  1958. }
  1959. /*****************************************************************************
  1960.  * FUNCTION
  1961.  *  SetCategory201RightSoftkeyFunction
  1962.  * DESCRIPTION
  1963.  *  
  1964.  * PARAMETERS
  1965.  *  f       [IN]        
  1966.  *  k       [IN]        
  1967.  * RETURNS
  1968.  *  void
  1969.  *****************************************************************************/
  1970. void SetCategory201RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  1971. {
  1972.     /*----------------------------------------------------------------*/
  1973.     /* Local Variables                                                */
  1974.     /*----------------------------------------------------------------*/
  1975.     /*----------------------------------------------------------------*/
  1976.     /* Code Body                                                      */
  1977.     /*----------------------------------------------------------------*/
  1978.     UI_UNUSED_PARAMETER(k);
  1979.     wgui_inputbox_RSK_function = f;
  1980. }
  1981. /* MTK Leo add, virtual keypad */
  1982. /*****************************************************************************
  1983.  * FUNCTION
  1984.  *  cat201_virtual_keypad_callback
  1985.  * DESCRIPTION
  1986.  *  
  1987.  * PARAMETERS
  1988.  *  void
  1989.  * RETURNS
  1990.  *  void
  1991.  *****************************************************************************/
  1992. void cat201_virtual_keypad_callback(void)
  1993. {
  1994.     /*----------------------------------------------------------------*/
  1995.     /* Local Variables                                                */
  1996.     /*----------------------------------------------------------------*/
  1997.     /*----------------------------------------------------------------*/
  1998.     /* Code Body                                                      */
  1999.     /*----------------------------------------------------------------*/
  2000. #if defined(__MMI_TOUCH_SCREEN__)
  2001.     mmi_pen_editor_resize_multiline_input_box_for_vk();
  2002. #endif 
  2003. }
  2004. /* MTK Leo add for category201 */
  2005. /*****************************************************************************
  2006.  * FUNCTION
  2007.  *  refresh_category201_search_list_change_list
  2008.  * DESCRIPTION
  2009.  *  input call back function of category200 multi tap
  2010.  * PARAMETERS
  2011.  *  no_entries                  [IN]        
  2012.  *  UI_character_type(?)        [IN]        Inp
  2013.  * RETURNS
  2014.  *  void
  2015.  *****************************************************************************/
  2016. void refresh_category201_search_list_change_list(S32 no_entries)
  2017. {
  2018.     /*----------------------------------------------------------------*/
  2019.     /* Local Variables                                                */
  2020.     /*----------------------------------------------------------------*/
  2021.     S32 shortcut_width;
  2022.     S32 max_entries = 0;
  2023.     /*----------------------------------------------------------------*/
  2024.     /* Code Body                                                      */
  2025.     /*----------------------------------------------------------------*/
  2026.     MMI_fixed_list_menu.highlighted_item = 0;
  2027.     MMI_fixed_list_menu.n_items = no_entries;
  2028.     MMI_fixed_list_menu.displayed_items = no_entries;
  2029.     if (wgui_check_application_present)
  2030.     {
  2031.         wgui_check_application_present(&max_entries);
  2032.     }
  2033.     shortcut_width = set_menu_item_count(max_entries) + 7;  /* number of element increases at the run time */
  2034.     resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  2035.     move_menu_shortcut_handler(UI_device_width - shortcut_width, MMI_title_y);
  2036. #ifdef __MMI_UI_DALMATIAN_SOFTKEYS__
  2037.     show_softkey_background();
  2038. #endif 
  2039.     if (no_entries > 0)
  2040.     {
  2041.         dynamic_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  2042.         draw_title();   /* 110805 quick search Calvin added */
  2043.     }
  2044.     else
  2045.     {
  2046.         gui_fixed_icontext_menuitem_stop_scroll();
  2047.         gui_pop_up_description_stop_scroll();
  2048.         MMI_menu_shortcut_number = 0;
  2049.         draw_title();
  2050.         wgui_current_pop_up_description_index = -1;
  2051.     }
  2052.     show_dynamic_list();
  2053. }
  2054. /*****************************************************************************
  2055.  * FUNCTION
  2056.  *  refresh_category201_search_list
  2057.  * DESCRIPTION
  2058.  *  
  2059.  * PARAMETERS
  2060.  *  void
  2061.  * RETURNS
  2062.  *  void
  2063.  *****************************************************************************/
  2064. void refresh_category201_search_list(void)
  2065. {
  2066.     /*----------------------------------------------------------------*/
  2067.     /* Local Variables                                                */
  2068.     /*----------------------------------------------------------------*/
  2069.     S32 no_entries = 0;
  2070.     U8 *name = MMI_multiline_inputbox.text;
  2071.     /*----------------------------------------------------------------*/
  2072.     /* Code Body                                                      */
  2073.     /*----------------------------------------------------------------*/
  2074.     no_entries = cat200_search_function(name);
  2075.     load_dynamic_item_buffer(no_entries);
  2076.     if (no_entries >= 0)
  2077.     {
  2078.         refresh_category201_search_list_change_list(no_entries);
  2079.         gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  2080.     }
  2081. }
  2082. /* MTK Leo end */
  2083. /*****************************************************************************
  2084.  * FUNCTION
  2085.  *  cat201_register_key_func
  2086.  * DESCRIPTION
  2087.  *  
  2088.  * PARAMETERS
  2089.  *  void
  2090.  * RETURNS
  2091.  *  void
  2092.  *****************************************************************************/
  2093. void cat201_register_key_func(void)
  2094. {
  2095.     /*----------------------------------------------------------------*/
  2096.     /* Local Variables                                                */
  2097.     /*----------------------------------------------------------------*/
  2098.     /*----------------------------------------------------------------*/
  2099.     /* Code Body                                                      */
  2100.     /*----------------------------------------------------------------*/
  2101.     /* when first word is highlighted, user should not be able to go to last item by pressing up arrow key. */
  2102.     if (MMI_fixed_list_menu.highlighted_item != 0)
  2103.     {
  2104.         SetKeyHandler(dynamic_list_goto_previous_item, KEY_UP_ARROW, KEY_EVENT_DOWN);
  2105.         SetKeyHandler(dynamic_list_goto_previous_item, KEY_VOL_UP, KEY_EVENT_DOWN);
  2106.     }
  2107.     SetKeyHandler(dynamic_list_goto_next_item, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  2108.     SetKeyHandler(dynamic_list_goto_next_item, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  2109. }
  2110. /*****************************************************************************
  2111.  * FUNCTION
  2112.  *  ShowCategory201Screen
  2113.  * DESCRIPTION
  2114.  *  category screen of phone search
  2115.  * PARAMETERS
  2116.  *  title                       [IN]        Title id
  2117.  *  title_icon                  [IN]        Title icon
  2118.  *  left_softkey                [IN]        Left soft key label
  2119.  *  left_softkey_icon           [IN]        Left soft key icon
  2120.  *  right_softkey               [IN]        Right soft key label
  2121.  *  right_softkey_icon          [IN]        Right soft key icon
  2122.  *  number_of_items             [IN]        Number of items
  2123.  *  get_item_func               [IN]        
  2124.  *  get_hint_func               [IN]        
  2125.  *  highlighted_item            [IN]        Highlighted item index
  2126.  *  search_image                [IN]        Seach image
  2127.  *  buffer                      [IN]        Buffer
  2128.  *  buffer_max_length           [IN]        
  2129.  *  input_type                  [IN]        
  2130.  *  history_buffer              [IN]        Histpry buffer
  2131.  *  required_input_mode_set     [?]         
  2132.  *  top_msg(?)                  [IN]        Message display below title bar
  2133.  *  list_of_items(?)            [IN]        List of items
  2134.  *  max_buffer_legth(?)         [IN]        Max size of buffer length
  2135.  *  list_of_icons1(?)           [IN]        List of icons
  2136.  * RETURNS
  2137.  *  void
  2138.  *****************************************************************************/
  2139. extern U8 wgui_multiline_inputbox_input_type;
  2140. extern void cat5_virtual_keypad_callback(void);
  2141. extern void wgui_redraw_input_information_bar(void);
  2142. void ShowCategory201Screen(
  2143.         U16 title,
  2144.         U16 title_icon,
  2145.         U16 left_softkey,
  2146.         U16 left_softkey_icon,
  2147.         U16 right_softkey,
  2148.         U16 right_softkey_icon,
  2149.         S32 number_of_items,
  2150.         GetItemFuncPtr get_item_func,
  2151.         GetHintFuncPtr get_hint_func,
  2152.         S32 highlighted_item,
  2153.         U16 search_image,
  2154.         U8 *buffer,
  2155.         S32 buffer_max_length,
  2156.         S16 input_type,
  2157.         U8 *history_buffer,
  2158.         S16 *required_input_mode_set)
  2159. {
  2160.     /*----------------------------------------------------------------*/
  2161.     /* Local Variables                                                */
  2162.     /*----------------------------------------------------------------*/
  2163.     dm_data_struct dm_data;
  2164.     U8 h_flag;
  2165.     S32 temp_w = 0, temp_h = 0;
  2166.     U8 *img = NULL;
  2167.     S32 input_box_width = 0;
  2168.     BOOL languageChanged = FALSE;
  2169.     S32 iwidth, iheight, max_entries = 0;
  2170.     /*----------------------------------------------------------------*/
  2171.     /* Code Body                                                      */
  2172.     /*----------------------------------------------------------------*/
  2173.     gdi_layer_lock_frame_buffer();
  2174.     MMI_menu_shortcut_number = -1;
  2175.     change_left_softkey(left_softkey, left_softkey_icon);
  2176.     change_right_softkey(right_softkey, right_softkey_icon);
  2177.     SetupCategoryKeyHandlers();
  2178.     /* Begin AP input mode set */
  2179.     if (required_input_mode_set != NULL)
  2180.     {
  2181.         wgui_fill_AP_required_input_mode_set(required_input_mode_set);
  2182.         wgui_set_AP_required_input_mode_set_flag();
  2183.     }
  2184.     /* End AP input mode set */
  2185. #ifdef __MMI_T9__
  2186.     InuptMethodEnterCategory5();
  2187. #elif defined __MMI_ZI__
  2188.     ZiInuptMethodEnterCategory5();
  2189. //KP Jerry add on 2007-3-8 start
  2190. #elif defined __MMI_CSTAR__
  2191.    CstarInputMethodEnterCategory5();
  2192. //KP Jerry add on 2007-3-8 end
  2193. #elif defined __MMI_KA__
  2194.     KonkaInuptMethodEnterCategory5();
  2195. #elif defined __MMI_ITAP__
  2196. /* under construction !*/
  2197. #endif 
  2198.     create_fixed_icontext_menuitems();
  2199.     MMI_current_menu_type = LIST_MENU;
  2200.     associate_fixed_icontext_list();
  2201.     MMI_disable_title_shortcut_display = 1;
  2202.     if (history_buffer)
  2203.     {
  2204.         if (wgui_multiline_inputbox_input_type != 0)
  2205.         {
  2206.             languageChanged = wgui_check_language_changed((U8) wgui_multiline_inputbox_input_type);
  2207.         }
  2208.     }
  2209.     init_dynamic_item_buffer(number_of_items, get_item_func, get_hint_func, UI_dummy_function);
  2210.     MMI_fixed_list_menu.n_items = number_of_items;
  2211.     if (wgui_check_application_present)
  2212.     {
  2213.         wgui_check_application_present(&max_entries);
  2214.     }
  2215.     /*
  2216.      * shortcut_width=set_menu_item_count(max_entries)+7; //number of element increases at the run time 
  2217.      * resize_menu_shortcut_handler(shortcut_width,MMI_title_height);
  2218.      * move_menu_shortcut_handler(UI_device_width-shortcut_width, MMI_title_y);
  2219.      * register_hide_menu_shortcut(gui_redraw_menu_shortcut);
  2220.      */
  2221.     MMI_fixed_list_menu.flags |= UI_LIST_MENU_ALIGN_TO_TOP | UI_LIST_MENU_DISABLE_SCROLLBAR;
  2222.     register_fixed_list_highlight_handler(dynamic_list_highlight_handler);
  2223.     img = (U8*) GetImage(search_image);
  2224.     gui_measure_image(img, &temp_w, &temp_h);
  2225.     input_box_width = (UI_device_width - (5 + temp_w + 1) - 4);
  2226.     h_flag = set_list_menu_category_history(MMI_CATEGORY201_ID, history_buffer);
  2227.     if (h_flag)
  2228.     {
  2229.         S32 s = sizeof(list_menu_category_history);
  2230.         s = (s + 3) / 4;
  2231.         s *= 4;
  2232.         MMI_fixed_list_menu.item_measure_function(NULL, MMI_fixed_list_menu.common_item_data, &iwidth, &iheight);
  2233.         MMI_fixed_list_menu.height = iheight * MMI_fixed_list_menu.displayed_items + 10;        /* need to handle this in more cleaner way, it is 22X4 +10 =98, as we only show 4 rows */
  2234.         if (wgui_multiline_inputbox_input_type != 0)
  2235.         {
  2236.             if (languageChanged)
  2237.             {
  2238.                 MMI_fixed_list_menu.highlighted_item = 0;
  2239.             }
  2240.         }
  2241.         dynamic_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  2242.         wgui_setup_inputbox_ext(
  2243.             0,
  2244.             0,
  2245.             UI_device_width - temp_w,
  2246.             temp_h,
  2247.             buffer,
  2248.             buffer_max_length,
  2249.             MMI_CATEGORY201_ID,
  2250.             get_string(right_softkey),
  2251.             get_image(right_softkey_icon),
  2252.             input_type,
  2253.             history_buffer + s,
  2254.             1,
  2255.             UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR,
  2256.             0,
  2257.             0,
  2258.             0,
  2259.             0,
  2260.             NULL);
  2261.         if (wgui_multiline_inputbox_input_type != 0)
  2262.         {
  2263.             if (languageChanged)
  2264.             {
  2265.                 multiline_inputbox_delete_all_characters();
  2266.                 set_right_softkey_function(GoBackHistory, KEY_EVENT_UP);
  2267.             }
  2268.         }
  2269.         /* MTK Terry for history issue */
  2270.         if (cat200_search_function)
  2271.         {
  2272.             //S32 no_entries;
  2273.             //no_entries = /*cat200_search_function((U8*)MMI_multiline_inputbox.text)*/number_of_items;
  2274.             //load_dynamic_item_buffer(no_entries );
  2275.             //refresh_search_list_change_list_ext(no_entries,MMI_fixed_list_menu.highlighted_item);
  2276.         }
  2277.     }
  2278.     else
  2279.     {
  2280.         wgui_setup_inputbox_ext(
  2281.             0,
  2282.             0,
  2283.             UI_device_width - temp_w,
  2284.             temp_h,
  2285.             buffer,
  2286.             buffer_max_length,
  2287.             MMI_CATEGORY201_ID,
  2288.             get_string(right_softkey),
  2289.             get_image(right_softkey_icon),
  2290.             input_type,
  2291.             NULL,
  2292.             1,
  2293.             UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR,
  2294.             0,
  2295.             0,
  2296.             0,
  2297.             0,
  2298.             NULL);
  2299.         dynamic_list_goto_item_no_redraw(highlighted_item);
  2300.     }
  2301.     /* multiline inputbox */
  2302.     inputbox_change_mode = change_multiline_inputbox_input_mode;
  2303.     MMI_multiline_inputbox.change_callback = refresh_category201_search_list;
  2304.     cat200_search_img = search_image;
  2305.     wgui_set_multiline_inputbox_register_up_down_key_funcptr(cat201_register_key_func);
  2306.     register_hide_multitap(category5_hide_multitap);
  2307.     /* up and down keys are handled by list menu */
  2308.     register_dynamic_list_keys();
  2309.     MMI_title_string = (UI_string_type) (get_string(title));
  2310.     MMI_title_icon = (PU8) (get_image(title_icon));
  2311.     resize_dynamic_icontext_menuitems_to_list_width();
  2312.     set_fixed_icontext_positions(MMI_ICONTEXT_MENUITEM_HEIGHT + 2, 0, 1, 0);//111106 dynamic icontext
  2313.     if (h_flag)
  2314.     {
  2315.         set_dynamic_pop_up_descriptions(MMI_fixed_list_menu.highlighted_item);
  2316.         if (MMI_fixed_list_menu.highlighted_item <= 0)
  2317.         {
  2318.             ClearKeyHandler(KEY_UP_ARROW, KEY_EVENT_DOWN);
  2319.             ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_DOWN);
  2320.         }
  2321.     }
  2322.     else
  2323.     {
  2324.         set_dynamic_pop_up_descriptions(highlighted_item);
  2325.     }
  2326.     wgui_multiline_inputbox_input_type = 0;
  2327.     wgui_singleline_inputbox_LSK_label_icon = get_image(left_softkey_icon);
  2328.     wgui_singleline_inputbox_LSK_label_string = get_string(left_softkey);
  2329.     gdi_layer_unlock_frame_buffer();
  2330.     ExitCategoryFunction = ExitCategory201Screen;
  2331.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory201History, GetCategory201HistorySize);
  2332.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2333.     dm_data.s32flags |= DM_SHOW_VKPAD;
  2334.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2335.     dm_data.s32CatId = MMI_CATEGORY201_ID;
  2336.     dm_setup_data(&dm_data);
  2337. #ifdef __MMI_TOUCH_SCREEN__
  2338.     dm_register_vkpad_callback(cat201_virtual_keypad_callback);
  2339. #endif 
  2340.     dm_redraw_category_screen();
  2341. }
  2342. /*****************************************************************************
  2343.  * FUNCTION
  2344.  *  RedrawCategoryControlledArea201Screen
  2345.  * DESCRIPTION
  2346.  *  
  2347.  * PARAMETERS
  2348.  *  void
  2349.  * RETURNS
  2350.  *  void
  2351.  *****************************************************************************/
  2352. void RedrawCategoryControlledArea201Screen(void)
  2353. {
  2354.     /*----------------------------------------------------------------*/
  2355.     /* Local Variables                                                */
  2356.     /*----------------------------------------------------------------*/
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Code Body                                                      */
  2359.     /*----------------------------------------------------------------*/
  2360.     gdi_layer_lock_frame_buffer();
  2361.     wgui_redraw_input_information_bar();
  2362.     show_dynamic_list();
  2363. #if defined(__MMI_TOUCH_SCREEN__)
  2364.     mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  2365.     redraw_multiline_inputbox();
  2366. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  2367.     gdi_layer_unlock_frame_buffer();
  2368.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  2369. }
  2370. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  2371. /*****************************************************************************
  2372.  * FUNCTION
  2373.  *  ShowCategory273Screen
  2374.  * DESCRIPTION
  2375.  *  A category to display thumbnail images in menu item.
  2376.  *  * PARAMETERS
  2377.  *  *  title                IN Title for the screen
  2378.  *  *  title_icon           IN Icon shown with the title
  2379.  *  *  left_softkey         IN Left softkey label
  2380.  *  *  left_softkey_icon    IN Icon for the Left softkey
  2381.  *  *  right_softkey        IN right softkey label
  2382.  *  *  right_softkey_icon   IN Icon for the right softkey
  2383.  *  *  number_of_items      IN number of items to be displayed
  2384.  *  *  get_item_func        IN function pointer to get next displayed items
  2385.  *  *  get_display_style_func        IN function pointer to get the display style of next item
  2386.  *  *  get_properties_func                          IN      function pointer to get the properties to highlighted menu item
  2387.  *  *  highlighted_item     IN index of item to be highlighted
  2388.  *  *  history_buffer       IN history buffer
  2389.  *  *  disable_data_cache      IN whether caching of dynamic data is disabled
  2390.  *  *  flush_data_callback     IN callback function invoked before data is reloaded
  2391.  *  *
  2392.  *  * RETURNS
  2393.  *  *  void
  2394.  * PARAMETERS
  2395.  *  title                       [IN]        
  2396.  *  title_icon                  [IN]        
  2397.  *  left_softkey                [IN]        
  2398.  *  left_softkey_icon           [IN]        
  2399.  *  right_softkey               [IN]        
  2400.  *  right_softkey_icon          [IN]        
  2401.  *  number_of_items             [IN]        
  2402.  *  get_item_func               [IN]        
  2403.  *  get_display_style_func      [IN]        
  2404.  *  get_properties_func         [IN]        
  2405.  *  highlighted_item            [IN]        
  2406.  *  history_buffer              [?]         
  2407.  * RETURNS
  2408.  *  void
  2409.  *****************************************************************************/
  2410. void ShowCategory273Screen(
  2411.         U16 title,
  2412.         U16 title_icon,
  2413.         U16 left_softkey,
  2414.         U16 left_softkey_icon,
  2415.         U16 right_softkey,
  2416.         U16 right_softkey_icon,
  2417.         S32 number_of_items,
  2418.         GetItemFuncPtr get_item_func,
  2419.         wgui_get_display_style get_display_style_func,
  2420.         wgui_get_two_line_menu_item_properties get_properties_func,
  2421.         S32 highlighted_item,
  2422.         U8 *history_buffer)
  2423. {
  2424.     /*----------------------------------------------------------------*/
  2425.     /* Local Variables                                                */
  2426.     /*----------------------------------------------------------------*/
  2427.     dm_data_struct dm_data;
  2428.     S32 shortcut_width;
  2429.     U8 h_flag;
  2430.     /*----------------------------------------------------------------*/
  2431.     /* Code Body                                                      */
  2432.     /*----------------------------------------------------------------*/
  2433.     gdi_layer_lock_frame_buffer();
  2434.     wgui_set_pfn_to_get_display_style(get_display_style_func);
  2435.     wgui_set_pfn_to_get_current_menu_item_properties(get_properties_func);
  2436.     gui_add_cleanup_hook(wgui_two_line_reset_all_pointers);//060606 2 line Calvin
  2437.     if (history_buffer)
  2438.     {
  2439.         wgui_two_line_disable_complete_callback();
  2440.     }
  2441.     MMI_title_string = (UI_string_type) get_string(title);
  2442.     MMI_title_icon = (PU8) get_image(title_icon);
  2443.     MMI_menu_shortcut_number = -1;
  2444.     change_left_softkey(left_softkey, left_softkey_icon);
  2445.     change_right_softkey(right_softkey, right_softkey_icon);
  2446.     SetupCategoryKeyHandlers();
  2447.     create_fixed_icontext_menuitems();
  2448.     MMI_current_menu_type = LIST_MENU;
  2449.     resize_fixed_list(MMI_content_width, MMI_content_height);
  2450.     associate_fixed_icontext_list();
  2451. #ifdef __MMI_TOUCH_SCREEN__
  2452.    gui_set_fixed_list_menu_item_pen_function(
  2453.         &MMI_fixed_list_menu,
  2454.         gui_fixed_icontext_menuitem_translate_pen_event,
  2455.         MMI_TRUE,
  2456.         MMI_FALSE);
  2457. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2458.     init_dynamic_item_buffer(number_of_items, get_item_func, NULL, UI_dummy_function);
  2459.     MMI_fixed_list_menu.n_items = number_of_items;
  2460.     register_dynamic_list_shortcut_handler();
  2461.     register_dynamic_list_keys();
  2462.     shortcut_width = set_menu_item_count(number_of_items) + 7;
  2463.     resize_menu_shortcut_handler(shortcut_width, (MMI_title_height));
  2464.     move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  2465.     register_hide_menu_shortcut(draw_title);
  2466.     resize_fixed_icontext_menuitems(0, MMI_MENUITEM_HEIGHT);
  2467.     set_fixed_icontext_positions(MMI_ICONTEXT_MENUITEM_HEIGHT + 2, 0, 1, 0);
  2468.     // TODO: temp removed
  2469.     register_fixed_list_highlight_handler(dynamic_list_highlight_handler);
  2470.     h_flag = set_list_menu_category_history(MMI_CATEGORY273_ID, history_buffer);
  2471.     dynamic_list_goto_item_no_redraw(h_flag ? MMI_fixed_list_menu.highlighted_item : highlighted_item);
  2472.     set_dynamic_pop_up_descriptions(h_flag ? MMI_fixed_list_menu.highlighted_item : highlighted_item);
  2473.     gdi_layer_unlock_frame_buffer();
  2474.     ExitCategoryFunction = ExitCategory273Screen;
  2475.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  2476.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2477.     dm_data.s32CatId = MMI_CATEGORY273_ID;
  2478.     dm_data.s32flags = 0;
  2479.     dm_setup_data(&dm_data);
  2480.     dm_redraw_category_screen();
  2481. }   /* end of ShowCategory273Screen */
  2482. /*****************************************************************************
  2483.  * FUNCTION
  2484.  *  ExitCategory273Screen
  2485.  * DESCRIPTION
  2486.  *  Exits the Category 273 Screen
  2487.  * PARAMETERS
  2488.  *  void
  2489.  * RETURNS
  2490.  *  void
  2491.  *****************************************************************************/
  2492. void ExitCategory273Screen(void)
  2493. {
  2494.     /*----------------------------------------------------------------*/
  2495.     /* Local Variables                                                */
  2496.     /*----------------------------------------------------------------*/
  2497.     /*----------------------------------------------------------------*/
  2498.     /* Code Body                                                      */
  2499.     /*----------------------------------------------------------------*/
  2500.     ClearHighlightHandler();
  2501.     reset_softkeys();
  2502.     reset_menu_shortcut_handler();
  2503.     reset_dynamic_list();
  2504.     reset_pop_up_descriptions();
  2505.     dynamic_item_text_align_left = FALSE;
  2506. #ifdef __MMI_UI_HINTS_IN_MENUITEM__
  2507.     reset_all_force_flags_for_hints();
  2508. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  2509.     gui_unblock_list_effect();
  2510. #endif 
  2511. #endif /* __MMI_UI_HINTS_IN_MENUITEM__ */ 
  2512. }
  2513. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 
  2514. /* barcode */
  2515. extern void register_multiline_inputbox_hilite_keys(void);//110606 compile warning
  2516. #ifdef __MMI_TOUCH_SCREEN__
  2517. extern void register_multiline_inputbox_hilite_pen_event_handler(void);
  2518. #endif
  2519. /*****************************************************************************
  2520.  * FUNCTION
  2521.  *  ShowCategory228Screen
  2522.  * DESCRIPTION
  2523.  *  
  2524.  * PARAMETERS
  2525.  *  title                   [IN]        
  2526.  *  title_icon              [IN]        
  2527.  *  left_softkey            [IN]        
  2528.  *  left_softkey_icon       [IN]        
  2529.  *  right_softkey           [IN]        
  2530.  *  right_softkey_icon      [IN]        
  2531.  *  buffer                  [?]         
  2532.  *  buffer_size             [IN]        
  2533.  *  hilite_str_list         [?]         
  2534.  *  hilite_str_number       [IN]        
  2535.  *  hilite_cb               [IN]        
  2536.  *  history_buffer          [?]         
  2537.  * RETURNS
  2538.  *  void
  2539.  *****************************************************************************/
  2540. void ShowCategory228Screen(
  2541.         U16 title,
  2542.         U16 title_icon,
  2543.         U16 left_softkey,
  2544.         U16 left_softkey_icon,
  2545.         U16 right_softkey,
  2546.         U16 right_softkey_icon,
  2547.         U8 *buffer,
  2548.         S32 buffer_size,
  2549.         HILITE_STR hilite_str_list[],
  2550.         U16 hilite_str_number,
  2551.         void (*hilite_cb) (S32 idx),
  2552.         U8 *history_buffer)
  2553. {
  2554.     /*----------------------------------------------------------------*/
  2555.     /* Local Variables                                                */
  2556.     /*----------------------------------------------------------------*/
  2557.     dm_data_struct dm_data;
  2558.     S32 l;
  2559.     S16 input_type = 0;
  2560.     U8 h = 0;
  2561.     /*----------------------------------------------------------------*/
  2562.     /* Code Body                                                      */
  2563.     /*----------------------------------------------------------------*/
  2564.     gdi_layer_lock_frame_buffer();
  2565.     MMI_menu_shortcut_number = -1;
  2566.     MMI_disable_title_shortcut_display = 1;
  2567.     change_left_softkey(left_softkey, left_softkey_icon);
  2568.     change_right_softkey(right_softkey, right_softkey_icon);
  2569.     SetupCategoryKeyHandlers();
  2570.     MMI_title_string = (UI_string_type) get_string(title);
  2571.     MMI_title_icon = (PU8) get_image(title_icon);
  2572.     l = gui_strlen((UI_string_type) buffer);
  2573.     create_multiline_inputbox_set_buffer((UI_string_type) buffer, buffer_size, l, 0);
  2574.     register_multiline_inputbox_viewer_keys();
  2575.     register_multiline_inputbox_hilite_keys();
  2576.     MMI_multiline_inputbox.hilite_list = hilite_str_list;
  2577.     MMI_multiline_inputbox.hilite_str_number = hilite_str_number;
  2578.     MMI_multiline_inputbox.current_hilite_idx = 0;
  2579. #ifdef __MMI_TOUCH_SCREEN__
  2580.     register_multiline_inputbox_hilite_pen_event_handler();
  2581. #endif 
  2582.     MMI_multiline_inputbox.flags |=
  2583.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE |
  2584.          UI_MULTI_LINE_INPUT_BOX_WORD_HIGHLIGHT);
  2585. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2586.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  2587. #endif 
  2588.     MMI_multiline_inputbox.hilite_cb = hilite_cb;
  2589.     h = set_multiline_inputbox_category_history(MMI_CATEGORY228_ID, history_buffer, &input_type);
  2590.     if (hilite_str_number != 0)
  2591.     {
  2592.     if (h)
  2593.     {
  2594.         gui_multi_line_input_box_go_to_hilite(
  2595.             &MMI_multiline_inputbox,
  2596.             (U16)MMI_multiline_inputbox.current_hilite_idx,
  2597.             MMI_TRUE);
  2598.     }
  2599.     else
  2600.     {
  2601.         gui_multi_line_input_box_go_to_hilite(&MMI_multiline_inputbox, 0, MMI_FALSE);
  2602.     }
  2603.     }
  2604.     gdi_layer_unlock_frame_buffer();
  2605.     ExitCategoryFunction = ExitCategory74Screen;
  2606.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  2607.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2608.     dm_data.s32CatId = MMI_CATEGORY228_ID;
  2609.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2610.     dm_setup_data(&dm_data);
  2611.     dm_redraw_category_screen();
  2612. }
  2613. void ExitCategory402Screen(void);
  2614. /*****************************************************************************
  2615.  * FUNCTION
  2616.  *  Cat402ScrolTextBg
  2617.  * DESCRIPTION
  2618.  *  
  2619.  * PARAMETERS
  2620.  *  x1                  [IN]        start x
  2621.  *  y1                  [IN]        start y
  2622.  *  x2                  [IN]        end x
  2623.  *  y2                  [IN]        end y
  2624.  * RETURNS
  2625.  *  void
  2626.  *****************************************************************************/
  2627. void Cat402ScrolTextBg(S32 x1, S32 y1, S32 x2, S32 y2)
  2628. {
  2629.     gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_WHITE);
  2630. }
  2631. /*****************************************************************************
  2632.  * FUNCTION
  2633.  *  ShowCategory402Screen
  2634.  * DESCRIPTION
  2635.  *  
  2636.  * PARAMETERS
  2637.  *  title                   [?]         
  2638.  *  title_icon              [IN]        
  2639.  *  left_softkey            [IN]        
  2640.  *  left_softkey_icon       [IN]        
  2641.  *  right_softkey           [IN]        
  2642.  *  right_softkey_icon      [IN]        
  2643.  *  string                  [?]         
  2644.  *  percentage              [IN]
  2645.  *  progress_string         [IN]
  2646.  * RETURNS
  2647.  *  void
  2648.  *****************************************************************************/
  2649. void ShowCategory402Screen(
  2650.     U8 *title,
  2651.     U16 title_icon,
  2652.     U16 left_softkey,
  2653.     U16 left_softkey_icon,
  2654.     U16 right_softkey,
  2655.     U16 right_softkey_icon,
  2656.     U8 *string,
  2657.     U16 percentage,
  2658.     U8 *progress_string)
  2659. {
  2660.     /*----------------------------------------------------------------*/
  2661.     /* Local Variables                                                */
  2662.     /*----------------------------------------------------------------*/
  2663.     dm_data_struct dm_data;
  2664.     color text_color = gui_color(0, 0, 0);
  2665.     /*----------------------------------------------------------------*/
  2666.     /* Code Body                                                      */
  2667.     /*----------------------------------------------------------------*/
  2668.     MMI_title_string = (UI_string_type) title;
  2669.     MMI_title_icon = (PU8) get_image(title_icon);
  2670.     MMI_menu_shortcut_number = -1;
  2671.     change_left_softkey(left_softkey, left_softkey_icon);
  2672.     change_right_softkey(right_softkey, right_softkey_icon);
  2673.     SetupCategoryKeyHandlers();
  2674.     dm_add_scroll_text((UI_string_type) string, NULL, Cat402ScrolTextBg, text_color, text_color);
  2675.     Cat402PercentageBarId = dm_add_percentage_bar(
  2676.                                 percentage,
  2677.                                 progress_string,
  2678.                                 UI_COLOR_RED,
  2679.                                 IMG_PERCENTAGE_BAR_BG_IMAGE,
  2680.                                 IMG_PERCENTAGE_BAR_LEFT_IMAGE,
  2681.                                 IMG_PERCENTAGE_BAR_RIGHT_IMAGE);
  2682.     ExitCategoryFunction = ExitCategory402Screen;
  2683.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  2684.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2685.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2686.     dm_data.s32CatId = MMI_CATEGORY402_ID;
  2687.     dm_setup_data(&dm_data);
  2688.     dm_redraw_category_screen();
  2689. }
  2690. /*****************************************************************************
  2691.  * FUNCTION
  2692.  *  UpdateCategory402Value
  2693.  * DESCRIPTION
  2694.  *  
  2695.  * PARAMETERS
  2696.  *  value       [IN]    
  2697.  *  string      [IN]
  2698.  * RETURNS
  2699.  *  void
  2700.  *****************************************************************************/
  2701. void UpdateCategory402Value(U16 value, U8 *string)
  2702. {
  2703.     /*----------------------------------------------------------------*/
  2704.     /* Local Variables                                                */
  2705.     /*----------------------------------------------------------------*/
  2706.     /*----------------------------------------------------------------*/
  2707.     /* Code Body                                                      */
  2708.     /*----------------------------------------------------------------*/
  2709.     dm_update_percentage_bar_value(Cat402PercentageBarId, value, string);
  2710.     dm_redraw_percentage_bar(Cat402PercentageBarId);
  2711. }
  2712. /*****************************************************************************
  2713.  * FUNCTION
  2714.  *  ExitCategory402Screen
  2715.  * DESCRIPTION
  2716.  *  
  2717.  * PARAMETERS
  2718.  *  void
  2719.  * RETURNS
  2720.  *  void
  2721.  *****************************************************************************/
  2722. void ExitCategory402Screen(void)
  2723. {
  2724.     /*----------------------------------------------------------------*/
  2725.     /* Local Variables                                                */
  2726.     /*----------------------------------------------------------------*/
  2727.     /*----------------------------------------------------------------*/
  2728.     /* Code Body                                                      */
  2729.     /*----------------------------------------------------------------*/
  2730.     Cat402PercentageBarId = 0;
  2731. }
  2732. /*****************************************************************************
  2733.  * FUNCTION
  2734.  *  ShowCategory501Screen
  2735.  * DESCRIPTION
  2736.  *  Displays the category501 screen
  2737.  * PARAMETERS
  2738.  *  title                   [IN]        Title for the screen
  2739.  *  title_icon              [IN]        Icon shown with the title
  2740.  *  left_softkey            [IN]        Left softkey label
  2741.  *  left_softkey_icon       [IN]        Icon for the Left softkey
  2742.  *  right_softkey           [IN]        Right softkey label
  2743.  *  right_softkey_icon      [IN]        Icon for the right softkey
  2744.  *  message_str             [IN]        Message string
  2745.  *  history_buffer          [IN]        History buffer
  2746.  * RETURNS
  2747.  *  void
  2748.  *****************************************************************************/
  2749. void ShowCategory501Screen(
  2750.         U16 title,
  2751.         U16 title_icon,
  2752.         U16 left_softkey,
  2753.         U16 left_softkey_icon,
  2754.         U16 right_softkey,
  2755.         U16 right_softkey_icon,
  2756.         U8* message_str,
  2757.         U8 *history_buffer)
  2758. {
  2759.     /*----------------------------------------------------------------*/
  2760.     /* Local Variables                                                */
  2761.     /*----------------------------------------------------------------*/
  2762.     /*----------------------------------------------------------------*/
  2763.     /* Code Body                                                      */
  2764.     /*----------------------------------------------------------------*/
  2765.     ShowCategory7Screen(
  2766.         title,
  2767.         title_icon,
  2768.         left_softkey,
  2769.         left_softkey_icon,
  2770.         right_softkey,
  2771.         right_softkey_icon,
  2772.         message_str,
  2773.         history_buffer);
  2774. }   /* end of ShowCategory501Screen */