From 64b0cd34fe31b9277d091d71e2a877f81d582df5 Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Mon, 27 Aug 2012 07:57:19 +0000 Subject: sync RTGUI with github(https://github.com/RT-Thread/RTGUI) 126336387561442a0508b661595134deb28ad34b As always, full log is in GitHub. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2265 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/rtgui/include/rtgui/filerw.h | 11 ++++++++ components/rtgui/include/rtgui/image.h | 2 +- components/rtgui/include/rtgui/image_bmp.h | 27 ++++++++++++++++++ components/rtgui/include/rtgui/rtgui_config.h | 4 +-- components/rtgui/include/rtgui/rtgui_system.h | 5 ++++ components/rtgui/include/rtgui/widgets/edit.h | 33 ++++++---------------- .../rtgui/include/rtgui/widgets/filelist_view.h | 2 +- 7 files changed, 56 insertions(+), 28 deletions(-) (limited to 'components/rtgui/include') diff --git a/components/rtgui/include/rtgui/filerw.h b/components/rtgui/include/rtgui/filerw.h index c254d51afa..03e030d539 100644 --- a/components/rtgui/include/rtgui/filerw.h +++ b/components/rtgui/include/rtgui/filerw.h @@ -14,6 +14,16 @@ #ifndef __RTGUI_FILERW_H__ #define __RTGUI_FILERW_H__ +#ifdef _WIN32 +#pragma warning(disable: 4996) +#include +#include +#include +#include +#else +#include +#endif + #include #define RTGUI_FILE_SEEK_SET 0 @@ -40,6 +50,7 @@ int rtgui_filerw_write(struct rtgui_filerw* context, const void* buffer, rt_size int rtgui_filerw_tell (struct rtgui_filerw* context); int rtgui_filerw_eof (struct rtgui_filerw* context); int rtgui_filerw_close(struct rtgui_filerw* context); +int rtgui_filerw_unlink(const char *filename); /* get memory data from filerw memory object */ const rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context); diff --git a/components/rtgui/include/rtgui/image.h b/components/rtgui/include/rtgui/image.h index 3314c444a0..6fe92e0a22 100644 --- a/components/rtgui/include/rtgui/image.h +++ b/components/rtgui/include/rtgui/image.h @@ -59,7 +59,7 @@ typedef struct rtgui_image rtgui_image_t; /* init rtgui image system */ void rtgui_system_image_init(void); -#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) +#if defined(RTGUI_USING_DFS_FILERW) struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn); struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load); struct rtgui_image* rtgui_image_create(const char* filename, rt_bool_t load); diff --git a/components/rtgui/include/rtgui/image_bmp.h b/components/rtgui/include/rtgui/image_bmp.h index 19fdfc7f6e..a282e23984 100644 --- a/components/rtgui/include/rtgui/image_bmp.h +++ b/components/rtgui/include/rtgui/image_bmp.h @@ -14,6 +14,33 @@ #ifndef __RTGUI_IMAGE_BMP_H__ #define __RTGUI_IMAGE_BMP_H__ +#pragma pack(2) + +struct rtgui_image_bmp_header +{ + /* The Win32 BMP file header (14 bytes) */ + rt_uint16_t bfType; + rt_uint32_t bfSize; + rt_uint16_t bfReserved1; + rt_uint16_t bfReserved2; + rt_uint32_t bfOffBits; + + /* The Win32 BITMAPINFOHEADER struct (40 bytes) */ + rt_uint32_t biSize; + rt_int32_t biWidth; + rt_int32_t biHeight; + rt_uint16_t biPlanes; + rt_uint16_t biBitCount; + rt_uint32_t biCompression; + rt_uint32_t biSizeImage; + rt_int32_t biXPelsPerMeter; + rt_int32_t biYPelsPerMeter; + rt_uint32_t biClrUsed; + rt_uint32_t biClrImportant; +}; +#ifdef _WIN32 +#pragma warning(disable : 4103) +#endif void rtgui_image_bmp_init(void); #endif diff --git a/components/rtgui/include/rtgui/rtgui_config.h b/components/rtgui/include/rtgui/rtgui_config.h index 73672aa739..98160339f1 100644 --- a/components/rtgui/include/rtgui/rtgui_config.h +++ b/components/rtgui/include/rtgui/rtgui_config.h @@ -35,7 +35,7 @@ #define RTGUI_DEFAULT_FONT_SIZE 12 #define RTGUI_USING_STDIO_FILERW - // #define RTGUI_USING_DFS_FILERW + #define RTGUI_USING_DFS_FILERW #define RTGUI_IMAGE_CONTAINER #define RTGUI_IMAGE_XPM #define RTGUI_IMAGE_BMP @@ -47,7 +47,7 @@ #define RTGUI_MEM_TRACE #define RTGUI_USING_WINMOVE #define RTGUI_USING_NOTEBOOK_IMAGE - + // #define RTGUI_USING_HZ_FILE #else /* native running under RT-Thread */ #ifndef RT_USING_DFS diff --git a/components/rtgui/include/rtgui/rtgui_system.h b/components/rtgui/include/rtgui/rtgui_system.h index 48f6ebb100..31030fa2ae 100644 --- a/components/rtgui/include/rtgui/rtgui_system.h +++ b/components/rtgui/include/rtgui/rtgui_system.h @@ -50,8 +50,13 @@ void* rtgui_malloc(rt_size_t size); void rtgui_free(void* ptr); void* rtgui_realloc(void* ptr, rt_size_t size); +#ifdef _WIN32 +#define rtgui_enter_critical() +#define rtgui_exit_critical() +#else #define rtgui_enter_critical rt_enter_critical #define rtgui_exit_critical rt_exit_critical +#endif rt_thread_t rtgui_get_server(void); void rtgui_set_mainwin_rect(struct rtgui_rect *rect); diff --git a/components/rtgui/include/rtgui/widgets/edit.h b/components/rtgui/include/rtgui/widgets/edit.h index c1ca181992..75cbdd319a 100644 --- a/components/rtgui/include/rtgui/widgets/edit.h +++ b/components/rtgui/include/rtgui/widgets/edit.h @@ -17,27 +17,10 @@ #include #include -#ifdef _WIN32 -#include -#include -#include -#include -#else -#include -#endif - #ifdef __cplusplus extern "C" { #endif -#ifdef _WIN32 -#define open _open -#define close _close -#define read _read -#define write _write -#define unlink _unlink -#endif - DECLARE_CLASS_TYPE(edit); /** Gets the type of a edit */ @@ -65,11 +48,11 @@ struct edit_update struct edit_line { - rt_size_t zsize; /* zone size */ - rt_uint32_t len; + rt_int16_t zsize; /* zone size */ + rt_int16_t len; struct edit_line *prev; struct edit_line *next; - char *text; + char *text; }; struct rtgui_edit @@ -79,21 +62,22 @@ struct rtgui_edit /* edit flag */ rt_uint32_t flag; - rt_uint32_t max_rows, max_cols; - rt_uint16_t row_per_page, col_per_page; + rt_int16_t max_rows, max_cols; + rt_int16_t row_per_page, col_per_page; rtgui_point_t upleft; rtgui_point_t visual; rt_uint8_t tabsize; rt_uint8_t item_height; rt_uint8_t font_width,font_height; rt_uint8_t margin; - rt_size_t bzsize; /* base zone size */ + rt_int16_t bzsize; /* base zone size */ struct rtgui_timer *caret_timer; rtgui_color_t *caret; rtgui_rect_t caret_rect; struct edit_update update; char *update_buf; /* speed up renewal process */ + struct rtgui_dc *dbl_buf; struct edit_line *head; struct edit_line *tail; @@ -118,7 +102,8 @@ void rtgui_edit_update(struct rtgui_edit *edit); void rtgui_edit_ondraw(struct rtgui_edit *edit); rt_bool_t rtgui_edit_event_handler(struct rtgui_object* object, rtgui_event_t* event); void rtgui_edit_set_text(struct rtgui_edit *edit, const char* text); - +rtgui_point_t rtgui_edit_get_current_point(struct rtgui_edit *edit); +rt_uint32_t rtgui_edit_get_mem_consume(struct rtgui_edit *edit); rt_bool_t rtgui_edit_readin_file(struct rtgui_edit *edit, const char *filename); rt_bool_t rtgui_edit_saveas_file(struct rtgui_edit *edit, const char *filename); diff --git a/components/rtgui/include/rtgui/widgets/filelist_view.h b/components/rtgui/include/rtgui/widgets/filelist_view.h index 6fc3b0b9d7..78a38a2835 100644 --- a/components/rtgui/include/rtgui/widgets/filelist_view.h +++ b/components/rtgui/include/rtgui/widgets/filelist_view.h @@ -3,7 +3,7 @@ #include -#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) +#if defined(RTGUI_USING_DFS_FILERW) #define RTGUI_FITEM_FILE 0x0 #define RTGUI_FITEM_DIR 0x1 struct rtgui_file_item -- cgit v1.3.1