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

MTK

开发平台:

C/C++

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