fix compile error in Preprocessor setting.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1136 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2010-11-29 09:19:46 +00:00
parent 4d88d694d5
commit c6a2715902
5 changed files with 32 additions and 5 deletions

View File

@ -71,8 +71,9 @@ void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc
static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect) static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
{ {
rt_uint32_t length; rt_uint32_t length;
struct rtgui_font* hz_font;
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data); struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
#ifdef RTGUI_USING_FONTHZ
struct rtgui_font* hz_font;
RT_ASSERT(bmp_font != RT_NULL); RT_ASSERT(bmp_font != RT_NULL);
@ -109,6 +110,27 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc
} }
rtgui_font_derefer(hz_font); rtgui_font_derefer(hz_font);
#else
while ((rect->x1 < rect->x2) && len)
{
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
if (length > 0)
{
len -= length;
while (length-- && rect->x1 < rect->x2)
{
rtgui_bitmap_font_draw_char(bmp_font, dc, *text, rect);
/* move x to next character */
if (bmp_font->char_width == RT_NULL)
rect->x1 += bmp_font->width;
else
rect->x1 += bmp_font->char_width[*text - bmp_font->first_char];
text ++;
}
}
}
#endif
} }
static void rtgui_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect) static void rtgui_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)

View File

@ -9,7 +9,7 @@
#include <rtgui/widgets/button.h> #include <rtgui/widgets/button.h>
#include <rtgui/widgets/filelist_view.h> #include <rtgui/widgets/filelist_view.h>
#ifdef RT_USING_DFS #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
/* 用于显示选择文件名的文本标签 */ /* 用于显示选择文件名的文本标签 */
static rtgui_label_t* label; static rtgui_label_t* label;
/* 触发文件列表视图的按钮回调函数 */ /* 触发文件列表视图的按钮回调函数 */

View File

@ -12,7 +12,7 @@
static rtgui_image_t* image = RT_NULL; static rtgui_image_t* image = RT_NULL;
static rtgui_view_t* _view = RT_NULL; static rtgui_view_t* _view = RT_NULL;
#ifdef RT_USING_DFS #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
/* 打开按钮的回调函数 */ /* 打开按钮的回调函数 */
static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event) static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
{ {

View File

@ -10,6 +10,7 @@
#include <string.h> #include <string.h>
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
static rtgui_view_t* _view = RT_NULL; static rtgui_view_t* _view = RT_NULL;
/* 打开按钮的回调函数 */ /* 打开按钮的回调函数 */
@ -72,3 +73,5 @@ rtgui_view_t* demo_view_module(rtgui_workbench_t* workbench)
return _view; return _view;
} }
#endif #endif
#endif

View File

@ -81,15 +81,17 @@ static void workbench_entry(void* parameter)
demo_view_listbox(workbench); demo_view_listbox(workbench);
demo_view_slider(workbench); demo_view_slider(workbench);
demo_view_mywidget(workbench); demo_view_mywidget(workbench);
#ifdef RT_USING_DFS #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
demo_view_image(workbench); demo_view_image(workbench);
#endif #endif
#ifdef RT_USING_MODULE #ifdef RT_USING_MODULE
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
demo_view_module(workbench); demo_view_module(workbench);
#endif
#endif #endif
demo_listview_view(workbench); demo_listview_view(workbench);
demo_listview_icon_view(workbench); demo_listview_icon_view(workbench);
#ifdef RT_USING_DFS #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
demo_fn_view(workbench); demo_fn_view(workbench);
#endif #endif