git-svn-id: https://rt-thread.googlecode.com/svn/trunk@275 bbd45198-f89e-11dd-88c7-29a3b14d5316

This commit is contained in:
aganhx@gmail.com 2010-01-03 09:25:33 +00:00
parent 5d45949ec5
commit 5b66724bad
8 changed files with 4 additions and 553 deletions

View File

@ -57,9 +57,6 @@ if rtconfig.RT_USING_RTGUI:
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_T35':
src_drv += ['lcd_t35.c']
if rtconfig.RT_USING_DEMO_GUI:
src_drv += ['gui_init.c','demo_gui.c','info.c']
objs = objs + env.Object(src_bsp + src_drv)
TARGET = target + '.' + rtconfig.TARGET_EXT

View File

@ -20,7 +20,6 @@
#include <board.h>
#include <rtthread.h>
#include <rtgui/rtgui.h>
#include "led.h"
#ifdef RT_USING_DFS
@ -78,7 +77,6 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_RTGUI
{
radio_rtgui_init();
rt_hw_key_init();
}
#endif

View File

@ -1,245 +0,0 @@
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/label.h>
#include <finsh.h>
static struct rtgui_timer *timer;
static struct rtgui_label* label;
static struct rtgui_win* msgbox;
static rt_uint8_t label_text[80];
static int cnt = 5;
void diag_close(struct rtgui_timer* timer, void* parameter)
{
rt_sprintf(label_text, "closed then %d second!", cnt);
rtgui_label_set_text(label, label_text);
rtgui_widget_update(RTGUI_WIDGET(label));
if (cnt == 0)
{
rtgui_win_destroy(msgbox);
rtgui_timer_stop(timer);
rtgui_timer_destory(timer);
}
cnt --;
}
void msg()
{
rt_mq_t mq;
rt_thread_t tid;
rt_uint32_t user_data;
struct rtgui_rect rect = {50, 50, 200, 200};
tid = rt_thread_self();
if (tid == RT_NULL) return; /* can't use in none-scheduler environement */
user_data = tid->user_data;
/* create gui message queue */
mq = rt_mq_create("msgbox", 256, 4, RT_IPC_FLAG_FIFO);
/* register message queue on current thread */
rtgui_thread_register(rt_thread_self(), mq);
msgbox = rtgui_win_create(RT_NULL, "Information", &rect, RTGUI_WIN_STYLE_DEFAULT);
if (msgbox != RT_NULL)
{
struct rtgui_box* box = rtgui_box_create(RTGUI_VERTICAL, RT_NULL);
cnt = 5;
rt_sprintf(label_text, "closed then %d second!", cnt);
label = rtgui_label_create(label_text);
rtgui_win_set_box(msgbox, box);
RTGUI_WIDGET(label)->align = RTGUI_ALIGN_CENTER_HORIZONTAL |
RTGUI_ALIGN_CENTER_VERTICAL;
rtgui_widget_set_miniwidth(RTGUI_WIDGET(label),130);
rtgui_box_append(box, RTGUI_WIDGET(label));
rtgui_box_layout(box);
rtgui_win_show(msgbox, RT_TRUE);
}
timer = rtgui_timer_create(200, RT_TIMER_FLAG_PERIODIC,
diag_close, RT_NULL);
rtgui_timer_start(timer);
rtgui_win_event_loop(msgbox);
rtgui_thread_deregister(rt_thread_self());
/* remove RTGUI message queue */
rt_mq_delete(mq);
/* recover user data */
tid->user_data = user_data;
}
FINSH_FUNCTION_EXPORT(msg, msg on gui)
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/box.h>
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/textbox.h>
#include <rtgui/widgets/iconbox.h>
#include <rtgui/widgets/view.h>
#include <rtgui/widgets/workbench.h>
/* XPM */
static const char *goto_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 43 1",
". c Black",
"e c #0F0F0F",
"= c #2D2D2D",
"> c #3C3C3C",
"X c #010101",
"$ c #101010",
"% c #1F1F1F",
"r c #090909",
"- c #272727",
"3 c #363636",
"+ c #020202",
"# c #111111",
"2 c #3E3E3E",
"i c #4D4D4D",
"q c #191919",
", c #373737",
"f c #464646",
"o c #030303",
"u c #121212",
"p c #212121",
"; c #0B0B0B",
" c None",
"7 c #292929",
"O c #040404",
"6 c #131313",
"5 c #222222",
"t c #313131",
"4 c #4F4F4F",
"@ c #0C0C0C",
"a c #1B1B1B",
"* c #2A2A2A",
"0 c #141414",
"< c #0D0D0D",
": c #3A3A3A",
"9 c #060606",
"& c #151515",
"w c #242424",
"s c #424242",
"d c #1D1D1D",
"8 c #070707",
"1 c #161616",
"g c #252525",
"y c #343434",
/* pixels */
" .XX. ",
" oOOO+ ",
" @####o ",
" $%%%%& ",
" .*===-+ ",
" ;:>,; ",
" <# 12O ",
" 345 .X. ",
" 678 .X++X ",
" +9999o ",
" o0&&&6+ ",
" qwwwwe ",
" rtyy% ",
" +; uip ",
" asd o ",
" $fg "
};
static struct rtgui_image* image = RT_NULL;
static void rtgui_demo_workbench_entry(void* parameter)
{
rt_mq_t mq;
struct rtgui_view* view;
struct rtgui_workbench* workbench;
/* init rtgui demo message queue */
mq = rt_mq_create("mqWB", 256, 4, RT_IPC_FLAG_FIFO);
/* register thread and message queue */
rtgui_thread_register(rt_thread_self(), mq);
/* create container */
workbench = rtgui_workbench_create("main", "widget");
if (workbench == RT_NULL) return;
/************************************************************************/
/* Create View */
/************************************************************************/
view = rtgui_view_create("widget");
rtgui_workbench_add_view(workbench, view);
image = rtgui_image_create_from_mem("xpm", (rt_uint8_t*)goto_xpm, sizeof(goto_xpm), RT_TRUE);
{
struct rtgui_box *box = rtgui_box_create(RTGUI_VERTICAL, &rtgui_empty_rect);
struct rtgui_box *hbox = rtgui_box_create(RTGUI_HORIZONTAL, &rtgui_empty_rect);
struct rtgui_button* button = rtgui_button_create("OK");
struct rtgui_textbox *textbox = rtgui_textbox_create("text edit box");
struct rtgui_iconbox *iconbox = rtgui_iconbox_create(image, "icon",
RTGUI_ICONBOX_TEXT_RIGHT);
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = RTGUI_RGB(255, 255, 224);
rtgui_view_set_box(view, box);
RTGUI_WIDGET(button)->align = RTGUI_ALIGN_CENTER_VERTICAL;
rtgui_widget_set_miniwidth(RTGUI_WIDGET(button), 80);
rtgui_widget_set_miniheight(RTGUI_WIDGET(button), 25);
rtgui_box_append(box, RTGUI_WIDGET(button));
/* add a horizontal box */
rtgui_widget_set_miniwidth(RTGUI_WIDGET(hbox), 20);
rtgui_widget_set_miniheight(RTGUI_WIDGET(hbox), 100);
RTGUI_WIDGET(hbox)->align = RTGUI_ALIGN_EXPAND;
rtgui_box_layout(hbox);
rtgui_box_append(box, RTGUI_WIDGET(hbox));
rtgui_box_append(box, RTGUI_WIDGET(textbox));
/* add icon box */
RTGUI_WIDGET(iconbox)->gc.font = rtgui_font_refer("hz", 16);
rtgui_box_append(box, RTGUI_WIDGET(iconbox));
rtgui_box_layout(box);
}
/* show view */
rtgui_view_show(view, RT_TRUE);
rtgui_workbench_event_loop(workbench);
}
void rtgui_demo_workbench_init()
{
static rt_bool_t inited = RT_FALSE;
if (inited == RT_FALSE)
{
rt_thread_t tid;
tid = rt_thread_create("tWB",
rtgui_demo_workbench_entry, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL) rt_thread_startup(tid);
inited = RT_TRUE;
}
}
#ifdef RT_USING_RTGUI
#include <finsh.h>
void w()
{
rtgui_demo_workbench_init();
}
FINSH_FUNCTION_EXPORT(w, workbench demo)
#endif

View File

@ -1,33 +0,0 @@
#include "rtthread.h"
#include <rtgui/rtgui.h>
#include <rtgui/driver.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/rtgui_system.h>
extern void info_init(void);
void radio_rtgui_init(void)
{
rtgui_rect_t rect;
rtgui_system_server_init();
/* register dock panel */
rect.x1 = 0;
rect.y1 = 0;
rect.x2 = 240;
rect.y2 = 25;
rtgui_panel_register("info", &rect);
/* register main panel */
rect.x1 = 0;
rect.y1 = 25;
rect.x2 = 320;
rect.y2 = 320;
rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main");
info_init();
/* player_init(); */
}

View File

@ -1,90 +0,0 @@
#include <rtgui/rtgui.h>
#include <rtgui/image.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
#include <rtgui/widgets/workbench.h>
#include "network.xpm"
static rtgui_image_t *rtt_image = RT_NULL;
static rtgui_image_t *network_image = RT_NULL;
static rtgui_image_t *usb_image = RT_NULL;
static rtgui_image_t *power_image = RT_NULL;
static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
{
if (event->type == RTGUI_EVENT_PAINT)
{
struct rtgui_dc* dc;
struct rtgui_rect rect;
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL) return RT_FALSE;
rtgui_widget_get_rect(widget, &rect);
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y2 - 1);
/* draw RT-Thread logo */
rtt_image = rtgui_image_create_from_file("hdc",
"/resource/RTT.hdc", RT_FALSE);
if (rtt_image != RT_NULL)
{
rtgui_image_blit(rtt_image, dc, &rect);
rtgui_image_destroy(rtt_image);
rtt_image = RT_NULL;
}
if (network_image != RT_NULL)
{
rect.x1 = rect.x2 - (network_image->w + 2);
rtgui_image_blit(network_image, dc, &rect);
}
rtgui_dc_end_drawing(dc);
return RT_FALSE;
}
return rtgui_view_event_handler(widget, event);
}
static void info_entry(void* parameter)
{
rt_mq_t mq;
struct rtgui_view* view;
struct rtgui_workbench* workbench;
mq = rt_mq_create("qInfo", 256, 4, RT_IPC_FLAG_FIFO);
rtgui_thread_register(rt_thread_self(), mq);
network_image = rtgui_image_create_from_mem("xpm",
(rt_uint8_t*)network_xpm, sizeof(network_xpm), RT_TRUE);
workbench = rtgui_workbench_create("info", "workbench");
if (workbench == RT_NULL) return;
view = rtgui_view_create("view");
rtgui_widget_set_event_handler(RTGUI_WIDGET(view), view_event_handler);
rtgui_workbench_add_view(workbench, view);
rtgui_view_show(view, RT_FALSE);
rtgui_workbench_event_loop(workbench);
rtgui_thread_deregister(rt_thread_self());
rt_mq_delete(mq);
}
void info_init()
{
rt_thread_t tid;
tid = rt_thread_create("info",
info_entry, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL) rt_thread_startup(tid);
}

View File

@ -1,172 +0,0 @@
/* XPM */
static char * network_xpm[] = {
"24 24 145 2",
" c None",
". c #6C6E6A",
"+ c #676965",
"@ c #6B6D6A",
"# c #C6C8C4",
"$ c #F0F1F0",
"% c #F1F1F0",
"& c #C8CAC6",
"* c #646662",
"= c #446795",
"- c #27508B",
"; c #2A538D",
"> c #2E558F",
", c #315890",
"' c #355B92",
") c #385E94",
"! c #3C6196",
"~ c #5C7BA2",
"{ c #F2F3F2",
"] c #626460",
"^ c #F2F2F2",
"/ c #3E6297",
"( c #86ACD5",
"_ c #88AED6",
": c #8BB0D7",
"< c #8DB1D7",
"[ c #8CB1D7",
"} c #8CB0D6",
"| c #8DAED6",
"1 c #5B7AA7",
"2 c #F4F4F4",
"3 c #61635F",
"4 c #30578F",
"5 c #88ADD6",
"6 c #8EB1D7",
"7 c #92B3D8",
"8 c #96B6D8",
"9 c #92B2D6",
"0 c #8CADD3",
"a c #84A7CF",
"b c #5F615D",
"c c #204A87",
"d c #6694C7",
"e c #6391C5",
"f c #618FC3",
"g c #5E8CC1",
"h c #5B8ABF",
"i c #5887BD",
"j c #5684BB",
"k c #5D5F5B",
"l c #5D8CC0",
"m c #5A89BE",
"n c #5886BD",
"o c #5584BB",
"p c #5281B9",
"q c #4F7FB7",
"r c #4D7CB5",
"s c #5C5E5A",
"t c #5482BA",
"u c #5180B8",
"v c #4F7EB6",
"w c #4C7BB4",
"x c #4979B2",
"y c #4676B1",
"z c #4373AF",
"A c #5A5C58",
"B c #406492",
"C c #31527F",
"D c #656D70",
"E c #5E605B",
"F c #C3C4C1",
"G c #80827F",
"H c #C8CAC7",
"I c #545651",
"J c #5E605C",
"K c #6A6E68",
"L c #72756F",
"M c #7B7E79",
"N c #848781",
"O c #8D908A",
"P c #969993",
"Q c #9FA29C",
"R c #416593",
"S c #244E89",
"T c #29518C",
"U c #2D558E",
"V c #325991",
"W c #375C93",
"X c #3B6096",
"Y c #5D7BA3",
"Z c #555753",
"` c #D0D2CE",
" . c #BBBEB7",
".. c #BABDB6",
"+. c #F2F2F1",
"@. c #345A92",
"#. c #81A8D3",
"$. c #83ABD4",
"%. c #8AAFD6",
"&. c #8FB3D8",
"*. c #92B4DA",
"=. c #5978A6",
"-. c #D2D4D1",
";. c #2C548E",
">. c #85ACD5",
",. c #92B5DA",
"'. c #98B9DB",
"). c #95B6DA",
"!. c #90B2D7",
"~. c #88ACD3",
"{. c #464644",
"]. c #719ECE",
"^. c #6E9BCC",
"/. c #6A98C9",
"(. c #6794C7",
"_. c #608EC2",
":. c #5C8BC0",
"<. c #757773",
"[. c #DADAD9",
"}. c #6391C4",
"|. c #5F8DC2",
"1. c #5C8ABF",
"2. c #5181B8",
"3. c #7F817C",
"4. c #ECECEA",
"5. c #5B89BF",
"6. c #5483BA",
"7. c #4D7DB6",
"8. c #4A7AB3",
"9. c #4776B1",
"0. c #80827D",
"a. c #EEEEEC",
"b. c #3F6392",
"c. c #82847F",
"d. c #848680",
"e. c #7F817D",
"f. c #7D7F7B",
"g. c #666863",
"h. c #A8ACA5",
"i. c #B1B3AC",
"j. c #E1E1DE",
"k. c #EDEDEB",
"l. c #E0E0DE",
"m. c #565854",
"n. c #767874",
" ",
" . + + + + + + + + + . ",
" @ # $ % % % % % % % $ & @ ",
" * $ = - ; > , ' ) ! ~ { * ",
" ] ^ / ( _ : < [ } | 1 2 ] ",
" 3 % 4 5 6 7 8 9 0 a ) % 3 ",
" b % c d e f g h i j c % b ",
" k % c l m n o p q r c % k ",
" s % c t u v w x y z c % s ",
" A $ B c c c c c c C D + + + + + + + + + . ",
" E F $ % % % % % % G # $ % % % % % % % $ H @ ",
" I J K L M N O P Q * $ R c S T U V W X Y { * ",
" Z ` .............] +.@.#.$.( %.[ &.*.=.2 ] ",
" Z -.+.+.+.+.+.+.+.3 % ;.>.: ,.'.).!.~.W % 3 ",
" {.Z Z Z Z Z Z Z Z b % c ].^./.(.e _.:.c % b ",
" <.[.<. k % c d }.|.1.i o 2.c % k ",
" 3.4.3. s % c 5.i 6.u 7.8.9.c % s ",
" 0.a.0. A $ B c c c c c c c b.$ A ",
" c...c. E F $ % % % % % % % $ F E ",
" 0.a.0.d.0.e.f.g.J K L M N O P Q h.i.J I ",
" 0.j.a...a.k.l.m.` ............... .` Z ",
" 0.0.c.0.3.n.Z -.+.+.+.+.+.+.+.+.+.-.Z ",
" {.Z Z Z Z Z Z Z Z Z Z Z {. ",
" "};

View File

@ -88,11 +88,11 @@
/* SECTION: RTGUI support */
/* using RTGUI support */
#define RT_USING_RTGUI
/* #define RT_USING_RTGUI */
/* SECTION: Device filesystem support */
/* using DFS support */
#define RT_USING_DFS
/* #define RT_USING_DFS */
#define RT_USING_DFS_EFSL
#define RT_USING_DFS_YAFFS2

View File

@ -4,7 +4,7 @@
RT_USING_FINSH = True
# device file system options
RT_USING_DFS = True
RT_USING_DFS = False
RT_USING_DFS_EFSL = True
RT_USING_DFS_ELMFAT = False
RT_USING_DFS_YAFFS2 = False
@ -13,16 +13,12 @@ RT_USING_DFS_YAFFS2 = False
RT_USING_LWIP = False
# rtgui options
RT_USING_RTGUI = True
RT_USING_RTGUI = False
# panel options
# 'PNL_A70','PNL_N35', 'PNL_T35'
RT_USING_LCD_TYPE = 'PNL_T35'
# rtgui demo options
RT_USING_DEMO_GUI = True
RT_USING_DEMO_TODAY = False
RT_USING_DEMO_WORKBENCH = False
# toolchains options
ARCH='arm'