📄 fmradiomainscreen.c
字号:
fmrdo_main_draw.power_button.y = skin_p->power_button_y;
gui_measure_image(fmrdo_main_draw.power_button.on_up_img, &w, &h);
fmrdo_main_draw.power_button.w = (S16) w;
fmrdo_main_draw.power_button.h = (S16) h;
#if defined(__MMI_FM_RADIO_RECORD__)
/* Record Indication Icon */
fmrdo_main_draw.rec_button.on_up_img = (PU8) GetImage(skin_p->rec_button_image_id); /* Use same image for all */
fmrdo_main_draw.rec_button.on_down_img = (PU8) GetImage(skin_p->rec_button_image_id);
fmrdo_main_draw.rec_button.off_up_img = (PU8) GetImage(skin_p->rec_button_image_id);
fmrdo_main_draw.rec_button.off_down_img = (PU8) GetImage(skin_p->rec_button_image_id);
fmrdo_main_draw.rec_button.x = skin_p->rec_button_x;
fmrdo_main_draw.rec_button.y = skin_p->rec_button_y;
gui_measure_image(fmrdo_main_draw.rec_button.on_up_img, &w, &h);
fmrdo_main_draw.rec_button.w = (S16) w;
fmrdo_main_draw.rec_button.h = (S16) h;
/* Pause Indication Icon */
fmrdo_main_draw.rec_pause_button.on_up_img = (PU8) GetImage(skin_p->rec_pause_button_image_id); /* Use same image for all */
fmrdo_main_draw.rec_pause_button.on_down_img = (PU8) GetImage(skin_p->rec_pause_button_image_id);
fmrdo_main_draw.rec_pause_button.off_up_img = (PU8) GetImage(skin_p->rec_pause_button_image_id);
fmrdo_main_draw.rec_pause_button.off_down_img = (PU8) GetImage(skin_p->rec_pause_button_image_id);
fmrdo_main_draw.rec_pause_button.x = skin_p->rec_button_x;
fmrdo_main_draw.rec_pause_button.y = skin_p->rec_button_y;
gui_measure_image(fmrdo_main_draw.rec_pause_button.on_up_img, &w, &h);
fmrdo_main_draw.rec_pause_button.w = (S16) w;
fmrdo_main_draw.rec_pause_button.h = (S16) h;
/* Record Duration */
fmrdo_main_draw.rec_base_num_id = skin_p->rec_duration_number_id_base;
fmrdo_main_draw.rec_num_col_id = skin_p->rec_duration_number_col_image_id;
gui_measure_image((PU8) GetImage(fmrdo_main_draw.rec_base_num_id), &w, &h);
gui_measure_image((PU8) GetImage(fmrdo_main_draw.rec_num_col_id), &w2, &h2);
fmrdo_main_draw.timer_hr_0_offset_x = skin_p->rec_duration_x;
fmrdo_main_draw.timer_hr_1_offset_x = fmrdo_main_draw.timer_hr_0_offset_x + w;
fmrdo_main_draw.timer_col_0_offset_x = fmrdo_main_draw.timer_hr_1_offset_x + w;
fmrdo_main_draw.timer_min_0_offset_x = fmrdo_main_draw.timer_col_0_offset_x + w2;
fmrdo_main_draw.timer_min_1_offset_x = fmrdo_main_draw.timer_min_0_offset_x + w;
fmrdo_main_draw.timer_col_1_offset_x = fmrdo_main_draw.timer_min_1_offset_x + w;
fmrdo_main_draw.timer_sec_0_offset_x = fmrdo_main_draw.timer_col_1_offset_x + w2;
fmrdo_main_draw.timer_sec_1_offset_x = fmrdo_main_draw.timer_sec_0_offset_x + w;
fmrdo_main_draw.timer_offset_y = skin_p->rec_duration_y;
fmrdo_main_draw.timer_offset_x2 = fmrdo_main_draw.timer_sec_1_offset_x + w;
fmrdo_main_draw.timer_offset_y2 = fmrdo_main_draw.timer_offset_y + h;
#endif /* defined(__MMI_FM_RADIO_RECORD__) */
}
/*****************************************************************************
* FUNCTION
* mmi_fmrdo_redraw_subLCD_background
* DESCRIPTION
*
* PARAMETERS
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_fmrdo_redraw_subLCD_background(S32 x1, S32 y1, S32 x2, S32 y2)
{
#ifdef __MMI_SUBLCD__
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
color c = gui_color(255, 255, 255);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
gui_fill_rectangle(x1, y1, x2, y2, c);
#endif /* __MMI_SUBLCD__ */
}
/*****************************************************************************
* FUNCTION
* mmi_fmrdo_subLCD_text_scroll_handler
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fmrdo_subLCD_text_scroll_handler(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_SUBLCD__
gui_handle_scrolling_text(&fmrdo_sub_LCD_scrolling_title);
#endif
}
/*****************************************************************************
* FUNCTION
* mmi_fmrdo_redraw_subLCD
* DESCRIPTION
*
* PARAMETERS
* is_show [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_fmrdo_redraw_subLCD(BOOL is_show)
{
#ifdef __MMI_SUBLCD__
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
color text_color = gui_color(0, 0, 0);
S32 x1, y1, x2, y2, x, y, str_w, str_h;
bitmap *saved_graphics_context = current_LCD_device_bitmap;
UI_string_type title;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!g_fmrdo.is_ready)
{
return;
}
mmi_fmrdo_set_subLCD_shown(TRUE);
UI_set_sub_LCD_graphics_context();
#if(UI_DOUBLE_BUFFER_SUPPORT)
gui_lock_double_buffer();
#endif
if (fmrdo_sub_LCD_scrolling_title_p != NULL)
{
gui_scrolling_text_stop(fmrdo_sub_LCD_scrolling_title_p);
fmrdo_sub_LCD_scrolling_title_p = NULL;
}
/* clear background */
x1 = 0;
y1 = 13;
x2 = UI_device_width - 1;
y2 = UI_device_height - 1;
gui_push_clip();
gui_set_clip(x1, y1, x2, y2);
mmi_fmrdo_redraw_subLCD_background(x1, y1, x2, y2);
if (is_show)
{
title = (UI_string_type) mmi_fmrdo_get_channel_name_or_freq();
/* draw song name */
gui_set_font(&MMI_medium_font);
gui_measure_string(title, &str_w, &str_h);
x = (UI_device_width - str_w) / 2;
y = 12 + (UI_device_height - 12 - str_h) / 2;
if (x >= 0)
{
gui_push_text_clip();
gui_set_text_clip(x, y, x + str_w - 1, y + str_h - 1);
gui_set_text_color(text_color);
gui_move_text_cursor(x, y);
gui_print_text(title);
gui_pop_text_clip();
}
else
{
/* scroll */
x = 0;
fmrdo_sub_LCD_scrolling_title_p = &fmrdo_sub_LCD_scrolling_title;
gui_create_scrolling_text(
fmrdo_sub_LCD_scrolling_title_p,
x + 2,
y,
UI_device_width - 4,
str_h,
title,
mmi_fmrdo_subLCD_text_scroll_handler,
mmi_fmrdo_redraw_subLCD_background,
text_color,
text_color);
fmrdo_sub_LCD_scrolling_title_p->text_font = MMI_medium_font;
gui_show_scrolling_text(fmrdo_sub_LCD_scrolling_title_p);
}
}
gui_pop_clip();
#if(UI_DOUBLE_BUFFER_SUPPORT)
gui_unlock_double_buffer();
gui_BLT_double_buffer(x1, y1, x2, y2);
#endif /* (UI_DOUBLE_BUFFER_SUPPORT) */
if (saved_graphics_context == &main_LCD_device_bitmap)
{
UI_set_main_LCD_graphics_context();
}
else if (saved_graphics_context == &sub_LCD_device_bitmap)
{
UI_set_sub_LCD_graphics_context();
}
#endif /* __MMI_SUBLCD__ */
}
/*****************************************************************************
* FUNCTION
* mmi_fmrdo_exit_subLCD
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fmrdo_exit_subLCD()
{
#ifdef __MMI_SUBLCD__
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (g_fmrdo.is_subLCD_shown)
{
bitmap *saved_graphics_context = current_LCD_device_bitmap;
UI_set_sub_LCD_graphics_context();
if (fmrdo_sub_LCD_scrolling_title_p != NULL)
{
gui_scrolling_text_stop(fmrdo_sub_LCD_scrolling_title_p);
fmrdo_sub_LCD_scrolling_title_p = NULL;
}
if (saved_graphics_context == &main_LCD_device_bitmap)
{
UI_set_main_LCD_graphics_context();
}
else if (saved_graphics_context == &sub_LCD_device_bitmap)
{
UI_set_sub_LCD_graphics_context();
}
mmi_fmrdo_set_subLCD_shown(FALSE);
}
#endif /* __MMI_SUBLCD__ */
}
/*****************************************************************************
* FUNCTION
* mmi_fmrdo_show_main
* DESCRIPTION
*
* PARAMETERS
* left_softkey [IN]
* right_softkey [IN]
* skin_index [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_fmrdo_show_main(U16 left_softkey, U16 right_softkey, U8 skin_index)
{
#ifdef __GDI_MEMORY_PROFILE_2__
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
gdi_layer_multi_layer_enable();
/* get base layer as skin layer */
gdi_layer_get_base_handle(&fmrdo_osd_layer);
gdi_layer_clear_background(GDI_COLOR_TRANSPARENT);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_create(0, 0, UI_device_width, UI_device_height, &fmrdo_skin_layer);
gdi_layer_set_blt_layer(fmrdo_skin_layer, fmrdo_osd_layer, 0, 0);
#endif /* __GDI_MEMORY_PROFILE_2__ */
/* Init images, always get image in ENFB project */
#ifndef __MMI_RESOURCE_ENFB_SUPPORT__
if (!fmrdo_main_draw.is_ready || fmrdo_main_draw.skin_index != skin_index)
#endif
{
mmi_fmrdo_init_main_images(skin_index);
fmrdo_main_draw.skin_index = skin_index;
fmrdo_main_draw.is_ready = TRUE;
fmrdo_main_draw.is_channel_name_scroll_ready = FALSE;
}
#ifdef __GDI_MEMORY_PROFILE_2__
is_fmrdo_skin_layer_drawn = FALSE;
#endif
clear_key_handlers();
clear_left_softkey();
clear_right_softkey();
fmrdo_main_draw.LSK_text = (UI_string_type) GetString(left_softkey);
fmrdo_main_draw.RSK_text = (UI_string_type) GetString(right_softkey);
SetKeyHandler(mmi_fmrdo_redraw_main_LSK_down, KEY_LSK, KEY_EVENT_DOWN);
SetKeyHandler(mmi_fmrdo_redraw_main_RSK_down, KEY_RSK, KEY_EVENT_DOWN);
/* associate functions */
ExitCategoryFunction = mmi_fmrdo_hide_main;
RedrawCategoryFunction = mmi_fmrdo_redraw_main_all;
GetCategoryHistory = dummy_get_history;
GetCategoryHistorySize = dummy_get_history_size;
/* draw screen */
mmi_fmrdo_redraw_main_all();
}
/*****************************************************************************
* FUNCTION
* mmi_fmrdo_hide_main
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_fmrdo_hide_main(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
gui_scrolling_text_stop(&fmrdo_main_draw.channel_name_scroll);
#ifdef __GDI_MEMORY_PROFILE_2__
gdi_layer_flatten_to_base(fmrdo_skin_layer, fmrdo_osd_layer, 0, 0);
gdi_layer_free(fmrdo_skin_layer);
gdi_layer_multi_layer_disable();
/* restore blt layer as base layer only */
gdi_layer_set_blt_layer(fmrdo_osd_layer, 0, 0, 0);
#endif /* __GDI_MEMORY_PROFILE_2__ */
#ifdef __MMI_TOUCH_SCREEN__
fmrdo_main_draw.volume_dec_button.down = FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -