From 07b910be8fef05de291097f93fe7787258e828ee Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Fri, 8 Jun 2012 08:13:44 +0000 Subject: [PATCH] fixed compiling error related to rtgui in mini2440 branch git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2155 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/mini2440/application.c | 23 +++++++++-------- bsp/mini2440/calibration.c | 33 ++++++++++++++---------- components/rtgui/widgets/filelist_view.c | 6 ++--- src/rtm.c | 17 ------------ 4 files changed, 34 insertions(+), 45 deletions(-) diff --git a/bsp/mini2440/application.c b/bsp/mini2440/application.c index f1fb575879..54dc433e78 100644 --- a/bsp/mini2440/application.c +++ b/bsp/mini2440/application.c @@ -16,6 +16,7 @@ /** * @addtogroup mini2440 */ + /*@{*/ #include @@ -60,9 +61,9 @@ extern void rt_hw_touch_init(void); static int argc = 1; static char* argv[] = {"ftk", NULL}; -void rt_ftk_thread_entry(void* parameter) +void rt_ftk_thread_entry(void *parameter) { - int FTK_MAIN(int argc, char* argv[]); + int FTK_MAIN(int argc, char *argv[]); FTK_MAIN(argc, argv); @@ -71,7 +72,7 @@ void rt_ftk_thread_entry(void* parameter) #endif -void rt_init_thread_entry(void* parameter) +void rt_init_thread_entry(void *parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS @@ -129,7 +130,7 @@ void rt_init_thread_entry(void* parameter) dfs_uffs_init(); /* mount flash device as flash directory */ - if(dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0) + if (dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0) rt_kprintf("UFFS File System initialized!\n"); else rt_kprintf("UFFS File System initialzation failed!\n"); @@ -159,8 +160,8 @@ void rt_init_thread_entry(void* parameter) /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); - /* startup rtgui */ - rtgui_startup(); + /* initalize rtgui system server */ + rtgui_system_server_init(); } #endif @@ -204,15 +205,15 @@ void rt_init_thread_entry(void* parameter) 10 * 1024, 8, 20); /* startup ftk thread */ - if(ftk_thread != RT_NULL) + if (ftk_thread != RT_NULL) rt_thread_startup(ftk_thread); } #endif } -void rt_led_thread_entry(void* parameter) +void rt_led_thread_entry(void *parameter) { - while(1) + while (1) { /* light on leds for one second */ rt_hw_led_on(LED2|LED3); @@ -226,7 +227,7 @@ void rt_led_thread_entry(void* parameter) } } -int rt_application_init() +int rt_application_init(void) { rt_thread_t init_thread; rt_thread_t led_thread; @@ -252,7 +253,7 @@ int rt_application_init() if (init_thread != RT_NULL) rt_thread_startup(init_thread); - if(led_thread != RT_NULL) + if (led_thread != RT_NULL) rt_thread_startup(led_thread); return 0; diff --git a/bsp/mini2440/calibration.c b/bsp/mini2440/calibration.c index 92bd10fe44..0217f805d8 100644 --- a/bsp/mini2440/calibration.c +++ b/bsp/mini2440/calibration.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "touch.h" @@ -107,7 +108,7 @@ static void calibration_data_post(rt_uint16_t x, rt_uint16_t y) calibration_ptr->data.max_x, calibration_ptr->data.min_y, calibration_ptr->data.max_y); - rtgui_thread_send(calibration_ptr->tid, &ecmd.parent, sizeof(struct rtgui_event_command)); + rtgui_application_send(calibration_ptr->tid, &ecmd.parent, sizeof(struct rtgui_event_command)); } return; } @@ -120,7 +121,7 @@ static void calibration_data_post(rt_uint16_t x, rt_uint16_t y) RTGUI_EVENT_COMMAND_INIT(&ecmd); ecmd.command_id = TOUCH_WIN_UPDATE; - rtgui_thread_send(calibration_ptr->tid, &ecmd.parent, sizeof(struct rtgui_event_command)); + rtgui_application_send(calibration_ptr->tid, &ecmd.parent, sizeof(struct rtgui_event_command)); } } } @@ -208,7 +209,7 @@ rt_bool_t calibration_event_handler(struct rtgui_widget* widget, struct rtgui_ev return RT_TRUE; default: - rtgui_win_event_handler(widget, event); + rtgui_win_event_handler(RTGUI_OBJECT(widget), event); } return RT_FALSE; @@ -216,14 +217,13 @@ rt_bool_t calibration_event_handler(struct rtgui_widget* widget, struct rtgui_ev void calibration_entry(void* parameter) { - rt_mq_t mq; + struct rtgui_application *app; rtgui_win_t* win; struct rtgui_rect rect; - mq = rt_mq_create("cali", 40, 8, RT_IPC_FLAG_FIFO); - if (mq == RT_NULL) return; - - rtgui_thread_register(rt_thread_self(), mq); + app = rtgui_application_create(rt_thread_self(), "cali"); + if (app == RT_NULL) + return; rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect); @@ -234,16 +234,21 @@ void calibration_entry(void* parameter) /* create calibration window */ win = rtgui_win_create(RT_NULL, "calibration", &rect, RTGUI_WIN_STYLE_NO_TITLE | RTGUI_WIN_STYLE_NO_BORDER); - rtgui_widget_set_event_handler(RTGUI_WIDGET(win), calibration_event_handler); + if (win == RT_NULL) + { + rtgui_application_destroy(app); + return; + } + + rtgui_win_set_onkey(win, calibration_event_handler); if (win != RT_NULL) { rtgui_win_show(win, RT_FALSE); - // rtgui_widget_update(RTGUI_WIDGET(win)); - rtgui_win_event_loop(win); + rtgui_widget_update(RTGUI_WIDGET(win)); + rtgui_application_run(app); } - rtgui_thread_deregister(rt_thread_self()); - rt_mq_delete(mq); + rtgui_application_destroy(app); /* set calibration data */ rt_device_control(calibration_ptr->device, RT_TOUCH_CALIBRATION_DATA, &calibration_ptr->data); @@ -256,7 +261,7 @@ void calibration_entry(void* parameter) calibration_ptr = RT_NULL; } -void calibration_init() +void calibration_init(void) { rt_device_t device; diff --git a/components/rtgui/widgets/filelist_view.c b/components/rtgui/widgets/filelist_view.c index 14209749ca..7d70b1f104 100644 --- a/components/rtgui/widgets/filelist_view.c +++ b/components/rtgui/widgets/filelist_view.c @@ -295,7 +295,7 @@ static void rtgui_filelist_view_menu_pop(rtgui_widget_t *parent) rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &screen); rtgui_rect_moveto_align(&screen, &rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL); - menu = rtgui_win_create(RTGUI_TOPLEVEL(rtgui_widget_get_toplevel(parent)), + menu = rtgui_win_create(rtgui_widget_get_toplevel(parent), "Folder Menu", &rect, RTGUI_WIN_STYLE_DEFAULT); if (menu != RT_NULL) { @@ -319,7 +319,7 @@ static void _rtgui_filelist_view_constructor(struct rtgui_filelist_view *view) struct rtgui_rect rect = {0, 0, 200, 200}; /* set default widget rect and set event handler */ - rtgui_object_set_event_handler(RTGUI_WIDGET(view), rtgui_filelist_view_event_handler); + rtgui_object_set_event_handler(RTGUI_OBJECT(view), rtgui_filelist_view_event_handler); rtgui_widget_set_rect(RTGUI_WIDGET(view), &rect); RTGUI_WIDGET(view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE; @@ -650,7 +650,7 @@ rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_widget* widget, struct } /* use view event handler */ - return rtgui_container_event_handler(widget, event); + return rtgui_container_event_handler(RTGUI_OBJECT(widget), event); } rtgui_filelist_view_t* rtgui_filelist_view_create(const char* directory, diff --git a/src/rtm.c b/src/rtm.c index 38d6df3d30..e1a97c93f6 100644 --- a/src/rtm.c +++ b/src/rtm.c @@ -228,8 +228,6 @@ RTM_EXPORT(stat); #include #include #include -#include -#include #include #include #include @@ -238,34 +236,19 @@ RTM_EXPORT(stat); #include RTM_EXPORT(rtgui_label_create); -RTM_EXPORT(rtgui_view_show); -RTM_EXPORT(rtgui_view_create); -RTM_EXPORT(rtgui_view_destroy); -RTM_EXPORT(rtgui_view_event_handler); RTM_EXPORT(rtgui_dc_draw_text); RTM_EXPORT(rtgui_dc_begin_drawing); RTM_EXPORT(rtgui_dc_end_drawing); -RTM_EXPORT(rtgui_workbench_event_loop); -RTM_EXPORT(rtgui_workbench_event_handler); -RTM_EXPORT(rtgui_workbench_add_view); -RTM_EXPORT(rtgui_workbench_create); -RTM_EXPORT(rtgui_workbench_destroy); -RTM_EXPORT(rtgui_workbench_close); RTM_EXPORT(rtgui_timer_start); RTM_EXPORT(rtgui_timer_create); RTM_EXPORT(rtgui_timer_destory); RTM_EXPORT(rtgui_timer_stop); -RTM_EXPORT(rtgui_thread_register); -RTM_EXPORT(rtgui_thread_deregister); RTM_EXPORT(rtgui_widget_focus); -RTM_EXPORT(rtgui_widget_set_event_handler); RTM_EXPORT(rtgui_widget_rect_to_device); RTM_EXPORT(rtgui_widget_update); RTM_EXPORT(rtgui_widget_get_rect); RTM_EXPORT(rtgui_widget_set_rect); RTM_EXPORT(rtgui_widget_get_toplevel); -RTM_EXPORT(rtgui_panel_register); -RTM_EXPORT(rtgui_panel_set_default_focused); RTM_EXPORT(rtgui_button_create); RTM_EXPORT(rtgui_button_destroy); RTM_EXPORT(rtgui_button_set_onbutton);