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

MTK

开发平台:

C/C++

  1.     }
  2.     if (g_dm_cntx.redraw_screen_main == REDRAW_2_REDRAW)
  3.     {
  4.         if (!(dm_buttonbar_info.coordinate.Flags & DM_BUTTON_DISABLE_BACKGROUND))
  5.         {
  6.             show_softkey_background();
  7.             draw_arrow_indication(
  8.                 (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_LEFT_ARROW),
  9.                 (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_RIGHT_ARROW),
  10.                 (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_UP_ARROW),
  11.                 (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_DOWN_ARROW));
  12.         }
  13.         if (!(g_dm_data.s32flags & DM_NO_SOFTKEY))
  14.         {
  15.             show_softkey(MMI_LEFT_SOFTKEY);
  16.             show_softkey(MMI_RIGHT_SOFTKEY);
  17.         #ifdef __MMI_WGUI_CSK_ENABLE__
  18.             show_softkey(MMI_CENTER_SOFTKEY);
  19.         #endif 
  20.         }
  21.         return 1;
  22.     }
  23.     gui_reset_clip();
  24.     set_button_bar_height(dm_buttonbar_info.coordinate.s16Height);
  25.     if (!(dm_buttonbar_info.coordinate.Flags & DM_BUTTON_DISABLE_BACKGROUND))
  26.     {
  27.         show_softkey_background();
  28.         draw_arrow_indication(
  29.             (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_LEFT_ARROW),
  30.             (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_RIGHT_ARROW),
  31.             (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_UP_ARROW),
  32.             (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_DOWN_ARROW));
  33.     }
  34.     if (!(g_dm_data.s32flags & DM_NO_SOFTKEY))
  35.     {
  36.     #ifdef __MMI_SCREEN_ROTATE__
  37.         if (mmi_frm_is_screen_width_height_swapped())
  38.         {
  39.             /* Vertical softkey bar aligned to right  */
  40.             /* FIXME. replace fixed value MMI_ROTATED_SOFTKEY_HEIGHT */
  41.             set_softkey_flags_on(UI_BUTTON_RIGHT_ALIGN, MMI_LEFT_SOFTKEY);
  42.             set_softkey_flags_off(UI_BUTTON_LEFT_ALIGN, MMI_LEFT_SOFTKEY);
  43.             move_softkey(
  44.                 dm_buttonbar_info.coordinate.s16X,
  45.                 dm_buttonbar_info.coordinate.s16Y + dm_buttonbar_info.coordinate.s16Height - MMI_ROTATED_SOFTKEY_HEIGHT,
  46.                 MMI_LEFT_SOFTKEY);
  47.             resize_softkey(dm_buttonbar_info.button_width, MMI_ROTATED_SOFTKEY_HEIGHT, MMI_LEFT_SOFTKEY);
  48.             show_softkey(MMI_LEFT_SOFTKEY);
  49.             move_softkey(dm_buttonbar_info.coordinate.s16X, dm_buttonbar_info.coordinate.s16Y, MMI_RIGHT_SOFTKEY);
  50.             resize_softkey(dm_buttonbar_info.button_width, MMI_ROTATED_SOFTKEY_HEIGHT, MMI_RIGHT_SOFTKEY);
  51.             show_softkey(MMI_RIGHT_SOFTKEY);
  52.         #ifdef __MMI_WGUI_CSK_ENABLE__
  53.             set_softkey_flags_on(UI_BUTTON_RIGHT_ALIGN, MMI_CENTER_SOFTKEY);
  54.             set_softkey_flags_off(UI_BUTTON_LEFT_ALIGN, MMI_LEFT_SOFTKEY);
  55.             move_softkey(
  56.                 dm_buttonbar_info.coordinate.s16X,
  57.                 dm_buttonbar_info.coordinate.s16Y + MMI_ROTATED_SOFTKEY_HEIGHT + ((dm_buttonbar_info.coordinate.s16Height - MMI_ROTATED_SOFTKEY_HEIGHT * 3) >> 1),
  58.                 MMI_CENTER_SOFTKEY);
  59.             resize_softkey(dm_buttonbar_info.button_width, MMI_ROTATED_SOFTKEY_HEIGHT, MMI_CENTER_SOFTKEY);
  60.             show_softkey(MMI_CENTER_SOFTKEY);
  61.         #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  62.         }
  63.         else
  64.     #endif /* __MMI_SCREEN_ROTATE__ */ 
  65.         {
  66.             /* PMT SUKRIT START 20060104 */
  67.         #ifdef __MMI_UI_DALMATIAN_SOFTKEYS__
  68.             dm_buttonbar_info.coordinate.s16Height -= (MMI_BUTTON_BAR_HEIGHT - MMI_SOFTKEY_HEIGHT);
  69.             move_softkey(
  70.                 dm_buttonbar_info.coordinate.s16X,
  71.                 dm_buttonbar_info.coordinate.s16Y + (MMI_BUTTON_BAR_HEIGHT - MMI_SOFTKEY_HEIGHT),
  72.                 MMI_LEFT_SOFTKEY);
  73.         #else /* __MMI_UI_DALMATIAN_SOFTKEYS__ */ 
  74.             move_softkey(dm_buttonbar_info.coordinate.s16X, dm_buttonbar_info.coordinate.s16Y, MMI_LEFT_SOFTKEY);
  75.         #endif /* __MMI_UI_DALMATIAN_SOFTKEYS__ */ 
  76.             /* PMT SUKRIT END 20060104 */
  77.             resize_softkey(dm_buttonbar_info.button_width, dm_buttonbar_info.coordinate.s16Height, MMI_LEFT_SOFTKEY);
  78.             show_softkey(MMI_LEFT_SOFTKEY);
  79.             move_softkey(
  80.                 dm_buttonbar_info.coordinate.s16X + dm_buttonbar_info.coordinate.s16Width - dm_buttonbar_info.button_width,
  81.                 dm_buttonbar_info.coordinate.s16Y,
  82.                 MMI_RIGHT_SOFTKEY);
  83.             resize_softkey(dm_buttonbar_info.button_width, dm_buttonbar_info.coordinate.s16Height, MMI_RIGHT_SOFTKEY);
  84.             show_softkey(MMI_RIGHT_SOFTKEY);
  85.         #ifdef __MMI_WGUI_CSK_ENABLE__
  86.             move_softkey(
  87.                 dm_buttonbar_info.coordinate.s16X + dm_buttonbar_info.button_width + ((dm_buttonbar_info.coordinate.s16Width - (dm_buttonbar_info.button_width * 3)) >> 1),
  88.                 dm_buttonbar_info.coordinate.s16Y,
  89.                 MMI_CENTER_SOFTKEY);
  90.             resize_softkey(dm_buttonbar_info.button_width, dm_buttonbar_info.coordinate.s16Height, MMI_CENTER_SOFTKEY);
  91.             show_softkey(MMI_CENTER_SOFTKEY);
  92.         #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  93.         }
  94.     }
  95.     return 1;
  96. }
  97. /*****************************************************************************
  98.  * FUNCTION
  99.  *  dm_setup_and_draw_inline_item
  100.  * DESCRIPTION
  101.  *  This function is used setup the inline items based on the coordinate set and
  102.  *  then draw it
  103.  * PARAMETERS
  104.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  105.  *  *(?)
  106.  * RETURNS
  107.  *  void
  108.  *****************************************************************************/
  109. S32 dm_setup_and_draw_inline_item(S16 **UICtrlAccessPtr_p)
  110. {
  111.     /*----------------------------------------------------------------*/
  112.     /* Local Variables                                                */
  113.     /*----------------------------------------------------------------*/
  114.     dm_coordinates dm_inline_fixed_list_info;
  115.     fixed_icontext_menuitem *menuitem_p;
  116.     /*----------------------------------------------------------------*/
  117.     /* Code Body                                                      */
  118.     /*----------------------------------------------------------------*/
  119.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_inline_fixed_list_info);
  120.     if (dm_inline_fixed_list_info.s16X == -1 || dm_inline_fixed_list_info.s16Y == -1 ||
  121.         dm_inline_fixed_list_info.s16Width == -1 || dm_inline_fixed_list_info.s16Height == -1)
  122.     {
  123.         return 0;
  124.     }
  125.     if (g_dm_cntx.redraw_screen_main != REDRAW_2_REDRAW)
  126.     {
  127.         gui_set_font(&MMI_medium_font);
  128.         MMI_fixed_icontext_menuitem.text_font = &MMI_medium_font;
  129.         MMI_fixed_text_menuitem.text_font = &MMI_medium_font;
  130.         move_fixed_list(dm_inline_fixed_list_info.s16X, dm_inline_fixed_list_info.s16Y);
  131.         resize_fixed_list(dm_inline_fixed_list_info.s16Width, dm_inline_fixed_list_info.s16Height);
  132.         /* W06.05 Do not draw fixed list in category57 because of virtual keyboard */
  133.         if ((g_dm_data.s32flags & DM_SHOW_VKPAD))
  134.         {
  135.         #if defined(__MMI_TOUCH_SCREEN__)
  136.             mmi_pen_editor_store_list_menu_height(MMI_fixed_list_menu.height);
  137.             if ((GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY != MMI_virtual_keyboard.lang_type)
  138.                 && (!((current_wgui_inline_item->flags & INLINE_ITEM_TYPE_MASK) == INLINE_ITEM_TYPE_FULL_SCREEN_EDIT)))
  139.             {
  140.                 /*
  141.                 resize_fixed_list(
  142.                     MMI_content_width,
  143.                     mmi_pen_editor_get_list_menu_height() - MMI_virtual_keyboard.height - 1);
  144.                 */
  145.                 mmi_pen_editor_list_menu_highlight_resize();
  146.                 /* W06.07 Locate highlighted item after resizing fixed list menu */
  147.                 gui_fixed_list_menu_locate_highlighted_item(&MMI_fixed_list_menu);
  148.                 /* W06.10 Make sure that the inline multi line edit is the first display item */
  149.                 if ((current_wgui_inline_item->flags & INLINE_ITEM_TYPE_MASK) == INLINE_ITEM_TYPE_MULTI_LINE_EDIT)
  150.                 {
  151.                     MMI_fixed_list_menu.first_displayed_item = MMI_fixed_list_menu.highlighted_item;
  152.                 }
  153.             }
  154.         #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  155.         }
  156.         menuitem_p = (fixed_icontext_menuitem*) MMI_fixed_list_menu.common_item_data;
  157.         /* menuitem_p->width = dm_inline_fixed_list_info.s16Width; */
  158.         gui_set_fixed_list_menu_common_item_data(&MMI_fixed_list_menu, menuitem_p);
  159.         move_fixed_list(dm_inline_fixed_list_info.s16X, dm_inline_fixed_list_info.s16Y);
  160.     }
  161.     show_fixed_list();
  162.     redraw_current_inline_item();
  163.     return 1;
  164. }
  165. /*****************************************************************************
  166.  * FUNCTION
  167.  *  dm_setup_and_draw_base_control_set
  168.  * DESCRIPTION
  169.  *  This function is used setup the base control set based on the coordinate set and
  170.  *  then draw it
  171.  * PARAMETERS
  172.  *  _UICtrlAccessPtr            [IN]            
  173.  *  UICtrlAccessPtr_p(?)        [IN/OUT]        It specifies the start position to take out the coordinates.
  174.  *  *(?)
  175.  * RETURNS
  176.  *  void
  177.  *****************************************************************************/
  178. S32 dm_setup_and_draw_base_control_set(S16 **_UICtrlAccessPtr)
  179. {
  180.     /*----------------------------------------------------------------*/
  181.     /* Local Variables                                                */
  182.     /*----------------------------------------------------------------*/
  183.     U8 *control_set_ptr;
  184.     U8 u8CtrlCt = 0;
  185.     U8 u8NoOfUICtrls = 0;
  186.     S16 *UICtrlAccessPtr_p = NULL;
  187. #ifdef __MMI_SCREEN_ROTATE__
  188.     MMI_BOOL popup_in_rotated_screen = MMI_FALSE;
  189. #endif 
  190.     /*----------------------------------------------------------------*/
  191.     /* Code Body                                                      */
  192.     /*----------------------------------------------------------------*/
  193. #ifdef __MMI_SCREEN_ROTATE__
  194.     /*
  195.      * 1. Draw a border around title and content area. 
  196.      * 2. Clear content area because some category screen (e.g. 66) does not clear it.
  197.      *
  198.      * If a category screen do not want to use standard MMI_ROTATED_{CONTENT|TITLE}_{X|Y}, 
  199.      * it should not contain DM_BASE_CONTROL_SET1 in its control set.
  200.      */
  201.     if (mmi_frm_is_screen_width_height_swapped())
  202.     {
  203.         popup_in_rotated_screen = dm_check_control_exist(g_dm_data.s32CatId, DM_POPUP_BACKGROUND);
  204.         if (!popup_in_rotated_screen && /* Prevent to erase popup background here */
  205.             !(g_dm_data.s32flags & DM_NO_TITLE))
  206.         {
  207.             gui_push_clip();
  208.             gui_reset_clip();
  209.             gui_fill_rectangle(
  210.                 MMI_ROTATED_TITLE_X - 1,
  211.                 MMI_ROTATED_TITLE_Y - 1,
  212.                 MMI_ROTATED_TITLE_X + MMI_ROTATED_TITLE_WIDTH,
  213.                 MMI_ROTATED_TITLE_Y + MMI_ROTATED_TITLE_HEIGHT + MMI_ROTATED_CONTENT_HEIGHT,
  214.                 gui_color(255, 255, 255));
  215.             gui_pop_clip();
  216.         }
  217.     }
  218. #endif /* __MMI_SCREEN_ROTATE__ */ 
  219.     control_set_ptr = dm_get_base_control_set();
  220.     UICtrlAccessPtr_p = dm_get_base_coordinate_set();
  221.     u8NoOfUICtrls = control_set_ptr[0];
  222.     for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)
  223.     {
  224.         switch (control_set_ptr[u8CtrlCt])
  225.         {
  226.             case DM_TITLE1:
  227.             {
  228.                 dm_setup_and_draw_title(&UICtrlAccessPtr_p);
  229.                 break;
  230.             }
  231.             case DM_STATUS_BAR1:
  232.             {
  233.                 dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);
  234.                 break;
  235.             }
  236.             case DM_BUTTON_BAR1:
  237.             {
  238.                 dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);
  239.                 break;
  240.             }
  241.             case DM_SCR_BG:
  242.         #ifdef __MMI_SCREEN_ROTATE__
  243.                 /* 
  244.                  * When screen is rotated, we do not show screen background if popup is drawn.
  245.                  * It simplify the design because partial screen is transparent.
  246.                  */
  247.                 if (!mmi_frm_is_screen_width_height_swapped() || !popup_in_rotated_screen)
  248.         #endif /* __MMI_SCREEN_ROTATE__ */ 
  249.                 {
  250.                     if (g_dm_cntx.redraw_screen_main != REDRAW_2_REDRAW)
  251.                     {
  252.                         dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p);
  253.                     }
  254.                 }
  255.         }
  256.     }
  257.     return 1;
  258. }
  259. /*****************************************************************************
  260.  * FUNCTION
  261.  *  dm_setup_and_draw_base_control_set2
  262.  * DESCRIPTION
  263.  *  This function is used setup the base control set 2 based on the coordinate set and
  264.  *  then draw it
  265.  * PARAMETERS
  266.  *  _UICtrlAccessPtr            [IN]            
  267.  *  UICtrlAccessPtr_p(?)        [IN/OUT]        It specifies the start position to take out the coordinates.
  268.  *  *(?)
  269.  * RETURNS
  270.  *  void
  271.  *****************************************************************************/
  272. S32 dm_setup_and_draw_base_control_set2(S16 **_UICtrlAccessPtr)
  273. {
  274.     /*----------------------------------------------------------------*/
  275.     /* Local Variables                                                */
  276.     /*----------------------------------------------------------------*/
  277.     U8 *control_set_ptr;
  278.     U8 u8CtrlCt = 0;
  279.     U8 u8NoOfUICtrls = 0;
  280.     S16 *UICtrlAccessPtr_p = NULL;
  281.     /*----------------------------------------------------------------*/
  282.     /* Code Body                                                      */
  283.     /*----------------------------------------------------------------*/
  284.     control_set_ptr = dm_get_base_control_set2();
  285.     UICtrlAccessPtr_p = dm_get_base_coordinate_set2();
  286.     u8NoOfUICtrls = control_set_ptr[0];
  287.     for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)
  288.     {
  289.         switch (control_set_ptr[u8CtrlCt])
  290.         {
  291.             case DM_STATUS_BAR1:
  292.             {
  293.                 dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);
  294.                 break;
  295.             }
  296.             case DM_BUTTON_BAR1:
  297.             {
  298.                 dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);
  299.                 break;
  300.             }
  301.             case DM_SCR_BG:
  302.             {
  303.                 dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p);
  304.             }
  305.         }
  306.     }
  307.     return 1;
  308. }
  309. /*****************************************************************************
  310.  * FUNCTION
  311.  *  dm_setup_and_draw_string
  312.  * DESCRIPTION
  313.  *  This function is used setup the string area set based on the coordinate set and
  314.  *  then draw it
  315.  * PARAMETERS
  316.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  317.  *  index                   [IN]            
  318.  *  *(?)
  319.  * RETURNS
  320.  *  void
  321.  *****************************************************************************/
  322. S32 dm_setup_and_draw_string(S16 **UICtrlAccessPtr_p, S32 index)
  323. {
  324.     /*----------------------------------------------------------------*/
  325.     /* Local Variables                                                */
  326.     /*----------------------------------------------------------------*/
  327.     dm_coordinates dm_string_info;
  328.     S32 string_width, string_height;
  329.     dm_string_data_struct *dm_string;
  330.     /*----------------------------------------------------------------*/
  331.     /* Code Body                                                      */
  332.     /*----------------------------------------------------------------*/
  333. #ifdef __MMI_SUBLCD__
  334.     if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  335.     {
  336.         dm_string = &dm_string_array_sub[index];
  337.     }
  338.     else
  339. #endif /* __MMI_SUBLCD__ */ 
  340.         dm_string = &dm_string_array[index];
  341.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_string_info);
  342.     if (dm_string_info.s16X == -1 || dm_string_info.s16Y == -1 ||
  343.         dm_string_info.s16Width == -1 || dm_string_info.s16Height == -1)
  344.     {
  345.         return 0;
  346.     }
  347.     gui_measure_string(dm_string->string, &string_width, &string_height);
  348.     if (dm_string->string == NULL || (string_width == 0 && string_height == 0))
  349.     {
  350.         return 0;
  351.     }
  352.     if (dm_string_info.s16Height == DM_CALCULATED_HEIGHT)
  353.     {
  354.         /* 060706 menstral Start */
  355.         if ( dm_string_info.Flags & DM_STRING_BORDERED )
  356.         {
  357.             dm_string_info.s16Height=string_height+2;
  358.         }
  359.         else
  360.         {
  361.             dm_string_info.s16Height=string_height;
  362.         }
  363.         /* 060706 menstral End*/
  364.         if (dm_string_info.Flags & DM_PREVIOUS_CONTROL_END_Y_OFFSET_HEIGHT)
  365.         {
  366.             dm_string_info.s16Y -= dm_string_info.s16Height;
  367.         }
  368.     }
  369.     if (dm_string_info.s16Width == DM_CALCULATED_WIDTH)
  370.     {
  371.         dm_string_info.s16Width = string_width + 1;
  372.         if (dm_string_info.Flags & DM_PREVIOUS_CONTROL_END_X_OFFSET_WIDTH)
  373.         {
  374.             dm_string_info.s16X -= dm_string_info.s16Width;
  375.         }
  376.     }
  377.     gui_push_text_clip();
  378.     gui_push_clip();
  379.     if (!dm_aligned_area_data.is_in_aligned_area)
  380.     {
  381.         gui_set_clip(
  382.             dm_string_info.s16X,
  383.             dm_string_info.s16Y,
  384.             dm_string_info.s16X + dm_string_info.s16Width - 1,
  385.             dm_string_info.s16Y + dm_string_info.s16Height - 1);
  386.         if (dm_string_info.Flags & DM_BACK_FILL)
  387.         {
  388.             gui_draw_filled_area(
  389.                 dm_string_info.s16X,
  390.                 dm_string_info.s16Y,
  391.                 dm_string_info.s16X + dm_string_info.s16Width - 1,
  392.                 dm_string_info.s16Y + dm_string_info.s16Height - 1,
  393.                 &(dm_string->back_fill));
  394.         }
  395.         gui_set_font(dm_string->font);
  396.         gui_measure_string(dm_string->string, &string_width, &string_height);
  397.         /* Align the string on x asis as per the flag */
  398.         if (string_width < dm_string_info.s16Width)
  399.         {
  400.             if (dm_string_info.Flags & DM_CENTRE_ALIGN_X)
  401.             {
  402.                 dm_string_info.s16X += (dm_string_info.s16Width - string_width) >> 1;
  403.             }
  404.             else if (dm_string_info.Flags & DM_RIGHT_ALIGN_X)
  405.             {
  406.                 dm_string_info.s16X += (dm_string_info.s16Width - string_width);
  407.             }
  408.         }
  409.         /* Align the string on y asis as per the flag */
  410.         if (string_height < dm_string_info.s16Height)
  411.         {
  412.             if (dm_string_info.Flags & DM_CENTER_ALIGN_Y)
  413.             {
  414.                 dm_string_info.s16Y += (dm_string_info.s16Height - string_height) >> 1;
  415.             }
  416.             else if (dm_string_info.Flags & DM_BOTTOM_ALIGN_Y)
  417.             {
  418.                 dm_string_info.s16Y += (dm_string_info.s16Height - string_height);
  419.             }
  420.         }
  421.         setup_previous_control(&dm_string_info);
  422.         gui_set_text_clip(
  423.             dm_string_info.s16X,
  424.             dm_string_info.s16Y,
  425.             dm_string_info.s16X + dm_string_info.s16Width - 1,
  426.             dm_string_info.s16Y + dm_string_info.s16Height - 1);
  427.         /* Add the string width to string x in case of right to left MMI. */
  428.         if (r2lMMIFlag)
  429.         {
  430.             dm_string_info.s16X += string_width - 1;
  431.         }
  432.         
  433.         gui_set_text_color(dm_string->text_color);
  434.         //gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y);
  435.         if (dm_string_info.Flags & DM_STRING_BORDERED)
  436.         {
  437.             gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y+1);
  438.             gui_set_text_border_color(dm_string->border_color);
  439.             /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
  440.             /* 072106 dm string Start */
  441.             if (string_width > dm_string_info.s16Width)
  442.             {
  443.                 gui_print_truncated_borderd_text(dm_string_info.s16X, dm_string_info.s16Y+1, dm_string_info.s16Width, dm_string->string);
  444.             }
  445.             else
  446.             {
  447.                 gui_print_bordered_text(dm_string->string);
  448.             }
  449.             /* 072106 dm string End */
  450.         }
  451.         else
  452.         {
  453.             /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
  454.             gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y);
  455.             /* 072106 dm string Start */
  456.             if (string_width > dm_string_info.s16Width)
  457.             {
  458.                 gui_print_truncated_text(dm_string_info.s16X, dm_string_info.s16Y, dm_string_info.s16Width, dm_string->string);
  459.             }
  460.             else
  461.             {
  462.                 gui_print_text(dm_string->string);
  463.             }
  464.             /* 072106 dm string End */
  465.         }
  466.         gui_pop_text_clip();
  467.         gui_pop_clip();
  468.         return 1;
  469.     }
  470.     else
  471.     {
  472.         gui_set_font(dm_string->font);
  473.         gui_measure_string(dm_string->string, &string_width, &string_height);
  474.         dm_string_info.s16X = dm_aligned_area_data.s16X;
  475.         dm_string_info.s16Y = dm_aligned_area_data.s16Y;
  476.         gui_set_clip(
  477.             dm_aligned_area_data.s16X,
  478.             dm_aligned_area_data.s16Y,
  479.             dm_aligned_area_data.s16X + dm_aligned_area_data.s16width - 1,
  480.             dm_aligned_area_data.s16Y + dm_aligned_area_data.s16height - 1);
  481.         /* We should make sure background filler is not NULL. */
  482.         if ((dm_string_info.Flags & DM_BACK_FILL) && (&(dm_string->back_fill) != NULL))
  483.         {
  484.             gui_draw_filled_area(
  485.                 dm_aligned_area_data.s16X,
  486.                 dm_aligned_area_data.s16X,
  487.                 dm_aligned_area_data.s16X + dm_aligned_area_data.s16width - 1,
  488.                 dm_aligned_area_data.s16Y + dm_aligned_area_data.s16height - 1,
  489.                 &(dm_string->back_fill));
  490.         }
  491.         /* Align the string on x asis as per the flag */
  492.         if (string_width < dm_aligned_area_data.s16width)
  493.         {
  494.             if (dm_string_info.Flags & DM_CENTRE_ALIGN_X)
  495.             {
  496.                 dm_string_info.s16X += (dm_aligned_area_data.s16width - string_width) >> 1;
  497.             }
  498.             else if (dm_string_info.Flags & DM_RIGHT_ALIGN_X)
  499.             {
  500.                 dm_string_info.s16X += (dm_aligned_area_data.s16width - string_width);
  501.             }
  502.         }
  503.         /* Align the string on y asis as per the flag */
  504.         if (string_height < dm_string_info.s16Height)
  505.         {
  506.             if (dm_string_info.Flags & DM_CENTER_ALIGN_Y)
  507.             {
  508.                 dm_string_info.s16Y += (dm_string_info.s16Height - string_height) >> 1;
  509.             }
  510.             else if (dm_string_info.Flags & DM_BOTTOM_ALIGN_Y)
  511.             {
  512.                 dm_string_info.s16Y += (dm_string_info.s16Height - string_height);
  513.             }
  514.         }
  515.         dm_string_info.s16Y += dm_aligned_area_data.y_space;    /* 101805 pin Calvin */
  516.         gui_set_text_clip(
  517.             dm_string_info.s16X,
  518.             dm_string_info.s16Y,
  519.             dm_string_info.s16X + dm_string_info.s16Width - 1,
  520.             dm_string_info.s16Y + dm_string_info.s16Height - 1);
  521.         /* Add the string width to string x in case of right to left MMI. */
  522.         if (r2lMMIFlag)
  523.         {
  524.             dm_string_info.s16X += string_width - 1;
  525.         }
  526.         gui_set_text_color(dm_string->text_color);
  527.         /* dm_string_info.s16Y+=dm_aligned_area_data.y_space; */
  528.         dm_aligned_area_data.s16Y = dm_string_info.s16Y;
  529.         gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y);
  530.         if (dm_string_info.Flags & DM_STRING_BORDERED)
  531.         {
  532.             gui_set_text_border_color(dm_string->border_color);
  533.             /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
  534.             /* 072106 dm string Start */
  535.             if (string_width > dm_string_info.s16Width)
  536.             {
  537.                 gui_print_truncated_borderd_text(dm_string_info.s16X, dm_string_info.s16Y, dm_string_info.s16Width, dm_string->string);
  538.             }
  539.             else
  540.             {
  541.                 gui_print_bordered_text(dm_string->string);
  542.             }
  543.             /* 072106 dm string End */
  544.         }
  545.         else
  546.         {
  547.             /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
  548.             /* 072106 dm string Start */
  549.             if (string_width > dm_string_info.s16Width)
  550.             {
  551.                 gui_print_truncated_text(dm_string_info.s16X, dm_string_info.s16Y, dm_string_info.s16Width, dm_string->string);
  552.             }
  553.             else
  554.             {
  555.                 gui_print_text(dm_string->string);
  556.             }
  557.             /* 072106 dm string End */
  558.         }
  559.         gui_pop_text_clip();
  560.         gui_pop_clip();
  561.         dm_aligned_area_data.s16Y += string_height;
  562.         return 1;
  563.     }
  564. }
  565. /*****************************************************************************
  566.  * FUNCTION
  567.  *  dm_setup_and_draw_image
  568.  * DESCRIPTION
  569.  *  This function is used setup the image area set based on the coordinate set and
  570.  *  then draw it
  571.  * PARAMETERS
  572.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  573.  *  index                   [IN]            
  574.  *  *(?)
  575.  * RETURNS
  576.  *  void
  577.  *****************************************************************************/
  578. S32 dm_setup_and_draw_image(S16 **UICtrlAccessPtr_p, S32 index)
  579. {
  580.     /*----------------------------------------------------------------*/
  581.     /* Local Variables                                                */
  582.     /*----------------------------------------------------------------*/
  583.     dm_coordinates dm_image_info;
  584.     S32 image_width, image_height;
  585.     dm_image_data_struct *dm_image;
  586.     /*----------------------------------------------------------------*/
  587.     /* Code Body                                                      */
  588.     /*----------------------------------------------------------------*/
  589. #ifdef __MMI_SUBLCD__
  590.     if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  591.     {
  592.         dm_image = &dm_image_array_sub[index];
  593.     }
  594.     else
  595. #endif /* __MMI_SUBLCD__ */ 
  596.         dm_image = &dm_image_array[index];
  597.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_image_info);
  598.     if (dm_image_info.s16X == -1 || dm_image_info.s16Y == -1 ||
  599.         dm_image_info.s16Width == -1 || dm_image_info.s16Height == -1)
  600.     {
  601.         return 0;
  602.     }
  603.     gui_measure_image(dm_image->image, &image_width, &image_height);
  604.     if ((dm_image->image == NULL && dm_image->name == NULL) || (image_width == 0 && image_height == 0))
  605.     {
  606.         return 0;
  607.     }
  608.     if (dm_image_info.s16Height == DM_CALCULATED_HEIGHT)
  609.     {
  610.         dm_image_info.s16Height = image_height;
  611.         if (dm_image_info.Flags & DM_PREVIOUS_CONTROL_END_Y_OFFSET_HEIGHT)
  612.         {
  613.             dm_image_info.s16Y -= dm_image_info.s16Height;
  614.         }
  615.     }
  616.     if (dm_image_info.s16Width == DM_CALCULATED_WIDTH)
  617.     {
  618.         dm_image_info.s16Width = image_width;
  619.         if (dm_image_info.Flags & DM_PREVIOUS_CONTROL_END_X_OFFSET_WIDTH)
  620.         {
  621.             dm_image_info.s16X -= dm_image_info.s16Width;
  622.         }
  623.     }
  624.     if (!dm_aligned_area_data.is_in_aligned_area)
  625.     {
  626.         gui_push_clip();
  627.         gui_set_clip(
  628.             dm_image_info.s16X,
  629.             dm_image_info.s16Y,
  630.             dm_image_info.s16X + dm_image_info.s16Width - 1,
  631.             dm_image_info.s16Y + dm_image_info.s16Height - 1);
  632.         /* We should make sure background filler is not NULL */
  633.         if ((dm_image_info.Flags & DM_BACK_FILL) && (&dm_image->back_fill != NULL))
  634.         {
  635.             gui_draw_filled_area(
  636.                 dm_image_info.s16X,
  637.                 dm_image_info.s16Y,
  638.                 dm_image_info.s16X + dm_image_info.s16Width - 1,
  639.                 dm_image_info.s16Y + dm_image_info.s16Height - 1,
  640.                 dm_image->back_fill);
  641.         }
  642.         gui_measure_image(dm_image->image, &image_width, &image_height);
  643.         /* Align the image on x asis as per the flag */
  644.         /* 062106 cat129 Start */
  645.         if (dm_image_info.Flags & DM_CENTRE_ALIGN_X || dm_image_info.Flags & DM_RIGHT_ALIGN_X)
  646.         {
  647.             if (image_width < dm_image_info.s16Width)
  648.             {
  649.                 if (dm_image_info.Flags & DM_CENTRE_ALIGN_X)
  650.                 {
  651.                     dm_image_info.s16X += (dm_image_info.s16Width - image_width) >> 1;
  652.                 }
  653.                 else if (dm_image_info.Flags & DM_RIGHT_ALIGN_X)
  654.                 {
  655.                     dm_image_info.s16X += (dm_image_info.s16Width - image_width);
  656.                 }
  657.             }
  658.         }
  659.         else if (dm_image_info.Flags & DM_FORCE_CENTRE_ALIGN_X)
  660.         {
  661.             dm_image_info.s16X+=(dm_image_info.s16Width-image_width)>>1;
  662.         }
  663.         /* Align the image on y asis as per the flag */
  664.         if (dm_image_info.Flags & DM_CENTER_ALIGN_Y || dm_image_info.Flags & DM_BOTTOM_ALIGN_Y)
  665.         {
  666.             if (image_height < dm_image_info.s16Height)
  667.             {
  668.                 if (dm_image_info.Flags & DM_CENTER_ALIGN_Y)
  669.                 {
  670.                     dm_image_info.s16Y += (dm_image_info.s16Height - image_height) >> 1;
  671.                 }
  672.                 else if (dm_image_info.Flags & DM_BOTTOM_ALIGN_Y)
  673.                 {
  674.                     dm_image_info.s16Y += (dm_image_info.s16Height - image_height);
  675.                 }
  676.             }
  677.         }
  678.         else if (dm_image_info.Flags & DM_FORCE_CENTER_ALIGN_Y)
  679.         {
  680.             dm_image_info.s16Y+=(dm_image_info.s16Height-image_height)>>1;
  681.         }
  682.         /* 062106 cat129 Start */
  683.         setup_previous_control(&dm_image_info);
  684.         if (dm_image->image_handle != GDI_ERROR_HANDLE)
  685.         {
  686.             gdi_image_stop_animation(dm_image->image_handle);
  687.         }
  688.         if (dm_image->name != NULL) /* from file */
  689.         {
  690.             gdi_image_draw_animation_file(
  691.                 dm_image_info.s16X,
  692.                 dm_image_info.s16Y,
  693.                 (S8*) dm_image->name,
  694.                 &(dm_image->image_handle));
  695.         }
  696.         else if (dm_image->image != NULL)   /* from resource */
  697.         {
  698.             gdi_image_draw_animation(
  699.                 dm_image_info.s16X,
  700.                 dm_image_info.s16Y,
  701.                 dm_image->image,
  702.                 &(dm_image->image_handle));
  703.         }
  704.         dm_image->x = dm_image_info.s16X;
  705.         dm_image->y = dm_image_info.s16Y;
  706.         dm_image->width = image_width;
  707.         dm_image->height = image_height;
  708.         gui_pop_clip();
  709.         return 1;
  710.     }
  711.     else
  712.     {
  713.         S32 image_width = 0, image_height = 0;
  714.         S32 x = 0, y = 0;
  715.         gui_push_clip();
  716.         gui_set_clip(
  717.             dm_aligned_area_data.s16X,
  718.             dm_aligned_area_data.s16Y,
  719.             dm_aligned_area_data.s16X + dm_aligned_area_data.s16width - 1,
  720.             dm_aligned_area_data.s16Y + dm_aligned_area_data.s16height - 1);
  721.         dm_aligned_area_data.s16Y += dm_aligned_area_data.y_space;
  722.         if (dm_image->name != NULL) /* from file */
  723.         {
  724.             gdi_image_get_dimension_file((S8*) dm_image->name, &image_width, &image_height);
  725.             if (dm_aligned_area_data.s16width > image_width)
  726.             {
  727.                 x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
  728.                 y = dm_aligned_area_data.s16Y;
  729.                 gdi_image_draw_animation_file(x, y, (S8*) dm_image->name, &(dm_image->image_handle));
  730.             }
  731.             else
  732.             {
  733.                 x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
  734.                 y = dm_aligned_area_data.s16Y;
  735.                 gdi_image_draw_animation_file(x, y, (S8*) dm_image->name, &(dm_image->image_handle));
  736.             }
  737.         }
  738.         else if (dm_image->image != NULL)   /* from resource */
  739.         {
  740.             gdi_image_get_dimension(dm_image->image, &image_width, &image_height);
  741.             if (dm_aligned_area_data.s16width > image_width)
  742.             {
  743.                 x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
  744.                 y = dm_aligned_area_data.s16Y;
  745.                 gdi_image_draw_animation(x, y, (U8*) dm_image->image, &(dm_image->image_handle));
  746.             }
  747.             else
  748.             {
  749.                 x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
  750.                 y = dm_aligned_area_data.s16Y;
  751.                 gdi_image_draw_animation(x, y, (U8*) dm_image->image, &(dm_image->image_handle));
  752.             }
  753.         }
  754.         dm_image->x = x;
  755.         dm_image->y = y;
  756.         dm_image->width = image_width;
  757.         dm_image->height = image_height;
  758.         dm_aligned_area_data.s16Y += (S16) image_height;
  759.         gui_pop_clip();
  760.         return 1;
  761.     }
  762. }
  763. /*****************************************************************************
  764.  * FUNCTION
  765.  *  dm_setup_and_draw_button
  766.  * DESCRIPTION
  767.  *  This function is used setup the icon button based on the coordinate set and
  768.  *  then draw it
  769.  * PARAMETERS
  770.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  771.  *  index                   [IN]            Index of icon button array
  772.  * RETURNS
  773.  *  void
  774.  *****************************************************************************/
  775. S32 dm_setup_and_draw_button(S16 **UICtrlAccessPtr_p, S32 index)
  776. {
  777.     /*----------------------------------------------------------------*/
  778.     /* Local Variables                                                */
  779.     /*----------------------------------------------------------------*/
  780.     dm_coordinates button_info;
  781.     /*----------------------------------------------------------------*/
  782.     /* Code Body                                                      */
  783.     /*----------------------------------------------------------------*/
  784.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &button_info);
  785.     if (button_info.s16X == -1 || button_info.s16Y == -1 || button_info.s16Width == -1 || button_info.s16Height == -1)
  786.     {
  787.         return 0;
  788.     }
  789.     gdi_layer_push_clip();
  790.     gdi_layer_set_clip(
  791.         button_info.s16X,
  792.         button_info.s16Y,
  793.         button_info.s16X + button_info.s16Width - 1,
  794.         button_info.s16Y + button_info.s16Height - 1);
  795.     if (dm_button_array[index].x == -1 || dm_button_array[index].y == -1)
  796.     {
  797.         gui_move_icontext_button(&dm_button_array[index], button_info.s16X, button_info.s16Y);
  798.     }
  799.     if (dm_button_array[index].width == -1 || dm_button_array[index].height == -1)
  800.     {
  801.         gui_resize_icontext_button(&dm_button_array[index], button_info.s16Width, button_info.s16Height);
  802.     }
  803.     gui_show_icontext_button(&dm_button_array[index]);
  804.     gdi_layer_pop_clip();
  805.     return 1;
  806. }
  807. /*****************************************************************************
  808.  * FUNCTION
  809.  *  dm_setup_and_draw_back_fill_area
  810.  * DESCRIPTION
  811.  *  This function is used setup the back fill area set based on the coordinate set and
  812.  *  then draw it
  813.  * PARAMETERS
  814.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  815.  *  index                   [IN]            
  816.  *  *(?)
  817.  * RETURNS
  818.  *  void
  819.  *****************************************************************************/
  820. S32 dm_setup_and_draw_back_fill_area(S16 **UICtrlAccessPtr_p, S32 index)
  821. {
  822.     /*----------------------------------------------------------------*/
  823.     /* Local Variables                                                */
  824.     /*----------------------------------------------------------------*/
  825.     dm_coordinates dm_back_fill_info;
  826.     /*----------------------------------------------------------------*/
  827.     /* Code Body                                                      */
  828.     /*----------------------------------------------------------------*/
  829.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_back_fill_info);
  830.     if (dm_back_fill_info.s16X == -1 || dm_back_fill_info.s16Y == -1 ||
  831.         dm_back_fill_info.s16Width == -1 || dm_back_fill_info.s16Height == -1)
  832.     {
  833.         return 0;
  834.     }
  835.     gui_push_clip();
  836.     gui_set_clip(
  837.         dm_back_fill_info.s16X,
  838.         dm_back_fill_info.s16Y,
  839.         dm_back_fill_info.s16X + dm_back_fill_info.s16Width - 1,
  840.         dm_back_fill_info.s16Y + dm_back_fill_info.s16Height - 1);
  841.     gui_draw_filled_area(
  842.         dm_back_fill_info.s16X,
  843.         dm_back_fill_info.s16Y,
  844.         dm_back_fill_info.s16X + dm_back_fill_info.s16Width - 1,
  845.         dm_back_fill_info.s16Y + dm_back_fill_info.s16Height - 1,
  846.         dm_back_fill_array[index]);
  847.     gui_pop_clip();
  848.     return 1;
  849. }
  850. /*****************************************************************************
  851.  * FUNCTION
  852.  *  dm_setup_and_draw_rectangle
  853.  * DESCRIPTION
  854.  *  This function is used setup the rectangle based on the coordinate set and
  855.  *  then draw it
  856.  * PARAMETERS
  857.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  858.  *  index                   [IN]            
  859.  *  *(?)
  860.  * RETURNS
  861.  *  void
  862.  *****************************************************************************/
  863. S32 dm_setup_and_draw_rectangle(S16 **UICtrlAccessPtr_p, S32 index)
  864. {
  865.     /*----------------------------------------------------------------*/
  866.     /* Local Variables                                                */
  867.     /*----------------------------------------------------------------*/
  868.     dm_coordinates dm_rectangle_info;
  869.     /*----------------------------------------------------------------*/
  870.     /* Code Body                                                      */
  871.     /*----------------------------------------------------------------*/
  872.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_rectangle_info);
  873.     if (dm_rectangle_info.s16X == -1 || dm_rectangle_info.s16Y == -1 ||
  874.         dm_rectangle_info.s16Width == -1 || dm_rectangle_info.s16Height == -1)
  875.     {
  876.         return 0;
  877.     }
  878.     gui_push_clip();
  879.     gui_set_clip(
  880.         dm_rectangle_info.s16X,
  881.         dm_rectangle_info.s16Y,
  882.         dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
  883.         dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1);
  884.     /* START VIJAY PMT 20050930 */
  885.     if (dm_rectangle_array[index].fill_rectangle == DM_RECTANGLE_FILL_GRAYSCALE)
  886.     {
  887.         gui_greyscale_rectangle(
  888.             dm_rectangle_info.s16X,
  889.             dm_rectangle_info.s16Y,
  890.             dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
  891.             dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1,
  892.             MMI_BG_GREYSCALE_VALUE,
  893.             MMI_BG_GREYSCALE_BLACK_VALUE);
  894.     }
  895.     else if (dm_rectangle_array[index].fill_rectangle == DM_RECTANGLE_FILL_COLOR)
  896.         /* END VIJAY PMT 20050930 */
  897.     {
  898.         gui_fill_rectangle(
  899.             dm_rectangle_info.s16X,
  900.             dm_rectangle_info.s16Y,
  901.             dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
  902.             dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1,
  903.             dm_rectangle_array[index].line_color);
  904.     }
  905.     else
  906.     {
  907.         gui_draw_rectangle(
  908.             dm_rectangle_info.s16X,
  909.             dm_rectangle_info.s16Y,
  910.             dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
  911.             dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1,
  912.             dm_rectangle_array[index].line_color);
  913.     }
  914.     gui_pop_clip();
  915.     return 1;
  916. }
  917. /*****************************************************************************
  918.  * FUNCTION
  919.  *  dm_setup_and_draw_line
  920.  * DESCRIPTION
  921.  *  This function is used setup the line based on the coordinate set and
  922.  *  then draw it
  923.  * PARAMETERS
  924.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  925.  *  index                   [IN]            
  926.  *  *(?)
  927.  * RETURNS
  928.  *  void
  929.  *****************************************************************************/
  930. S32 dm_setup_and_draw_line(S16 **UICtrlAccessPtr_p, S32 index)
  931. {
  932.     /*----------------------------------------------------------------*/
  933.     /* Local Variables                                                */
  934.     /*----------------------------------------------------------------*/
  935.     dm_coordinates dm_line_info;
  936.     /*----------------------------------------------------------------*/
  937.     /* Code Body                                                      */
  938.     /*----------------------------------------------------------------*/
  939.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_line_info);
  940.     if (dm_line_info.s16X == -1 || dm_line_info.s16Y == -1 ||
  941.         dm_line_info.s16Width == -1 || dm_line_info.s16Height == -1)
  942.     {
  943.         return 0;
  944.     }
  945.     gui_push_clip();
  946.     gui_set_clip(
  947.         dm_line_info.s16X,
  948.         dm_line_info.s16Y,
  949.         dm_line_info.s16X + dm_line_info.s16Width - 1,
  950.         dm_line_info.s16Y + dm_line_info.s16Height - 1);
  951.     gui_line(
  952.         dm_line_info.s16X,
  953.         dm_line_info.s16Y,
  954.         dm_line_info.s16X + dm_line_info.s16Width - 1,
  955.         dm_line_info.s16Y + dm_line_info.s16Height - 1,
  956.         dm_line_array[index]);
  957.     gui_pop_clip();
  958.     return 1;
  959. }
  960. /*****************************************************************************
  961.  * FUNCTION
  962.  *  dm_setup_and_draw_calendar
  963.  * DESCRIPTION
  964.  *  This function is used setup the calendat control based on the coordinate set and
  965.  *  then draw it
  966.  * PARAMETERS
  967.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  968.  *  *(?)
  969.  * RETURNS
  970.  *  void
  971.  *****************************************************************************/
  972. S32 dm_setup_and_draw_calendar(S16 **UICtrlAccessPtr_p)
  973. {
  974.     /*----------------------------------------------------------------*/
  975.     /* Local Variables                                                */
  976.     /*----------------------------------------------------------------*/
  977.     dm_calendar_info_struct dm_calendar_info;
  978.     /*----------------------------------------------------------------*/
  979.     /* Code Body                                                      */
  980.     /*----------------------------------------------------------------*/
  981.     *UICtrlAccessPtr_p = dm_get_calendar_coordinates(*UICtrlAccessPtr_p, &dm_calendar_info);
  982.     if (dm_calendar_info.coordinate.s16X == -1 || dm_calendar_info.coordinate.s16Y == -1 ||
  983.         dm_calendar_info.coordinate.s16Width == -1 || dm_calendar_info.coordinate.s16Height == -1)
  984.     {
  985.         return 0;
  986.     }
  987.     wgui_reset_calendar_params(
  988.         dm_calendar_info.coordinate.s16X,
  989.         dm_calendar_info.coordinate.s16Y,
  990.         dm_calendar_info.calendar_columns,
  991.         dm_calendar_info.calendar_rows,
  992.         dm_calendar_info.coordinate.s16Width / dm_calendar_info.calendar_columns,
  993.         dm_calendar_info.coordinate.s16Height / dm_calendar_info.calendar_rows);
  994.     set_calendar_control_background_limits(
  995.         dm_calendar_info.calendar_background_y,
  996.         dm_calendar_info.calendar_background_y + dm_calendar_info.calendar_background_width);
  997.     /* gui_set_font(&MMI_default_font); */
  998.     cat82_title1_x1 = dm_calendar_info.title1_x;
  999.     cat82_title1_y1 = dm_calendar_info.title1_y;
  1000.     cat82_title1_x2 = dm_calendar_info.title1_x + dm_calendar_info.title1_width - 1;
  1001.     cat82_title1_y2 = dm_calendar_info.title1_y + dm_calendar_info.title1_height - 1;
  1002.     calendar_title_font = dm_get_font(dm_calendar_info.title1_font);
  1003.     /* 053005 Calvin Start */
  1004. #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
  1005.     cat82_title1_month_x1 = dm_calendar_info.title1_month_x;
  1006.     cat82_title1_month_y1 = dm_calendar_info.title1_month_y;
  1007.     cat82_title1_month_x2 = dm_calendar_info.title1_month_x + dm_calendar_info.title1_month_width - 1;
  1008.     cat82_title1_month_y2 = dm_calendar_info.title1_month_y + dm_calendar_info.title1_month_height - 1;
  1009.     calendar_title_month_font = dm_get_font(dm_calendar_info.title1_month_font);
  1010.     calendar_show_title_month = dm_calendar_info.title1_month_show;
  1011.     /* 061705 Calvin Start */
  1012. #ifdef __MMI_TOUCH_SCREEN__
  1013.     if (!calendar_show_title_month) /* Don't wanna show Month on title 1: Month so disable */
  1014.     {
  1015.         DisableCalendarTitle1MonthArrow();
  1016.     }
  1017. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1018. #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */ 
  1019.     cat82_title2_x1 = dm_calendar_info.title2_x;
  1020.     cat82_title2_y1 = dm_calendar_info.title2_y;
  1021.     cat82_title2_x2 = dm_calendar_info.title2_x + dm_calendar_info.title2_width - 1;
  1022.     cat82_title2_y2 = dm_calendar_info.title2_y + dm_calendar_info.title2_height - 1;
  1023.     calendar_show_title2 = dm_calendar_info.title2_show;
  1024. #if defined(__MMI_UI_CALENDAR_WITH_INFO_BOX__) && defined (__MMI_TOUCH_SCREEN__)
  1025.     if (lunar_calendar_present)
  1026.     {
  1027.         if (!calendar_show_title2)  /* Don't wanna show Year on title 2 so disable */
  1028.         {
  1029.             DisableCalendarTitle1Arrow();
  1030.         }
  1031.     }
  1032. #endif /* defined(__MMI_UI_CALENDAR_WITH_INFO_BOX__) && defined (__MMI_TOUCH_SCREEN__) */ 
  1033.     cat82_title3_x1 = dm_calendar_info.title3_x;
  1034.     cat82_title3_y1 = dm_calendar_info.title3_y;
  1035.     cat82_title3_x2 = dm_calendar_info.title3_x + dm_calendar_info.title3_width - 1;
  1036.     cat82_title3_y2 = dm_calendar_info.title3_y + dm_calendar_info.title3_height - 1;
  1037.     calendar_show_title3 = dm_calendar_info.title3_show;
  1038. #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
  1039.     wgui_set_calendar_info_box(
  1040.         dm_calendar_info.infobox_x,
  1041.         dm_calendar_info.infobox_y,
  1042.         dm_calendar_info.infobox_width,
  1043.         dm_calendar_info.infobox_height,
  1044.         dm_calendar_info.infobox_max,
  1045.         dm_calendar_info.infobox_show);
  1046. #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */ 
  1047.     wgui_show_calendar();
  1048.     ChangeCategory82Title1(Cat82_title1);
  1049. #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
  1050.     ChangeCategory82Title1Month(Cat82_title1_month);
  1051. #endif 
  1052.     ChangeCategory82Title2(Cat82_title2);
  1053.     ChangeCategory82Title3(Cat82_title3);
  1054.     return 1;
  1055. }
  1056. /*****************************************************************************
  1057.  * FUNCTION
  1058.  *  dm_setup_and_draw_popup_background
  1059.  * DESCRIPTION
  1060.  *  This function is used setup the popup background based on the coordinate set and
  1061.  *  then draw it
  1062.  * PARAMETERS
  1063.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1064.  *  *(?)
  1065.  * RETURNS
  1066.  *  void
  1067.  *****************************************************************************/
  1068. S32 dm_setup_and_draw_popup_background(S16 **UICtrlAccessPtr_p)
  1069. {
  1070.     /*----------------------------------------------------------------*/
  1071.     /* Local Variables                                                */
  1072.     /*----------------------------------------------------------------*/
  1073.     dm_coordinates dm_popup_background_info;
  1074.     /*----------------------------------------------------------------*/
  1075.     /* Code Body                                                      */
  1076.     /*----------------------------------------------------------------*/
  1077.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_popup_background_info);
  1078.     if (dm_popup_background_info.s16X == -1 || dm_popup_background_info.s16Y == -1 ||
  1079.         dm_popup_background_info.s16Width == -1 || dm_popup_background_info.s16Height == -1)
  1080.     {
  1081.         return 0;
  1082.     }
  1083.     if ((g_dm_data.s32flags & DM_NO_POPUP_BACKGROUND))
  1084.     {
  1085.         return 0;
  1086.     }
  1087. #ifdef __MMI_SCREEN_ROTATE__
  1088.     /*
  1089.      * Becuse we do not reserve the display of previous screen,
  1090.      * popup background is not displayed.
  1091.      * It might be changed in the future.
  1092.      *
  1093.      * 1. non-rotated -> rotated
  1094.      * 2. rotated->non-rotated 
  1095.      *
  1096.      * Use transparent color to be the same as softkey background
  1097.      */
  1098.     if (mmi_frm_get_previous_screen_rotate() != mmi_frm_get_screen_rotate() ||
  1099.         mmi_frm_get_screen_rotate() != MMI_FRM_SCREEN_ROTATE_0)
  1100.     {
  1101.         gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  1102.     }
  1103.     else
  1104. #endif /* __MMI_SCREEN_ROTATE__ */ 
  1105.     if (dm_popup_background_info.Flags & DM_POPUP_BACKGROUND_HATCH_FILL)
  1106.     {
  1107.         color c = {200, 200, 200, 100};
  1108.         UI_cross_hatch_fill_rectangle(0, 0, UI_device_width - 1, UI_device_height - 1, c);
  1109.         entry_full_screen();
  1110.         g_dm_cntx.exit_full_screen_on_exit = MMI_TRUE;
  1111.     }
  1112.     else if (dm_popup_background_info.Flags & DM_POPUP_BACKGROUND_GREYSCALE)     /* 072505 Calvin added: After 6228, it should support alpha channel */
  1113.     {
  1114.         gui_greyscale_rectangle(0, 0, UI_device_width - 1, UI_device_height - 1, MMI_BG_GREYSCALE_VALUE, MMI_BG_GREYSCALE_BLACK_VALUE);     /* 102605 greyscale Calvin modified */
  1115.     }
  1116.     if (dm_popup_background_info.Flags & DM_DRAW_POPUP_BACKGROUND_3D)
  1117.     {
  1118.         wgui_draw_pop_up_screen_background(
  1119.             dm_popup_background_info.s16X,
  1120.             dm_popup_background_info.s16Y,
  1121.             dm_popup_background_info.s16X + dm_popup_background_info.s16Width - 1,
  1122.             dm_popup_background_info.s16Y + dm_popup_background_info.s16Height - 1,
  1123.             &wgui_pop_up_dialog_background,
  1124.             MMI_TRUE);
  1125.     }
  1126.     else
  1127.     {
  1128.         wgui_draw_pop_up_screen_background(
  1129.             dm_popup_background_info.s16X,
  1130.             dm_popup_background_info.s16Y,
  1131.             dm_popup_background_info.s16X + dm_popup_background_info.s16Width - 1,
  1132.             dm_popup_background_info.s16Y + dm_popup_background_info.s16Height - 1,
  1133.             &wgui_pop_up_dialog_background,
  1134.             MMI_FALSE);
  1135.     }
  1136.     return 1;
  1137. }
  1138. /*****************************************************************************
  1139.  * FUNCTION
  1140.  *  dm_setup_and_draw_scroll_text
  1141.  * DESCRIPTION
  1142.  *  This function is used setup the popup background based on the coordinate set and
  1143.  *  then draw it
  1144.  * PARAMETERS
  1145.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1146.  *  index                   [IN]            
  1147.  *  *(?)
  1148.  * RETURNS
  1149.  *  void
  1150.  *****************************************************************************/
  1151. S32 dm_setup_and_draw_scroll_text(S16 **UICtrlAccessPtr_p, S32 index)
  1152. {
  1153.     /*----------------------------------------------------------------*/
  1154.     /* Local Variables                                                */
  1155.     /*----------------------------------------------------------------*/
  1156.     dm_coordinates dm_scroll_text_info;
  1157.     S32 width = 0, height = 0;
  1158.     /*----------------------------------------------------------------*/
  1159.     /* Code Body                                                      */
  1160.     /*----------------------------------------------------------------*/
  1161.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_scroll_text_info);
  1162.     if (dm_scroll_text_info.s16X == -1 || dm_scroll_text_info.s16Y == -1 ||
  1163.         dm_scroll_text_info.s16Width == -1 || dm_scroll_text_info.s16Height == -1)
  1164.     {
  1165.         return 0;
  1166.     }
  1167.     if (dm_scroll_text_buf[index][0] == 0 && dm_scroll_text_buf[index][1] == 0)
  1168.     {
  1169.         return 0;
  1170.     }
  1171.     dm_current_scroll_text = &dm_scroll_text[index];
  1172.     if (dm_scroll_text_info.Flags & DM_SCROLL_TEXT_CENTRE_ALIGN_X)
  1173.         if (dm_current_scroll_text->text_width >= dm_scroll_text_info.s16Width)
  1174.         {
  1175.             dm_current_scroll_text->x = (S32) dm_scroll_text_info.s16X;
  1176.             dm_current_scroll_text->width = (S32) dm_scroll_text_info.s16Width;
  1177.         }
  1178.         else
  1179.         {
  1180.             dm_current_scroll_text->x =
  1181.                 (S32) dm_scroll_text_info.s16X + ((dm_scroll_text_info.s16Width - dm_current_scroll_text->width) >> 1);
  1182.         }
  1183.     else
  1184.     {
  1185.         dm_current_scroll_text->x = (S32) dm_scroll_text_info.s16X;
  1186.         dm_current_scroll_text->width = (S32) dm_scroll_text_info.s16Width;
  1187.     }
  1188.     if (dm_scroll_text_info.Flags & DM_SCROLL_TEXT_CENTER_ALIGN_Y)
  1189.     {
  1190.         dm_current_scroll_text->y =
  1191.             (S32) (dm_scroll_text_info.s16Y + ((dm_scroll_text_info.s16Height - dm_current_scroll_text->height) >> 1));
  1192.     }
  1193.     else
  1194.     {
  1195.         dm_current_scroll_text->y = (S32) dm_scroll_text_info.s16Y;
  1196.     }
  1197.     //dm_current_scroll_text->width = (S32) dm_scroll_text_info.s16Width;
  1198.     if (dm_scroll_text_info.Flags & DM_SCROLL_TEXT_USE_FONT_HEIGHT)
  1199.     {
  1200.         gui_measure_string(dm_current_scroll_text->text, &width, &height);
  1201.         dm_current_scroll_text->height = height;
  1202.         dm_scroll_text_info.s16Height = height;
  1203.     }
  1204.     else
  1205.     {
  1206.         dm_current_scroll_text->height = (S32) dm_scroll_text_info.s16Height;
  1207.     }
  1208.     setup_previous_control(&dm_scroll_text_info);
  1209.     gui_show_scrolling_text(dm_current_scroll_text);
  1210.     return 1;
  1211. }
  1212. /*****************************************************************************
  1213.  * FUNCTION
  1214.  *  dm_setup_and_draw_aligned_area
  1215.  * DESCRIPTION
  1216.  *  This function is used setup the aligned area based on the coordinate set and
  1217.  *  then draw it
  1218.  * PARAMETERS
  1219.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1220.  *  control_set_ptr         [?]             
  1221.  *  *(?)
  1222.  * RETURNS
  1223.  *  void
  1224.  *****************************************************************************/
  1225. S32 dm_setup_and_draw_aligned_area(S16 **UICtrlAccessPtr_p, U8 *control_set_ptr)
  1226. {
  1227.     /*----------------------------------------------------------------*/
  1228.     /* Local Variables                                                */
  1229.     /*----------------------------------------------------------------*/
  1230.     dm_coordinates dm_aligned_area_info;
  1231.     U8 i = 1, number_of_elements = 0;
  1232.     S32 total_element_height = 0, element_height = 0, element_width = 0;
  1233.     S32 image_count = 0, string_count = 0;
  1234.     S32 is_multiline = 0;
  1235.     /*----------------------------------------------------------------*/
  1236.     /* Code Body                                                      */
  1237.     /*----------------------------------------------------------------*/
  1238.     /* Get aligned area range and flags */
  1239.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_aligned_area_info);
  1240.     dm_aligned_area_data.s16X = dm_aligned_area_info.s16X;
  1241.     dm_aligned_area_data.s16Y = dm_aligned_area_info.s16Y;
  1242.     dm_aligned_area_data.Flags = dm_aligned_area_info.Flags;
  1243.     dm_aligned_area_data.s16width = dm_aligned_area_info.s16Width;
  1244.     dm_aligned_area_data.s16height = dm_aligned_area_info.s16Height;
  1245.     if (!dm_aligned_area_data.Flags & DM_ALLIGNED_AREA_NO_BACK_FILL)
  1246.     {
  1247.         gui_draw_filled_area(
  1248.             dm_aligned_area_info.s16X,
  1249.             dm_aligned_area_info.s16Y,
  1250.             dm_aligned_area_info.s16X + dm_aligned_area_info.s16Width,
  1251.             dm_aligned_area_info.s16Y + dm_aligned_area_info.s16Height,
  1252.             current_MMI_theme->general_background_filler);
  1253.     }
  1254.     /* Get Number of elements in aligned area */
  1255.     while (control_set_ptr[i - 1] != DM_ALIGNED_AREA_START) /* find the start of aligned area */
  1256.     {
  1257.         i++;
  1258.         if (control_set_ptr[i - 1] == DM_IMAGE)
  1259.         {
  1260.             image_count++;  /* skip those images not in aligned area. */
  1261.         }
  1262.         if (control_set_ptr[i - 1] == DM_STRING)
  1263.         {
  1264.             string_count++; /* skip those strings not in aligned area. */
  1265.         }
  1266.         MMI_ASSERT(i < 20); /* avoid infinite while loop. */
  1267.     }
  1268.     /* Assume all is vertically arranged, horizontally center alignment */
  1269.     while (control_set_ptr[i] != DM_ALIGNED_AREA_END)   /* start to calculate number of items and its' height */
  1270.     {
  1271.         MMI_ASSERT(i < 20); /* avoid infinite while loop. */
  1272.         switch (control_set_ptr[i])
  1273.         {
  1274.             case DM_SINGLELINE_INPUTBOX1:
  1275.                 if (get_singleline_inputbox_display_status())
  1276.                 {
  1277.                     resize_singleline_inputbox(dm_aligned_area_info.s16Width, MMI_singleline_inputbox_height);
  1278.                     number_of_elements++;
  1279.                     element_width = dm_aligned_area_info.s16Width;
  1280.                     element_height = MMI_singleline_inputbox_height;
  1281.                 }
  1282.                 else
  1283.                 {
  1284.                     element_width = 0;
  1285.                     element_height = 0;
  1286.                 }
  1287.                 break;
  1288.             case DM_MULTILINE_INPUTBOX1:
  1289.                 is_multiline = 1;
  1290.                 if (get_multiline_inputbox_display_status())
  1291.                 {
  1292.                     resize_multiline_inputbox_fit(
  1293.                         dm_aligned_area_info.s16Width,
  1294.                         dm_aligned_area_info.s16Height,
  1295.                         &element_width,
  1296.                         &element_height);
  1297.                     number_of_elements++;
  1298.                 }
  1299.                 else
  1300.                 {
  1301.                     element_width = 0;
  1302.                     element_height = 0;
  1303.                 }
  1304.                 break;
  1305.             case DM_IMAGE:
  1306.                 if (dm_image_array[image_count].image != NULL)  /* from resource */
  1307.                 {
  1308.                     gdi_image_get_dimension(dm_image_array[image_count++].image, &element_width, &element_height);
  1309.                     number_of_elements++;
  1310.                 }
  1311.                 else if (dm_image_array[image_count].name != NULL)      /* from file */
  1312.                 {
  1313.                     gdi_image_get_dimension_file(
  1314.                         (S8*) dm_image_array[image_count++].name,
  1315.                         &element_width,
  1316.                         &element_height);
  1317.                     number_of_elements++;
  1318.                 }
  1319.                 else    /* empty image. */
  1320.                 {
  1321.                     element_width = 0;
  1322.                     element_height = 0;
  1323.                     image_count++;
  1324.                 }
  1325.                 break;
  1326.             case DM_STRING:
  1327.                 if (dm_string_array[string_count].string != NULL)
  1328.                 {
  1329.                     gui_measure_string(dm_string_array[string_count++].string, &element_width, &element_height);
  1330.                     number_of_elements++;
  1331.                 }
  1332.                 else
  1333.                 {
  1334.                     element_width = 0;
  1335.                     element_height = 0;
  1336.                     string_count++;
  1337.                 }
  1338.                 break;
  1339.             case DM_SLIDE_CONTROL:
  1340.                 break;
  1341.             case DM_MATRIX_MENU1:
  1342.                 break;
  1343.             default:
  1344.                 MMI_ASSERT(0);  /* support above controls ONLY */
  1345.         }
  1346.         total_element_height += element_height;
  1347.         i++;
  1348.     }
  1349.     if (dm_aligned_area_data.Flags & DM_ALLIGNED_AREA_EQUAL_SPACE_TOP_AND_BOTTOM)
  1350.     {
  1351.         if (total_element_height < dm_aligned_area_info.s16Height)
  1352.         {
  1353.             dm_aligned_area_data.s16Y += ((dm_aligned_area_info.s16Height - total_element_height) >> 1);
  1354.             dm_aligned_area_data.s16height -= ((dm_aligned_area_info.s16Height - total_element_height) >> 1);
  1355.             dm_aligned_area_data.y_space = 0;
  1356.         }
  1357.         else
  1358.         {
  1359.             if (is_multiline && dm_aligned_area_data.Flags & DM_ALLIGNED_AREA_MULTILINE_SCROLL_IF_REQUIRED)
  1360.             {
  1361.                 S32 h;
  1362.                 MMI_multiline_inputbox.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR;
  1363.                 h = dm_aligned_area_info.s16Height - (total_element_height - MMI_multiline_inputbox.height);
  1364.                 resize_multiline_inputbox(MMI_multiline_inputbox.width, h - 1);
  1365.                 MMI_multiline_inputbox.edit_width =
  1366.                     MMI_multiline_inputbox.width - MMI_multiline_inputbox.vbar.width - 2;
  1367.                 register_keyboard_key_handler(category151_keyboard_handler);
  1368.                 SetKeyHandler(multiline_inputbox_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1369.                 SetKeyHandler(multiline_inputbox_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1370.             }
  1371.             else
  1372.             {
  1373.                 S32 h = dm_aligned_area_info.s16Height - (total_element_height - MMI_multiline_inputbox.height);
  1374.                 resize_multiline_inputbox(MMI_multiline_inputbox.width, h);
  1375.             }
  1376.         }
  1377.     }
  1378.     else
  1379.     {
  1380.         dm_aligned_area_data.y_space =
  1381.             (dm_aligned_area_info.s16Height - total_element_height) / (number_of_elements + 1);
  1382.     }
  1383.     dm_aligned_area_data.x_space = 0;
  1384.     return 1;
  1385. }   /* end of dm_setup_and_draw_aligned_area */
  1386. /*****************************************************************************
  1387.  * FUNCTION
  1388.  *  dm_setup_and_draw_slide_control
  1389.  * DESCRIPTION
  1390.  *  This function is used setup the slide control based on the coordinate set and
  1391.  *  then draw it
  1392.  * PARAMETERS
  1393.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1394.  *  index                   [IN]            
  1395.  *  *(?)
  1396.  * RETURNS
  1397.  *  void
  1398.  *****************************************************************************/
  1399. S32 dm_setup_and_draw_slide_control(S16 **UICtrlAccessPtr_p, S32 index)
  1400. {
  1401.     /*----------------------------------------------------------------*/
  1402.     /* Local Variables                                                */
  1403.     /*----------------------------------------------------------------*/
  1404.     dm_coordinates dm_slide_control_info;
  1405.     slide_control *previous_current_slide_control = MMI_current_slide_control;
  1406.     S32 value_width = 0;
  1407.     S32 idx = 0;
  1408.     /*----------------------------------------------------------------*/
  1409.     /* Code Body                                                      */
  1410.     /*----------------------------------------------------------------*/
  1411.     /* Get aligned area range and flags */
  1412.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_slide_control_info);
  1413.     if (dm_slide_control_info.s16X == -1 || dm_slide_control_info.s16Y == -1 ||
  1414.         dm_slide_control_info.s16Width == -1 || dm_slide_control_info.s16Height == -1)
  1415.     {
  1416.         return 0;
  1417.     }
  1418.     if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_NONE)
  1419.     {
  1420.         MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_NONE;
  1421.     }
  1422.     else if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_HEAD)
  1423.     {
  1424.         MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_HEAD;
  1425.     }
  1426.     else if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_TAIL)
  1427.     {
  1428.         MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_TAIL;
  1429.     }
  1430.     else if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_NEXT_LINE)
  1431.     {
  1432.         MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_NEXT_LINE;
  1433.     }
  1434.     if (g_dm_cntx.redraw_screen_main != REDRAW_2_REDRAW)
  1435.     {
  1436.         for (idx = 0; idx < dm_slide_control_count; idx++)
  1437.         {
  1438.             if (MMI_slide_control[idx].value_string_width > value_width)
  1439.             {
  1440.                 value_width = MMI_slide_control[idx].value_string_width;
  1441.             }
  1442.         }
  1443.         /* if ( dm_slide_control_info.Flags&DM_CENTRE_ALIGN_X) */
  1444.         switch (MMI_slide_control[index].flags)
  1445.         {
  1446.             case GUI_SLIDE_CONTROL_VALUE_POS_HEAD:
  1447.                 dm_slide_control_info.s16X +=
  1448.                     ((dm_slide_control_info.s16Width - MMI_slide_control[index].bg_image_width - value_width) >> 1) +
  1449.                     value_width;
  1450.                 MMI_slide_control[index].value_string_gap =
  1451.                     (value_width - MMI_slide_control[index].value_string_width) >> 1;
  1452.                 break;
  1453.             case GUI_SLIDE_CONTROL_VALUE_POS_TAIL:
  1454.                 dm_slide_control_info.s16X +=
  1455.                     (dm_slide_control_info.s16Width - MMI_slide_control[index].bg_image_width - value_width) >> 1;
  1456.                 MMI_slide_control[index].value_string_gap =
  1457.                     (value_width - MMI_slide_control[index].value_string_width) >> 1;
  1458.                 break;
  1459.             case GUI_SLIDE_CONTROL_VALUE_POS_NEXT_LINE:
  1460.                 dm_slide_control_info.s16X +=
  1461.                     (dm_slide_control_info.s16Width - MMI_slide_control[index].bg_image_width) >> 1;
  1462.                 MMI_slide_control[index].value_string_gap = 0;
  1463.                 break;
  1464.             case GUI_SLIDE_CONTROL_VALUE_POS_NONE:
  1465.                 break;
  1466.             default:
  1467.                 break;
  1468.         }
  1469.         /* if ( MMI_slide_control[index].flags == GUI_SLIDE_CONTROL_VALUE_POS_TAIL ) */
  1470.         dm_slide_control_info.s16Height = MMI_slide_control[index].bg_image_height;
  1471.         setup_previous_control(&dm_slide_control_info);
  1472.         move_slide_control_value(&MMI_slide_control[index], dm_slide_control_info.s16X, dm_slide_control_info.s16Y);
  1473.     }
  1474.     MMI_current_slide_control = &MMI_slide_control[index];
  1475.     wgui_show_slide_control();
  1476.     if (MMI_current_slide_control == previous_current_slide_control)
  1477.     {
  1478.         wgui_show_slide_control_focus();
  1479.     }
  1480.     MMI_current_slide_control = previous_current_slide_control;
  1481.     return 1;
  1482. }   /* end of dm_setup_and_draw_slide_control */
  1483. /*****************************************************************************
  1484.  * FUNCTION
  1485.  *  dm_setup_and_draw_typical_stopwatch
  1486.  * DESCRIPTION
  1487.  *  This function is used setup the typical stopwatch based on the coordinate set and
  1488.  *  then draw it
  1489.  * PARAMETERS
  1490.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1491.  *  *(?)
  1492.  * RETURNS
  1493.  *  void
  1494.  *****************************************************************************/
  1495. S32 dm_setup_and_draw_typical_stopwatch(S16 **UICtrlAccessPtr_p)
  1496. {
  1497. #ifdef __MMI_STOPWATCH__
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Local Variables                                                */
  1500.     /*----------------------------------------------------------------*/
  1501.     dm_typical_stopwatch_info_struct dm_typical_stopwatch_info;
  1502.     /*----------------------------------------------------------------*/
  1503.     /* Code Body                                                      */
  1504.     /*----------------------------------------------------------------*/
  1505.     *UICtrlAccessPtr_p = dm_get_typical_stopwatch_coordinates(*UICtrlAccessPtr_p, &dm_typical_stopwatch_info);
  1506.     if (dm_typical_stopwatch_info.coordinate.s16X == -1 || dm_typical_stopwatch_info.coordinate.s16Y == -1 ||
  1507.         dm_typical_stopwatch_info.coordinate.s16Width == -1 || dm_typical_stopwatch_info.coordinate.s16Height == -1)
  1508.     {
  1509.         return 0;
  1510.     }
  1511.     wtch_pos.typ_timer.x = dm_typical_stopwatch_info.typ_timer_x;
  1512.     wtch_pos.typ_timer.y = dm_typical_stopwatch_info.typ_timer_y;
  1513.     wtch_pos.typ_milsec.x = dm_typical_stopwatch_info.typ_milsec_x;
  1514.     wtch_pos.typ_milsec.y = dm_typical_stopwatch_info.typ_milsec_y;
  1515.     wtch_pos.typ_history_height = dm_typical_stopwatch_info.typ_history_height;
  1516.     move_fixed_list(dm_typical_stopwatch_info.coordinate.s16X, dm_typical_stopwatch_info.coordinate.s16Y);
  1517.     resize_fixed_list(dm_typical_stopwatch_info.coordinate.s16Width, dm_typical_stopwatch_info.typ_history_height);
  1518.     stop_watch_x = (dm_typical_stopwatch_info.coordinate.s16Width >> 1) - (stop_watch_width >> 1);
  1519.     stop_watch_y = dm_typical_stopwatch_info.coordinate.s16Y + MMI_fixed_list_menu.height;
  1520.     show_typical_stop_watch();
  1521.     return 1;
  1522. #else /* __MMI_STOPWATCH__ */ 
  1523.     return 0;
  1524. #endif /* __MMI_STOPWATCH__ */ 
  1525. }   /* end of dm_setup_and_draw_typical_stopwatch */
  1526. /*****************************************************************************
  1527.  * FUNCTION
  1528.  *  dm_setup_and_draw_nway_stopwatch
  1529.  * DESCRIPTION
  1530.  *  This function is used setup the N Way stopwatch based on the coordinate set and
  1531.  *  then draw it
  1532.  * PARAMETERS
  1533.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1534.  *  *(?)
  1535.  * RETURNS
  1536.  *  void
  1537.  *****************************************************************************/
  1538. S32 dm_setup_and_draw_nway_stopwatch(S16 **UICtrlAccessPtr_p)
  1539. {
  1540. #ifdef __MMI_STOPWATCH__
  1541.     /*----------------------------------------------------------------*/
  1542.     /* Local Variables                                                */
  1543.     /*----------------------------------------------------------------*/
  1544.     dm_nway_stopwatch_info_struct dm_nway_stopwatch_info;
  1545.     /*----------------------------------------------------------------*/
  1546.     /* Code Body                                                      */
  1547.     /*----------------------------------------------------------------*/
  1548.     *UICtrlAccessPtr_p = dm_get_nway_stopwatch_coordinates(*UICtrlAccessPtr_p, &dm_nway_stopwatch_info);
  1549.     if (dm_nway_stopwatch_info.coordinate.s16X == -1 || dm_nway_stopwatch_info.coordinate.s16Y == -1 ||
  1550.         dm_nway_stopwatch_info.coordinate.s16Width == -1 || dm_nway_stopwatch_info.coordinate.s16Height == -1)
  1551.     {
  1552.         return 0;
  1553.     }
  1554.     wtch_pos.nWay_maintimer_start.x = dm_nway_stopwatch_info.nway_main_timer_x1;
  1555.     wtch_pos.nWay_maintimer_start.y = dm_nway_stopwatch_info.nway_main_timer_y1;
  1556.     wtch_pos.nWay_maintimer_end.x = dm_nway_stopwatch_info.nway_main_timer_x2;
  1557.     wtch_pos.nWay_maintimer_end.y = dm_nway_stopwatch_info.nway_main_timer_y2;
  1558.     wtch_pos.nWay_dialog_start.x = dm_nway_stopwatch_info.nway_dialog_x1;
  1559.     wtch_pos.nWay_dialog_start.y = dm_nway_stopwatch_info.nway_dialog_y1;
  1560.     wtch_pos.nWay_dialog_end.x = dm_nway_stopwatch_info.nway_dialog_x2;
  1561.     wtch_pos.nWay_dialog_end.y = dm_nway_stopwatch_info.nway_dialog_y2;
  1562.     wtch_pos.separator_height = dm_nway_stopwatch_info.separator_height;
  1563.     show_nway_stop_watch();
  1564.     return 1;
  1565. #else /* __MMI_STOPWATCH__ */ 
  1566.     return 0;
  1567. #endif /* __MMI_STOPWATCH__ */ 
  1568. }   /* dm_get_nway_stopwatch_coordinates */
  1569. /*****************************************************************************
  1570.  * FUNCTION
  1571.  *  dm_setup_and_draw_wallpaper
  1572.  * DESCRIPTION
  1573.  *  This function is used setup wallpaper based on the coordinate set and
  1574.  *  then draw it
  1575.  * PARAMETERS
  1576.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  1577.  *  *(?)
  1578.  * RETURNS
  1579.  *  void
  1580.  *****************************************************************************/
  1581. S32 dm_setup_and_draw_wallpaper(S16 **UICtrlAccessPtr_p)
  1582. {
  1583.     /*----------------------------------------------------------------*/
  1584.     /* Local Variables                                                */
  1585.     /*----------------------------------------------------------------*/
  1586.     dm_coordinates dm_wallpaper_info;
  1587.     /*----------------------------------------------------------------*/
  1588.     /* Code Body                                                      */
  1589.     /*----------------------------------------------------------------*/
  1590.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_wallpaper_info);
  1591.     if (dm_wallpaper_info.s16X == -1 || dm_wallpaper_info.s16Y == -1 ||
  1592.         dm_wallpaper_info.s16Width == -1 || dm_wallpaper_info.s16Height == -1)
  1593.     {
  1594.         return 0;
  1595.     }
  1596.     if ((g_dm_cntx.redraw_screen_main == REDRAW_2_REDRAW) && (dm_wallpaper_layer != GDI_ERROR_HANDLE))
  1597.     {
  1598.         gdi_layer_push_and_set_active(dm_layers[dm_wallpaper_layer]);
  1599.         draw_wallpaper();
  1600.         gdi_layer_pop_and_restore_active();
  1601.     }
  1602.     else
  1603.     {
  1604.     #ifdef __GDI_MEMORY_PROFILE_2__
  1605.         gdi_layer_multi_layer_enable();
  1606.         gdi_layer_create(
  1607.             dm_wallpaper_info.s16X,
  1608.             dm_wallpaper_info.s16Y,
  1609.             dm_wallpaper_info.s16Width,
  1610.             dm_wallpaper_info.s16Height,
  1611.             &dm_layers[dm_layers_count]);
  1612.         gdi_layer_set_active(dm_layers[dm_layers_count++]);
  1613.         /* gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT); */
  1614.         gdi_layer_clear(gdi_layer_get_background());
  1615.         dm_wallpaper_layer = dm_layers_count - 1;
  1616.     #endif /* __GDI_MEMORY_PROFILE_2__ */ 
  1617.         draw_wallpaper();
  1618.     }
  1619.     return 1;
  1620. }   /* dm_get_nway_stopwatch_coordinates */
  1621. /*****************************************************************************
  1622.  * FUNCTION
  1623.  *  dm_setup_and_draw_percentage_bar
  1624.  * DESCRIPTION
  1625.  *  
  1626.  * PARAMETERS
  1627.  *  UICtrlAccessPtr_p       [IN]        
  1628.  *  count                   [IN]        
  1629.  * RETURNS
  1630.  *  
  1631.  *****************************************************************************/
  1632. S32 dm_setup_and_draw_percentage_bar(S16 **UICtrlAccessPtr_p, S32 count)
  1633. {
  1634.     /*----------------------------------------------------------------*/
  1635.     /* Local Variables                                                */
  1636.     /*----------------------------------------------------------------*/
  1637.     dm_coordinates dm_percentage_bar_info;
  1638.     dm_percentage_bar_struct *act_bar = &dm_percentage_bar_array[count];
  1639.     /*----------------------------------------------------------------*/
  1640.     /* Code Body                                                      */
  1641.     /*----------------------------------------------------------------*/
  1642.     *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_percentage_bar_info);
  1643.     if (dm_percentage_bar_info.s16X == -1 || dm_percentage_bar_info.s16Y == -1 ||
  1644.         dm_percentage_bar_info.s16Width == -1 || dm_percentage_bar_info.s16Height == -1)
  1645.     {
  1646.         return 0;
  1647.     }
  1648.     act_bar->x = dm_percentage_bar_info.s16X;
  1649.     act_bar->y = dm_percentage_bar_info.s16Y;
  1650.     act_bar->width = dm_percentage_bar_info.s16Width;
  1651.     act_bar->height = dm_percentage_bar_info.s16Height;
  1652.     dm_redraw_percentage_bar(count);
  1653.     return 1;
  1654. }
  1655. /*****************************************************************************
  1656.  * FUNCTION
  1657.  *  dm_draw_scr_bg_image
  1658.  * DESCRIPTION
  1659.  *  This function is used to draw scr bg image
  1660.  * PARAMETERS
  1661.  *  void
  1662.  * RETURNS
  1663.  *  void
  1664.  *****************************************************************************/
  1665. void dm_draw_scr_bg_image(void)
  1666. {
  1667.     /*----------------------------------------------------------------*/
  1668.     /* Local Variables                                                */
  1669.     /*----------------------------------------------------------------*/
  1670.     S32 img_width, img_height;
  1671.     GDI_RESULT ret;
  1672.     /*----------------------------------------------------------------*/
  1673.     /* Code Body                                                      */
  1674.     /*----------------------------------------------------------------*/
  1675.     gdi_layer_push_and_set_active(g_dm_scr_bg_cntx.layer_handle);
  1676. #ifdef __MMI_LITE_DISPLAY__
  1677.     /* 082906 scr_bg Start */
  1678.     if (!(g_dm_scr_bg_cntx.flags && DM_SCR_BG_FORCE_SHOW))
  1679.     {
  1680.         UI_UNUSED_PARAMETER(img_width);
  1681.         UI_UNUSED_PARAMETER(img_height);
  1682.         UI_UNUSED_PARAMETER(ret);
  1683.         gdi_draw_solid_rect(
  1684.             g_dm_scr_bg_cntx.offset_x,
  1685.             g_dm_scr_bg_cntx.offset_y,
  1686.             UI_device_width - 1,
  1687.             UI_device_height - 1,
  1688.             gdi_act_color_from_rgb(0xFF, current_MMI_theme->lite_disp_scr_bg_color->r, current_MMI_theme->lite_disp_scr_bg_color->g, current_MMI_theme->lite_disp_scr_bg_color->b));
  1689.     }
  1690.     else
  1691. #endif /* __MMI_LITE_DISPLAY__ */
  1692. //#else /* __MMI_LITE_DISPLAY__ */ 
  1693.     {
  1694.         gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, gdi_layer_get_background());
  1695.         if (g_dm_scr_bg_cntx.image_id != 0) /* from resource */
  1696.         {
  1697.             if (g_dm_scr_bg_cntx.offset_x == -1 && g_dm_scr_bg_cntx.offset_y == -1)
  1698.             {
  1699.                 gdi_image_get_dimension_id(g_dm_scr_bg_cntx.image_id, &img_width, &img_height);
  1700.                 if (img_width > UI_device_width || img_height > UI_device_height)   /* the image is too large to fit the screen */
  1701.                 {
  1702.                     S32 resized_offset_x, resized_offset_y;
  1703.                     S32 resized_width, resized_height;
  1704.                     gdi_image_util_fit_bbox(
  1705.                         UI_device_width,
  1706.                         UI_device_height,
  1707.                         img_width,
  1708.                         img_height,
  1709.                         &resized_offset_x,
  1710.                         &resized_offset_y,
  1711.                         &resized_width,
  1712.                         &resized_height);
  1713.                     ret = gdi_image_draw_resized(
  1714.                             resized_offset_x,
  1715.                             resized_offset_y,
  1716.                             resized_width,
  1717.                             resized_height,
  1718.                             get_image(g_dm_scr_bg_cntx.image_id));
  1719.                 }
  1720.                 else
  1721.                 {
  1722.                     S32 offset_x = (UI_device_width - img_width) >> 1;
  1723.                     S32 offset_y = (UI_device_height - img_height) >> 1;;
  1724.                     gdi_image_draw_id(offset_x, offset_y, g_dm_scr_bg_cntx.image_id);
  1725.                 }
  1726.             }
  1727.             else
  1728.             {
  1729.                 gdi_image_draw_id(g_dm_scr_bg_cntx.offset_x, g_dm_scr_bg_cntx.offset_y, g_dm_scr_bg_cntx.image_id);
  1730.             }
  1731.         }
  1732.         else    /* from file */
  1733.         {
  1734.             if (g_dm_scr_bg_cntx.offset_x == -1 && g_dm_scr_bg_cntx.offset_y == -1)
  1735.             {
  1736.                 gdi_image_get_dimension_file(g_dm_scr_bg_cntx.image_name, &img_width, &img_height);
  1737.                 if (img_width > UI_device_width || img_height > UI_device_height)   /* the image is too large to fit the screen */
  1738.                 {
  1739.                     S32 resized_offset_x, resized_offset_y;
  1740.                     S32 resized_width, resized_height;
  1741.                     gdi_image_util_fit_bbox(
  1742.                         UI_device_width,
  1743.                         UI_device_height,
  1744.                         img_width,
  1745.                         img_height,
  1746.                         &resized_offset_x,
  1747.                         &resized_offset_y,
  1748.                         &resized_width,
  1749.                         &resized_height);
  1750.                     ret = gdi_image_draw_resized_file(
  1751.                             resized_offset_x,
  1752.                             resized_offset_y,
  1753.                             resized_width,
  1754.                             resized_height,
  1755.                             (S8*) g_dm_scr_bg_cntx.image_name);
  1756.                 }
  1757.                 else
  1758.                 {
  1759.                     S32 offset_x = (UI_device_width - img_width) >> 1;
  1760.                     S32 offset_y = (UI_device_height - img_height) >> 1;
  1761.                     gdi_image_draw_file(offset_x, offset_y, g_dm_scr_bg_cntx.image_name);
  1762.                 }
  1763.             }
  1764.             else
  1765.             {
  1766.                 gdi_image_draw_file(g_dm_scr_bg_cntx.offset_x, g_dm_scr_bg_cntx.offset_y, g_dm_scr_bg_cntx.image_name);
  1767.             }
  1768.         }
  1769.     }
  1770.     /* 082906 scr_bg End */
  1771. //#endif /* __MMI_LITE_DISPLAY__ */ 
  1772.     gdi_layer_pop_and_restore_active();
  1773. }
  1774. /*****************************************************************************
  1775.  * FUNCTION
  1776.  *  dm_set_scr_bg_image
  1777.  * DESCRIPTION
  1778.  *  This function is used to set image id or image name of scr bg image
  1779.  * PARAMETERS
  1780.  *  image_id        [IN]        Id of the image
  1781.  *  file_name       [IN]        File name of the image
  1782.  *  x               [IN]        
  1783.  *  y               [IN]        
  1784.  *  opacity         [IN]        
  1785.  * RETURNS
  1786.  *  void
  1787.  *****************************************************************************/
  1788. void dm_set_scr_bg_image(U16 image_id, S8 *file_name, S32 x, S32 y, U8 opacity)
  1789. {
  1790.     /*----------------------------------------------------------------*/
  1791.     /* Local Variables                                                */
  1792.     /*----------------------------------------------------------------*/
  1793.     /*----------------------------------------------------------------*/
  1794.     /* Code Body                                                      */
  1795.     /*----------------------------------------------------------------*/
  1796.     /* 092005 Wallpaper Setting Calvin */
  1797.     if (image_id != 0 && file_name == NULL)
  1798.     {
  1799.         g_dm_scr_bg_cntx.image_id = image_id;
  1800.         g_dm_scr_bg_cntx.image_name = NULL;
  1801.     }
  1802.     else if (image_id == 0 && file_name != NULL)
  1803.     {
  1804.         g_dm_scr_bg_cntx.image_id = 0;
  1805.         g_dm_scr_bg_cntx.image_name = file_name;
  1806.     }
  1807.     /* 092005 Wallpaper Setting Calvin End */
  1808. #ifndef MMI_ON_WIN32
  1809.     else
  1810.     {
  1811.         MMI_ASSERT(0);
  1812.     }
  1813. #endif /* MMI_ON_WIN32 */ 
  1814.     g_dm_scr_bg_cntx.offset_x = x;
  1815.     g_dm_scr_bg_cntx.offset_y = y;
  1816.     g_dm_scr_bg_cntx.layer_opacity = opacity;   /* 070505 Calvin added */
  1817.     /* 070505 Calvin moved */
  1818.     /* if g_dm_scr_bg_cntx.1scr_bg_layer does not exist */
  1819.     if (g_dm_scr_bg_cntx.layer_handle == GDI_ERROR_HANDLE)
  1820.     {
  1821.         return;
  1822.     }
  1823.     /* 070505 Calvin end */
  1824.     gdi_layer_push_and_set_active(g_dm_scr_bg_cntx.layer_handle);
  1825.     gdi_layer_set_opacity(TRUE, g_dm_scr_bg_cntx.layer_opacity);        /* 070505 Calvin added */
  1826.     gdi_layer_clear(GDI_COLOR_WHITE);
  1827.     dm_draw_scr_bg_image();
  1828.     gdi_layer_pop_and_restore_active();
  1829. }
  1830. /* 100405 dm_set_scr_bg_image_no_draw Calvin Start */
  1831. /*****************************************************************************
  1832.  * FUNCTION
  1833.  *  dm_set_scr_bg_image_no_draw
  1834.  * DESCRIPTION
  1835.  *  This function is used to set image id or image name of scr bg image
  1836.  * PARAMETERS
  1837.  *  image_id        [IN]        Id of the image
  1838.  *  file_name       [IN]        File name of the image
  1839.  *  x               [IN]        
  1840.  *  y               [IN]        
  1841.  *  opacity         [IN]        
  1842.  * RETURNS
  1843.  *  void
  1844.  *****************************************************************************/
  1845. void dm_set_scr_bg_image_no_draw(U16 image_id, S8 *file_name, S32 x, S32 y, U8 opacity)
  1846. {
  1847.     /*----------------------------------------------------------------*/
  1848.     /* Local Variables                                                */
  1849.     /*----------------------------------------------------------------*/
  1850.     /*----------------------------------------------------------------*/
  1851.     /* Code Body                                                      */
  1852.     /*----------------------------------------------------------------*/
  1853.     if (image_id != 0 && file_name == NULL)
  1854.     {
  1855.         g_dm_scr_bg_cntx.image_id = image_id;
  1856.         g_dm_scr_bg_cntx.image_name = NULL;
  1857.     }
  1858.     else if (image_id == 0 && file_name != NULL)
  1859.     {
  1860.         g_dm_scr_bg_cntx.image_id = 0;
  1861.         g_dm_scr_bg_cntx.image_name = file_name;
  1862.     }
  1863. #ifndef MMI_ON_WIN32
  1864.     else
  1865.     {
  1866.         MMI_ASSERT(0);
  1867.     }
  1868. #endif /* MMI_ON_WIN32 */ 
  1869.     g_dm_scr_bg_cntx.offset_x = x;
  1870.     g_dm_scr_bg_cntx.offset_y = y;
  1871.     g_dm_scr_bg_cntx.layer_opacity = opacity;   /* 070505 Calvin added */
  1872. }
  1873. /* 100405 dm_set_scr_bg_image_no_draw Calvin End */
  1874. /*****************************************************************************
  1875.  * FUNCTION
  1876.  *  dm_get_scr_bg_image
  1877.  * DESCRIPTION
  1878.  *  This function is used to get image id or image name of scr bg image
  1879.  * PARAMETERS
  1880.  *  image_id        [IN/OUT]        Id of the image
  1881.  *  file_name       [IN/OUT]        File name of the image
  1882.  *  x               [?]             
  1883.  *  y               [?]             
  1884.  *  opacity         [?]             
  1885.  * RETURNS
  1886.  *  void
  1887.  *****************************************************************************/
  1888. /* Leo add 0701 */
  1889. void dm_get_scr_bg_image(U16 *image_id, S8 **file_name, S32 *x, S32 *y, U8 *opacity)
  1890. {
  1891.     /*----------------------------------------------------------------*/
  1892.     /* Local Variables                                                */
  1893.     /*----------------------------------------------------------------*/
  1894.     /*----------------------------------------------------------------*/
  1895.     /* Code Body                                                      */
  1896.     /*----------------------------------------------------------------*/
  1897.     /* 070505 Calvin Start */
  1898.     if (g_dm_scr_bg_cntx.image_id == 0 && g_dm_scr_bg_cntx.image_name == NULL)
  1899.     {
  1900.         //if (idle_screen_wallpaper_ID == 0)//073106 cache wallpaper
  1901.         if (idle_screen_cache_id == 0)
  1902.         {
  1903.             //g_dm_scr_bg_cntx.image_name = idle_screen_wallpaper_name;
  1904.             g_dm_scr_bg_cntx.image_name = idle_screen_cache_name;
  1905.         }
  1906.         else
  1907.         {
  1908.             //g_dm_scr_bg_cntx.image_id = idle_screen_wallpaper_ID;
  1909.             g_dm_scr_bg_cntx.image_id = idle_screen_cache_id;
  1910.         }
  1911.     }
  1912.     /* 070505 Calvin End */
  1913.     *image_id = g_dm_scr_bg_cntx.image_id;
  1914.     *file_name = g_dm_scr_bg_cntx.image_name;
  1915.     *x = g_dm_scr_bg_cntx.offset_x;
  1916.     *y = g_dm_scr_bg_cntx.offset_y;
  1917.     *opacity = g_dm_scr_bg_cntx.layer_opacity;
  1918. }
  1919. /*****************************************************************************
  1920.  * FUNCTION
  1921.  *  dm_set_scr_bg_redraw
  1922.  * DESCRIPTION
  1923.  *  An API for application to set the flag g_dm_cntx.redraw_scr_bg_flag
  1924.  * PARAMETERS
  1925.  *  status      [IN]        The new value of dm_draw_scr_bg_flag.
  1926.  * RETURNS
  1927.  *  void
  1928.  *****************************************************************************/
  1929. void dm_set_scr_bg_redraw(MMI_BOOL status)
  1930. {
  1931.     /*----------------------------------------------------------------*/
  1932.     /* Local Variables                                                */
  1933.     /*----------------------------------------------------------------*/
  1934.     /*----------------------------------------------------------------*/
  1935.     /* Code Body                                                      */
  1936.     /*----------------------------------------------------------------*/
  1937.     if (g_dm_cntx.redraw_scr_bg_flag == MMI_FALSE && status == MMI_TRUE)        /* should clear g_dm_scr_bg_cntx.1scr_bg_layer */
  1938.     {
  1939.         g_dm_cntx.redraw_scr_bg_flag = status;
  1940.     }
  1941.     else if (g_dm_cntx.redraw_scr_bg_flag == MMI_TRUE && status == MMI_FALSE)
  1942.     {
  1943.         /* SHOULD NOT HAPPEN */
  1944.         g_dm_cntx.redraw_scr_bg_flag = status;
  1945.     }
  1946. }
  1947. /*****************************************************************************
  1948.  * FUNCTION
  1949.  *  dm_set_scr_bg_opacity
  1950.  * DESCRIPTION
  1951.  *  This function is used to set opacity of scr_bg layer
  1952.  * PARAMETERS
  1953.  *  opacity     [IN]        Opacity of layer
  1954.  * RETURNS
  1955.  *  void
  1956.  *****************************************************************************/
  1957. void dm_set_scr_bg_opacity(U8 opacity)
  1958. {
  1959.     /*----------------------------------------------------------------*/
  1960.     /* Local Variables                                                */
  1961.     /*----------------------------------------------------------------*/
  1962.     /*----------------------------------------------------------------*/
  1963.     /* Code Body                                                      */
  1964.     /*----------------------------------------------------------------*/
  1965.     g_dm_scr_bg_cntx.layer_opacity = opacity;
  1966. }
  1967. /*****************************************************************************
  1968.  * FUNCTION
  1969.  *  dm_get_scr_bg_opacity
  1970.  * DESCRIPTION
  1971.  *  This function is used to get opacity of scr_bg layer
  1972.  * PARAMETERS
  1973.  *  opacity     [IN/OUT]        Opacity of layer
  1974.  * RETURNS
  1975.  *  void
  1976.  *****************************************************************************/
  1977. void dm_get_scr_bg_opacity(U8 *opacity)
  1978. {
  1979.     /*----------------------------------------------------------------*/
  1980.     /* Local Variables                                                */
  1981.     /*----------------------------------------------------------------*/
  1982.     /*----------------------------------------------------------------*/
  1983.     /* Code Body                                                      */
  1984.     /*----------------------------------------------------------------*/
  1985.     *opacity = g_dm_scr_bg_cntx.layer_opacity;
  1986. }
  1987. /* 082906 scr_bg Start */
  1988. /*****************************************************************************
  1989.  * FUNCTION
  1990.  *  dm_set_scr_bg_flag
  1991.  * DESCRIPTION
  1992.  *  This function is used to set display flags of scr_bg layer
  1993.  * PARAMETERS
  1994.  *  flags     [IN]        display flags
  1995.  * RETURNS
  1996.  *  void
  1997.  *****************************************************************************/
  1998. void dm_set_scr_bg_flag(S32 flags)
  1999. {
  2000.     /*----------------------------------------------------------------*/
  2001.     /* Local Variables                                                */
  2002.     /*----------------------------------------------------------------*/
  2003.     /*----------------------------------------------------------------*/
  2004.     /* Code Body                                                      */
  2005.     /*----------------------------------------------------------------*/
  2006.     g_dm_scr_bg_cntx.flags = flags;
  2007. }
  2008. /*****************************************************************************
  2009.  * FUNCTION
  2010.  *  dm_get_scr_bg_flag
  2011.  * DESCRIPTION
  2012.  *  This function is used to get display flags of scr_bg layer
  2013.  * PARAMETERS
  2014.  *  flags     [IN/OUT]        display flags
  2015.  * RETURNS
  2016.  *  void
  2017.  *****************************************************************************/
  2018. void dm_get_scr_bg_flag(S32 *flags)
  2019. {
  2020.     /*----------------------------------------------------------------*/
  2021.     /* Local Variables                                                */
  2022.     /*----------------------------------------------------------------*/
  2023.     /*----------------------------------------------------------------*/
  2024.     /* Code Body                                                      */
  2025.     /*----------------------------------------------------------------*/
  2026.     *flags = g_dm_scr_bg_cntx.flags;
  2027. }
  2028. /* 082906 scr_bg End */
  2029. /*****************************************************************************
  2030.  * FUNCTION
  2031.  *  dm_get_scr_bg_layer
  2032.  * DESCRIPTION
  2033.  *  This function is used to get the layer handle of scr bg image
  2034.  * PARAMETERS
  2035.  *  void
  2036.  * RETURNS
  2037.  *  GDI_HANDLE
  2038.  *****************************************************************************/
  2039. GDI_HANDLE dm_get_scr_bg_layer(void)
  2040. {
  2041.     /*----------------------------------------------------------------*/
  2042.     /* Local Variables                                                */
  2043.     /*----------------------------------------------------------------*/
  2044.     /*----------------------------------------------------------------*/
  2045.     /* Code Body                                                      */
  2046.     /*----------------------------------------------------------------*/
  2047.     return g_dm_scr_bg_cntx.layer_handle;
  2048. }
  2049. /*****************************************************************************
  2050.  * FUNCTION
  2051.  *  dm_setup_and_draw_scr_bg
  2052.  * DESCRIPTION
  2053.  *  This function is used setup screen background layer and draw it
  2054.  * PARAMETERS
  2055.  *  UICtrlAccessPtr_p       [IN/OUT]        It specifies the start position to take out the coordinates.
  2056.  *  *(?)
  2057.  * RETURNS
  2058.  *  void
  2059.  *****************************************************************************/
  2060. S32 dm_setup_and_draw_scr_bg(S16 **UICtrlAccessPtr_p)
  2061. {
  2062.     /* Currently coordinate set is not needed. The input UICtrlAccessPtr_p is just for future use. */
  2063. #ifdef __GDI_MEMORY_PROFILE_2__
  2064.     /*----------------------------------------------------------------*/
  2065.     /* Local Variables                                                */
  2066.     /*----------------------------------------------------------------*/
  2067.     GDI_RESULT ret;
  2068.     U8 layer_idx = 0;
  2069.     /*----------------------------------------------------------------*/
  2070.     /* Code Body                                                      */
  2071.     /*----------------------------------------------------------------*/
  2072.     if (g_dm_cntx.redraw_scr_bg_flag == MMI_TRUE)
  2073.     {
  2074.         /* There is no free layer can be used for background */
  2075.         MMI_ASSERT(dm_layers_count < GDI_LAYER_TOTAL_LAYER_COUNT);
  2076.         gdi_layer_multi_layer_enable();
  2077.         ret = gdi_layer_create(0, 0, UI_device_width, UI_device_height, &g_dm_scr_bg_cntx.layer_handle);
  2078.         /* Create layer fail */
  2079.         /* MMI_ASSERT (ret>0); */
  2080.         if (ret < 0)
  2081.         {
  2082.             return 0;
  2083.         }
  2084.         gdi_layer_push_and_set_active(g_dm_scr_bg_cntx.layer_handle);
  2085.     #ifdef __MMI_SCREEN_ROTATE__
  2086.         /* gdi_layer_set_rotate(gdi_layer_get_base_layer_rotation()); */
  2087.     #endif 
  2088.         gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  2089.         gdi_layer_set_opacity(TRUE, g_dm_scr_bg_cntx.layer_opacity);
  2090.         gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  2091.         if (g_dm_scr_bg_cntx.image_id == 0 && g_dm_scr_bg_cntx.image_name == NULL)
  2092.         {
  2093.             //if (idle_screen_wallpaper_ID == 0)//073106 cache wallpaper
  2094.             if (idle_screen_cache_id == 0)
  2095.             {
  2096.                 //g_dm_scr_bg_cntx.image_name = idle_screen_wallpaper_name;
  2097.                 g_dm_scr_bg_cntx.image_name = idle_screen_cache_name;
  2098.             }
  2099.             else
  2100.             {
  2101.                 //g_dm_scr_bg_cntx.image_id = idle_screen_wallpaper_ID;
  2102.                 g_dm_scr_bg_cntx.image_id = idle_screen_cache_id;
  2103.             }
  2104.         }
  2105.         /* Start to draw the background */
  2106.         dm_draw_scr_bg_image();
  2107.         /* End of drawing the background */
  2108.         gdi_layer_pop_and_restore_active();
  2109.         /* set scr_bg layer to be the most buttom layer, and shift other layers */
  2110.         for (layer_idx = 0; layer_idx < dm_layers_count; layer_idx++)
  2111.         {
  2112.             dm_layers[layer_idx + 1] = dm_layers[layer_idx];
  2113.         }
  2114.         dm_layers[0] = g_dm_scr_bg_cntx.layer_handle;
  2115.         dm_layers_count++;
  2116.         /* Once scr_bg is drawn, there is no need to redraw again, except the flag is turned on */
  2117.         g_dm_cntx.redraw_scr_bg_flag = MMI_FALSE;
  2118.     }
  2119. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2120.     wgui_set_wallpaper_on_bottom(MMI_TRUE);
  2121. #endif 
  2122.     return 1;
  2123. #else /* __GDI_MEMORY_PROFILE_2__ */ 
  2124.     return 0;
  2125. #endif /* __GDI_MEMORY_PROFILE_2__ */ 
  2126. }   /* dm_setup_and_draw_scr_bg */
  2127. /*****************************************************************************
  2128.  * FUNCTION
  2129.  *  dm_register_vkpad_callback
  2130.  * DESCRIPTION
  2131.  *  This function is to register dm_show_vkpad_callback
  2132.  * PARAMETERS
  2133.  *  f       [IN]        Function pointer to do changes before show virtual keypad.
  2134.  * RETURNS
  2135.  *  void
  2136.  *****************************************************************************/
  2137. void dm_register_vkpad_callback(FuncPtr f)
  2138. {
  2139.     /*----------------------------------------------------------------*/
  2140.     /* Local Variables                                                */
  2141.     /*----------------------------------------------------------------*/
  2142.     /*----------------------------------------------------------------*/
  2143.     /* Code Body                                                      */
  2144.     /*----------------------------------------------------------------*/
  2145.     dm_show_vkpad_callback = f;
  2146. }
  2147. /*****************************************************************************
  2148.  * FUNCTION
  2149.  *  dm_check_control_exist
  2150.  * DESCRIPTION
  2151.  *  This function is to register dm_show_vkpad_callback
  2152.  * PARAMETERS
  2153.  *  category_id     [IN]        
  2154.  *  control_id      [IN]        
  2155.  *  f(?)            [IN]        Function pointer to do changes before show virtual keypad.
  2156.  * RETURNS
  2157.  *  void
  2158.  *****************************************************************************/
  2159. MMI_BOOL dm_check_control_exist(S32 category_id, mmi_dm_control_ids_enum control_id)
  2160. {
  2161.     /*----------------------------------------------------------------*/
  2162.     /* Local Variables                                                */
  2163.     /*----------------------------------------------------------------*/
  2164.     U8 *control_set = NULL;
  2165.     S16 *coorindate_set = NULL;
  2166.     S32 i, num_control = 0;
  2167.     /*----------------------------------------------------------------*/
  2168.     /* Code Body                                                      */
  2169.     /*----------------------------------------------------------------*/
  2170.     control_set = dm_search_control_set((U16) g_dm_data.s32CatId, &coorindate_set);
  2171.     if (!control_set)
  2172.     {
  2173.         return MMI_FALSE;
  2174.     }
  2175.     num_control = (S32) control_set[0];
  2176.     for (i = 1; i <= num_control; i++)
  2177.     {
  2178.         if (control_set[i] == (U8) control_id)
  2179.         {
  2180.             return MMI_TRUE;
  2181.         }
  2182.     }
  2183.     return MMI_FALSE;
  2184. }
  2185. /*****************************************************************************
  2186.  * FUNCTION
  2187.  *  dm_redraw_category_screen
  2188.  * DESCRIPTION
  2189.  *  This function is the actual Draw Manager, which is used by all categories to draw themselves.
  2190.  * PARAMETERS
  2191.  *  void
  2192.  * RETURNS
  2193.  *  void
  2194.  *****************************************************************************/
  2195. void dm_redraw_category_screen(void)
  2196. {
  2197.     /*----------------------------------------------------------------*/
  2198.     /* Local Variables                                                */
  2199.     /*----------------------------------------------------------------*/
  2200.     S32 u8CtrlCt = 0;
  2201.     S32 u8NoOfUICtrls = 0;
  2202.     S16 *UICtrlAccessPtr_p = NULL, *DeafultCoordinateSet_p = NULL;
  2203.     dm_cat_scr_info_struct dm_cat_scr_info;
  2204.     S32 idx = 0;
  2205.     U8 *control_set_ptr = NULL;
  2206.     S32 string_count = 0, image_count = 0, back_fill_count = 0, rectangle_count = 0, line_count =
  2207.         0, slide_control_count = 0;
  2208.     MMI_BOOL scr_bg_layer_exist = MMI_FALSE;
  2209.     S32 button_count = 0;
  2210.     S32 scroll_text_count = 0;
  2211.     S32 percentage_bar_count = 0;
  2212.     dm_redraw_state_enum redraw_type = NORMAL_EXIT;
  2213.     /*----------------------------------------------------------------*/
  2214.     /* Code Body                                                      */
  2215.     /*----------------------------------------------------------------*/
  2216. #if defined(__MMI_SCREEN_ROTATE__) && !defined(__MMI_WALLPAPER_ON_BOTTOM__)
  2217.     if (mmi_frm_is_screen_width_height_swapped())
  2218.     {
  2219.         /* We always use another background layer if screen is rotated */
  2220.         scr_bg_layer_exist = MMI_TRUE;
  2221.     }
  2222. #endif /* defined(__MMI_SCREEN_ROTATE__) && !defined(__MMI_WALLPAPER_ON_BOTTOM__) */ 
  2223. #ifdef __MMI_SUBLCD__
  2224.     if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  2225.     {
  2226.         if (g_dm_cntx.lock_redraw_sub == MMI_TRUE)
  2227.         {
  2228.             return;
  2229.         }
  2230.         g_dm_cntx.lock_redraw_sub = MMI_TRUE;
  2231.         switch (g_dm_cntx.redraw_screen_sub)
  2232.         {
  2233.                 /* from new screen */
  2234.             case NORMAL_SHOW:
  2235.                 g_dm_cntx.redraw_screen_sub = NORMAL_REDRAW;
  2236.                 redraw_type = NORMAL_REDRAW;
  2237.                 break;
  2238.                 /* from show categoryscreen without exit screen */
  2239.             case REDRAW_2_SHOW:
  2240.                 MMI_ASSERT(0);
  2241.                 break;
  2242.                 /* from redraw screen */
  2243.             case REDRAW_2_REDRAW:
  2244.                 redraw_type = REDRAW_2_REDRAW;
  2245.                 break;
  2246.             case NORMAL_REDRAW:
  2247.                 g_dm_cntx.redraw_screen_sub = REDRAW_2_REDRAW;
  2248.                 redraw_type = REDRAW_2_REDRAW;
  2249.                 break;
  2250.         }
  2251.     }
  2252.     else
  2253. #endif /* __MMI_SUBLCD__ */ 
  2254.     {
  2255.         if (g_dm_cntx.lock_redraw_main == MMI_TRUE)
  2256.         {
  2257.             return;
  2258.         }
  2259.         g_dm_cntx.lock_redraw_main = MMI_TRUE;
  2260.         switch (g_dm_cntx.redraw_screen_main)
  2261.         {
  2262.                 /* from new screen */
  2263.             case NORMAL_SHOW:
  2264.                 g_dm_cntx.redraw_screen_main = NORMAL_REDRAW;
  2265.                 redraw_type = NORMAL_REDRAW;
  2266.                 break;
  2267.                 /* from show categoryscreen without exit screen */
  2268.             case REDRAW_2_SHOW:
  2269.                 /*
  2270.                  * dm_reset_context();
  2271.                  * g_dm_cntx.redraw_screen_main = NORMAL_REDRAW;
  2272.                  * redraw_type=NORMAL_REDRAW;
  2273.                  */
  2274.                 MMI_ASSERT(0);
  2275.                 break;
  2276.                 /* from redraw screen */
  2277.             case REDRAW_2_REDRAW:
  2278.                 redraw_type = REDRAW_2_REDRAW;
  2279.                 break;
  2280.             case NORMAL_REDRAW:
  2281.                 g_dm_cntx.redraw_screen_main = REDRAW_2_REDRAW;
  2282.                 redraw_type = REDRAW_2_REDRAW;
  2283.                 break;
  2284.         }
  2285.     }
  2286.     g_dm_cntx.is_context_reset = MMI_FALSE;
  2287.     memset((void*)&prev_control_coordinates, 0, sizeof(prev_control_coordinates));
  2288.     control_set_ptr = dm_search_control_set((U16) g_dm_data.s32CatId, &DeafultCoordinateSet_p);
  2289.     /* First element in Category-Controls map specifies the number of controls */
  2290.     u8NoOfUICtrls = control_set_ptr[0];
  2291.     UICtrlAccessPtr_p = dm_search_coordinate_set(g_dm_data.s32ScrId);
  2292.     if (UICtrlAccessPtr_p == NULL)
  2293.     {
  2294.         UICtrlAccessPtr_p = DeafultCoordinateSet_p;
  2295.     }
  2296.    /*************************************************************************
  2297.    If dm_search_coordinate_set returns NULL, then there must be Default Coordinate Set.
  2298.    *************************************************************************/
  2299.     MMI_ASSERT(UICtrlAccessPtr_p != NULL);
  2300. #ifdef __MMI_INTERACTIVE_PROFILNG__
  2301. #ifdef __MMI_SUBLCD__
  2302.     if (!(g_dm_data.s32flags & DM_SUB_LCD_CONTEXT))
  2303. #endif
  2304.     {
  2305.         mmi_frm_profiling_delay_start_timer(MMI_FRM_PROFILING_DELAY_SCREEN);
  2306.     }
  2307. #endif /* __MMI_INTERACTIVE_PROFILNG__ */
  2308.     gdi_layer_lock_frame_buffer();
  2309.     /* Get category screen size */
  2310.     /* Some category screens size are not the same as lcd size */
  2311.     UICtrlAccessPtr_p = dm_get_cat_scr_coordinates(UICtrlAccessPtr_p, &dm_cat_scr_info);
  2312.     /* Set clip according to category screen size */
  2313.     /* Assume active layer is base layer for mainlcd or sublcd */
  2314. #ifdef __MMI_SUBLCD__
  2315.     if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  2316.     {
  2317.         gdi_layer_set_active(GDI_LAYER_SUB_BASE_LAYER_HANDLE);
  2318.     }
  2319.     else
  2320. #endif /* __MMI_SUBLCD__ */ 
  2321.         gdi_layer_set_active(GDI_LAYER_MAIN_BASE_LAYER_HANDLE);
  2322.     /* This might be an issue */
  2323.     gui_set_clip(dm_cat_scr_info.x1, dm_cat_scr_info.y1, dm_cat_scr_info.x2, dm_cat_scr_info.y2);
  2324.     if (g_dm_data.s32flags & DM_CLEAR_SCREEN_BACKGROUND)
  2325.     {
  2326.     #ifdef GDI_USING_LAYER
  2327.         gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_TRANSPARENT);
  2328.     #else
  2329.         gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_WHITE);
  2330.     #endif
  2331.     }
  2332. #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  2333.     g_mmi_frm_cntx.dump_screen_info.allow_dump_dm_screen = MMI_TRUE;
  2334. #endif
  2335. #ifdef __MMI_SUBLCD__
  2336.     if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  2337.     {
  2338.         UI_set_sub_LCD_graphics_context();
  2339.     #ifdef __MMI_SUBLCD_COLOR__
  2340.         if (!(g_dm_data.s32flags & DM_SUB_LCD_TRANSPARENT_BG))
  2341.         {
  2342.             show_sublcd_status_background(0, 0, (UI_device_width - 1), (UI_device_height - 1), MMI_FALSE);
  2343.         }
  2344.     #else /* __MMI_SUBLCD_COLOR__ */ 
  2345.         gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_WHITE);
  2346.     #endif /* __MMI_SUBLCD_COLOR__ */ 
  2347.     #if (0)
  2348. /* under construction !*/
  2349. /* under construction !*/
  2350. /* under construction !*/
  2351. /* under construction !*/
  2352. /* under construction !*/
  2353. /* under construction !*/
  2354.     #endif /* (0) */ 
  2355.     }
  2356. #endif /* __MMI_SUBLCD__ */ 
  2357.     for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)
  2358.     {
  2359.         switch (control_set_ptr[u8CtrlCt])
  2360.         {
  2361.             case DM_BASE_LAYER_START:
  2362.             {
  2363.                 if (redraw_type != REDRAW_2_REDRAW)
  2364.                 {
  2365.                     dm_setup_base_layer();
  2366.                 }
  2367.                 break;
  2368.             }
  2369.             case DM_NEW_LAYER_START:
  2370.             {
  2371.                 dm_setup_new_layer(&UICtrlAccessPtr_p);
  2372.                 break;
  2373.             }
  2374.             case DM_NEW_LAYER_END:  /* Just for Test, should be BASE_CONTROL_SET */
  2375.             {
  2376.                 break;
  2377.             }
  2378.             case DM_SCR_BG:
  2379.             {
  2380.                 dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p);
  2381.                 scr_bg_layer_exist = MMI_TRUE; 
  2382.                 break;
  2383.             }
  2384.             case DM_CIRCULAR_MENU1:
  2385.             {
  2386.                 dm_setup_and_draw_circular_menu(&UICtrlAccessPtr_p);
  2387.                 break;
  2388.             }
  2389.             case DM_LIST1:
  2390.             {
  2391.                 dm_setup_and_draw_fixed_list(&UICtrlAccessPtr_p);
  2392.                 break;
  2393.             }
  2394.             case DM_DYNAMIC_LIST1:
  2395.             {
  2396.                 dm_setup_and_draw_dynamic_list(&UICtrlAccessPtr_p);
  2397.                 break;
  2398.             }
  2399.             case DM_ASYNCDYNAMIC_LIST1:
  2400.             {
  2401.                 dm_setup_and_draw_asyncdynamic_list(&UICtrlAccessPtr_p);
  2402.                 break;
  2403.             }
  2404.             case DM_MATRIX_MENU1:
  2405.             {
  2406.                 dm_setup_and_draw_matrix_menu(&UICtrlAccessPtr_p);
  2407.                 break;
  2408.             }
  2409.             case DM_MULTILINE_INPUTBOX1:
  2410.             {
  2411.                 dm_setup_and_draw_multiline_inputbox(&UICtrlAccessPtr_p, &dm_cat_scr_info);
  2412.                 break;
  2413.             }
  2414.             case DM_EMS_INPUTBOX1:
  2415.             {
  2416.                 dm_setup_and_draw_ems_inputbox(&UICtrlAccessPtr_p, &dm_cat_scr_info);
  2417.                 break;
  2418.             }
  2419.             case DM_DIALER_INPUT_BOX1:
  2420.             {
  2421.                 dm_setup_and_draw_dialer_inputbox(&UICtrlAccessPtr_p);
  2422.                 break;
  2423.             }
  2424.             case DM_SINGLELINE_INPUTBOX1:
  2425.             {
  2426.                 dm_setup_and_draw_singleline_inputbox(&UICtrlAccessPtr_p);
  2427.                 break;
  2428.             }
  2429.             case DM_LSK:
  2430.             {
  2431.                 dm_setup_and_draw_left_softkey(&UICtrlAccessPtr_p);
  2432.                 break;
  2433.             }
  2434.             case DM_RSK:
  2435.             {
  2436.                 dm_setup_and_draw_right_softkey(&UICtrlAccessPtr_p);
  2437.                 break;
  2438.             }
  2439.             case DM_BUTTON:
  2440.             {
  2441.                 dm_setup_and_draw_button(&UICtrlAccessPtr_p, button_count++);
  2442.                 break;
  2443.             }
  2444.             case DM_TITLE1:
  2445.             {
  2446.                 dm_setup_and_draw_title(&UICtrlAccessPtr_p);
  2447.                 break;
  2448.             }
  2449.             case DM_HORIZONTAL_TAB_BAR:
  2450.             {
  2451.                 dm_setup_and_draw_horizontal_tab_bar(&UICtrlAccessPtr_p);
  2452.                 break;
  2453.             }
  2454.             case DM_CATEGORY_CONTROLLED_AREA:
  2455.             {
  2456.                 dm_setup_and_draw_category_controlled_area(&UICtrlAccessPtr_p);
  2457.                 break;
  2458.             }
  2459.             case DM_CATEGORY_CONTROLLED_AREA2:
  2460.             {
  2461.                 dm_setup_and_draw_category_controlled_area2(&UICtrlAccessPtr_p);
  2462.                 break;
  2463.             }
  2464.             case DM_STATUS_BAR1:
  2465.             {
  2466.                 dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);
  2467.                 break;
  2468.             }
  2469.             case DM_BUTTON_BAR1:
  2470.             {
  2471.                 dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);
  2472.                 break;
  2473.             }
  2474.             case DM_INLINE_FIXED_LIST1:
  2475.             {
  2476.                 dm_setup_and_draw_inline_item(&UICtrlAccessPtr_p);
  2477.                 break;
  2478.             }
  2479.             case DM_BASE_CONTROL_SET1:
  2480.             {
  2481.                 dm_setup_and_draw_base_control_set(&UICtrlAccessPtr_p);
  2482.                 break;
  2483.             }
  2484.             case DM_BASE_CONTROL_SET2:
  2485.             {
  2486.                 dm_setup_and_draw_base_control_set2(&UICtrlAccessPtr_p);
  2487.                 break;
  2488.             }
  2489.             case DM_STRING:
  2490.             {
  2491.                 dm_setup_and_draw_string(&UICtrlAccessPtr_p, string_count++);
  2492.                 break;
  2493.             }
  2494.             case DM_IMAGE:
  2495.             {
  2496.                 dm_setup_and_draw_image(&UICtrlAccessPtr_p, image_count++);
  2497.                 break;
  2498.             }
  2499.             case DM_CALENDAR:
  2500.             {
  2501.                 dm_setup_and_draw_calendar(&UICtrlAccessPtr_p);
  2502.                 break;
  2503.             }
  2504.             case DM_ALIGNED_AREA_START:
  2505.             {
  2506.                 dm_aligned_area_data.is_in_aligned_area = MMI_TRUE;
  2507.                 dm_setup_and_draw_aligned_area(&UICtrlAccessPtr_p, control_set_ptr);
  2508.                 break;
  2509.             }
  2510.             case DM_ALIGNED_AREA_END:
  2511.             {
  2512.                 memset(&dm_aligned_area_data, 0, sizeof(dm_aligned_area_data));
  2513.                 dm_aligned_area_data.is_in_aligned_area = MMI_FALSE;
  2514.                 break;
  2515.             }
  2516.             case DM_DATE_TIME_DISPLAY:
  2517.             {
  2518.             #ifdef __MMI_SUBLCD__
  2519.                 if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  2520.                     if (redraw_type == REDRAW_2_REDRAW)
  2521.                     {
  2522.                         update_sublcd_dt_display();
  2523.                     }
  2524.                     else
  2525.                     {
  2526.                         show_sub_LCD_dt_display();
  2527.                     }
  2528.                 else
  2529.             #endif /* __MMI_SUBLCD__ */ 
  2530.                 if (redraw_type == REDRAW_2_REDRAW)
  2531.                 {
  2532.                     update_mainlcd_dt_display();
  2533.                 }
  2534.                 else
  2535.                 {
  2536.                     show_main_LCD_dt_display();
  2537.                 }
  2538.                 break;
  2539.             }
  2540.             case DM_BACK_FILL_AREA:
  2541.             {
  2542.                 dm_setup_and_draw_back_fill_area(&UICtrlAccessPtr_p, back_fill_count++);
  2543.                 break;
  2544.             }
  2545.             case DM_RECTANGLE:
  2546.             {
  2547.                 dm_setup_and_draw_rectangle(&UICtrlAccessPtr_p, rectangle_count++);
  2548.                 break;
  2549.             }
  2550.             case DM_LINE:
  2551.             {
  2552.                 dm_setup_and_draw_line(&UICtrlAccessPtr_p, line_count++);
  2553.                 break;
  2554.             }
  2555.             case DM_SLIDE_CONTROL:
  2556.             {
  2557.                 dm_setup_and_draw_slide_control(&UICtrlAccessPtr_p, slide_control_count++);
  2558.                 break;
  2559.             }
  2560.             case DM_POPUP_BACKGROUND:
  2561.             {
  2562.                 dm_setup_and_draw_popup_background(&UICtrlAccessPtr_p);
  2563.                 break;
  2564.             }
  2565.             case DM_TYPICAL_STOPWATCH:
  2566.             {
  2567.                 dm_setup_and_draw_typical_stopwatch(&UICtrlAccessPtr_p);
  2568.                 break;
  2569.             }
  2570.             case DM_NWAY_STOPWATCH:
  2571.             {
  2572.                 dm_setup_and_draw_nway_stopwatch(&UICtrlAccessPtr_p);
  2573.                 break;
  2574.             }
  2575.             case DM_WALL_PAPER:
  2576.             {
  2577.                 dm_setup_and_draw_wallpaper(&UICtrlAccessPtr_p);
  2578.                 break;
  2579.             }
  2580.             case DM_SCROLL_TEXT:
  2581.             {
  2582.                 dm_setup_and_draw_scroll_text(&UICtrlAccessPtr_p, scroll_text_count++);
  2583.                 break;
  2584.             }
  2585.             case DM_PERCENTAGE_BAR:
  2586.             {
  2587.                 dm_setup_and_draw_percentage_bar(&UICtrlAccessPtr_p, percentage_bar_count++);
  2588.             }
  2589.         }
  2590.     }
  2591. #ifndef __GDI_MEMORY_PROFILE_2__
  2592.     new_layer_x = 0;
  2593.     new_layer_y = 0;
  2594. #endif /* __GDI_MEMORY_PROFILE_2__ */ 
  2595.     /* if virtual keypad show flag is set, show the virtual keypad */
  2596.     if (g_dm_data.s32flags & DM_SHOW_VKPAD)
  2597.     {
  2598.         if (dm_show_vkpad_callback != NULL)
  2599.         {
  2600.             dm_show_vkpad_callback();
  2601.         }
  2602.         /* wgui_show_virtual_keyboard(); */
  2603.     }
  2604. #ifdef __MMI_SUBLCD__
  2605.     if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
  2606.     {
  2607.         if (g_dm_data.s32flags & DM_SUB_LCD_ROTATE_180)
  2608.         {
  2609.             gui_rotate_180_sublcd();
  2610.         }
  2611.         gdi_layer_unlock_frame_buffer();
  2612.         if (!(g_dm_data.s32flags & DM_NO_BLT))
  2613.         {
  2614.             gdi_layer_blt(
  2615.                 dm_layers_sub[0],
  2616.                 dm_layers_sub[1],
  2617.                 dm_layers_sub[2],
  2618.                 dm_layers_sub[3],
  2619.                 dm_cat_scr_info.x1,
  2620.                 dm_cat_scr_info.y1,
  2621.                 dm_cat_scr_info.x2,
  2622.                 dm_cat_scr_info.y2);
  2623.         }
  2624.         else
  2625.         {
  2626.             gdi_layer_set_blt_layer(dm_layers_sub[0], dm_layers_sub[1], dm_layers_sub[2], dm_layers_sub[3]);
  2627.         }
  2628.         UI_set_main_LCD_graphics_context();
  2629.         g_dm_cntx.lock_redraw_sub = MMI_FALSE;
  2630.         return;
  2631.     }
  2632. #endif /* __MMI_SUBLCD__ */ 
  2633.     gdi_layer_restore_base_active();
  2634.     if (scr_bg_layer_exist == MMI_FALSE)
  2635.     {
  2636.         for (idx = 0; idx < GDI_LAYER_TOTAL_LAYER_COUNT; idx++)
  2637.         {
  2638.             if (dm_layers[idx] == g_dm_scr_bg_cntx.layer_handle)
  2639.             {
  2640.                 dm_layers[idx] = 0;
  2641.                 break;
  2642.             }
  2643.         }
  2644.         if (idx < GDI_LAYER_TOTAL_LAYER_COUNT)
  2645.         {
  2646.             dm_layers[idx] = g_dm_scr_bg_cntx.layer_handle;
  2647.         }
  2648.     }
  2649.     gdi_layer_unlock_frame_buffer();
  2650.     if (!(g_dm_data.s32flags & DM_NO_BLT))
  2651.     {
  2652.         gdi_layer_blt(
  2653.             dm_layers[0],
  2654.             dm_layers[1],
  2655.             dm_layers[2],
  2656.             dm_layers[3],
  2657.             dm_cat_scr_info.x1,
  2658.             dm_cat_scr_info.y1,
  2659.             dm_cat_scr_info.x2 - dm_cat_scr_info.x1 - 1,
  2660.             dm_cat_scr_info.y2 - dm_cat_scr_info.y1 - 1);
  2661.     }
  2662.     else
  2663.     {
  2664.         gdi_layer_set_blt_layer(dm_layers[0], dm_layers[1], dm_layers[2], dm_layers[3]);
  2665.     }
  2666. #ifdef __MMI_INTERACTIVE_PROFILNG__
  2667. #ifdef __MMI_SUBLCD__
  2668.     if (!(g_dm_data.s32flags & DM_SUB_LCD_CONTEXT))
  2669. #endif
  2670.     {
  2671.         mmi_frm_profiling_delay_perform(MMI_FRM_PROFILING_DELAY_SCREEN);
  2672.     }
  2673. #endif /* __MMI_INTERACTIVE_PROFILNG__ */
  2674.     
  2675.     /* 061506 double buffer Start */
  2676.     for (idx=0; idx<MAX_STATUS_ICON_BARS; idx++)
  2677.     {
  2678.         if(get_status_icon_bar_type(idx)&STATUS_ICON_BAR_ENABLE_DOUBLE_BUFFER)
  2679.         {
  2680.             gdi_layer_push_and_set_active(get_status_icon_bar_layer(idx));
  2681.             gdi_layer_toggle_double();
  2682.             gdi_layer_copy_double();//070306 copy double
  2683.             gdi_layer_pop_and_restore_active();
  2684.         }
  2685.     }
  2686.     /* 061506 double buffer Start */
  2687. #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  2688.     g_mmi_frm_cntx.dump_screen_info.allow_dump_dm_screen = MMI_FALSE;
  2689. #endif
  2690.     g_dm_cntx.lock_redraw_main = MMI_FALSE;
  2691. }   /* end of dm_redraw_category_screen */
  2692. /* Get Coordinate Set for different components */
  2693. /*****************************************************************************
  2694.  * FUNCTION
  2695.  *  dm_get_coordinates
  2696.  * DESCRIPTION
  2697.  *  To get coordinates for any control.
  2698.  * PARAMETERS
  2699.  *  UICtrlAccessPtr_p       [?]     
  2700.  *  dm_coordinate_info      [?]     
  2701.  * RETURNS
  2702.  *  void
  2703.  *****************************************************************************/
  2704. S16 *dm_get_coordinates(S16 *UICtrlAccessPtr_p, dm_coordinates *dm_coordinate_info)
  2705. {
  2706.     /*----------------------------------------------------------------*/
  2707.     /* Local Variables                                                */
  2708.     /*----------------------------------------------------------------*/
  2709.     /*----------------------------------------------------------------*/
  2710.     /* Code Body                                                      */
  2711.     /*----------------------------------------------------------------*/
  2712.     if (*UICtrlAccessPtr_p == DM_DUMMY_COORDINATE)
  2713.     {
  2714.         dm_coordinate_info->s16X = 0;
  2715.         dm_coordinate_info->s16Y = 0;
  2716.         dm_coordinate_info->s16Width = 0;
  2717.         dm_coordinate_info->s16Height = 0;
  2718.         dm_coordinate_info->Flags = DM_NO_FLAGS;
  2719.         UICtrlAccessPtr_p++;
  2720.     }
  2721.     else if (*UICtrlAccessPtr_p == DM_NULL_COORDINATE)
  2722.     {
  2723.         dm_coordinate_info->s16X = -1;
  2724.         dm_coordinate_info->s16Y = -1;
  2725.         dm_coordinate_info->s16Width = -1;
  2726.         dm_coordinate_info->s16Height = -1;
  2727.         dm_coordinate_info->Flags = DM_NO_FLAGS;
  2728.         UICtrlAccessPtr_p++;
  2729.     }
  2730.     else if (*UICtrlAccessPtr_p == DM_FULL_SCREEN_COORDINATE_FLAG || *UICtrlAccessPtr_p == DM_FULL_SCREEN_COORDINATE)
  2731.     {
  2732.     #ifdef __MMI_SCREEN_ROTATE__
  2733.         if (mmi_frm_is_screen_width_height_swapped())
  2734.         {
  2735.             dm_coordinate_info->s16X = 0;
  2736.             dm_coordinate_info->s16Y = 0;
  2737.             dm_coordinate_info->s16Width = MMI_ROTATED_LCD_WIDTH;
  2738.             dm_coordinate_info->s16Height = MMI_ROTATED_LCD_HEIGHT;
  2739.         }
  2740.         else
  2741.     #endif /* __MMI_SCREEN_ROTATE__ */ 
  2742.         {
  2743.             dm_coordinate_info->s16X = 0;
  2744.             dm_coordinate_info->s16Y = 0;
  2745.             dm_coordinate_info->s16Width = MAIN_LCD_DEVICE_WIDTH;
  2746.             dm_coordinate_info->s16Height = MAIN_LCD_DEVICE_HEIGHT;
  2747.         }
  2748.         if (*UICtrlAccessPtr_p == DM_FULL_SCREEN_COORDINATE_FLAG)
  2749.         {
  2750.             dm_coordinate_info->Flags = DM_NO_FLAGS;
  2751.         }
  2752.         else
  2753.         {
  2754.             UICtrlAccessPtr_p++;
  2755.             dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
  2756.         }
  2757.         UICtrlAccessPtr_p++;
  2758.     }
  2759.     else if (*UICtrlAccessPtr_p == DM_CONTENT_COORDINATE_FLAG || *UICtrlAccessPtr_p == DM_CONTENT_COORDINATE)
  2760.     {
  2761.     #ifdef __MMI_SCREEN_ROTATE__
  2762.         if (mmi_frm_is_screen_width_height_swapped())
  2763.         {
  2764.             dm_coordinate_info->s16X = MMI_ROTATED_CONTENT_X;
  2765.             dm_coordinate_info->s16Y = MMI_ROTATED_CONTENT_Y;
  2766.             dm_coordinate_info->s16Width = MMI_ROTATED_CONTENT_WIDTH;
  2767.             dm_coordinate_info->s16Height = MMI_ROTATED_CONTENT_HEIGHT;
  2768.         }
  2769.         else
  2770.     #endif /* __MMI_SCREEN_ROTATE__ */ 
  2771.         {
  2772.             dm_coordinate_info->s16X = MMI_CONTENT_X;
  2773. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
  2774. #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
  2775.     if(GetActiveScreenId() == MAIN_MENU_SCREENID)
  2776.     {
  2777. //jerson modify begin 20070625
  2778. #if defined(__MMI_MAINLCD_176X220__)
  2779.      dm_coordinate_info->s16Y = 20;
  2780. dm_coordinate_info->s16Width = MMI_CONTENT_WIDTH;
  2781. dm_coordinate_info->s16Height = MAIN_LCD_DEVICE_HEIGHT-MMI_BUTTON_BAR_HEIGHT-20;
  2782. #elif defined(__MMI_MAINLCD_240X320__)
  2783.      dm_coordinate_info->s16Y = 30;
  2784. dm_coordinate_info->s16Width = MMI_CONTENT_WIDTH;
  2785. dm_coordinate_info->s16Height = MAIN_LCD_DEVICE_HEIGHT-MMI_BUTTON_BAR_HEIGHT-30;
  2786. #endif
  2787. //jerson modify end 20070625
  2788.     }
  2789.     else
  2790. #endif
  2791. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
  2792. {     //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
  2793. dm_coordinate_info->s16Y = MMI_CONTENT_Y;
  2794. dm_coordinate_info->s16Width = MMI_CONTENT_WIDTH;
  2795. dm_coordinate_info->s16Height = MMI_CONTENT_HEIGHT;
  2796. }     //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
  2797.         }
  2798.         if (*UICtrlAccessPtr_p == DM_CONTENT_COORDINATE_FLAG)
  2799.         {
  2800.             dm_coordinate_info->Flags = DM_NO_FLAGS;
  2801.         }
  2802.         else
  2803.         {
  2804.             UICtrlAccessPtr_p++;
  2805.             dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
  2806.         }
  2807.         UICtrlAccessPtr_p++;
  2808.     }
  2809.     else if (*UICtrlAccessPtr_p == DM_POPUP_SCREEN_COORDINATE_FLAG || *UICtrlAccessPtr_p == DM_POPUP_SCREEN_COORDINATE)
  2810.     {
  2811.     #ifdef __MMI_SCREEN_ROTATE__
  2812.         if (mmi_frm_is_screen_width_height_swapped())
  2813.         {
  2814.             dm_coordinate_info->s16X = MMI_ROTATED_POP_UP_DIALOG_X;
  2815.             dm_coordinate_info->s16Y = MMI_ROTATED_POP_UP_DIALOG_Y;
  2816.             dm_coordinate_info->s16Width = MMI_ROTATED_POP_UP_DIALOG_WIDTH;
  2817.             dm_coordinate_info->s16Height = MMI_ROTATED_POP_UP_DIALOG_FULL_HEIGHT;
  2818.         }
  2819.         else
  2820.     #endif /* __MMI_SCREEN_ROTATE__ */ 
  2821.         {
  2822.             dm_coordinate_info->s16X = MMI_POP_UP_DIALOG_X;
  2823.             dm_coordinate_info->s16Y = MMI_POP_UP_DIALOG_Y;
  2824.             dm_coordinate_info->s16Width = MMI_POP_UP_DIALOG_WIDTH;
  2825.             dm_coordinate_info->s16Height = MMI_POP_UP_DIALOG_FULL_HEIGHT;
  2826.         }
  2827.         if (*UICtrlAccessPtr_p == DM_POPUP_SCREEN_COORDINATE_FLAG)
  2828.         {
  2829.             dm_coordinate_info->Flags = DM_NO_FLAGS;
  2830.         }
  2831.         else
  2832.         {
  2833.             UICtrlAccessPtr_p++;
  2834.             dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
  2835.         }
  2836.         UICtrlAccessPtr_p++;
  2837.     }
  2838.     else if (*UICtrlAccessPtr_p == DM_DEFAULT_TITLE_BAR_FLAG || *UICtrlAccessPtr_p == DM_DEFAULT_TITLE_BAR)
  2839.     {
  2840.     #ifdef __MMI_SCREEN_ROTATE__
  2841.         if (mmi_frm_is_screen_width_height_swapped())
  2842.         {
  2843.             dm_coordinate_info->s16X = MMI_ROTATED_TITLE_X;
  2844.             dm_coordinate_info->s16Y = MMI_ROTATED_TITLE_Y;
  2845.             dm_coordinate_info->s16Width = MMI_ROTATED_TITLE_WIDTH;
  2846.             dm_coordinate_info->s16Height = MMI_ROTATED_TITLE_HEIGHT;
  2847.         }
  2848.         else
  2849.     #endif /* __MMI_SCREEN_ROTATE__ */ 
  2850.         {
  2851.             dm_coordinate_info->s16X = MMI_TITLE_X;
  2852. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
  2853. #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
  2854.     if(GetActiveScreenId() == MAIN_MENU_SCREENID)
  2855.     {
  2856. //jerson modify begin 20070625
  2857. #if defined(__MMI_MAINLCD_176X220__)
  2858. dm_coordinate_info->s16Y = 0;
  2859. dm_coordinate_info->s16Width = MMI_TITLE_WIDTH;
  2860. dm_coordinate_info->s16Height = 20;
  2861. #elif defined(__MMI_MAINLCD_240X320__)
  2862. dm_coordinate_info->s16Y = 0;
  2863. dm_coordinate_info->s16Width = MMI_TITLE_WIDTH;
  2864. dm_coordinate_info->s16Height = 20;
  2865. #endif
  2866. //jerson modify end 20070625
  2867.     }
  2868.     else
  2869. #endif
  2870. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
  2871. {     //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
  2872.             dm_coordinate_info->s16Y = MMI_TITLE_Y;
  2873.             dm_coordinate_info->s16Width = MMI_TITLE_WIDTH;
  2874.             dm_coordinate_info->s16Height = MMI_TITLE_HEIGHT;
  2875. }     //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
  2876.         }
  2877.         if (*UICtrlAccessPtr_p == DM_DEFAULT_TITLE_BAR_FLAG)
  2878.         {
  2879.             dm_coordinate_info->Flags = DM_NO_FLAGS;
  2880.         }
  2881.         else
  2882.         {
  2883.             UICtrlAccessPtr_p++;
  2884.             dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
  2885.         }
  2886.         UICtrlAccessPtr_p++;
  2887.     }