📄 jui_widget.c
字号:
{
gdi_layer_free(jui_icon_layer_handle);
jui_icon_layer_handle = GDI_LAYER_EMPTY_HANDLE;
jui_icon_layer_blt_handle = GDI_LAYER_EMPTY_HANDLE;
}
if (jui_icon_lcd_buffer)
{
jvm_free(jui_icon_lcd_buffer);
jui_icon_lcd_buffer = NULL;
jui_icon_layer_buffer_size = 0;
}
wgui_cat176_reset_jui_menu_filler();//011507 menu
}
/*****************************************************************************
* FUNCTION
* jui_widget_register_lcd
* DESCRIPTION
* create layer in gdi
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void jui_widget_register_lcd(kal_bool refresh_screen)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *buf_ptr = NULL;
S32 byte_per_pixel = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_REGISTER_LCD,
jvm_is_own_screen(),
jui_layer_handle,
jui_lcd_buffer,
jui_icon_lcd_buffer,
jui_icon_layer_handle,
jui_soft_button_layer_handle,
jui_status_icon_layer_handle,
jui_widget_obj_show_status(JUI_OBJ_STATUS_BAR),
refresh_screen);
JAL_LOCK_MUTEX
wgui_cat176_set_jui_menu_filler();//011507 menu
if (jui_lcd_buffer && (jui_layer_handle == GDI_LAYER_EMPTY_HANDLE))
{
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
/* check if jui_lcd_buffer_double is allocated */
if ( jui_lcd_buffer_double == NULL )
{
jui_lcd_buffer_double = (kal_uint16*) mmi_frm_scrmem_alloc(jui_lcd_buffer_size );
memcpy(jui_lcd_buffer_double, jui_lcd_buffer, jui_lcd_buffer_size);
}
/* second buffer can be freed when Java is paused */
gdi_layer_create_using_outside_memory
(
0,
0,
jui_ui_device_width, jui_ui_device_height, &jui_blt_handle,
(kal_uint8*) jui_lcd_buffer_double, jui_lcd_buffer_size);
gdi_layer_create_cf_double_using_outside_memory
(
GDI_LCD->cf,
0,
0,
jui_ui_device_width, jui_ui_device_height, &jui_layer_handle,
(kal_uint8*) jui_lcd_buffer, jui_lcd_buffer_size,
(kal_uint8*) jui_lcd_buffer_double, jui_lcd_buffer_size);
jui_widget_layer_set_position(jui_layer_handle);
#else /* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
gdi_layer_create_using_outside_memory
(0,
0,
jui_ui_device_width, jui_ui_device_height, &jui_layer_handle, (kal_uint8*) jui_lcd_buffer, jui_lcd_buffer_size);
#endif /* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
gdi_layer_set_active(jui_layer_handle);
gdi_layer_set_source_key(FALSE, GDI_COLOR_TRANSPARENT);
wgui_status_icon_set_display_layer(GDI_LAYER_MAIN_BASE_LAYER_HANDLE);
}
/* create connection icon layer */
if (jui_icon_lcd_buffer && (jui_icon_layer_handle == GDI_LAYER_EMPTY_HANDLE))
{
U8 *img_ptr = (U8*) get_image(IMG_SI_JAVA_CONNECT);
S32 width, height;
if (img_ptr != NULL && jam_get_net_icon_setting())
{
gdi_image_get_dimension(img_ptr, &width, &height);
gdi_layer_create_using_outside_memory(
(jui_ui_device_width - width) >> 1,
0,
width,
height,
&jui_icon_layer_handle,
(U8*) jui_icon_lcd_buffer,
jui_icon_layer_buffer_size);
gdi_layer_push_and_set_active(jui_icon_layer_handle);
gdi_layer_set_opacity(TRUE, 150);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_clear(GDI_COLOR_TRANSPARENT);
gdi_image_draw(0, 0, img_ptr);
gdi_layer_pop_and_restore_active();
}
else
{
jui_icon_layer_handle = GDI_LAYER_EMPTY_HANDLE;
}
}
gdi_layer_push_and_set_active(GDI_LAYER_MAIN_BASE_LAYER_HANDLE);
/*
* We still draw status icons and softkeys on mmi base layer.
* Instead of using mmi base layer in gdi_layer_blt, two layers
* are created using the mmi base layer buffer.
* The purpose is to reduce the overlap region with jui_layer_buffer
*/
if (jui_soft_button_layer_handle == GDI_LAYER_EMPTY_HANDLE ||
jui_status_icon_layer_handle == GDI_LAYER_EMPTY_HANDLE )
{
gdi_layer_get_buffer_ptr(&buf_ptr);
byte_per_pixel = (gdi_layer_get_bit_per_pixel()>>3);
if(jui_soft_button_layer_handle == GDI_LAYER_EMPTY_HANDLE)
{
/* 030607 24 bit Start */
/*
gdi_layer_create_using_outside_memory(
0,
jui_ui_device_height - MMI_softkey_height,
jui_ui_device_width,
MMI_softkey_height,
&jui_soft_button_layer_handle,
buf_ptr + (jui_ui_device_width * (jui_ui_device_height - MMI_softkey_height) * byte_per_pixel),
jui_ui_device_width * MMI_softkey_height * byte_per_pixel);
*/
gdi_layer_create_cf_using_outside_memory(
__MMI_MAIN_BASE_LAYER_FORMAT__,
0,
jui_ui_device_height - MMI_softkey_height,
jui_ui_device_width,
MMI_softkey_height,
&jui_soft_button_layer_handle,
buf_ptr + (jui_ui_device_width * (jui_ui_device_height - MMI_softkey_height) * byte_per_pixel),
jui_ui_device_width * MMI_softkey_height * byte_per_pixel);
gdi_layer_push_and_set_active(jui_soft_button_layer_handle);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_pop_and_restore_active();
}
if(jui_status_icon_layer_handle == GDI_LAYER_EMPTY_HANDLE)
{
gdi_layer_create_cf_using_outside_memory(
__MMI_MAIN_BASE_LAYER_FORMAT__,
0,
0,
jui_ui_device_width,
MMI_title_height+jui_title_offset,
&jui_status_icon_layer_handle,
buf_ptr,
jui_ui_device_width * (MMI_title_height+jui_title_offset) * byte_per_pixel);
gdi_layer_push_and_set_active(jui_status_icon_layer_handle);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_pop_and_restore_active();
}
}
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_clear(GDI_COLOR_TRANSPARENT);
wgui_status_icon_set_display_layer(GDI_LAYER_MAIN_BASE_LAYER_HANDLE);
#if defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
wgui_status_icon_integrated_enable(KAL_FALSE);
wgui_status_icon_integrated_register_redraw(NULL);
#endif
/* draw the status icons if necessary */
jui_is_hide_status_icon = KAL_TRUE;
if ( jui_widget_obj_show_status( JUI_OBJ_STATUS_BAR) )
{
gdi_layer_lock_frame_buffer();
register_hide_status_icon_bar(0, jui_hide_status_icons_bar0);
show_status_icon_bar(0);
show_status_icons();
jui_set_blt_status_icon = KAL_TRUE;
gdi_layer_unlock_frame_buffer();
}
else
{
hide_status_icon_bar(0);
}
gdi_layer_pop_and_restore_active();
gdi_layer_multi_layer_enable();
/* entry_full_screen(); */
if ( refresh_screen )
{
jui_widget_refresh_lcd(0, 0, jui_ui_device_width, jui_ui_device_height);
}
JAL_UNLOCK_MUTEX
}
/* void j2me_unregister_lcd(void) */
/*****************************************************************************
* FUNCTION
* jui_widget_unregister_lcd
* DESCRIPTION
* free layer in gdi
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void jui_widget_unregister_lcd(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_UNREGISTER_LCD,
jvm_is_own_screen(),
jui_layer_handle,
jui_lcd_buffer,
jui_icon_lcd_buffer,
jui_icon_layer_handle,
jui_soft_button_layer_handle,
jui_status_icon_layer_handle);
jui_widget_exit_screen();
if (jui_layer_handle != GDI_LAYER_EMPTY_HANDLE)
{
gdi_layer_free(jui_layer_handle);
}
if (jui_status_icon_layer_handle != GDI_LAYER_EMPTY_HANDLE)
{
jui_is_hide_status_icon = KAL_FALSE;
hide_status_icon_bar(0);
gdi_layer_free(jui_status_icon_layer_handle);
jui_status_icon_layer_handle = GDI_LAYER_EMPTY_HANDLE;
}
if (jui_soft_button_layer_handle != GDI_LAYER_EMPTY_HANDLE)
{
gdi_layer_free(jui_soft_button_layer_handle);
jui_soft_button_layer_handle = GDI_LAYER_EMPTY_HANDLE;
}
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
if ( jui_blt_handle != 0 )
{
gdi_layer_free(jui_blt_handle);
jui_blt_handle=0;
}
if ( jui_lcd_buffer_double != NULL )
{
mmi_frm_scrmem_free ((void*) jui_lcd_buffer_double );
jui_lcd_buffer_double = NULL;
}
#endif
wgui_status_icon_reset_display_layer();
if ( jui_layer_handle != GDI_LAYER_EMPTY_HANDLE || jui_icon_layer_handle != GDI_LAYER_EMPTY_HANDLE )
{
gdi_handle base_handle;
jui_layer_handle = GDI_LAYER_EMPTY_HANDLE;
gdi_layer_multi_layer_disable();
leave_full_screen();
gdi_layer_get_base_handle(&base_handle);
gdi_layer_set_active(base_handle);
gdi_layer_reset_clip();
}
wgui_cat176_reset_jui_menu_filler();//011507 menu
}
/*****************************************************************************
* FUNCTION
* jui_widget_config_blt_layer
* DESCRIPTION
* automatically configure the blt layers
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void jui_widget_config_blt_layer(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
#ifndef __JUI_USE_DOUBLE_BUFFER_LAYER__
GDI_HANDLE mmi_layer_handle = GDI_LAYER_MAIN_BASE_LAYER_HANDLE;
#endif
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
if ( jui_double_buffer_activated )
{
GDI_LOCK;
if (jui_widget_act_mode_idx == JUI_SCREEN_MODE_NORMAL)
{
if (jui_set_blt_status_icon == KAL_TRUE)
{/* someone change screen mode, need to update status icon bar region */
//gdi_layer_blt(jui_blt_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle, rect.x1, rect.y1 , rect.x2, rect.y2);
gdi_layer_set_blt_layer(jui_blt_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle);
//jui_set_blt_status_icon = KAL_FALSE;
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
}
else
{
//gdi_layer_blt(jui_blt_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle, rect.x1, rect.y1 + MMI_status_bar_height, rect.x2, rect.y2);
gdi_layer_set_blt_layer(jui_blt_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
}
}
else
{
//gdi_layer_blt(jui_blt_handle, jui_hardware_layer_handle, jui_icon_layer_blt_handle, 0, rect.x1, rect.y1, rect.x2, rect.y2);
gdi_layer_set_blt_layer(jui_blt_handle, jui_hardware_layer_handle, jui_icon_layer_blt_handle, 0);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
}
GDI_UNLOCK;
}
else
{
if (jui_widget_act_mode_idx == JUI_SCREEN_MODE_NORMAL)
{
if (jui_set_blt_status_icon == KAL_TRUE)
{/* someone change screen mode, need to update status icon bar region */
//gdi_layer_blt(jui_layer_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle, rect.x1, rect.y1 , rect.x2, rect.y2);
gdi_layer_set_blt_layer(jui_layer_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
//jui_set_blt_status_icon = KAL_FALSE;
}
else
{
//gdi_layer_blt(jui_layer_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle, rect.x1, rect.y1 + MMI_status_bar_height, rect.x2, rect.y2);
gdi_layer_set_blt_layer(jui_layer_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
}
}
else
{
//gdi_layer_blt(jui_layer_handle, jui_hardware_layer_handle, jui_icon_layer_blt_handle, 0, rect.x1, rect.y1, rect.x2, rect.y2);
gdi_layer_set_blt_layer(jui_layer_handle, jui_hardware_layer_handle, jui_icon_layer_blt_handle, 0);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
}
}
#else/* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
//gdi_layer_blt(mmi_layer_handle, jui_layer_handle, jui_hardware_layer_handle, jui_icon_layer_blt_handle, rect.x1, rect.y1, rect.x2, rect.y2);
gdi_layer_set_blt_layer(mmi_layer_handle, jui_layer_handle, jui_hardware_layer_handle, jui_icon_layer_blt_handle);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_2;//121306
#endif/* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
}
/*****************************************************************************
* FUNCTION
* jui_widget_refresh_lcd
* DESCRIPTION
* update lcd buffer using given range.
* PARAMETERS
* x1 [IN] Start of x-coordinate
* y1 [IN] Start of y-coordinate
* x2 [IN] End of x-coordinate
* y2 [IN] End of y-coordinate
* RETURNS
* void
*****************************************************************************/
void jui_widget_refresh_lcd(kal_int32 x1, kal_int32 y1, kal_int32 x2, kal_int32 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
#ifndef __JUI_USE_DOUBLE_BUFFER_LAYER__
GDI_HANDLE mmi_layer_handle = GDI_LAYER_MAIN_BASE_LAYER_HANDLE;
#endif
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
JAL_LOCK_MUTEX
if (jui_lcd_buffer)
{
gdi_rect_struct rect;
if (jui_widget_is_normal_mode_blt_layer_set)//screen mode is set to normal, but the blt layer may not be set
{
rect.x1 = 0;
rect.x2 = jui_ui_device_width - 1;
rect.y1 = 0;
rect.y2 = jui_ui_device_height - 1;
jui_widget_is_normal_mode_blt_layer_set = 0;
}
else
{
rect.x1 = x1;
rect.x2 = x2;
rect.y1 = y1;
rect.y2 = y2;
if ( x1<0 )
{
rect.x1 = 0;
}
if ( y1<0 )
{
rect.y1 = 0;
}
if ( x2 >= jui_ui_device_width )
{
rect.x2 = jui_ui_device_width - 1;
}
if ( y2 >= jui_ui_device_height)
{
rect.y2 = jui_ui_device_height - 1;
}
}
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
if ( jui_double_buffer_activated )
{
GDI_LOCK;
gdi_layer_push_and_set_active(jui_layer_handle);
gdi_layer_toggle_double();
gdi_layer_copy_double();
jui_widget_layer_set_position(jui_blt_handle);
}
#endif /* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
if (jui_widget_act_mode_idx == JUI_SCREEN_MODE_NORMAL)
{
rect.y2 += MMI_status_bar_height;
}
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
if ( jui_double_buffer_activated )
{
if (jui_widget_act_mode_idx == JUI_SCREEN_MODE_NORMAL)
{
if (jui_set_blt_status_icon == KAL_TRUE)
{/* someone change screen mode, need to update status icon bar region */
gdi_layer_blt(jui_blt_handle, jui_hardware_layer_handle, jui_status_icon_layer_handle, jui_soft_button_layer_handle, rect.x1, rect.y1 , rect.x2, rect.y2);
jui_hardware_layer_blt_index = GDI_LAYER_ENABLE_LAYER_1;//121306
jui_set_blt_status_icon = K
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -