fixed Chinese font issue; fixed keyboard event handler issue in list widgets.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1673 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
c834d7cdbd
commit
e1e75c4572
|
@ -19,7 +19,7 @@ static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font,
|
||||||
rt_uint8_t* str;
|
rt_uint8_t* str;
|
||||||
rtgui_color_t bc;
|
rtgui_color_t bc;
|
||||||
rt_uint16_t style;
|
rt_uint16_t style;
|
||||||
register rt_base_t h, word_bytes;
|
register rt_base_t h, word_bytes, font_bytes;
|
||||||
|
|
||||||
RT_ASSERT(bmp_font != RT_NULL);
|
RT_ASSERT(bmp_font != RT_NULL);
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font,
|
||||||
/* drawing height */
|
/* drawing height */
|
||||||
h = (bmp_font->height + rect->y1 > rect->y2)? rect->y2 - rect->y1 : bmp_font->height;
|
h = (bmp_font->height + rect->y1 > rect->y2)? rect->y2 - rect->y1 : bmp_font->height;
|
||||||
word_bytes = (bmp_font->width + 7)/8;
|
word_bytes = (bmp_font->width + 7)/8;
|
||||||
|
font_bytes = word_bytes * bmp_font->height;
|
||||||
|
|
||||||
str = (rt_uint8_t*)text;
|
str = (rt_uint8_t*)text;
|
||||||
|
|
||||||
|
@ -44,15 +45,14 @@ static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font,
|
||||||
index = *(str+1) - 0xA0;
|
index = *(str+1) - 0xA0;
|
||||||
|
|
||||||
/* get font pixel data */
|
/* get font pixel data */
|
||||||
font_ptr = bmp_font->bmp + ( 94*(sect-1) + (index-1) )*(bmp_font->width + bmp_font->height);
|
font_ptr = bmp_font->bmp + (94 * (sect - 1) + (index - 1)) * font_bytes;
|
||||||
|
|
||||||
/* draw word */
|
/* draw word */
|
||||||
for (i=0; i < h; i ++)
|
for (i=0; i < h; i ++)
|
||||||
{
|
{
|
||||||
for (j=0; j < word_bytes; j++)
|
for (j=0; j < word_bytes; j++)
|
||||||
for (k=0; k < 8; k++)
|
for (k=0; k < 8; k++)
|
||||||
{
|
{
|
||||||
if ( ((font_ptr[i*2 + j] >> (7-k)) & 0x01) != 0 &&
|
if ( ((font_ptr[i*word_bytes + j] >> (7-k)) & 0x01) != 0 &&
|
||||||
(rect->x1 + 8 * j + k < rect->x2))
|
(rect->x1 + 8 * j + k < rect->x2))
|
||||||
{
|
{
|
||||||
rtgui_dc_draw_point(dc, rect->x1 + 8*j + k, rect->y1 + i);
|
rtgui_dc_draw_point(dc, rect->x1 + 8*j + k, rect->y1 + i);
|
||||||
|
|
|
@ -142,7 +142,7 @@ static void _rtgui_hz_file_font_draw_text(struct rtgui_hz_file_font* hz_file_fon
|
||||||
for (j=0; j < word_bytes; j++)
|
for (j=0; j < word_bytes; j++)
|
||||||
for (k=0; k < 8; k++)
|
for (k=0; k < 8; k++)
|
||||||
{
|
{
|
||||||
if ( ((font_ptr[i*2 + j] >> (7-k)) & 0x01) != 0 &&
|
if ( ((font_ptr[i*word_bytes + j] >> (7-k)) & 0x01) != 0 &&
|
||||||
(rect->x1 + 8 * j + k < rect->x2))
|
(rect->x1 + 8 * j + k < rect->x2))
|
||||||
{
|
{
|
||||||
rtgui_dc_draw_point(dc, rect->x1 + 8*j + k, rect->y1 + i);
|
rtgui_dc_draw_point(dc, rect->x1 + 8*j + k, rect->y1 + i);
|
||||||
|
|
|
@ -456,6 +456,22 @@ rt_bool_t rtgui_list_view_event_handler(struct rtgui_widget* widget, struct rtgu
|
||||||
{
|
{
|
||||||
rt_uint16_t old_item;
|
rt_uint16_t old_item;
|
||||||
|
|
||||||
|
if (view->current_item == -1)
|
||||||
|
{
|
||||||
|
/* set a initial item */
|
||||||
|
if ((view->items_count > 0) &&
|
||||||
|
(ekbd->key == RTGUIK_UP || ekbd->key == RTGUIK_DOWN))
|
||||||
|
{
|
||||||
|
view->current_item = 0;
|
||||||
|
if (view->flag == RTGUI_LIST_VIEW_LIST)
|
||||||
|
rtgui_list_view_update_list(view, -1);
|
||||||
|
else
|
||||||
|
rtgui_list_view_update_icon(view, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else return RT_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
old_item = view->current_item;
|
old_item = view->current_item;
|
||||||
switch (ekbd->key)
|
switch (ekbd->key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -266,7 +266,18 @@ rt_bool_t rtgui_listbox_event_handler(struct rtgui_widget* widget, struct rtgui_
|
||||||
{
|
{
|
||||||
rt_int16_t old_item;
|
rt_int16_t old_item;
|
||||||
|
|
||||||
if (box->current_item == -1) return RT_FALSE;
|
if (box->current_item == -1)
|
||||||
|
{
|
||||||
|
/* set a initial item */
|
||||||
|
if ((box->items_count > 0) &&
|
||||||
|
(ekbd->key == RTGUIK_UP || ekbd->key == RTGUIK_DOWN))
|
||||||
|
{
|
||||||
|
box->current_item = 0;
|
||||||
|
rtgui_listbox_update_current(box, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else return RT_FALSE;
|
||||||
|
}
|
||||||
old_item = box->current_item;
|
old_item = box->current_item;
|
||||||
|
|
||||||
switch (ekbd->key)
|
switch (ekbd->key)
|
||||||
|
|
Loading…
Reference in New Issue