Selaa lähdekoodia

fixed RT-Thread/GUI building warning.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2080 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong@gmail.com 13 vuotta sitten
vanhempi
commit
ffbbf82474

+ 2 - 2
examples/gui/demo_listview.c

@@ -15,7 +15,7 @@ static rtgui_list_view_t* _view = RT_NULL;
 // static rtgui_image_t* return_image = RT_NULL;
 
 /* 列表项的动作函数 */
-#if RT_VERSION == 4
+#if RTTHREAD_VERSION >= 10000
 static void listitem_action(rtgui_widget_t *widget, void* parameter)
 #else
 static void listitem_action(void* parameter)
@@ -50,7 +50,7 @@ static void listitem_action(void* parameter)
 }
 
 /* 返回功能的动作函数 */
-#if RT_VERSION == 4
+#if RTTHREAD_VERSION >= 10000
 static void return_action(rtgui_widget_t* widget, void* parameter)
 #else
 static void return_action(void* parameter)

+ 2 - 2
examples/gui/demo_listview_icon.c

@@ -14,7 +14,7 @@ static rtgui_workbench_t* workbench = RT_NULL;
 static rtgui_list_view_t* _view = RT_NULL;
 
 /* 列表项的动作函数 */
-#if RT_VERSION == 4
+#if RTTHREAD_VERSION >= 10000
 static void listitem_action(rtgui_widget_t* widget, void* parameter)
 #else
 static void listitem_action(void* parameter)
@@ -49,7 +49,7 @@ static void listitem_action(void* parameter)
 }
 
 /* 返回功能的动作函数 */
-#if RT_VERSION == 4
+#if RTTHREAD_VERSION >= 10000
 static void return_action(rtgui_widget_t* widget, void* parameter)
 #else
 static void return_action(void* parameter)

+ 1 - 1
examples/gui/demo_view_benchmark.c

@@ -4,7 +4,7 @@
 #include <rtgui/widgets/view.h>
 #include "demo_view.h"
 
-#if RT_VERSION == 4
+#if RTTHREAD_VERSION >= 10000
 #define RAND(x1, x2) ((rand() % (x2 - x1)) + x1)
 
 static rtgui_view_t* view = RT_NULL;

+ 2 - 2
examples/gui/demo_view_dc.c

@@ -26,8 +26,8 @@ rt_bool_t dc_event_handler(rtgui_widget_t* widget, rtgui_event_t *event)
 	{
 		struct rtgui_dc* dc;
 		rtgui_rect_t rect;
-		const int vx[] = {20, 50, 60, 45, 60, 20};
-		const int vy[] = {150, 50, 90, 60, 45, 50};
+		// const int vx[] = {20, 50, 60, 45, 60, 20};
+		// const int vy[] = {150, 50, 90, 60, 45, 50};
 
 		/*
 		 * 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view

+ 1 - 1
examples/gui/demo_view_dc_buffer.c

@@ -10,7 +10,7 @@
 #include <rtgui/widgets/slider.h>
 #include <rtgui/image.h>
 
-static rtgui_image_t *background;
+// static rtgui_image_t *background;
 static struct rtgui_dc *dc_buffer;
 
 /*

+ 2 - 2
examples/gui/demo_view_image.c

@@ -9,8 +9,8 @@
 #include <rtgui/widgets/filelist_view.h>
 #include <string.h>
 
-static rtgui_image_t* image = RT_NULL;
-static rtgui_view_t* _view = RT_NULL;
+// static rtgui_image_t* image = RT_NULL;
+// static rtgui_view_t* _view = RT_NULL;
 
 #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
 /* ´ò¿ª°´Å¥µÄ»Øµ÷º¯Êý */

+ 1 - 1
examples/gui/demo_view_menu.c

@@ -29,7 +29,7 @@ static const rtgui_menu_item_t items[] =
 };
 static rtgui_menu_t* menu;
 
-static _onmenu(struct rtgui_widget* widget, struct rtgui_event* event)
+static void _onmenu(struct rtgui_widget* widget, struct rtgui_event* event)
 {
 	rtgui_rect_t rect;
 

+ 15 - 15
examples/gui/demo_workbench.c

@@ -6,7 +6,7 @@
 
 static rt_bool_t demo_workbench_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
 {
-	/* 鎴戜滑鐩�墠鍙��鎸夐敭浜嬩欢鎰熷叴瓒c€傚�鏋滃綋鍓峸orkbench澶勪簬妯″紡鏄剧ず鐘舵€侊紝蹇界暐瀹�  */
+	/* 我们目前只对按键事件感兴趣。如果当前workbench处于模式显示状态,忽略它  */
 	if ((event->type == RTGUI_EVENT_KBD) && !RTGUI_WORKBENCH_IS_MODAL_MODE(RTGUI_WORKBENCH(widget)))
 	{
 		struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
@@ -26,7 +26,7 @@ static rt_bool_t demo_workbench_event_handler(struct rtgui_widget* widget, struc
 		}
 	}
 
-	/* 濡傛灉涓嶆槸缁樺埗浜嬩欢锛屼娇鐢╲iew鍘熸潵鐨勪簨浠跺�鐞嗗嚱鏁板�鐞� */
+	/* 如果不是绘制事件,使用view原来的事件处理函数处理 */
 	return rtgui_workbench_event_handler(widget, event);
 }
 
@@ -35,28 +35,28 @@ static void workbench_entry(void* parameter)
 	rt_mq_t mq;
 	struct rtgui_workbench* workbench;
 
-	/* 鍒涘缓GUI搴旂敤闇€瑕佺殑娑堟伅闃熷垪 */
+	/* 创建GUI应用需要的消息队列 */
 #ifdef RTGUI_USING_SMALL_SIZE
 	mq = rt_mq_create("workbench", 32, 32, RT_IPC_FLAG_FIFO);
 #else
 	mq = rt_mq_create("workbench", 256, 32, RT_IPC_FLAG_FIFO);
 #endif
-	/* 娉ㄥ唽褰撳墠绾跨▼涓篏UI绾跨▼ */
+	/* 注册当前线程为GUI线程 */
 	rtgui_thread_register(rt_thread_self(), mq);
 
-	/* 鍒涘缓涓€涓�伐浣滃彴 */
+	/* 创建一个工作台 */
 	workbench = rtgui_workbench_create("main", "workbench");
 	if (workbench == RT_NULL) return;
 
 	rtgui_widget_set_event_handler(RTGUI_WIDGET(workbench), demo_workbench_event_handler);
 
-	/* 鍒濆�鍖栧悇涓�緥瀛愮殑瑙嗗浘 */
-#if RT_VERSION == 4
+	/* 初始化各个例子的视图 */
+#if RTTHREAD_VERSION >= 10000
 	demo_view_benchmark(workbench);
 #endif
 
 	demo_view_dc(workbench);
-#if RT_VERSION == 4
+#if RTTHREAD_VERSION >= 10000
 #ifdef RTGUI_USING_TTF
 	demo_view_ttf(workbench);
 #endif
@@ -68,7 +68,7 @@ static void workbench_entry(void* parameter)
 	demo_view_animation(workbench);
 #ifndef RTGUI_USING_SMALL_SIZE
 	demo_view_buffer_animation(workbench);
-	// demo_view_instrument_panel(workbench);
+	demo_view_instrument_panel(workbench);
 #endif
 	demo_view_window(workbench);
 	demo_view_label(workbench);
@@ -83,7 +83,7 @@ static void workbench_entry(void* parameter)
 	demo_view_listctrl(workbench);
 	demo_view_combobox(workbench);
 	demo_view_slider(workbench);
-	demo_view_notebook(workbench);
+	// demo_view_notebook(workbench);
 	demo_view_mywidget(workbench);
 #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
 	demo_view_image(workbench);
@@ -99,13 +99,13 @@ static void workbench_entry(void* parameter)
 	demo_fn_view(workbench);
 #endif
 
-	/* 鏄剧ず瑙嗗浘 */
+	/* 显示视图 */
 	demo_view_show();
 
-	/* 鎵ц�宸ヤ綔鍙颁簨浠跺惊鐜� */
+	/* 执行工作台事件循环 */
 	rtgui_workbench_event_loop(workbench);
 
-	/* 鍘绘敞鍐孏UI绾跨▼ */
+	/* 去注册GUI线程 */
 	rtgui_thread_deregister(rt_thread_self());
 	rt_mq_delete(mq);
 }
@@ -114,7 +114,7 @@ void workbench_init()
 {
 	static rt_bool_t inited = RT_FALSE;
 
-	if (inited == RT_FALSE) /* 閬垮厤閲嶅�鍒濆�鍖栬€屽仛鐨勪繚鎶� */
+	if (inited == RT_FALSE) /* 避免重复初始化而做的保护 */
 	{
 		rt_thread_t tid;
 
@@ -134,6 +134,6 @@ void workbench()
 {
 	workbench_init();
 }
-/* finsh鐨勫懡浠よ緭鍑猴紝鍙�互鐩存帴鎵ц�workbench()鍑芥暟浠ユ墽琛屼笂闈㈢殑鍑芥暟 */
+/* finsh的命令输出,可以直接执行workbench()函数以执行上面的函数 */
 FINSH_FUNCTION_EXPORT(workbench, workbench demo)
 #endif