mt2503 inline caption item text太长的时候如何滚动显示
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
目前 inline Editor caption item 只能显示固定长度的text 长度,当text 长度超过最大可显示范围,超过的部分显示不出来,所以text 需要滚动显示,目前修改的方法适用于FTE project,NON-FTE project 请参照此codebase ,修改和FTE对应函数。
[SOLUTION]
基本原理是highlight show caption item 的时候,判断如果text 长度超过最大可显示长度就start timer 定时刷新text,unhighlight 或 screen exit 的时候 stop当前的timer。
具体修改步骤如下:
所有修改都是基于wgui_inline_edit.c
1.add a variable
at the head of wgui_inline_edit.c, add a variable definition
static scrolling_text wgui_inline_scroll_text2 ; //for caption scrolling
2.add a function
void wgui_inline_scrolling_timer2(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//for caption scrolling
gui_handle_scrolling_text(&wgui_inline_scroll_text2);
}
3.add a function
void wgui_scrolling_text_draw_background2(S32 x1, S32 y1, S32 x2, S32 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 * image = NULL;
UI_filled_area *bg_filler = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_FTE_SUPPORT__
if((wgui_inline_itEMS[wgui_inline_item_highlighted_index-1].flags & 0xff)
== INLINE_ITEM_TYPE_CAPTION)
{
gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT); // 如果需要显
示其他background,这里要修改
}
#else
gui_draw_filled_area(x1, y1, x2, y2,
(wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
#endif
}
4.modify function
extern void wgui_show_inline_fte_caption_item(
S32 x,
S32 y,
S32 width,
S32 height,
wgui_inline_item *item)
{
...
//for caption scrolling
if((MMI_fixed_list_menu.current_displayed_item ==
wgui_inline_item_highlighted_index - 1) &&
(text_width > (width - MMI_fixed_icontext_menuitem.text_x)))
{
text_width = width - MMI_fixed_icontext_menuitem.text_x;
text_x = x + INLINE_FTE_SINGLELINE_TEXT_OFFSET;
gui_create_scrolling_text(&wgui_inline_scroll_text2, text_x,y + (height -
text_height)/2, text_width, text_height, (UI_string_type)(item->text_p),
wgui_inline_scrolling_timer2, wgui_scrolling_text_draw_background2,
text_colr, text_colr);
gui_show_scrolling_text(&wgui_inline_scroll_text2);
}
else
{
if(mmi_fe_get_r2l_state() == 0)
{
text_x = x + INLINE_FTE_SINGLELINE_TEXT_OFFSET;
gui_print_truncated_text(text_x, y + (height - text_height) - 2, width -
INLINE_FTE_SINGLELINE_TEXT_OFFSET, (UI_string_type)(item->text_p));
}
else if(mmi_fe_get_r2l_state() == 1)
{
text_x = x + width - 1 - INLINE_FTE_SINGLELINE_TEXT_OFFSET;
gui_print_truncated_text(text_x, y + (height - text_height) - 2, width -
INLINE_FTE_SINGLELINE_TEXT_OFFSET, (UI_string_type)(item->text_p));
}
}
}
5.modify function
void wgui_inline_display_only_close(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
complete_inline_item_edit = UI_dummy_function;
gui_scrolling_text_stop(&wgui_inline_scroll_text);
gui_scrolling_text_stop(&wgui_inline_scroll_text2);//for caption scrolling
clear_inline_item_keys = UI_dummy_function;
memset(&wgui_inline_scroll_text, 0, sizeof(wgui_inline_scroll_text));
memset(&wgui_inline_scroll_text2, 0,
sizeof(wgui_inline_scroll_text2));//for caption scrolling
}
6. modify function
void wgui_inline_edit_default_list_unhighlight_handler(S32 item_index)
{
...
complete_inline_item_edit();
wgui_inline_display_only_close(); //for caption scrolling
...
}
以上步骤完成后,只需 remake mmi_php?mod=tag&id=6090" target="_blank" class="relatedlink">Framework
谢谢!
目前 inline Editor caption item 只能显示固定长度的text 长度,当text 长度超过最大可显示范围,超过的部分显示不出来,所以text 需要滚动显示,目前修改的方法适用于FTE project,NON-FTE project 请参照此codebase ,修改和FTE对应函数。
[SOLUTION]
基本原理是highlight show caption item 的时候,判断如果text 长度超过最大可显示长度就start timer 定时刷新text,unhighlight 或 screen exit 的时候 stop当前的timer。
具体修改步骤如下:
所有修改都是基于wgui_inline_edit.c
1.add a variable
at the head of wgui_inline_edit.c, add a variable definition
static scrolling_text wgui_inline_scroll_text2 ; //for caption scrolling
2.add a function
void wgui_inline_scrolling_timer2(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
//for caption scrolling
gui_handle_scrolling_text(&wgui_inline_scroll_text2);
}
3.add a function
void wgui_scrolling_text_draw_background2(S32 x1, S32 y1, S32 x2, S32 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 * image = NULL;
UI_filled_area *bg_filler = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_FTE_SUPPORT__
if((wgui_inline_itEMS[wgui_inline_item_highlighted_index-1].flags & 0xff)
== INLINE_ITEM_TYPE_CAPTION)
{
gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT); // 如果需要显
示其他background,这里要修改
}
#else
gui_draw_filled_area(x1, y1, x2, y2,
(wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
#endif
}
4.modify function
extern void wgui_show_inline_fte_caption_item(
S32 x,
S32 y,
S32 width,
S32 height,
wgui_inline_item *item)
{
...
//for caption scrolling
if((MMI_fixed_list_menu.current_displayed_item ==
wgui_inline_item_highlighted_index - 1) &&
(text_width > (width - MMI_fixed_icontext_menuitem.text_x)))
{
text_width = width - MMI_fixed_icontext_menuitem.text_x;
text_x = x + INLINE_FTE_SINGLELINE_TEXT_OFFSET;
gui_create_scrolling_text(&wgui_inline_scroll_text2, text_x,y + (height -
text_height)/2, text_width, text_height, (UI_string_type)(item->text_p),
wgui_inline_scrolling_timer2, wgui_scrolling_text_draw_background2,
text_colr, text_colr);
gui_show_scrolling_text(&wgui_inline_scroll_text2);
}
else
{
if(mmi_fe_get_r2l_state() == 0)
{
text_x = x + INLINE_FTE_SINGLELINE_TEXT_OFFSET;
gui_print_truncated_text(text_x, y + (height - text_height) - 2, width -
INLINE_FTE_SINGLELINE_TEXT_OFFSET, (UI_string_type)(item->text_p));
}
else if(mmi_fe_get_r2l_state() == 1)
{
text_x = x + width - 1 - INLINE_FTE_SINGLELINE_TEXT_OFFSET;
gui_print_truncated_text(text_x, y + (height - text_height) - 2, width -
INLINE_FTE_SINGLELINE_TEXT_OFFSET, (UI_string_type)(item->text_p));
}
}
}
5.modify function
void wgui_inline_display_only_close(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
complete_inline_item_edit = UI_dummy_function;
gui_scrolling_text_stop(&wgui_inline_scroll_text);
gui_scrolling_text_stop(&wgui_inline_scroll_text2);//for caption scrolling
clear_inline_item_keys = UI_dummy_function;
memset(&wgui_inline_scroll_text, 0, sizeof(wgui_inline_scroll_text));
memset(&wgui_inline_scroll_text2, 0,
sizeof(wgui_inline_scroll_text2));//for caption scrolling
}
6. modify function
void wgui_inline_edit_default_list_unhighlight_handler(S32 item_index)
{
...
complete_inline_item_edit();
wgui_inline_display_only_close(); //for caption scrolling
...
}
以上步骤完成后,只需 remake mmi_php?mod=tag&id=6090" target="_blank" class="relatedlink">Framework
谢谢!
66666