wgui_draw_manager.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:345k
源码类别:
MTK
开发平台:
C/C++
- }
- if (g_dm_cntx.redraw_screen_main == REDRAW_2_REDRAW)
- {
- if (!(dm_buttonbar_info.coordinate.Flags & DM_BUTTON_DISABLE_BACKGROUND))
- {
- show_softkey_background();
- draw_arrow_indication(
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_LEFT_ARROW),
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_RIGHT_ARROW),
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_UP_ARROW),
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_DOWN_ARROW));
- }
- if (!(g_dm_data.s32flags & DM_NO_SOFTKEY))
- {
- show_softkey(MMI_LEFT_SOFTKEY);
- show_softkey(MMI_RIGHT_SOFTKEY);
- #ifdef __MMI_WGUI_CSK_ENABLE__
- show_softkey(MMI_CENTER_SOFTKEY);
- #endif
- }
- return 1;
- }
- gui_reset_clip();
- set_button_bar_height(dm_buttonbar_info.coordinate.s16Height);
- if (!(dm_buttonbar_info.coordinate.Flags & DM_BUTTON_DISABLE_BACKGROUND))
- {
- show_softkey_background();
- draw_arrow_indication(
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_LEFT_ARROW),
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_RIGHT_ARROW),
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_UP_ARROW),
- (S8) (dm_buttonbar_info.coordinate.Flags & DM_BUTTON_BAR_DOWN_ARROW));
- }
- if (!(g_dm_data.s32flags & DM_NO_SOFTKEY))
- {
- #ifdef __MMI_SCREEN_ROTATE__
- if (mmi_frm_is_screen_width_height_swapped())
- {
- /* Vertical softkey bar aligned to right */
- /* FIXME. replace fixed value MMI_ROTATED_SOFTKEY_HEIGHT */
- set_softkey_flags_on(UI_BUTTON_RIGHT_ALIGN, MMI_LEFT_SOFTKEY);
- set_softkey_flags_off(UI_BUTTON_LEFT_ALIGN, MMI_LEFT_SOFTKEY);
- move_softkey(
- dm_buttonbar_info.coordinate.s16X,
- dm_buttonbar_info.coordinate.s16Y + dm_buttonbar_info.coordinate.s16Height - MMI_ROTATED_SOFTKEY_HEIGHT,
- MMI_LEFT_SOFTKEY);
- resize_softkey(dm_buttonbar_info.button_width, MMI_ROTATED_SOFTKEY_HEIGHT, MMI_LEFT_SOFTKEY);
- show_softkey(MMI_LEFT_SOFTKEY);
- move_softkey(dm_buttonbar_info.coordinate.s16X, dm_buttonbar_info.coordinate.s16Y, MMI_RIGHT_SOFTKEY);
- resize_softkey(dm_buttonbar_info.button_width, MMI_ROTATED_SOFTKEY_HEIGHT, MMI_RIGHT_SOFTKEY);
- show_softkey(MMI_RIGHT_SOFTKEY);
- #ifdef __MMI_WGUI_CSK_ENABLE__
- set_softkey_flags_on(UI_BUTTON_RIGHT_ALIGN, MMI_CENTER_SOFTKEY);
- set_softkey_flags_off(UI_BUTTON_LEFT_ALIGN, MMI_LEFT_SOFTKEY);
- move_softkey(
- dm_buttonbar_info.coordinate.s16X,
- dm_buttonbar_info.coordinate.s16Y + MMI_ROTATED_SOFTKEY_HEIGHT + ((dm_buttonbar_info.coordinate.s16Height - MMI_ROTATED_SOFTKEY_HEIGHT * 3) >> 1),
- MMI_CENTER_SOFTKEY);
- resize_softkey(dm_buttonbar_info.button_width, MMI_ROTATED_SOFTKEY_HEIGHT, MMI_CENTER_SOFTKEY);
- show_softkey(MMI_CENTER_SOFTKEY);
- #endif /* __MMI_WGUI_CSK_ENABLE__ */
- }
- else
- #endif /* __MMI_SCREEN_ROTATE__ */
- {
- /* PMT SUKRIT START 20060104 */
- #ifdef __MMI_UI_DALMATIAN_SOFTKEYS__
- dm_buttonbar_info.coordinate.s16Height -= (MMI_BUTTON_BAR_HEIGHT - MMI_SOFTKEY_HEIGHT);
- move_softkey(
- dm_buttonbar_info.coordinate.s16X,
- dm_buttonbar_info.coordinate.s16Y + (MMI_BUTTON_BAR_HEIGHT - MMI_SOFTKEY_HEIGHT),
- MMI_LEFT_SOFTKEY);
- #else /* __MMI_UI_DALMATIAN_SOFTKEYS__ */
- move_softkey(dm_buttonbar_info.coordinate.s16X, dm_buttonbar_info.coordinate.s16Y, MMI_LEFT_SOFTKEY);
- #endif /* __MMI_UI_DALMATIAN_SOFTKEYS__ */
- /* PMT SUKRIT END 20060104 */
- resize_softkey(dm_buttonbar_info.button_width, dm_buttonbar_info.coordinate.s16Height, MMI_LEFT_SOFTKEY);
- show_softkey(MMI_LEFT_SOFTKEY);
- move_softkey(
- dm_buttonbar_info.coordinate.s16X + dm_buttonbar_info.coordinate.s16Width - dm_buttonbar_info.button_width,
- dm_buttonbar_info.coordinate.s16Y,
- MMI_RIGHT_SOFTKEY);
- resize_softkey(dm_buttonbar_info.button_width, dm_buttonbar_info.coordinate.s16Height, MMI_RIGHT_SOFTKEY);
- show_softkey(MMI_RIGHT_SOFTKEY);
- #ifdef __MMI_WGUI_CSK_ENABLE__
- move_softkey(
- dm_buttonbar_info.coordinate.s16X + dm_buttonbar_info.button_width + ((dm_buttonbar_info.coordinate.s16Width - (dm_buttonbar_info.button_width * 3)) >> 1),
- dm_buttonbar_info.coordinate.s16Y,
- MMI_CENTER_SOFTKEY);
- resize_softkey(dm_buttonbar_info.button_width, dm_buttonbar_info.coordinate.s16Height, MMI_CENTER_SOFTKEY);
- show_softkey(MMI_CENTER_SOFTKEY);
- #endif /* __MMI_WGUI_CSK_ENABLE__ */
- }
- }
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_inline_item
- * DESCRIPTION
- * This function is used setup the inline items based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_inline_item(S16 **UICtrlAccessPtr_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_inline_fixed_list_info;
- fixed_icontext_menuitem *menuitem_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_inline_fixed_list_info);
- if (dm_inline_fixed_list_info.s16X == -1 || dm_inline_fixed_list_info.s16Y == -1 ||
- dm_inline_fixed_list_info.s16Width == -1 || dm_inline_fixed_list_info.s16Height == -1)
- {
- return 0;
- }
- if (g_dm_cntx.redraw_screen_main != REDRAW_2_REDRAW)
- {
- gui_set_font(&MMI_medium_font);
- MMI_fixed_icontext_menuitem.text_font = &MMI_medium_font;
- MMI_fixed_text_menuitem.text_font = &MMI_medium_font;
- move_fixed_list(dm_inline_fixed_list_info.s16X, dm_inline_fixed_list_info.s16Y);
- resize_fixed_list(dm_inline_fixed_list_info.s16Width, dm_inline_fixed_list_info.s16Height);
- /* W06.05 Do not draw fixed list in category57 because of virtual keyboard */
- if ((g_dm_data.s32flags & DM_SHOW_VKPAD))
- {
- #if defined(__MMI_TOUCH_SCREEN__)
- mmi_pen_editor_store_list_menu_height(MMI_fixed_list_menu.height);
- if ((GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY != MMI_virtual_keyboard.lang_type)
- && (!((current_wgui_inline_item->flags & INLINE_ITEM_TYPE_MASK) == INLINE_ITEM_TYPE_FULL_SCREEN_EDIT)))
- {
- /*
- resize_fixed_list(
- MMI_content_width,
- mmi_pen_editor_get_list_menu_height() - MMI_virtual_keyboard.height - 1);
- */
- mmi_pen_editor_list_menu_highlight_resize();
- /* W06.07 Locate highlighted item after resizing fixed list menu */
- gui_fixed_list_menu_locate_highlighted_item(&MMI_fixed_list_menu);
- /* W06.10 Make sure that the inline multi line edit is the first display item */
- if ((current_wgui_inline_item->flags & INLINE_ITEM_TYPE_MASK) == INLINE_ITEM_TYPE_MULTI_LINE_EDIT)
- {
- MMI_fixed_list_menu.first_displayed_item = MMI_fixed_list_menu.highlighted_item;
- }
- }
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- }
- menuitem_p = (fixed_icontext_menuitem*) MMI_fixed_list_menu.common_item_data;
- /* menuitem_p->width = dm_inline_fixed_list_info.s16Width; */
- gui_set_fixed_list_menu_common_item_data(&MMI_fixed_list_menu, menuitem_p);
- move_fixed_list(dm_inline_fixed_list_info.s16X, dm_inline_fixed_list_info.s16Y);
- }
- show_fixed_list();
- redraw_current_inline_item();
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_base_control_set
- * DESCRIPTION
- * This function is used setup the base control set based on the coordinate set and
- * then draw it
- * PARAMETERS
- * _UICtrlAccessPtr [IN]
- * UICtrlAccessPtr_p(?) [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_base_control_set(S16 **_UICtrlAccessPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *control_set_ptr;
- U8 u8CtrlCt = 0;
- U8 u8NoOfUICtrls = 0;
- S16 *UICtrlAccessPtr_p = NULL;
- #ifdef __MMI_SCREEN_ROTATE__
- MMI_BOOL popup_in_rotated_screen = MMI_FALSE;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_SCREEN_ROTATE__
- /*
- * 1. Draw a border around title and content area.
- * 2. Clear content area because some category screen (e.g. 66) does not clear it.
- *
- * If a category screen do not want to use standard MMI_ROTATED_{CONTENT|TITLE}_{X|Y},
- * it should not contain DM_BASE_CONTROL_SET1 in its control set.
- */
- if (mmi_frm_is_screen_width_height_swapped())
- {
- popup_in_rotated_screen = dm_check_control_exist(g_dm_data.s32CatId, DM_POPUP_BACKGROUND);
- if (!popup_in_rotated_screen && /* Prevent to erase popup background here */
- !(g_dm_data.s32flags & DM_NO_TITLE))
- {
- gui_push_clip();
- gui_reset_clip();
- gui_fill_rectangle(
- MMI_ROTATED_TITLE_X - 1,
- MMI_ROTATED_TITLE_Y - 1,
- MMI_ROTATED_TITLE_X + MMI_ROTATED_TITLE_WIDTH,
- MMI_ROTATED_TITLE_Y + MMI_ROTATED_TITLE_HEIGHT + MMI_ROTATED_CONTENT_HEIGHT,
- gui_color(255, 255, 255));
- gui_pop_clip();
- }
- }
- #endif /* __MMI_SCREEN_ROTATE__ */
- control_set_ptr = dm_get_base_control_set();
- UICtrlAccessPtr_p = dm_get_base_coordinate_set();
- u8NoOfUICtrls = control_set_ptr[0];
- for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)
- {
- switch (control_set_ptr[u8CtrlCt])
- {
- case DM_TITLE1:
- {
- dm_setup_and_draw_title(&UICtrlAccessPtr_p);
- break;
- }
- case DM_STATUS_BAR1:
- {
- dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);
- break;
- }
- case DM_BUTTON_BAR1:
- {
- dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);
- break;
- }
- case DM_SCR_BG:
- #ifdef __MMI_SCREEN_ROTATE__
- /*
- * When screen is rotated, we do not show screen background if popup is drawn.
- * It simplify the design because partial screen is transparent.
- */
- if (!mmi_frm_is_screen_width_height_swapped() || !popup_in_rotated_screen)
- #endif /* __MMI_SCREEN_ROTATE__ */
- {
- if (g_dm_cntx.redraw_screen_main != REDRAW_2_REDRAW)
- {
- dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p);
- }
- }
- }
- }
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_base_control_set2
- * DESCRIPTION
- * This function is used setup the base control set 2 based on the coordinate set and
- * then draw it
- * PARAMETERS
- * _UICtrlAccessPtr [IN]
- * UICtrlAccessPtr_p(?) [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_base_control_set2(S16 **_UICtrlAccessPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *control_set_ptr;
- U8 u8CtrlCt = 0;
- U8 u8NoOfUICtrls = 0;
- S16 *UICtrlAccessPtr_p = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- control_set_ptr = dm_get_base_control_set2();
- UICtrlAccessPtr_p = dm_get_base_coordinate_set2();
- u8NoOfUICtrls = control_set_ptr[0];
- for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)
- {
- switch (control_set_ptr[u8CtrlCt])
- {
- case DM_STATUS_BAR1:
- {
- dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);
- break;
- }
- case DM_BUTTON_BAR1:
- {
- dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);
- break;
- }
- case DM_SCR_BG:
- {
- dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p);
- }
- }
- }
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_string
- * DESCRIPTION
- * This function is used setup the string area set based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_string(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_string_info;
- S32 string_width, string_height;
- dm_string_data_struct *dm_string;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- {
- dm_string = &dm_string_array_sub[index];
- }
- else
- #endif /* __MMI_SUBLCD__ */
- dm_string = &dm_string_array[index];
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_string_info);
- if (dm_string_info.s16X == -1 || dm_string_info.s16Y == -1 ||
- dm_string_info.s16Width == -1 || dm_string_info.s16Height == -1)
- {
- return 0;
- }
- gui_measure_string(dm_string->string, &string_width, &string_height);
- if (dm_string->string == NULL || (string_width == 0 && string_height == 0))
- {
- return 0;
- }
- if (dm_string_info.s16Height == DM_CALCULATED_HEIGHT)
- {
- /* 060706 menstral Start */
- if ( dm_string_info.Flags & DM_STRING_BORDERED )
- {
- dm_string_info.s16Height=string_height+2;
- }
- else
- {
- dm_string_info.s16Height=string_height;
- }
- /* 060706 menstral End*/
- if (dm_string_info.Flags & DM_PREVIOUS_CONTROL_END_Y_OFFSET_HEIGHT)
- {
- dm_string_info.s16Y -= dm_string_info.s16Height;
- }
- }
- if (dm_string_info.s16Width == DM_CALCULATED_WIDTH)
- {
- dm_string_info.s16Width = string_width + 1;
- if (dm_string_info.Flags & DM_PREVIOUS_CONTROL_END_X_OFFSET_WIDTH)
- {
- dm_string_info.s16X -= dm_string_info.s16Width;
- }
- }
- gui_push_text_clip();
- gui_push_clip();
- if (!dm_aligned_area_data.is_in_aligned_area)
- {
- gui_set_clip(
- dm_string_info.s16X,
- dm_string_info.s16Y,
- dm_string_info.s16X + dm_string_info.s16Width - 1,
- dm_string_info.s16Y + dm_string_info.s16Height - 1);
- if (dm_string_info.Flags & DM_BACK_FILL)
- {
- gui_draw_filled_area(
- dm_string_info.s16X,
- dm_string_info.s16Y,
- dm_string_info.s16X + dm_string_info.s16Width - 1,
- dm_string_info.s16Y + dm_string_info.s16Height - 1,
- &(dm_string->back_fill));
- }
- gui_set_font(dm_string->font);
- gui_measure_string(dm_string->string, &string_width, &string_height);
- /* Align the string on x asis as per the flag */
- if (string_width < dm_string_info.s16Width)
- {
- if (dm_string_info.Flags & DM_CENTRE_ALIGN_X)
- {
- dm_string_info.s16X += (dm_string_info.s16Width - string_width) >> 1;
- }
- else if (dm_string_info.Flags & DM_RIGHT_ALIGN_X)
- {
- dm_string_info.s16X += (dm_string_info.s16Width - string_width);
- }
- }
- /* Align the string on y asis as per the flag */
- if (string_height < dm_string_info.s16Height)
- {
- if (dm_string_info.Flags & DM_CENTER_ALIGN_Y)
- {
- dm_string_info.s16Y += (dm_string_info.s16Height - string_height) >> 1;
- }
- else if (dm_string_info.Flags & DM_BOTTOM_ALIGN_Y)
- {
- dm_string_info.s16Y += (dm_string_info.s16Height - string_height);
- }
- }
- setup_previous_control(&dm_string_info);
- gui_set_text_clip(
- dm_string_info.s16X,
- dm_string_info.s16Y,
- dm_string_info.s16X + dm_string_info.s16Width - 1,
- dm_string_info.s16Y + dm_string_info.s16Height - 1);
- /* Add the string width to string x in case of right to left MMI. */
- if (r2lMMIFlag)
- {
- dm_string_info.s16X += string_width - 1;
- }
- gui_set_text_color(dm_string->text_color);
- //gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y);
- if (dm_string_info.Flags & DM_STRING_BORDERED)
- {
- gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y+1);
- gui_set_text_border_color(dm_string->border_color);
- /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
- /* 072106 dm string Start */
- if (string_width > dm_string_info.s16Width)
- {
- gui_print_truncated_borderd_text(dm_string_info.s16X, dm_string_info.s16Y+1, dm_string_info.s16Width, dm_string->string);
- }
- else
- {
- gui_print_bordered_text(dm_string->string);
- }
- /* 072106 dm string End */
- }
- else
- {
- /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
- gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y);
- /* 072106 dm string Start */
- if (string_width > dm_string_info.s16Width)
- {
- gui_print_truncated_text(dm_string_info.s16X, dm_string_info.s16Y, dm_string_info.s16Width, dm_string->string);
- }
- else
- {
- gui_print_text(dm_string->string);
- }
- /* 072106 dm string End */
- }
- gui_pop_text_clip();
- gui_pop_clip();
- return 1;
- }
- else
- {
- gui_set_font(dm_string->font);
- gui_measure_string(dm_string->string, &string_width, &string_height);
- dm_string_info.s16X = dm_aligned_area_data.s16X;
- dm_string_info.s16Y = dm_aligned_area_data.s16Y;
- gui_set_clip(
- dm_aligned_area_data.s16X,
- dm_aligned_area_data.s16Y,
- dm_aligned_area_data.s16X + dm_aligned_area_data.s16width - 1,
- dm_aligned_area_data.s16Y + dm_aligned_area_data.s16height - 1);
- /* We should make sure background filler is not NULL. */
- if ((dm_string_info.Flags & DM_BACK_FILL) && (&(dm_string->back_fill) != NULL))
- {
- gui_draw_filled_area(
- dm_aligned_area_data.s16X,
- dm_aligned_area_data.s16X,
- dm_aligned_area_data.s16X + dm_aligned_area_data.s16width - 1,
- dm_aligned_area_data.s16Y + dm_aligned_area_data.s16height - 1,
- &(dm_string->back_fill));
- }
- /* Align the string on x asis as per the flag */
- if (string_width < dm_aligned_area_data.s16width)
- {
- if (dm_string_info.Flags & DM_CENTRE_ALIGN_X)
- {
- dm_string_info.s16X += (dm_aligned_area_data.s16width - string_width) >> 1;
- }
- else if (dm_string_info.Flags & DM_RIGHT_ALIGN_X)
- {
- dm_string_info.s16X += (dm_aligned_area_data.s16width - string_width);
- }
- }
- /* Align the string on y asis as per the flag */
- if (string_height < dm_string_info.s16Height)
- {
- if (dm_string_info.Flags & DM_CENTER_ALIGN_Y)
- {
- dm_string_info.s16Y += (dm_string_info.s16Height - string_height) >> 1;
- }
- else if (dm_string_info.Flags & DM_BOTTOM_ALIGN_Y)
- {
- dm_string_info.s16Y += (dm_string_info.s16Height - string_height);
- }
- }
- dm_string_info.s16Y += dm_aligned_area_data.y_space; /* 101805 pin Calvin */
- gui_set_text_clip(
- dm_string_info.s16X,
- dm_string_info.s16Y,
- dm_string_info.s16X + dm_string_info.s16Width - 1,
- dm_string_info.s16Y + dm_string_info.s16Height - 1);
- /* Add the string width to string x in case of right to left MMI. */
- if (r2lMMIFlag)
- {
- dm_string_info.s16X += string_width - 1;
- }
- gui_set_text_color(dm_string->text_color);
- /* dm_string_info.s16Y+=dm_aligned_area_data.y_space; */
- dm_aligned_area_data.s16Y = dm_string_info.s16Y;
- gui_move_text_cursor(dm_string_info.s16X, dm_string_info.s16Y);
- if (dm_string_info.Flags & DM_STRING_BORDERED)
- {
- gui_set_text_border_color(dm_string->border_color);
- /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
- /* 072106 dm string Start */
- if (string_width > dm_string_info.s16Width)
- {
- gui_print_truncated_borderd_text(dm_string_info.s16X, dm_string_info.s16Y, dm_string_info.s16Width, dm_string->string);
- }
- else
- {
- gui_print_bordered_text(dm_string->string);
- }
- /* 072106 dm string End */
- }
- else
- {
- /* if(! (g_dm_data.s32flags & DM_NO_STRING) ) */
- /* 072106 dm string Start */
- if (string_width > dm_string_info.s16Width)
- {
- gui_print_truncated_text(dm_string_info.s16X, dm_string_info.s16Y, dm_string_info.s16Width, dm_string->string);
- }
- else
- {
- gui_print_text(dm_string->string);
- }
- /* 072106 dm string End */
- }
- gui_pop_text_clip();
- gui_pop_clip();
- dm_aligned_area_data.s16Y += string_height;
- return 1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_image
- * DESCRIPTION
- * This function is used setup the image area set based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_image(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_image_info;
- S32 image_width, image_height;
- dm_image_data_struct *dm_image;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- {
- dm_image = &dm_image_array_sub[index];
- }
- else
- #endif /* __MMI_SUBLCD__ */
- dm_image = &dm_image_array[index];
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_image_info);
- if (dm_image_info.s16X == -1 || dm_image_info.s16Y == -1 ||
- dm_image_info.s16Width == -1 || dm_image_info.s16Height == -1)
- {
- return 0;
- }
- gui_measure_image(dm_image->image, &image_width, &image_height);
- if ((dm_image->image == NULL && dm_image->name == NULL) || (image_width == 0 && image_height == 0))
- {
- return 0;
- }
- if (dm_image_info.s16Height == DM_CALCULATED_HEIGHT)
- {
- dm_image_info.s16Height = image_height;
- if (dm_image_info.Flags & DM_PREVIOUS_CONTROL_END_Y_OFFSET_HEIGHT)
- {
- dm_image_info.s16Y -= dm_image_info.s16Height;
- }
- }
- if (dm_image_info.s16Width == DM_CALCULATED_WIDTH)
- {
- dm_image_info.s16Width = image_width;
- if (dm_image_info.Flags & DM_PREVIOUS_CONTROL_END_X_OFFSET_WIDTH)
- {
- dm_image_info.s16X -= dm_image_info.s16Width;
- }
- }
- if (!dm_aligned_area_data.is_in_aligned_area)
- {
- gui_push_clip();
- gui_set_clip(
- dm_image_info.s16X,
- dm_image_info.s16Y,
- dm_image_info.s16X + dm_image_info.s16Width - 1,
- dm_image_info.s16Y + dm_image_info.s16Height - 1);
- /* We should make sure background filler is not NULL */
- if ((dm_image_info.Flags & DM_BACK_FILL) && (&dm_image->back_fill != NULL))
- {
- gui_draw_filled_area(
- dm_image_info.s16X,
- dm_image_info.s16Y,
- dm_image_info.s16X + dm_image_info.s16Width - 1,
- dm_image_info.s16Y + dm_image_info.s16Height - 1,
- dm_image->back_fill);
- }
- gui_measure_image(dm_image->image, &image_width, &image_height);
- /* Align the image on x asis as per the flag */
- /* 062106 cat129 Start */
- if (dm_image_info.Flags & DM_CENTRE_ALIGN_X || dm_image_info.Flags & DM_RIGHT_ALIGN_X)
- {
- if (image_width < dm_image_info.s16Width)
- {
- if (dm_image_info.Flags & DM_CENTRE_ALIGN_X)
- {
- dm_image_info.s16X += (dm_image_info.s16Width - image_width) >> 1;
- }
- else if (dm_image_info.Flags & DM_RIGHT_ALIGN_X)
- {
- dm_image_info.s16X += (dm_image_info.s16Width - image_width);
- }
- }
- }
- else if (dm_image_info.Flags & DM_FORCE_CENTRE_ALIGN_X)
- {
- dm_image_info.s16X+=(dm_image_info.s16Width-image_width)>>1;
- }
- /* Align the image on y asis as per the flag */
- if (dm_image_info.Flags & DM_CENTER_ALIGN_Y || dm_image_info.Flags & DM_BOTTOM_ALIGN_Y)
- {
- if (image_height < dm_image_info.s16Height)
- {
- if (dm_image_info.Flags & DM_CENTER_ALIGN_Y)
- {
- dm_image_info.s16Y += (dm_image_info.s16Height - image_height) >> 1;
- }
- else if (dm_image_info.Flags & DM_BOTTOM_ALIGN_Y)
- {
- dm_image_info.s16Y += (dm_image_info.s16Height - image_height);
- }
- }
- }
- else if (dm_image_info.Flags & DM_FORCE_CENTER_ALIGN_Y)
- {
- dm_image_info.s16Y+=(dm_image_info.s16Height-image_height)>>1;
- }
- /* 062106 cat129 Start */
- setup_previous_control(&dm_image_info);
- if (dm_image->image_handle != GDI_ERROR_HANDLE)
- {
- gdi_image_stop_animation(dm_image->image_handle);
- }
- if (dm_image->name != NULL) /* from file */
- {
- gdi_image_draw_animation_file(
- dm_image_info.s16X,
- dm_image_info.s16Y,
- (S8*) dm_image->name,
- &(dm_image->image_handle));
- }
- else if (dm_image->image != NULL) /* from resource */
- {
- gdi_image_draw_animation(
- dm_image_info.s16X,
- dm_image_info.s16Y,
- dm_image->image,
- &(dm_image->image_handle));
- }
- dm_image->x = dm_image_info.s16X;
- dm_image->y = dm_image_info.s16Y;
- dm_image->width = image_width;
- dm_image->height = image_height;
- gui_pop_clip();
- return 1;
- }
- else
- {
- S32 image_width = 0, image_height = 0;
- S32 x = 0, y = 0;
- gui_push_clip();
- gui_set_clip(
- dm_aligned_area_data.s16X,
- dm_aligned_area_data.s16Y,
- dm_aligned_area_data.s16X + dm_aligned_area_data.s16width - 1,
- dm_aligned_area_data.s16Y + dm_aligned_area_data.s16height - 1);
- dm_aligned_area_data.s16Y += dm_aligned_area_data.y_space;
- if (dm_image->name != NULL) /* from file */
- {
- gdi_image_get_dimension_file((S8*) dm_image->name, &image_width, &image_height);
- if (dm_aligned_area_data.s16width > image_width)
- {
- x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
- y = dm_aligned_area_data.s16Y;
- gdi_image_draw_animation_file(x, y, (S8*) dm_image->name, &(dm_image->image_handle));
- }
- else
- {
- x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
- y = dm_aligned_area_data.s16Y;
- gdi_image_draw_animation_file(x, y, (S8*) dm_image->name, &(dm_image->image_handle));
- }
- }
- else if (dm_image->image != NULL) /* from resource */
- {
- gdi_image_get_dimension(dm_image->image, &image_width, &image_height);
- if (dm_aligned_area_data.s16width > image_width)
- {
- x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
- y = dm_aligned_area_data.s16Y;
- gdi_image_draw_animation(x, y, (U8*) dm_image->image, &(dm_image->image_handle));
- }
- else
- {
- x = dm_aligned_area_data.s16X + ((dm_aligned_area_data.s16width - image_width) >> 1);
- y = dm_aligned_area_data.s16Y;
- gdi_image_draw_animation(x, y, (U8*) dm_image->image, &(dm_image->image_handle));
- }
- }
- dm_image->x = x;
- dm_image->y = y;
- dm_image->width = image_width;
- dm_image->height = image_height;
- dm_aligned_area_data.s16Y += (S16) image_height;
- gui_pop_clip();
- return 1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_button
- * DESCRIPTION
- * This function is used setup the icon button based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN] Index of icon button array
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_button(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates button_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &button_info);
- if (button_info.s16X == -1 || button_info.s16Y == -1 || button_info.s16Width == -1 || button_info.s16Height == -1)
- {
- return 0;
- }
- gdi_layer_push_clip();
- gdi_layer_set_clip(
- button_info.s16X,
- button_info.s16Y,
- button_info.s16X + button_info.s16Width - 1,
- button_info.s16Y + button_info.s16Height - 1);
- if (dm_button_array[index].x == -1 || dm_button_array[index].y == -1)
- {
- gui_move_icontext_button(&dm_button_array[index], button_info.s16X, button_info.s16Y);
- }
- if (dm_button_array[index].width == -1 || dm_button_array[index].height == -1)
- {
- gui_resize_icontext_button(&dm_button_array[index], button_info.s16Width, button_info.s16Height);
- }
- gui_show_icontext_button(&dm_button_array[index]);
- gdi_layer_pop_clip();
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_back_fill_area
- * DESCRIPTION
- * This function is used setup the back fill area set based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_back_fill_area(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_back_fill_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_back_fill_info);
- if (dm_back_fill_info.s16X == -1 || dm_back_fill_info.s16Y == -1 ||
- dm_back_fill_info.s16Width == -1 || dm_back_fill_info.s16Height == -1)
- {
- return 0;
- }
- gui_push_clip();
- gui_set_clip(
- dm_back_fill_info.s16X,
- dm_back_fill_info.s16Y,
- dm_back_fill_info.s16X + dm_back_fill_info.s16Width - 1,
- dm_back_fill_info.s16Y + dm_back_fill_info.s16Height - 1);
- gui_draw_filled_area(
- dm_back_fill_info.s16X,
- dm_back_fill_info.s16Y,
- dm_back_fill_info.s16X + dm_back_fill_info.s16Width - 1,
- dm_back_fill_info.s16Y + dm_back_fill_info.s16Height - 1,
- dm_back_fill_array[index]);
- gui_pop_clip();
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_rectangle
- * DESCRIPTION
- * This function is used setup the rectangle based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_rectangle(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_rectangle_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_rectangle_info);
- if (dm_rectangle_info.s16X == -1 || dm_rectangle_info.s16Y == -1 ||
- dm_rectangle_info.s16Width == -1 || dm_rectangle_info.s16Height == -1)
- {
- return 0;
- }
- gui_push_clip();
- gui_set_clip(
- dm_rectangle_info.s16X,
- dm_rectangle_info.s16Y,
- dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
- dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1);
- /* START VIJAY PMT 20050930 */
- if (dm_rectangle_array[index].fill_rectangle == DM_RECTANGLE_FILL_GRAYSCALE)
- {
- gui_greyscale_rectangle(
- dm_rectangle_info.s16X,
- dm_rectangle_info.s16Y,
- dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
- dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1,
- MMI_BG_GREYSCALE_VALUE,
- MMI_BG_GREYSCALE_BLACK_VALUE);
- }
- else if (dm_rectangle_array[index].fill_rectangle == DM_RECTANGLE_FILL_COLOR)
- /* END VIJAY PMT 20050930 */
- {
- gui_fill_rectangle(
- dm_rectangle_info.s16X,
- dm_rectangle_info.s16Y,
- dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
- dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1,
- dm_rectangle_array[index].line_color);
- }
- else
- {
- gui_draw_rectangle(
- dm_rectangle_info.s16X,
- dm_rectangle_info.s16Y,
- dm_rectangle_info.s16X + dm_rectangle_info.s16Width - 1,
- dm_rectangle_info.s16Y + dm_rectangle_info.s16Height - 1,
- dm_rectangle_array[index].line_color);
- }
- gui_pop_clip();
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_line
- * DESCRIPTION
- * This function is used setup the line based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_line(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_line_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_line_info);
- if (dm_line_info.s16X == -1 || dm_line_info.s16Y == -1 ||
- dm_line_info.s16Width == -1 || dm_line_info.s16Height == -1)
- {
- return 0;
- }
- gui_push_clip();
- gui_set_clip(
- dm_line_info.s16X,
- dm_line_info.s16Y,
- dm_line_info.s16X + dm_line_info.s16Width - 1,
- dm_line_info.s16Y + dm_line_info.s16Height - 1);
- gui_line(
- dm_line_info.s16X,
- dm_line_info.s16Y,
- dm_line_info.s16X + dm_line_info.s16Width - 1,
- dm_line_info.s16Y + dm_line_info.s16Height - 1,
- dm_line_array[index]);
- gui_pop_clip();
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_calendar
- * DESCRIPTION
- * This function is used setup the calendat control based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_calendar(S16 **UICtrlAccessPtr_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_calendar_info_struct dm_calendar_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_calendar_coordinates(*UICtrlAccessPtr_p, &dm_calendar_info);
- if (dm_calendar_info.coordinate.s16X == -1 || dm_calendar_info.coordinate.s16Y == -1 ||
- dm_calendar_info.coordinate.s16Width == -1 || dm_calendar_info.coordinate.s16Height == -1)
- {
- return 0;
- }
- wgui_reset_calendar_params(
- dm_calendar_info.coordinate.s16X,
- dm_calendar_info.coordinate.s16Y,
- dm_calendar_info.calendar_columns,
- dm_calendar_info.calendar_rows,
- dm_calendar_info.coordinate.s16Width / dm_calendar_info.calendar_columns,
- dm_calendar_info.coordinate.s16Height / dm_calendar_info.calendar_rows);
- set_calendar_control_background_limits(
- dm_calendar_info.calendar_background_y,
- dm_calendar_info.calendar_background_y + dm_calendar_info.calendar_background_width);
- /* gui_set_font(&MMI_default_font); */
- cat82_title1_x1 = dm_calendar_info.title1_x;
- cat82_title1_y1 = dm_calendar_info.title1_y;
- cat82_title1_x2 = dm_calendar_info.title1_x + dm_calendar_info.title1_width - 1;
- cat82_title1_y2 = dm_calendar_info.title1_y + dm_calendar_info.title1_height - 1;
- calendar_title_font = dm_get_font(dm_calendar_info.title1_font);
- /* 053005 Calvin Start */
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- cat82_title1_month_x1 = dm_calendar_info.title1_month_x;
- cat82_title1_month_y1 = dm_calendar_info.title1_month_y;
- cat82_title1_month_x2 = dm_calendar_info.title1_month_x + dm_calendar_info.title1_month_width - 1;
- cat82_title1_month_y2 = dm_calendar_info.title1_month_y + dm_calendar_info.title1_month_height - 1;
- calendar_title_month_font = dm_get_font(dm_calendar_info.title1_month_font);
- calendar_show_title_month = dm_calendar_info.title1_month_show;
- /* 061705 Calvin Start */
- #ifdef __MMI_TOUCH_SCREEN__
- if (!calendar_show_title_month) /* Don't wanna show Month on title 1: Month so disable */
- {
- DisableCalendarTitle1MonthArrow();
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- cat82_title2_x1 = dm_calendar_info.title2_x;
- cat82_title2_y1 = dm_calendar_info.title2_y;
- cat82_title2_x2 = dm_calendar_info.title2_x + dm_calendar_info.title2_width - 1;
- cat82_title2_y2 = dm_calendar_info.title2_y + dm_calendar_info.title2_height - 1;
- calendar_show_title2 = dm_calendar_info.title2_show;
- #if defined(__MMI_UI_CALENDAR_WITH_INFO_BOX__) && defined (__MMI_TOUCH_SCREEN__)
- if (lunar_calendar_present)
- {
- if (!calendar_show_title2) /* Don't wanna show Year on title 2 so disable */
- {
- DisableCalendarTitle1Arrow();
- }
- }
- #endif /* defined(__MMI_UI_CALENDAR_WITH_INFO_BOX__) && defined (__MMI_TOUCH_SCREEN__) */
- cat82_title3_x1 = dm_calendar_info.title3_x;
- cat82_title3_y1 = dm_calendar_info.title3_y;
- cat82_title3_x2 = dm_calendar_info.title3_x + dm_calendar_info.title3_width - 1;
- cat82_title3_y2 = dm_calendar_info.title3_y + dm_calendar_info.title3_height - 1;
- calendar_show_title3 = dm_calendar_info.title3_show;
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- wgui_set_calendar_info_box(
- dm_calendar_info.infobox_x,
- dm_calendar_info.infobox_y,
- dm_calendar_info.infobox_width,
- dm_calendar_info.infobox_height,
- dm_calendar_info.infobox_max,
- dm_calendar_info.infobox_show);
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- wgui_show_calendar();
- ChangeCategory82Title1(Cat82_title1);
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- ChangeCategory82Title1Month(Cat82_title1_month);
- #endif
- ChangeCategory82Title2(Cat82_title2);
- ChangeCategory82Title3(Cat82_title3);
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_popup_background
- * DESCRIPTION
- * This function is used setup the popup background based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_popup_background(S16 **UICtrlAccessPtr_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_popup_background_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_popup_background_info);
- if (dm_popup_background_info.s16X == -1 || dm_popup_background_info.s16Y == -1 ||
- dm_popup_background_info.s16Width == -1 || dm_popup_background_info.s16Height == -1)
- {
- return 0;
- }
- if ((g_dm_data.s32flags & DM_NO_POPUP_BACKGROUND))
- {
- return 0;
- }
- #ifdef __MMI_SCREEN_ROTATE__
- /*
- * Becuse we do not reserve the display of previous screen,
- * popup background is not displayed.
- * It might be changed in the future.
- *
- * 1. non-rotated -> rotated
- * 2. rotated->non-rotated
- *
- * Use transparent color to be the same as softkey background
- */
- if (mmi_frm_get_previous_screen_rotate() != mmi_frm_get_screen_rotate() ||
- mmi_frm_get_screen_rotate() != MMI_FRM_SCREEN_ROTATE_0)
- {
- gdi_layer_clear(GDI_COLOR_TRANSPARENT);
- }
- else
- #endif /* __MMI_SCREEN_ROTATE__ */
- if (dm_popup_background_info.Flags & DM_POPUP_BACKGROUND_HATCH_FILL)
- {
- color c = {200, 200, 200, 100};
- UI_cross_hatch_fill_rectangle(0, 0, UI_device_width - 1, UI_device_height - 1, c);
- entry_full_screen();
- g_dm_cntx.exit_full_screen_on_exit = MMI_TRUE;
- }
- else if (dm_popup_background_info.Flags & DM_POPUP_BACKGROUND_GREYSCALE) /* 072505 Calvin added: After 6228, it should support alpha channel */
- {
- 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 */
- }
- if (dm_popup_background_info.Flags & DM_DRAW_POPUP_BACKGROUND_3D)
- {
- wgui_draw_pop_up_screen_background(
- dm_popup_background_info.s16X,
- dm_popup_background_info.s16Y,
- dm_popup_background_info.s16X + dm_popup_background_info.s16Width - 1,
- dm_popup_background_info.s16Y + dm_popup_background_info.s16Height - 1,
- &wgui_pop_up_dialog_background,
- MMI_TRUE);
- }
- else
- {
- wgui_draw_pop_up_screen_background(
- dm_popup_background_info.s16X,
- dm_popup_background_info.s16Y,
- dm_popup_background_info.s16X + dm_popup_background_info.s16Width - 1,
- dm_popup_background_info.s16Y + dm_popup_background_info.s16Height - 1,
- &wgui_pop_up_dialog_background,
- MMI_FALSE);
- }
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_scroll_text
- * DESCRIPTION
- * This function is used setup the popup background based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_scroll_text(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_scroll_text_info;
- S32 width = 0, height = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_scroll_text_info);
- if (dm_scroll_text_info.s16X == -1 || dm_scroll_text_info.s16Y == -1 ||
- dm_scroll_text_info.s16Width == -1 || dm_scroll_text_info.s16Height == -1)
- {
- return 0;
- }
- if (dm_scroll_text_buf[index][0] == 0 && dm_scroll_text_buf[index][1] == 0)
- {
- return 0;
- }
- dm_current_scroll_text = &dm_scroll_text[index];
- if (dm_scroll_text_info.Flags & DM_SCROLL_TEXT_CENTRE_ALIGN_X)
- if (dm_current_scroll_text->text_width >= dm_scroll_text_info.s16Width)
- {
- dm_current_scroll_text->x = (S32) dm_scroll_text_info.s16X;
- dm_current_scroll_text->width = (S32) dm_scroll_text_info.s16Width;
- }
- else
- {
- dm_current_scroll_text->x =
- (S32) dm_scroll_text_info.s16X + ((dm_scroll_text_info.s16Width - dm_current_scroll_text->width) >> 1);
- }
- else
- {
- dm_current_scroll_text->x = (S32) dm_scroll_text_info.s16X;
- dm_current_scroll_text->width = (S32) dm_scroll_text_info.s16Width;
- }
- if (dm_scroll_text_info.Flags & DM_SCROLL_TEXT_CENTER_ALIGN_Y)
- {
- dm_current_scroll_text->y =
- (S32) (dm_scroll_text_info.s16Y + ((dm_scroll_text_info.s16Height - dm_current_scroll_text->height) >> 1));
- }
- else
- {
- dm_current_scroll_text->y = (S32) dm_scroll_text_info.s16Y;
- }
- //dm_current_scroll_text->width = (S32) dm_scroll_text_info.s16Width;
- if (dm_scroll_text_info.Flags & DM_SCROLL_TEXT_USE_FONT_HEIGHT)
- {
- gui_measure_string(dm_current_scroll_text->text, &width, &height);
- dm_current_scroll_text->height = height;
- dm_scroll_text_info.s16Height = height;
- }
- else
- {
- dm_current_scroll_text->height = (S32) dm_scroll_text_info.s16Height;
- }
- setup_previous_control(&dm_scroll_text_info);
- gui_show_scrolling_text(dm_current_scroll_text);
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_aligned_area
- * DESCRIPTION
- * This function is used setup the aligned area based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * control_set_ptr [?]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_aligned_area(S16 **UICtrlAccessPtr_p, U8 *control_set_ptr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_aligned_area_info;
- U8 i = 1, number_of_elements = 0;
- S32 total_element_height = 0, element_height = 0, element_width = 0;
- S32 image_count = 0, string_count = 0;
- S32 is_multiline = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Get aligned area range and flags */
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_aligned_area_info);
- dm_aligned_area_data.s16X = dm_aligned_area_info.s16X;
- dm_aligned_area_data.s16Y = dm_aligned_area_info.s16Y;
- dm_aligned_area_data.Flags = dm_aligned_area_info.Flags;
- dm_aligned_area_data.s16width = dm_aligned_area_info.s16Width;
- dm_aligned_area_data.s16height = dm_aligned_area_info.s16Height;
- if (!dm_aligned_area_data.Flags & DM_ALLIGNED_AREA_NO_BACK_FILL)
- {
- gui_draw_filled_area(
- dm_aligned_area_info.s16X,
- dm_aligned_area_info.s16Y,
- dm_aligned_area_info.s16X + dm_aligned_area_info.s16Width,
- dm_aligned_area_info.s16Y + dm_aligned_area_info.s16Height,
- current_MMI_theme->general_background_filler);
- }
- /* Get Number of elements in aligned area */
- while (control_set_ptr[i - 1] != DM_ALIGNED_AREA_START) /* find the start of aligned area */
- {
- i++;
- if (control_set_ptr[i - 1] == DM_IMAGE)
- {
- image_count++; /* skip those images not in aligned area. */
- }
- if (control_set_ptr[i - 1] == DM_STRING)
- {
- string_count++; /* skip those strings not in aligned area. */
- }
- MMI_ASSERT(i < 20); /* avoid infinite while loop. */
- }
- /* Assume all is vertically arranged, horizontally center alignment */
- while (control_set_ptr[i] != DM_ALIGNED_AREA_END) /* start to calculate number of items and its' height */
- {
- MMI_ASSERT(i < 20); /* avoid infinite while loop. */
- switch (control_set_ptr[i])
- {
- case DM_SINGLELINE_INPUTBOX1:
- if (get_singleline_inputbox_display_status())
- {
- resize_singleline_inputbox(dm_aligned_area_info.s16Width, MMI_singleline_inputbox_height);
- number_of_elements++;
- element_width = dm_aligned_area_info.s16Width;
- element_height = MMI_singleline_inputbox_height;
- }
- else
- {
- element_width = 0;
- element_height = 0;
- }
- break;
- case DM_MULTILINE_INPUTBOX1:
- is_multiline = 1;
- if (get_multiline_inputbox_display_status())
- {
- resize_multiline_inputbox_fit(
- dm_aligned_area_info.s16Width,
- dm_aligned_area_info.s16Height,
- &element_width,
- &element_height);
- number_of_elements++;
- }
- else
- {
- element_width = 0;
- element_height = 0;
- }
- break;
- case DM_IMAGE:
- if (dm_image_array[image_count].image != NULL) /* from resource */
- {
- gdi_image_get_dimension(dm_image_array[image_count++].image, &element_width, &element_height);
- number_of_elements++;
- }
- else if (dm_image_array[image_count].name != NULL) /* from file */
- {
- gdi_image_get_dimension_file(
- (S8*) dm_image_array[image_count++].name,
- &element_width,
- &element_height);
- number_of_elements++;
- }
- else /* empty image. */
- {
- element_width = 0;
- element_height = 0;
- image_count++;
- }
- break;
- case DM_STRING:
- if (dm_string_array[string_count].string != NULL)
- {
- gui_measure_string(dm_string_array[string_count++].string, &element_width, &element_height);
- number_of_elements++;
- }
- else
- {
- element_width = 0;
- element_height = 0;
- string_count++;
- }
- break;
- case DM_SLIDE_CONTROL:
- break;
- case DM_MATRIX_MENU1:
- break;
- default:
- MMI_ASSERT(0); /* support above controls ONLY */
- }
- total_element_height += element_height;
- i++;
- }
- if (dm_aligned_area_data.Flags & DM_ALLIGNED_AREA_EQUAL_SPACE_TOP_AND_BOTTOM)
- {
- if (total_element_height < dm_aligned_area_info.s16Height)
- {
- dm_aligned_area_data.s16Y += ((dm_aligned_area_info.s16Height - total_element_height) >> 1);
- dm_aligned_area_data.s16height -= ((dm_aligned_area_info.s16Height - total_element_height) >> 1);
- dm_aligned_area_data.y_space = 0;
- }
- else
- {
- if (is_multiline && dm_aligned_area_data.Flags & DM_ALLIGNED_AREA_MULTILINE_SCROLL_IF_REQUIRED)
- {
- S32 h;
- MMI_multiline_inputbox.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR;
- h = dm_aligned_area_info.s16Height - (total_element_height - MMI_multiline_inputbox.height);
- resize_multiline_inputbox(MMI_multiline_inputbox.width, h - 1);
- MMI_multiline_inputbox.edit_width =
- MMI_multiline_inputbox.width - MMI_multiline_inputbox.vbar.width - 2;
- register_keyboard_key_handler(category151_keyboard_handler);
- SetKeyHandler(multiline_inputbox_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(multiline_inputbox_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- S32 h = dm_aligned_area_info.s16Height - (total_element_height - MMI_multiline_inputbox.height);
- resize_multiline_inputbox(MMI_multiline_inputbox.width, h);
- }
- }
- }
- else
- {
- dm_aligned_area_data.y_space =
- (dm_aligned_area_info.s16Height - total_element_height) / (number_of_elements + 1);
- }
- dm_aligned_area_data.x_space = 0;
- return 1;
- } /* end of dm_setup_and_draw_aligned_area */
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_slide_control
- * DESCRIPTION
- * This function is used setup the slide control based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * index [IN]
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_slide_control(S16 **UICtrlAccessPtr_p, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_slide_control_info;
- slide_control *previous_current_slide_control = MMI_current_slide_control;
- S32 value_width = 0;
- S32 idx = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Get aligned area range and flags */
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_slide_control_info);
- if (dm_slide_control_info.s16X == -1 || dm_slide_control_info.s16Y == -1 ||
- dm_slide_control_info.s16Width == -1 || dm_slide_control_info.s16Height == -1)
- {
- return 0;
- }
- if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_NONE)
- {
- MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_NONE;
- }
- else if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_HEAD)
- {
- MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_HEAD;
- }
- else if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_TAIL)
- {
- MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_TAIL;
- }
- else if (dm_slide_control_info.Flags & DM_SLIDE_CONTROL_VALUE_POS_NEXT_LINE)
- {
- MMI_slide_control[index].flags = GUI_SLIDE_CONTROL_VALUE_POS_NEXT_LINE;
- }
- if (g_dm_cntx.redraw_screen_main != REDRAW_2_REDRAW)
- {
- for (idx = 0; idx < dm_slide_control_count; idx++)
- {
- if (MMI_slide_control[idx].value_string_width > value_width)
- {
- value_width = MMI_slide_control[idx].value_string_width;
- }
- }
- /* if ( dm_slide_control_info.Flags&DM_CENTRE_ALIGN_X) */
- switch (MMI_slide_control[index].flags)
- {
- case GUI_SLIDE_CONTROL_VALUE_POS_HEAD:
- dm_slide_control_info.s16X +=
- ((dm_slide_control_info.s16Width - MMI_slide_control[index].bg_image_width - value_width) >> 1) +
- value_width;
- MMI_slide_control[index].value_string_gap =
- (value_width - MMI_slide_control[index].value_string_width) >> 1;
- break;
- case GUI_SLIDE_CONTROL_VALUE_POS_TAIL:
- dm_slide_control_info.s16X +=
- (dm_slide_control_info.s16Width - MMI_slide_control[index].bg_image_width - value_width) >> 1;
- MMI_slide_control[index].value_string_gap =
- (value_width - MMI_slide_control[index].value_string_width) >> 1;
- break;
- case GUI_SLIDE_CONTROL_VALUE_POS_NEXT_LINE:
- dm_slide_control_info.s16X +=
- (dm_slide_control_info.s16Width - MMI_slide_control[index].bg_image_width) >> 1;
- MMI_slide_control[index].value_string_gap = 0;
- break;
- case GUI_SLIDE_CONTROL_VALUE_POS_NONE:
- break;
- default:
- break;
- }
- /* if ( MMI_slide_control[index].flags == GUI_SLIDE_CONTROL_VALUE_POS_TAIL ) */
- dm_slide_control_info.s16Height = MMI_slide_control[index].bg_image_height;
- setup_previous_control(&dm_slide_control_info);
- move_slide_control_value(&MMI_slide_control[index], dm_slide_control_info.s16X, dm_slide_control_info.s16Y);
- }
- MMI_current_slide_control = &MMI_slide_control[index];
- wgui_show_slide_control();
- if (MMI_current_slide_control == previous_current_slide_control)
- {
- wgui_show_slide_control_focus();
- }
- MMI_current_slide_control = previous_current_slide_control;
- return 1;
- } /* end of dm_setup_and_draw_slide_control */
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_typical_stopwatch
- * DESCRIPTION
- * This function is used setup the typical stopwatch based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_typical_stopwatch(S16 **UICtrlAccessPtr_p)
- {
- #ifdef __MMI_STOPWATCH__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_typical_stopwatch_info_struct dm_typical_stopwatch_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_typical_stopwatch_coordinates(*UICtrlAccessPtr_p, &dm_typical_stopwatch_info);
- if (dm_typical_stopwatch_info.coordinate.s16X == -1 || dm_typical_stopwatch_info.coordinate.s16Y == -1 ||
- dm_typical_stopwatch_info.coordinate.s16Width == -1 || dm_typical_stopwatch_info.coordinate.s16Height == -1)
- {
- return 0;
- }
- wtch_pos.typ_timer.x = dm_typical_stopwatch_info.typ_timer_x;
- wtch_pos.typ_timer.y = dm_typical_stopwatch_info.typ_timer_y;
- wtch_pos.typ_milsec.x = dm_typical_stopwatch_info.typ_milsec_x;
- wtch_pos.typ_milsec.y = dm_typical_stopwatch_info.typ_milsec_y;
- wtch_pos.typ_history_height = dm_typical_stopwatch_info.typ_history_height;
- move_fixed_list(dm_typical_stopwatch_info.coordinate.s16X, dm_typical_stopwatch_info.coordinate.s16Y);
- resize_fixed_list(dm_typical_stopwatch_info.coordinate.s16Width, dm_typical_stopwatch_info.typ_history_height);
- stop_watch_x = (dm_typical_stopwatch_info.coordinate.s16Width >> 1) - (stop_watch_width >> 1);
- stop_watch_y = dm_typical_stopwatch_info.coordinate.s16Y + MMI_fixed_list_menu.height;
- show_typical_stop_watch();
- return 1;
- #else /* __MMI_STOPWATCH__ */
- return 0;
- #endif /* __MMI_STOPWATCH__ */
- } /* end of dm_setup_and_draw_typical_stopwatch */
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_nway_stopwatch
- * DESCRIPTION
- * This function is used setup the N Way stopwatch based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_nway_stopwatch(S16 **UICtrlAccessPtr_p)
- {
- #ifdef __MMI_STOPWATCH__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_nway_stopwatch_info_struct dm_nway_stopwatch_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_nway_stopwatch_coordinates(*UICtrlAccessPtr_p, &dm_nway_stopwatch_info);
- if (dm_nway_stopwatch_info.coordinate.s16X == -1 || dm_nway_stopwatch_info.coordinate.s16Y == -1 ||
- dm_nway_stopwatch_info.coordinate.s16Width == -1 || dm_nway_stopwatch_info.coordinate.s16Height == -1)
- {
- return 0;
- }
- wtch_pos.nWay_maintimer_start.x = dm_nway_stopwatch_info.nway_main_timer_x1;
- wtch_pos.nWay_maintimer_start.y = dm_nway_stopwatch_info.nway_main_timer_y1;
- wtch_pos.nWay_maintimer_end.x = dm_nway_stopwatch_info.nway_main_timer_x2;
- wtch_pos.nWay_maintimer_end.y = dm_nway_stopwatch_info.nway_main_timer_y2;
- wtch_pos.nWay_dialog_start.x = dm_nway_stopwatch_info.nway_dialog_x1;
- wtch_pos.nWay_dialog_start.y = dm_nway_stopwatch_info.nway_dialog_y1;
- wtch_pos.nWay_dialog_end.x = dm_nway_stopwatch_info.nway_dialog_x2;
- wtch_pos.nWay_dialog_end.y = dm_nway_stopwatch_info.nway_dialog_y2;
- wtch_pos.separator_height = dm_nway_stopwatch_info.separator_height;
- show_nway_stop_watch();
- return 1;
- #else /* __MMI_STOPWATCH__ */
- return 0;
- #endif /* __MMI_STOPWATCH__ */
- } /* dm_get_nway_stopwatch_coordinates */
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_wallpaper
- * DESCRIPTION
- * This function is used setup wallpaper based on the coordinate set and
- * then draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_wallpaper(S16 **UICtrlAccessPtr_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_wallpaper_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_wallpaper_info);
- if (dm_wallpaper_info.s16X == -1 || dm_wallpaper_info.s16Y == -1 ||
- dm_wallpaper_info.s16Width == -1 || dm_wallpaper_info.s16Height == -1)
- {
- return 0;
- }
- if ((g_dm_cntx.redraw_screen_main == REDRAW_2_REDRAW) && (dm_wallpaper_layer != GDI_ERROR_HANDLE))
- {
- gdi_layer_push_and_set_active(dm_layers[dm_wallpaper_layer]);
- draw_wallpaper();
- gdi_layer_pop_and_restore_active();
- }
- else
- {
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_layer_multi_layer_enable();
- gdi_layer_create(
- dm_wallpaper_info.s16X,
- dm_wallpaper_info.s16Y,
- dm_wallpaper_info.s16Width,
- dm_wallpaper_info.s16Height,
- &dm_layers[dm_layers_count]);
- gdi_layer_set_active(dm_layers[dm_layers_count++]);
- /* gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT); */
- gdi_layer_clear(gdi_layer_get_background());
- dm_wallpaper_layer = dm_layers_count - 1;
- #endif /* __GDI_MEMORY_PROFILE_2__ */
- draw_wallpaper();
- }
- return 1;
- } /* dm_get_nway_stopwatch_coordinates */
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_percentage_bar
- * DESCRIPTION
- *
- * PARAMETERS
- * UICtrlAccessPtr_p [IN]
- * count [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 dm_setup_and_draw_percentage_bar(S16 **UICtrlAccessPtr_p, S32 count)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_coordinates dm_percentage_bar_info;
- dm_percentage_bar_struct *act_bar = &dm_percentage_bar_array[count];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_percentage_bar_info);
- if (dm_percentage_bar_info.s16X == -1 || dm_percentage_bar_info.s16Y == -1 ||
- dm_percentage_bar_info.s16Width == -1 || dm_percentage_bar_info.s16Height == -1)
- {
- return 0;
- }
- act_bar->x = dm_percentage_bar_info.s16X;
- act_bar->y = dm_percentage_bar_info.s16Y;
- act_bar->width = dm_percentage_bar_info.s16Width;
- act_bar->height = dm_percentage_bar_info.s16Height;
- dm_redraw_percentage_bar(count);
- return 1;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_draw_scr_bg_image
- * DESCRIPTION
- * This function is used to draw scr bg image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void dm_draw_scr_bg_image(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 img_width, img_height;
- GDI_RESULT ret;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_push_and_set_active(g_dm_scr_bg_cntx.layer_handle);
- #ifdef __MMI_LITE_DISPLAY__
- /* 082906 scr_bg Start */
- if (!(g_dm_scr_bg_cntx.flags && DM_SCR_BG_FORCE_SHOW))
- {
- UI_UNUSED_PARAMETER(img_width);
- UI_UNUSED_PARAMETER(img_height);
- UI_UNUSED_PARAMETER(ret);
- gdi_draw_solid_rect(
- g_dm_scr_bg_cntx.offset_x,
- g_dm_scr_bg_cntx.offset_y,
- UI_device_width - 1,
- UI_device_height - 1,
- 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));
- }
- else
- #endif /* __MMI_LITE_DISPLAY__ */
- //#else /* __MMI_LITE_DISPLAY__ */
- {
- gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, gdi_layer_get_background());
- if (g_dm_scr_bg_cntx.image_id != 0) /* from resource */
- {
- if (g_dm_scr_bg_cntx.offset_x == -1 && g_dm_scr_bg_cntx.offset_y == -1)
- {
- gdi_image_get_dimension_id(g_dm_scr_bg_cntx.image_id, &img_width, &img_height);
- if (img_width > UI_device_width || img_height > UI_device_height) /* the image is too large to fit the screen */
- {
- S32 resized_offset_x, resized_offset_y;
- S32 resized_width, resized_height;
- gdi_image_util_fit_bbox(
- UI_device_width,
- UI_device_height,
- img_width,
- img_height,
- &resized_offset_x,
- &resized_offset_y,
- &resized_width,
- &resized_height);
- ret = gdi_image_draw_resized(
- resized_offset_x,
- resized_offset_y,
- resized_width,
- resized_height,
- get_image(g_dm_scr_bg_cntx.image_id));
- }
- else
- {
- S32 offset_x = (UI_device_width - img_width) >> 1;
- S32 offset_y = (UI_device_height - img_height) >> 1;;
- gdi_image_draw_id(offset_x, offset_y, g_dm_scr_bg_cntx.image_id);
- }
- }
- else
- {
- 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);
- }
- }
- else /* from file */
- {
- if (g_dm_scr_bg_cntx.offset_x == -1 && g_dm_scr_bg_cntx.offset_y == -1)
- {
- gdi_image_get_dimension_file(g_dm_scr_bg_cntx.image_name, &img_width, &img_height);
- if (img_width > UI_device_width || img_height > UI_device_height) /* the image is too large to fit the screen */
- {
- S32 resized_offset_x, resized_offset_y;
- S32 resized_width, resized_height;
- gdi_image_util_fit_bbox(
- UI_device_width,
- UI_device_height,
- img_width,
- img_height,
- &resized_offset_x,
- &resized_offset_y,
- &resized_width,
- &resized_height);
- ret = gdi_image_draw_resized_file(
- resized_offset_x,
- resized_offset_y,
- resized_width,
- resized_height,
- (S8*) g_dm_scr_bg_cntx.image_name);
- }
- else
- {
- S32 offset_x = (UI_device_width - img_width) >> 1;
- S32 offset_y = (UI_device_height - img_height) >> 1;
- gdi_image_draw_file(offset_x, offset_y, g_dm_scr_bg_cntx.image_name);
- }
- }
- else
- {
- 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);
- }
- }
- }
- /* 082906 scr_bg End */
- //#endif /* __MMI_LITE_DISPLAY__ */
- gdi_layer_pop_and_restore_active();
- }
- /*****************************************************************************
- * FUNCTION
- * dm_set_scr_bg_image
- * DESCRIPTION
- * This function is used to set image id or image name of scr bg image
- * PARAMETERS
- * image_id [IN] Id of the image
- * file_name [IN] File name of the image
- * x [IN]
- * y [IN]
- * opacity [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void dm_set_scr_bg_image(U16 image_id, S8 *file_name, S32 x, S32 y, U8 opacity)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* 092005 Wallpaper Setting Calvin */
- if (image_id != 0 && file_name == NULL)
- {
- g_dm_scr_bg_cntx.image_id = image_id;
- g_dm_scr_bg_cntx.image_name = NULL;
- }
- else if (image_id == 0 && file_name != NULL)
- {
- g_dm_scr_bg_cntx.image_id = 0;
- g_dm_scr_bg_cntx.image_name = file_name;
- }
- /* 092005 Wallpaper Setting Calvin End */
- #ifndef MMI_ON_WIN32
- else
- {
- MMI_ASSERT(0);
- }
- #endif /* MMI_ON_WIN32 */
- g_dm_scr_bg_cntx.offset_x = x;
- g_dm_scr_bg_cntx.offset_y = y;
- g_dm_scr_bg_cntx.layer_opacity = opacity; /* 070505 Calvin added */
- /* 070505 Calvin moved */
- /* if g_dm_scr_bg_cntx.1scr_bg_layer does not exist */
- if (g_dm_scr_bg_cntx.layer_handle == GDI_ERROR_HANDLE)
- {
- return;
- }
- /* 070505 Calvin end */
- gdi_layer_push_and_set_active(g_dm_scr_bg_cntx.layer_handle);
- gdi_layer_set_opacity(TRUE, g_dm_scr_bg_cntx.layer_opacity); /* 070505 Calvin added */
- gdi_layer_clear(GDI_COLOR_WHITE);
- dm_draw_scr_bg_image();
- gdi_layer_pop_and_restore_active();
- }
- /* 100405 dm_set_scr_bg_image_no_draw Calvin Start */
- /*****************************************************************************
- * FUNCTION
- * dm_set_scr_bg_image_no_draw
- * DESCRIPTION
- * This function is used to set image id or image name of scr bg image
- * PARAMETERS
- * image_id [IN] Id of the image
- * file_name [IN] File name of the image
- * x [IN]
- * y [IN]
- * opacity [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void dm_set_scr_bg_image_no_draw(U16 image_id, S8 *file_name, S32 x, S32 y, U8 opacity)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (image_id != 0 && file_name == NULL)
- {
- g_dm_scr_bg_cntx.image_id = image_id;
- g_dm_scr_bg_cntx.image_name = NULL;
- }
- else if (image_id == 0 && file_name != NULL)
- {
- g_dm_scr_bg_cntx.image_id = 0;
- g_dm_scr_bg_cntx.image_name = file_name;
- }
- #ifndef MMI_ON_WIN32
- else
- {
- MMI_ASSERT(0);
- }
- #endif /* MMI_ON_WIN32 */
- g_dm_scr_bg_cntx.offset_x = x;
- g_dm_scr_bg_cntx.offset_y = y;
- g_dm_scr_bg_cntx.layer_opacity = opacity; /* 070505 Calvin added */
- }
- /* 100405 dm_set_scr_bg_image_no_draw Calvin End */
- /*****************************************************************************
- * FUNCTION
- * dm_get_scr_bg_image
- * DESCRIPTION
- * This function is used to get image id or image name of scr bg image
- * PARAMETERS
- * image_id [IN/OUT] Id of the image
- * file_name [IN/OUT] File name of the image
- * x [?]
- * y [?]
- * opacity [?]
- * RETURNS
- * void
- *****************************************************************************/
- /* Leo add 0701 */
- void dm_get_scr_bg_image(U16 *image_id, S8 **file_name, S32 *x, S32 *y, U8 *opacity)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* 070505 Calvin Start */
- if (g_dm_scr_bg_cntx.image_id == 0 && g_dm_scr_bg_cntx.image_name == NULL)
- {
- //if (idle_screen_wallpaper_ID == 0)//073106 cache wallpaper
- if (idle_screen_cache_id == 0)
- {
- //g_dm_scr_bg_cntx.image_name = idle_screen_wallpaper_name;
- g_dm_scr_bg_cntx.image_name = idle_screen_cache_name;
- }
- else
- {
- //g_dm_scr_bg_cntx.image_id = idle_screen_wallpaper_ID;
- g_dm_scr_bg_cntx.image_id = idle_screen_cache_id;
- }
- }
- /* 070505 Calvin End */
- *image_id = g_dm_scr_bg_cntx.image_id;
- *file_name = g_dm_scr_bg_cntx.image_name;
- *x = g_dm_scr_bg_cntx.offset_x;
- *y = g_dm_scr_bg_cntx.offset_y;
- *opacity = g_dm_scr_bg_cntx.layer_opacity;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_set_scr_bg_redraw
- * DESCRIPTION
- * An API for application to set the flag g_dm_cntx.redraw_scr_bg_flag
- * PARAMETERS
- * status [IN] The new value of dm_draw_scr_bg_flag.
- * RETURNS
- * void
- *****************************************************************************/
- void dm_set_scr_bg_redraw(MMI_BOOL status)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_dm_cntx.redraw_scr_bg_flag == MMI_FALSE && status == MMI_TRUE) /* should clear g_dm_scr_bg_cntx.1scr_bg_layer */
- {
- g_dm_cntx.redraw_scr_bg_flag = status;
- }
- else if (g_dm_cntx.redraw_scr_bg_flag == MMI_TRUE && status == MMI_FALSE)
- {
- /* SHOULD NOT HAPPEN */
- g_dm_cntx.redraw_scr_bg_flag = status;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * dm_set_scr_bg_opacity
- * DESCRIPTION
- * This function is used to set opacity of scr_bg layer
- * PARAMETERS
- * opacity [IN] Opacity of layer
- * RETURNS
- * void
- *****************************************************************************/
- void dm_set_scr_bg_opacity(U8 opacity)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_dm_scr_bg_cntx.layer_opacity = opacity;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_get_scr_bg_opacity
- * DESCRIPTION
- * This function is used to get opacity of scr_bg layer
- * PARAMETERS
- * opacity [IN/OUT] Opacity of layer
- * RETURNS
- * void
- *****************************************************************************/
- void dm_get_scr_bg_opacity(U8 *opacity)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *opacity = g_dm_scr_bg_cntx.layer_opacity;
- }
- /* 082906 scr_bg Start */
- /*****************************************************************************
- * FUNCTION
- * dm_set_scr_bg_flag
- * DESCRIPTION
- * This function is used to set display flags of scr_bg layer
- * PARAMETERS
- * flags [IN] display flags
- * RETURNS
- * void
- *****************************************************************************/
- void dm_set_scr_bg_flag(S32 flags)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_dm_scr_bg_cntx.flags = flags;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_get_scr_bg_flag
- * DESCRIPTION
- * This function is used to get display flags of scr_bg layer
- * PARAMETERS
- * flags [IN/OUT] display flags
- * RETURNS
- * void
- *****************************************************************************/
- void dm_get_scr_bg_flag(S32 *flags)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *flags = g_dm_scr_bg_cntx.flags;
- }
- /* 082906 scr_bg End */
- /*****************************************************************************
- * FUNCTION
- * dm_get_scr_bg_layer
- * DESCRIPTION
- * This function is used to get the layer handle of scr bg image
- * PARAMETERS
- * void
- * RETURNS
- * GDI_HANDLE
- *****************************************************************************/
- GDI_HANDLE dm_get_scr_bg_layer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return g_dm_scr_bg_cntx.layer_handle;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_setup_and_draw_scr_bg
- * DESCRIPTION
- * This function is used setup screen background layer and draw it
- * PARAMETERS
- * UICtrlAccessPtr_p [IN/OUT] It specifies the start position to take out the coordinates.
- * *(?)
- * RETURNS
- * void
- *****************************************************************************/
- S32 dm_setup_and_draw_scr_bg(S16 **UICtrlAccessPtr_p)
- {
- /* Currently coordinate set is not needed. The input UICtrlAccessPtr_p is just for future use. */
- #ifdef __GDI_MEMORY_PROFILE_2__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- GDI_RESULT ret;
- U8 layer_idx = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_dm_cntx.redraw_scr_bg_flag == MMI_TRUE)
- {
- /* There is no free layer can be used for background */
- MMI_ASSERT(dm_layers_count < GDI_LAYER_TOTAL_LAYER_COUNT);
- gdi_layer_multi_layer_enable();
- ret = gdi_layer_create(0, 0, UI_device_width, UI_device_height, &g_dm_scr_bg_cntx.layer_handle);
- /* Create layer fail */
- /* MMI_ASSERT (ret>0); */
- if (ret < 0)
- {
- return 0;
- }
- gdi_layer_push_and_set_active(g_dm_scr_bg_cntx.layer_handle);
- #ifdef __MMI_SCREEN_ROTATE__
- /* gdi_layer_set_rotate(gdi_layer_get_base_layer_rotation()); */
- #endif
- gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
- gdi_layer_set_opacity(TRUE, g_dm_scr_bg_cntx.layer_opacity);
- gdi_layer_clear(GDI_COLOR_TRANSPARENT);
- if (g_dm_scr_bg_cntx.image_id == 0 && g_dm_scr_bg_cntx.image_name == NULL)
- {
- //if (idle_screen_wallpaper_ID == 0)//073106 cache wallpaper
- if (idle_screen_cache_id == 0)
- {
- //g_dm_scr_bg_cntx.image_name = idle_screen_wallpaper_name;
- g_dm_scr_bg_cntx.image_name = idle_screen_cache_name;
- }
- else
- {
- //g_dm_scr_bg_cntx.image_id = idle_screen_wallpaper_ID;
- g_dm_scr_bg_cntx.image_id = idle_screen_cache_id;
- }
- }
- /* Start to draw the background */
- dm_draw_scr_bg_image();
- /* End of drawing the background */
- gdi_layer_pop_and_restore_active();
- /* set scr_bg layer to be the most buttom layer, and shift other layers */
- for (layer_idx = 0; layer_idx < dm_layers_count; layer_idx++)
- {
- dm_layers[layer_idx + 1] = dm_layers[layer_idx];
- }
- dm_layers[0] = g_dm_scr_bg_cntx.layer_handle;
- dm_layers_count++;
- /* Once scr_bg is drawn, there is no need to redraw again, except the flag is turned on */
- g_dm_cntx.redraw_scr_bg_flag = MMI_FALSE;
- }
- #ifdef __MMI_WALLPAPER_ON_BOTTOM__
- wgui_set_wallpaper_on_bottom(MMI_TRUE);
- #endif
- return 1;
- #else /* __GDI_MEMORY_PROFILE_2__ */
- return 0;
- #endif /* __GDI_MEMORY_PROFILE_2__ */
- } /* dm_setup_and_draw_scr_bg */
- /*****************************************************************************
- * FUNCTION
- * dm_register_vkpad_callback
- * DESCRIPTION
- * This function is to register dm_show_vkpad_callback
- * PARAMETERS
- * f [IN] Function pointer to do changes before show virtual keypad.
- * RETURNS
- * void
- *****************************************************************************/
- void dm_register_vkpad_callback(FuncPtr f)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dm_show_vkpad_callback = f;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_check_control_exist
- * DESCRIPTION
- * This function is to register dm_show_vkpad_callback
- * PARAMETERS
- * category_id [IN]
- * control_id [IN]
- * f(?) [IN] Function pointer to do changes before show virtual keypad.
- * RETURNS
- * void
- *****************************************************************************/
- MMI_BOOL dm_check_control_exist(S32 category_id, mmi_dm_control_ids_enum control_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *control_set = NULL;
- S16 *coorindate_set = NULL;
- S32 i, num_control = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- control_set = dm_search_control_set((U16) g_dm_data.s32CatId, &coorindate_set);
- if (!control_set)
- {
- return MMI_FALSE;
- }
- num_control = (S32) control_set[0];
- for (i = 1; i <= num_control; i++)
- {
- if (control_set[i] == (U8) control_id)
- {
- return MMI_TRUE;
- }
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * dm_redraw_category_screen
- * DESCRIPTION
- * This function is the actual Draw Manager, which is used by all categories to draw themselves.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void dm_redraw_category_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 u8CtrlCt = 0;
- S32 u8NoOfUICtrls = 0;
- S16 *UICtrlAccessPtr_p = NULL, *DeafultCoordinateSet_p = NULL;
- dm_cat_scr_info_struct dm_cat_scr_info;
- S32 idx = 0;
- U8 *control_set_ptr = NULL;
- S32 string_count = 0, image_count = 0, back_fill_count = 0, rectangle_count = 0, line_count =
- 0, slide_control_count = 0;
- MMI_BOOL scr_bg_layer_exist = MMI_FALSE;
- S32 button_count = 0;
- S32 scroll_text_count = 0;
- S32 percentage_bar_count = 0;
- dm_redraw_state_enum redraw_type = NORMAL_EXIT;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_SCREEN_ROTATE__) && !defined(__MMI_WALLPAPER_ON_BOTTOM__)
- if (mmi_frm_is_screen_width_height_swapped())
- {
- /* We always use another background layer if screen is rotated */
- scr_bg_layer_exist = MMI_TRUE;
- }
- #endif /* defined(__MMI_SCREEN_ROTATE__) && !defined(__MMI_WALLPAPER_ON_BOTTOM__) */
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- {
- if (g_dm_cntx.lock_redraw_sub == MMI_TRUE)
- {
- return;
- }
- g_dm_cntx.lock_redraw_sub = MMI_TRUE;
- switch (g_dm_cntx.redraw_screen_sub)
- {
- /* from new screen */
- case NORMAL_SHOW:
- g_dm_cntx.redraw_screen_sub = NORMAL_REDRAW;
- redraw_type = NORMAL_REDRAW;
- break;
- /* from show categoryscreen without exit screen */
- case REDRAW_2_SHOW:
- MMI_ASSERT(0);
- break;
- /* from redraw screen */
- case REDRAW_2_REDRAW:
- redraw_type = REDRAW_2_REDRAW;
- break;
- case NORMAL_REDRAW:
- g_dm_cntx.redraw_screen_sub = REDRAW_2_REDRAW;
- redraw_type = REDRAW_2_REDRAW;
- break;
- }
- }
- else
- #endif /* __MMI_SUBLCD__ */
- {
- if (g_dm_cntx.lock_redraw_main == MMI_TRUE)
- {
- return;
- }
- g_dm_cntx.lock_redraw_main = MMI_TRUE;
- switch (g_dm_cntx.redraw_screen_main)
- {
- /* from new screen */
- case NORMAL_SHOW:
- g_dm_cntx.redraw_screen_main = NORMAL_REDRAW;
- redraw_type = NORMAL_REDRAW;
- break;
- /* from show categoryscreen without exit screen */
- case REDRAW_2_SHOW:
- /*
- * dm_reset_context();
- * g_dm_cntx.redraw_screen_main = NORMAL_REDRAW;
- * redraw_type=NORMAL_REDRAW;
- */
- MMI_ASSERT(0);
- break;
- /* from redraw screen */
- case REDRAW_2_REDRAW:
- redraw_type = REDRAW_2_REDRAW;
- break;
- case NORMAL_REDRAW:
- g_dm_cntx.redraw_screen_main = REDRAW_2_REDRAW;
- redraw_type = REDRAW_2_REDRAW;
- break;
- }
- }
- g_dm_cntx.is_context_reset = MMI_FALSE;
- memset((void*)&prev_control_coordinates, 0, sizeof(prev_control_coordinates));
- control_set_ptr = dm_search_control_set((U16) g_dm_data.s32CatId, &DeafultCoordinateSet_p);
- /* First element in Category-Controls map specifies the number of controls */
- u8NoOfUICtrls = control_set_ptr[0];
- UICtrlAccessPtr_p = dm_search_coordinate_set(g_dm_data.s32ScrId);
- if (UICtrlAccessPtr_p == NULL)
- {
- UICtrlAccessPtr_p = DeafultCoordinateSet_p;
- }
- /*************************************************************************
- If dm_search_coordinate_set returns NULL, then there must be Default Coordinate Set.
- *************************************************************************/
- MMI_ASSERT(UICtrlAccessPtr_p != NULL);
- #ifdef __MMI_INTERACTIVE_PROFILNG__
- #ifdef __MMI_SUBLCD__
- if (!(g_dm_data.s32flags & DM_SUB_LCD_CONTEXT))
- #endif
- {
- mmi_frm_profiling_delay_start_timer(MMI_FRM_PROFILING_DELAY_SCREEN);
- }
- #endif /* __MMI_INTERACTIVE_PROFILNG__ */
- gdi_layer_lock_frame_buffer();
- /* Get category screen size */
- /* Some category screens size are not the same as lcd size */
- UICtrlAccessPtr_p = dm_get_cat_scr_coordinates(UICtrlAccessPtr_p, &dm_cat_scr_info);
- /* Set clip according to category screen size */
- /* Assume active layer is base layer for mainlcd or sublcd */
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- {
- gdi_layer_set_active(GDI_LAYER_SUB_BASE_LAYER_HANDLE);
- }
- else
- #endif /* __MMI_SUBLCD__ */
- gdi_layer_set_active(GDI_LAYER_MAIN_BASE_LAYER_HANDLE);
- /* This might be an issue */
- gui_set_clip(dm_cat_scr_info.x1, dm_cat_scr_info.y1, dm_cat_scr_info.x2, dm_cat_scr_info.y2);
- if (g_dm_data.s32flags & DM_CLEAR_SCREEN_BACKGROUND)
- {
- #ifdef GDI_USING_LAYER
- gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_TRANSPARENT);
- #else
- gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_WHITE);
- #endif
- }
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- g_mmi_frm_cntx.dump_screen_info.allow_dump_dm_screen = MMI_TRUE;
- #endif
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- {
- UI_set_sub_LCD_graphics_context();
- #ifdef __MMI_SUBLCD_COLOR__
- if (!(g_dm_data.s32flags & DM_SUB_LCD_TRANSPARENT_BG))
- {
- show_sublcd_status_background(0, 0, (UI_device_width - 1), (UI_device_height - 1), MMI_FALSE);
- }
- #else /* __MMI_SUBLCD_COLOR__ */
- gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_WHITE);
- #endif /* __MMI_SUBLCD_COLOR__ */
- #if (0)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* (0) */
- }
- #endif /* __MMI_SUBLCD__ */
- for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)
- {
- switch (control_set_ptr[u8CtrlCt])
- {
- case DM_BASE_LAYER_START:
- {
- if (redraw_type != REDRAW_2_REDRAW)
- {
- dm_setup_base_layer();
- }
- break;
- }
- case DM_NEW_LAYER_START:
- {
- dm_setup_new_layer(&UICtrlAccessPtr_p);
- break;
- }
- case DM_NEW_LAYER_END: /* Just for Test, should be BASE_CONTROL_SET */
- {
- break;
- }
- case DM_SCR_BG:
- {
- dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p);
- scr_bg_layer_exist = MMI_TRUE;
- break;
- }
- case DM_CIRCULAR_MENU1:
- {
- dm_setup_and_draw_circular_menu(&UICtrlAccessPtr_p);
- break;
- }
- case DM_LIST1:
- {
- dm_setup_and_draw_fixed_list(&UICtrlAccessPtr_p);
- break;
- }
- case DM_DYNAMIC_LIST1:
- {
- dm_setup_and_draw_dynamic_list(&UICtrlAccessPtr_p);
- break;
- }
- case DM_ASYNCDYNAMIC_LIST1:
- {
- dm_setup_and_draw_asyncdynamic_list(&UICtrlAccessPtr_p);
- break;
- }
- case DM_MATRIX_MENU1:
- {
- dm_setup_and_draw_matrix_menu(&UICtrlAccessPtr_p);
- break;
- }
- case DM_MULTILINE_INPUTBOX1:
- {
- dm_setup_and_draw_multiline_inputbox(&UICtrlAccessPtr_p, &dm_cat_scr_info);
- break;
- }
- case DM_EMS_INPUTBOX1:
- {
- dm_setup_and_draw_ems_inputbox(&UICtrlAccessPtr_p, &dm_cat_scr_info);
- break;
- }
- case DM_DIALER_INPUT_BOX1:
- {
- dm_setup_and_draw_dialer_inputbox(&UICtrlAccessPtr_p);
- break;
- }
- case DM_SINGLELINE_INPUTBOX1:
- {
- dm_setup_and_draw_singleline_inputbox(&UICtrlAccessPtr_p);
- break;
- }
- case DM_LSK:
- {
- dm_setup_and_draw_left_softkey(&UICtrlAccessPtr_p);
- break;
- }
- case DM_RSK:
- {
- dm_setup_and_draw_right_softkey(&UICtrlAccessPtr_p);
- break;
- }
- case DM_BUTTON:
- {
- dm_setup_and_draw_button(&UICtrlAccessPtr_p, button_count++);
- break;
- }
- case DM_TITLE1:
- {
- dm_setup_and_draw_title(&UICtrlAccessPtr_p);
- break;
- }
- case DM_HORIZONTAL_TAB_BAR:
- {
- dm_setup_and_draw_horizontal_tab_bar(&UICtrlAccessPtr_p);
- break;
- }
- case DM_CATEGORY_CONTROLLED_AREA:
- {
- dm_setup_and_draw_category_controlled_area(&UICtrlAccessPtr_p);
- break;
- }
- case DM_CATEGORY_CONTROLLED_AREA2:
- {
- dm_setup_and_draw_category_controlled_area2(&UICtrlAccessPtr_p);
- break;
- }
- case DM_STATUS_BAR1:
- {
- dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);
- break;
- }
- case DM_BUTTON_BAR1:
- {
- dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);
- break;
- }
- case DM_INLINE_FIXED_LIST1:
- {
- dm_setup_and_draw_inline_item(&UICtrlAccessPtr_p);
- break;
- }
- case DM_BASE_CONTROL_SET1:
- {
- dm_setup_and_draw_base_control_set(&UICtrlAccessPtr_p);
- break;
- }
- case DM_BASE_CONTROL_SET2:
- {
- dm_setup_and_draw_base_control_set2(&UICtrlAccessPtr_p);
- break;
- }
- case DM_STRING:
- {
- dm_setup_and_draw_string(&UICtrlAccessPtr_p, string_count++);
- break;
- }
- case DM_IMAGE:
- {
- dm_setup_and_draw_image(&UICtrlAccessPtr_p, image_count++);
- break;
- }
- case DM_CALENDAR:
- {
- dm_setup_and_draw_calendar(&UICtrlAccessPtr_p);
- break;
- }
- case DM_ALIGNED_AREA_START:
- {
- dm_aligned_area_data.is_in_aligned_area = MMI_TRUE;
- dm_setup_and_draw_aligned_area(&UICtrlAccessPtr_p, control_set_ptr);
- break;
- }
- case DM_ALIGNED_AREA_END:
- {
- memset(&dm_aligned_area_data, 0, sizeof(dm_aligned_area_data));
- dm_aligned_area_data.is_in_aligned_area = MMI_FALSE;
- break;
- }
- case DM_DATE_TIME_DISPLAY:
- {
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- if (redraw_type == REDRAW_2_REDRAW)
- {
- update_sublcd_dt_display();
- }
- else
- {
- show_sub_LCD_dt_display();
- }
- else
- #endif /* __MMI_SUBLCD__ */
- if (redraw_type == REDRAW_2_REDRAW)
- {
- update_mainlcd_dt_display();
- }
- else
- {
- show_main_LCD_dt_display();
- }
- break;
- }
- case DM_BACK_FILL_AREA:
- {
- dm_setup_and_draw_back_fill_area(&UICtrlAccessPtr_p, back_fill_count++);
- break;
- }
- case DM_RECTANGLE:
- {
- dm_setup_and_draw_rectangle(&UICtrlAccessPtr_p, rectangle_count++);
- break;
- }
- case DM_LINE:
- {
- dm_setup_and_draw_line(&UICtrlAccessPtr_p, line_count++);
- break;
- }
- case DM_SLIDE_CONTROL:
- {
- dm_setup_and_draw_slide_control(&UICtrlAccessPtr_p, slide_control_count++);
- break;
- }
- case DM_POPUP_BACKGROUND:
- {
- dm_setup_and_draw_popup_background(&UICtrlAccessPtr_p);
- break;
- }
- case DM_TYPICAL_STOPWATCH:
- {
- dm_setup_and_draw_typical_stopwatch(&UICtrlAccessPtr_p);
- break;
- }
- case DM_NWAY_STOPWATCH:
- {
- dm_setup_and_draw_nway_stopwatch(&UICtrlAccessPtr_p);
- break;
- }
- case DM_WALL_PAPER:
- {
- dm_setup_and_draw_wallpaper(&UICtrlAccessPtr_p);
- break;
- }
- case DM_SCROLL_TEXT:
- {
- dm_setup_and_draw_scroll_text(&UICtrlAccessPtr_p, scroll_text_count++);
- break;
- }
- case DM_PERCENTAGE_BAR:
- {
- dm_setup_and_draw_percentage_bar(&UICtrlAccessPtr_p, percentage_bar_count++);
- }
- }
- }
- #ifndef __GDI_MEMORY_PROFILE_2__
- new_layer_x = 0;
- new_layer_y = 0;
- #endif /* __GDI_MEMORY_PROFILE_2__ */
- /* if virtual keypad show flag is set, show the virtual keypad */
- if (g_dm_data.s32flags & DM_SHOW_VKPAD)
- {
- if (dm_show_vkpad_callback != NULL)
- {
- dm_show_vkpad_callback();
- }
- /* wgui_show_virtual_keyboard(); */
- }
- #ifdef __MMI_SUBLCD__
- if (g_dm_data.s32flags & DM_SUB_LCD_CONTEXT)
- {
- if (g_dm_data.s32flags & DM_SUB_LCD_ROTATE_180)
- {
- gui_rotate_180_sublcd();
- }
- gdi_layer_unlock_frame_buffer();
- if (!(g_dm_data.s32flags & DM_NO_BLT))
- {
- gdi_layer_blt(
- dm_layers_sub[0],
- dm_layers_sub[1],
- dm_layers_sub[2],
- dm_layers_sub[3],
- dm_cat_scr_info.x1,
- dm_cat_scr_info.y1,
- dm_cat_scr_info.x2,
- dm_cat_scr_info.y2);
- }
- else
- {
- gdi_layer_set_blt_layer(dm_layers_sub[0], dm_layers_sub[1], dm_layers_sub[2], dm_layers_sub[3]);
- }
- UI_set_main_LCD_graphics_context();
- g_dm_cntx.lock_redraw_sub = MMI_FALSE;
- return;
- }
- #endif /* __MMI_SUBLCD__ */
- gdi_layer_restore_base_active();
- if (scr_bg_layer_exist == MMI_FALSE)
- {
- for (idx = 0; idx < GDI_LAYER_TOTAL_LAYER_COUNT; idx++)
- {
- if (dm_layers[idx] == g_dm_scr_bg_cntx.layer_handle)
- {
- dm_layers[idx] = 0;
- break;
- }
- }
- if (idx < GDI_LAYER_TOTAL_LAYER_COUNT)
- {
- dm_layers[idx] = g_dm_scr_bg_cntx.layer_handle;
- }
- }
- gdi_layer_unlock_frame_buffer();
- if (!(g_dm_data.s32flags & DM_NO_BLT))
- {
- gdi_layer_blt(
- dm_layers[0],
- dm_layers[1],
- dm_layers[2],
- dm_layers[3],
- dm_cat_scr_info.x1,
- dm_cat_scr_info.y1,
- dm_cat_scr_info.x2 - dm_cat_scr_info.x1 - 1,
- dm_cat_scr_info.y2 - dm_cat_scr_info.y1 - 1);
- }
- else
- {
- gdi_layer_set_blt_layer(dm_layers[0], dm_layers[1], dm_layers[2], dm_layers[3]);
- }
- #ifdef __MMI_INTERACTIVE_PROFILNG__
- #ifdef __MMI_SUBLCD__
- if (!(g_dm_data.s32flags & DM_SUB_LCD_CONTEXT))
- #endif
- {
- mmi_frm_profiling_delay_perform(MMI_FRM_PROFILING_DELAY_SCREEN);
- }
- #endif /* __MMI_INTERACTIVE_PROFILNG__ */
- /* 061506 double buffer Start */
- for (idx=0; idx<MAX_STATUS_ICON_BARS; idx++)
- {
- if(get_status_icon_bar_type(idx)&STATUS_ICON_BAR_ENABLE_DOUBLE_BUFFER)
- {
- gdi_layer_push_and_set_active(get_status_icon_bar_layer(idx));
- gdi_layer_toggle_double();
- gdi_layer_copy_double();//070306 copy double
- gdi_layer_pop_and_restore_active();
- }
- }
- /* 061506 double buffer Start */
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- g_mmi_frm_cntx.dump_screen_info.allow_dump_dm_screen = MMI_FALSE;
- #endif
- g_dm_cntx.lock_redraw_main = MMI_FALSE;
- } /* end of dm_redraw_category_screen */
- /* Get Coordinate Set for different components */
- /*****************************************************************************
- * FUNCTION
- * dm_get_coordinates
- * DESCRIPTION
- * To get coordinates for any control.
- * PARAMETERS
- * UICtrlAccessPtr_p [?]
- * dm_coordinate_info [?]
- * RETURNS
- * void
- *****************************************************************************/
- S16 *dm_get_coordinates(S16 *UICtrlAccessPtr_p, dm_coordinates *dm_coordinate_info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (*UICtrlAccessPtr_p == DM_DUMMY_COORDINATE)
- {
- dm_coordinate_info->s16X = 0;
- dm_coordinate_info->s16Y = 0;
- dm_coordinate_info->s16Width = 0;
- dm_coordinate_info->s16Height = 0;
- dm_coordinate_info->Flags = DM_NO_FLAGS;
- UICtrlAccessPtr_p++;
- }
- else if (*UICtrlAccessPtr_p == DM_NULL_COORDINATE)
- {
- dm_coordinate_info->s16X = -1;
- dm_coordinate_info->s16Y = -1;
- dm_coordinate_info->s16Width = -1;
- dm_coordinate_info->s16Height = -1;
- dm_coordinate_info->Flags = DM_NO_FLAGS;
- UICtrlAccessPtr_p++;
- }
- else if (*UICtrlAccessPtr_p == DM_FULL_SCREEN_COORDINATE_FLAG || *UICtrlAccessPtr_p == DM_FULL_SCREEN_COORDINATE)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- if (mmi_frm_is_screen_width_height_swapped())
- {
- dm_coordinate_info->s16X = 0;
- dm_coordinate_info->s16Y = 0;
- dm_coordinate_info->s16Width = MMI_ROTATED_LCD_WIDTH;
- dm_coordinate_info->s16Height = MMI_ROTATED_LCD_HEIGHT;
- }
- else
- #endif /* __MMI_SCREEN_ROTATE__ */
- {
- dm_coordinate_info->s16X = 0;
- dm_coordinate_info->s16Y = 0;
- dm_coordinate_info->s16Width = MAIN_LCD_DEVICE_WIDTH;
- dm_coordinate_info->s16Height = MAIN_LCD_DEVICE_HEIGHT;
- }
- if (*UICtrlAccessPtr_p == DM_FULL_SCREEN_COORDINATE_FLAG)
- {
- dm_coordinate_info->Flags = DM_NO_FLAGS;
- }
- else
- {
- UICtrlAccessPtr_p++;
- dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
- }
- UICtrlAccessPtr_p++;
- }
- else if (*UICtrlAccessPtr_p == DM_CONTENT_COORDINATE_FLAG || *UICtrlAccessPtr_p == DM_CONTENT_COORDINATE)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- if (mmi_frm_is_screen_width_height_swapped())
- {
- dm_coordinate_info->s16X = MMI_ROTATED_CONTENT_X;
- dm_coordinate_info->s16Y = MMI_ROTATED_CONTENT_Y;
- dm_coordinate_info->s16Width = MMI_ROTATED_CONTENT_WIDTH;
- dm_coordinate_info->s16Height = MMI_ROTATED_CONTENT_HEIGHT;
- }
- else
- #endif /* __MMI_SCREEN_ROTATE__ */
- {
- dm_coordinate_info->s16X = MMI_CONTENT_X;
- //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
- #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
- if(GetActiveScreenId() == MAIN_MENU_SCREENID)
- {
- //jerson modify begin 20070625
- #if defined(__MMI_MAINLCD_176X220__)
- dm_coordinate_info->s16Y = 20;
- dm_coordinate_info->s16Width = MMI_CONTENT_WIDTH;
- dm_coordinate_info->s16Height = MAIN_LCD_DEVICE_HEIGHT-MMI_BUTTON_BAR_HEIGHT-20;
- #elif defined(__MMI_MAINLCD_240X320__)
- dm_coordinate_info->s16Y = 30;
- dm_coordinate_info->s16Width = MMI_CONTENT_WIDTH;
- dm_coordinate_info->s16Height = MAIN_LCD_DEVICE_HEIGHT-MMI_BUTTON_BAR_HEIGHT-30;
- #endif
- //jerson modify end 20070625
- }
- else
- #endif
- //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
- { //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
- dm_coordinate_info->s16Y = MMI_CONTENT_Y;
- dm_coordinate_info->s16Width = MMI_CONTENT_WIDTH;
- dm_coordinate_info->s16Height = MMI_CONTENT_HEIGHT;
- } //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
- }
- if (*UICtrlAccessPtr_p == DM_CONTENT_COORDINATE_FLAG)
- {
- dm_coordinate_info->Flags = DM_NO_FLAGS;
- }
- else
- {
- UICtrlAccessPtr_p++;
- dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
- }
- UICtrlAccessPtr_p++;
- }
- else if (*UICtrlAccessPtr_p == DM_POPUP_SCREEN_COORDINATE_FLAG || *UICtrlAccessPtr_p == DM_POPUP_SCREEN_COORDINATE)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- if (mmi_frm_is_screen_width_height_swapped())
- {
- dm_coordinate_info->s16X = MMI_ROTATED_POP_UP_DIALOG_X;
- dm_coordinate_info->s16Y = MMI_ROTATED_POP_UP_DIALOG_Y;
- dm_coordinate_info->s16Width = MMI_ROTATED_POP_UP_DIALOG_WIDTH;
- dm_coordinate_info->s16Height = MMI_ROTATED_POP_UP_DIALOG_FULL_HEIGHT;
- }
- else
- #endif /* __MMI_SCREEN_ROTATE__ */
- {
- dm_coordinate_info->s16X = MMI_POP_UP_DIALOG_X;
- dm_coordinate_info->s16Y = MMI_POP_UP_DIALOG_Y;
- dm_coordinate_info->s16Width = MMI_POP_UP_DIALOG_WIDTH;
- dm_coordinate_info->s16Height = MMI_POP_UP_DIALOG_FULL_HEIGHT;
- }
- if (*UICtrlAccessPtr_p == DM_POPUP_SCREEN_COORDINATE_FLAG)
- {
- dm_coordinate_info->Flags = DM_NO_FLAGS;
- }
- else
- {
- UICtrlAccessPtr_p++;
- dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
- }
- UICtrlAccessPtr_p++;
- }
- else if (*UICtrlAccessPtr_p == DM_DEFAULT_TITLE_BAR_FLAG || *UICtrlAccessPtr_p == DM_DEFAULT_TITLE_BAR)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- if (mmi_frm_is_screen_width_height_swapped())
- {
- dm_coordinate_info->s16X = MMI_ROTATED_TITLE_X;
- dm_coordinate_info->s16Y = MMI_ROTATED_TITLE_Y;
- dm_coordinate_info->s16Width = MMI_ROTATED_TITLE_WIDTH;
- dm_coordinate_info->s16Height = MMI_ROTATED_TITLE_HEIGHT;
- }
- else
- #endif /* __MMI_SCREEN_ROTATE__ */
- {
- dm_coordinate_info->s16X = MMI_TITLE_X;
- //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
- #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
- if(GetActiveScreenId() == MAIN_MENU_SCREENID)
- {
- //jerson modify begin 20070625
- #if defined(__MMI_MAINLCD_176X220__)
- dm_coordinate_info->s16Y = 0;
- dm_coordinate_info->s16Width = MMI_TITLE_WIDTH;
- dm_coordinate_info->s16Height = 20;
- #elif defined(__MMI_MAINLCD_240X320__)
- dm_coordinate_info->s16Y = 0;
- dm_coordinate_info->s16Width = MMI_TITLE_WIDTH;
- dm_coordinate_info->s16Height = 20;
- #endif
- //jerson modify end 20070625
- }
- else
- #endif
- //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
- { //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
- dm_coordinate_info->s16Y = MMI_TITLE_Y;
- dm_coordinate_info->s16Width = MMI_TITLE_WIDTH;
- dm_coordinate_info->s16Height = MMI_TITLE_HEIGHT;
- } //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
- }
- if (*UICtrlAccessPtr_p == DM_DEFAULT_TITLE_BAR_FLAG)
- {
- dm_coordinate_info->Flags = DM_NO_FLAGS;
- }
- else
- {
- UICtrlAccessPtr_p++;
- dm_coordinate_info->Flags = *UICtrlAccessPtr_p;
- }
- UICtrlAccessPtr_p++;
- }