add radio player UI
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@171 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
c1e1d638ff
commit
010cec2009
|
@ -42,10 +42,31 @@
|
|||
#endif
|
||||
|
||||
#ifdef RT_USING_RTGUI
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
extern void radio_rtgui_init(void);
|
||||
#endif
|
||||
|
||||
void sram_test_entry(void* parameter)
|
||||
{
|
||||
rt_uint32_t *ptr;
|
||||
rt_uint32_t index;
|
||||
|
||||
ptr = (rt_uint32_t*)STM32_EXT_SRAM_BEGIN;
|
||||
index = 0;
|
||||
while (1)
|
||||
{
|
||||
*ptr = index;
|
||||
ptr ++; index ++;
|
||||
|
||||
if (ptr == (rt_uint32_t*)STM32_EXT_SRAM_END)
|
||||
{
|
||||
ptr = (rt_uint32_t*)STM32_EXT_SRAM_BEGIN;
|
||||
rt_kprintf("test passed\n");
|
||||
|
||||
rt_thread_delay(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* thread phase init */
|
||||
void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
|
@ -76,10 +97,26 @@ void rt_init_thread_entry(void *parameter)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* RTGUI Initialization */
|
||||
#ifdef RT_USING_RTGUI
|
||||
{
|
||||
radio_rtgui_init();
|
||||
rt_hw_key_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* LwIP Initialization */
|
||||
#ifdef RT_USING_LWIP
|
||||
{
|
||||
extern void lwip_sys_init(void);
|
||||
#ifdef RT_USING_LWIP
|
||||
eth_system_device_init();
|
||||
|
||||
/* register ethernetif device */
|
||||
rt_hw_dm9000_init();
|
||||
/* init all device */
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
|
||||
/* init lwip system */
|
||||
lwip_sys_init();
|
||||
|
@ -92,32 +129,14 @@ void rt_init_thread_entry(void *parameter)
|
|||
net_buf_init(320 * 1024);
|
||||
#endif
|
||||
|
||||
/* RTGUI Initialization */
|
||||
#ifdef RT_USING_RTGUI
|
||||
#if 0
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rt_thread_t tid;
|
||||
|
||||
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 = 240;
|
||||
rect.y2 = 320;
|
||||
rtgui_panel_register("main", &rect);
|
||||
|
||||
rt_hw_lcd_init();
|
||||
|
||||
info_init();
|
||||
today_init();
|
||||
tid = rt_thread_create("sram",
|
||||
sram_test_entry, RT_NULL,
|
||||
512, 30, 5);
|
||||
if (tid != RT_NULL) rt_thread_startup(tid);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -139,8 +158,6 @@ int rt_application_init()
|
|||
#endif
|
||||
if (init_thread != RT_NULL) rt_thread_startup(init_thread);
|
||||
|
||||
rt_hw_key_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,239 @@
|
|||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtgui/widgets/view.h>
|
||||
#include <rtgui/widgets/workbench.h>
|
||||
|
||||
#include <stm32f10x_dbgmcu.h>
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
#include <lwip/err.h>
|
||||
#include <lwip/dns.h>
|
||||
#include <lwip/netif.h>
|
||||
#endif
|
||||
|
||||
static struct rtgui_view* device_view = RT_NULL;
|
||||
|
||||
int get_thread_cnt()
|
||||
{
|
||||
int cnt = 0;
|
||||
struct rt_list_node *list, *node;
|
||||
extern struct rt_object_information rt_object_container[];
|
||||
|
||||
list = &rt_object_container[RT_Object_Class_Thread].object_list;
|
||||
|
||||
for (node = list->next; node != list; node = node->next)
|
||||
{
|
||||
cnt ++;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
const static char *stm32_devname[] =
|
||||
{
|
||||
"STM32 MD", /* 0x410 */
|
||||
"STM32 LD", /* 0x412 */
|
||||
"STM32 HD", /* 0x414 */
|
||||
"Unknown" , /* 0x416 */
|
||||
"STM32 CL", /* 0x418 */
|
||||
};
|
||||
|
||||
const static char *stm32_revname[] =
|
||||
{
|
||||
"Rev A",
|
||||
"Rev B",
|
||||
"Rev Z",
|
||||
"Rev Y",
|
||||
"Rev Unknown"
|
||||
};
|
||||
|
||||
/*
|
||||
* Device Information View
|
||||
* Device: Win32 or Cortex-M3 etc
|
||||
* Memory:
|
||||
* Thread:
|
||||
* IP Address:
|
||||
* Gateway:
|
||||
* DNS:
|
||||
*/
|
||||
static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
{
|
||||
struct rtgui_dc* dc;
|
||||
struct rtgui_rect rect;
|
||||
char* line;
|
||||
rt_uint32_t total, used, max_used;
|
||||
|
||||
line = rtgui_malloc(256);
|
||||
if (line == RT_NULL) return RT_FALSE;
|
||||
|
||||
dc = rtgui_dc_begin_drawing(widget);
|
||||
if (dc == RT_NULL)
|
||||
{
|
||||
rtgui_free(line);
|
||||
return RT_FALSE;
|
||||
}
|
||||
rtgui_widget_get_rect(widget, &rect);
|
||||
|
||||
/* fill background */
|
||||
rtgui_dc_fill_rect(dc, &rect);
|
||||
|
||||
rect.y2 = rect.y1 + 18;
|
||||
|
||||
{
|
||||
rt_uint32_t dev_index, rev_index;
|
||||
|
||||
dev_index = DBGMCU_GetDEVID();
|
||||
dev_index = (dev_index - 0x410)/2;
|
||||
rev_index = DBGMCU_GetREVID();
|
||||
switch (rev_index)
|
||||
{
|
||||
case 0x1000:
|
||||
case 0x0000:
|
||||
rev_index = 0; /* Revision A */
|
||||
break;
|
||||
|
||||
case 0x1001:
|
||||
case 0x2001:
|
||||
rev_index = 3; /* Revision Z */
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
rev_index = 1; /* Revision B */
|
||||
break;
|
||||
case 0x2002:
|
||||
rev_index = 2; /* Revision Y */
|
||||
break;
|
||||
|
||||
default:
|
||||
rev_index = 4; /* Unknown */
|
||||
break;
|
||||
};
|
||||
|
||||
/* check device index */
|
||||
if (dev_index < 0 || dev_index > 4) dev_index = 3;
|
||||
|
||||
/* draw each information */
|
||||
sprintf(line, "设备: %s %s",
|
||||
stm32_devname[dev_index],
|
||||
stm32_revname[rev_index]);
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
}
|
||||
|
||||
rt_memory_info(&total, &used, &max_used);
|
||||
sprintf(line, "内存: 当前使用 %d 字节", used);
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
{
|
||||
rt_uint16_t rect_width;
|
||||
rtgui_color_t saved;
|
||||
|
||||
rtgui_rect_t mem_rect = rect;
|
||||
rtgui_rect_inflate(&mem_rect, -2);
|
||||
rtgui_dc_draw_rect(dc, &mem_rect);
|
||||
|
||||
rtgui_rect_inflate(&mem_rect, -1);
|
||||
rect_width = rtgui_rect_width(mem_rect);
|
||||
|
||||
saved = RTGUI_WIDGET_BACKGROUND(widget);
|
||||
|
||||
RTGUI_WIDGET_BACKGROUND(widget) = light_grey;
|
||||
mem_rect.x2 = mem_rect.x1 + (max_used * rect_width / total);
|
||||
rtgui_dc_fill_rect(dc, &mem_rect);
|
||||
|
||||
RTGUI_WIDGET_BACKGROUND(widget) = blue;
|
||||
mem_rect.x2 = mem_rect.x1 + (used * rect_width / total);
|
||||
rtgui_dc_fill_rect(dc, &mem_rect);
|
||||
|
||||
/* restore color */
|
||||
RTGUI_WIDGET_BACKGROUND(widget) = saved;
|
||||
}
|
||||
rect.y1 += 18; rect.y2 += 18;
|
||||
|
||||
sprintf(line, "线程数: %d", get_thread_cnt());
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
{
|
||||
struct ip_addr ip_addr;
|
||||
struct _ip_addr
|
||||
{
|
||||
rt_uint8_t addr0, addr1, addr2, addr3;
|
||||
} *addr;
|
||||
|
||||
addr = (struct _ip_addr*)&netif_default->ip_addr.addr;
|
||||
|
||||
sprintf(line, "IP地址 : %d.%d.%d.%d", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
|
||||
addr = (struct _ip_addr*)&netif_default->gw.addr;
|
||||
sprintf(line, "网关地址: %d.%d.%d.%d", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
|
||||
addr = (struct _ip_addr*)&netif_default->netmask.addr;
|
||||
sprintf(line, "网络掩码: %d.%d.%d.%d", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
|
||||
#if LWIP_DNS
|
||||
ip_addr = dns_getserver(0);
|
||||
addr = (struct _ip_addr*)&ip_addr;
|
||||
sprintf(line, "DNS地址 : %d.%d.%d.%d", addr->addr0, addr->addr1, addr->addr2, addr->addr3);
|
||||
rtgui_dc_draw_text(dc, line, &rect); rect.y1 += 16; rect.y2 += 16;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
rtgui_dc_end_drawing(dc);
|
||||
rtgui_free(line);
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
case RTGUI_EVENT_KBD:
|
||||
{
|
||||
struct rtgui_event_kbd* ekbd;
|
||||
|
||||
ekbd = (struct rtgui_event_kbd*)event;
|
||||
if (ekbd->type == RTGUI_KEYDOWN && ekbd->key == RTGUIK_RETURN)
|
||||
{
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(device_view)->parent);
|
||||
rtgui_workbench_remove_view(workbench, device_view);
|
||||
|
||||
rtgui_view_destroy(device_view);
|
||||
device_view = RT_NULL;
|
||||
}
|
||||
}
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
/* use parent event handler */
|
||||
return rtgui_view_event_handler(widget, event);
|
||||
}
|
||||
|
||||
rtgui_view_t *device_view_create(rtgui_workbench_t* workbench)
|
||||
{
|
||||
if (device_view != RT_NULL)
|
||||
{
|
||||
rtgui_view_show(device_view, RT_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* create a view */
|
||||
device_view = rtgui_view_create("Device Info");
|
||||
/* set view event handler */
|
||||
rtgui_widget_set_event_handler(RTGUI_WIDGET(device_view), view_event_handler);
|
||||
/* this view can be focused */
|
||||
RTGUI_WIDGET(device_view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
|
||||
|
||||
/* add view to workbench */
|
||||
rtgui_workbench_add_view(workbench, device_view);
|
||||
}
|
||||
|
||||
return device_view;
|
||||
}
|
|
@ -276,7 +276,7 @@ static rt_err_t rt_dm9000_init(rt_device_t dev)
|
|||
while (!(phy_read(1) & 0x20))
|
||||
{
|
||||
/* autonegation complete bit */
|
||||
delay_ms(10);
|
||||
rt_thread_delay(10);
|
||||
i++;
|
||||
if (i == 10000)
|
||||
{
|
||||
|
|
|
@ -1,13 +1,209 @@
|
|||
#include <rtgui/rtgui_object.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/rtgui_theme.h>
|
||||
|
||||
#include <rtgui/list.h>
|
||||
#include <rtgui/image.h>
|
||||
#include <rtgui/widgets/view.h>
|
||||
#include <rtgui/widgets/workbench.h>
|
||||
|
||||
#include "filelist.h"
|
||||
#include <dfs_posix.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FILELIST_MARGIN 5
|
||||
#ifdef _WIN32
|
||||
#define PATH_SEPARATOR '\\'
|
||||
#define stat _stat
|
||||
#else
|
||||
#define PATH_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
const static char * file_xpm[] = {
|
||||
"16 16 21 1",
|
||||
" c None",
|
||||
". c #999999",
|
||||
"+ c #818181",
|
||||
"@ c #FFFFFF",
|
||||
"# c #ECECEC",
|
||||
"$ c #EAEAEA",
|
||||
"% c #EBEBEB",
|
||||
"& c #EDEDED",
|
||||
"* c #F0F0F0",
|
||||
"= c #C4C4C4",
|
||||
"- c #C5C5C5",
|
||||
"; c #C6C6C6",
|
||||
"> c #C7C7C7",
|
||||
", c #EEEEEE",
|
||||
"' c #EDEDE5",
|
||||
") c #EDEDE6",
|
||||
"! c #EFEFEF",
|
||||
"~ c #C8C8C8",
|
||||
"{ c #F1F1F1",
|
||||
"] c #F2F2F2",
|
||||
"^ c #959595",
|
||||
".++++++++++++ ",
|
||||
"+@@@@@@@@@@@@+ ",
|
||||
"+@#$$%%%##&*@+ ",
|
||||
"+@$=--;;;;>*@+ ",
|
||||
"+@$%%###&&,*@+ ",
|
||||
"+@%-;;;;;;>*@+ ",
|
||||
"+@%%##&&'#,*@+ ",
|
||||
"+@%;;;;,,),*@+ ",
|
||||
"+@##&&,,!!!*@+ ",
|
||||
"+@#;;;>>~~~*@+ ",
|
||||
"+@#&,,!!*{{{@+ ",
|
||||
"+@&;>>~~~{{]@+ ",
|
||||
"+@&&,!!**{]]@+ ",
|
||||
"+@@@@@@@@@@@@+ ",
|
||||
"^++++++++++++^ ",
|
||||
" "};
|
||||
|
||||
const static char * folder_xpm[] = {
|
||||
"16 16 121 2",
|
||||
" c None",
|
||||
". c #D9B434",
|
||||
"+ c #E1C25E",
|
||||
"@ c #E2C360",
|
||||
"# c #E2C35F",
|
||||
"$ c #DBB63C",
|
||||
"% c #DAB336",
|
||||
"& c #FEFEFD",
|
||||
"* c #FFFFFE",
|
||||
"= c #FFFEFE",
|
||||
"- c #FFFEFD",
|
||||
"; c #FBF7EA",
|
||||
"> c #E4C76B",
|
||||
", c #E3C76B",
|
||||
"' c #E6CD79",
|
||||
") c #E5CA74",
|
||||
"! c #DAAF35",
|
||||
"~ c #FEFCF7",
|
||||
"{ c #F8E48E",
|
||||
"] c #F5DE91",
|
||||
"^ c #F5E09F",
|
||||
"/ c #F6E1AC",
|
||||
"( c #FEFBEF",
|
||||
"_ c #FEFDF4",
|
||||
": c #FEFCF3",
|
||||
"< c #FEFCF1",
|
||||
"[ c #FEFBEE",
|
||||
"} c #FFFDFA",
|
||||
"| c #DAAF36",
|
||||
"1 c #DAAA36",
|
||||
"2 c #FDFAF1",
|
||||
"3 c #F5DE94",
|
||||
"4 c #F4DC93",
|
||||
"5 c #F2D581",
|
||||
"6 c #EDCA6A",
|
||||
"7 c #EACB6C",
|
||||
"8 c #EFD385",
|
||||
"9 c #EFD280",
|
||||
"0 c #EFD07A",
|
||||
"a c #EECF76",
|
||||
"b c #EECF72",
|
||||
"c c #FBF7E9",
|
||||
"d c #DAAE34",
|
||||
"e c #DAAB35",
|
||||
"f c #FBF6E8",
|
||||
"g c #EFD494",
|
||||
"h c #EECE88",
|
||||
"i c #E9C173",
|
||||
"j c #F6E9C9",
|
||||
"k c #FEFCF2",
|
||||
"l c #FEFCF0",
|
||||
"m c #DAAB36",
|
||||
"n c #DAA637",
|
||||
"o c #FFFDF8",
|
||||
"p c #FFFDF6",
|
||||
"q c #FFFCF5",
|
||||
"r c #FCF6D8",
|
||||
"s c #F8E694",
|
||||
"t c #F7E385",
|
||||
"u c #F6DF76",
|
||||
"v c #F5DB68",
|
||||
"w c #F4D85C",
|
||||
"x c #FCF4D7",
|
||||
"y c #DAA435",
|
||||
"z c #DAA136",
|
||||
"A c #FEFCF6",
|
||||
"B c #FCF2C8",
|
||||
"C c #FBEFB9",
|
||||
"D c #FAECAC",
|
||||
"E c #F9E89C",
|
||||
"F c #F7E38B",
|
||||
"G c #F6E07C",
|
||||
"H c #F6DC6C",
|
||||
"I c #F5D95D",
|
||||
"J c #F4D64F",
|
||||
"K c #F3D344",
|
||||
"L c #FCF3D0",
|
||||
"M c #DA9F35",
|
||||
"N c #DA9A36",
|
||||
"O c #FDFAF2",
|
||||
"P c #FAEDB3",
|
||||
"Q c #F9E9A4",
|
||||
"R c #F8E695",
|
||||
"S c #F7E285",
|
||||
"T c #F6DE76",
|
||||
"U c #F5DB65",
|
||||
"V c #F4D757",
|
||||
"W c #F3D449",
|
||||
"X c #F2D13B",
|
||||
"Y c #F1CE30",
|
||||
"Z c #FBF2CC",
|
||||
"` c #DA9835",
|
||||
" . c #DA9435",
|
||||
".. c #FEFAEF",
|
||||
"+. c #F9E9A1",
|
||||
"@. c #F8E591",
|
||||
"#. c #F7E181",
|
||||
"$. c #F6DE72",
|
||||
"%. c #F5DA63",
|
||||
"&. c #F4D754",
|
||||
"*. c #F3D347",
|
||||
"=. c #F2D039",
|
||||
"-. c #F1CD2E",
|
||||
";. c #F0CB26",
|
||||
">. c #FBF2CA",
|
||||
",. c #D98E33",
|
||||
"'. c #FAF0DC",
|
||||
"). c #F4DDA7",
|
||||
"!. c #F4DB9E",
|
||||
"~. c #F3DA96",
|
||||
"{. c #F3D88E",
|
||||
"]. c #F3D786",
|
||||
"^. c #F2D47F",
|
||||
"/. c #F2D379",
|
||||
"(. c #F1D272",
|
||||
"_. c #F1D06C",
|
||||
":. c #F1CF69",
|
||||
"<. c #F8EAC2",
|
||||
"[. c #D8882D",
|
||||
"}. c #D8872D",
|
||||
"|. c #D8862C",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . + @ @ @ # $ ",
|
||||
" % & * = - * ; > , , , ' ) ",
|
||||
" ! ~ { ] ^ / ( _ : < ( [ } | ",
|
||||
" 1 2 3 4 5 6 7 8 9 0 a b c d ",
|
||||
" e f g h i j k : k l ( [ * m ",
|
||||
" n * o p q : r s t u v w x y ",
|
||||
" z A B C D E F G H I J K L M ",
|
||||
" N O P Q R S T U V W X Y Z ` ",
|
||||
" ...+.@.#.$.%.&.*.=.-.;.>. . ",
|
||||
" ,.'.).!.~.{.].^./.(._.:.<.,. ",
|
||||
" [.}.[.[.[.[.[.[.[.[.}.[.|. ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
/* image for file and folder */
|
||||
rtgui_image_t *file_image, *folder_image;
|
||||
static rtgui_image_t *file_image, *folder_image;
|
||||
static struct filelist_view *filelist_view = RT_NULL; /* only one view in global */
|
||||
|
||||
static void _filelist_view_constructor(filelist_view *view)
|
||||
static void _filelist_view_constructor(struct filelist_view *view)
|
||||
{
|
||||
/* default rect */
|
||||
struct rtgui_rect rect = {0, 0, 200, 200};
|
||||
|
@ -16,12 +212,21 @@ static void _filelist_view_constructor(filelist_view *view)
|
|||
rtgui_widget_set_event_handler(RTGUI_WIDGET(view),filelist_view_event_handler);
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(view), &rect);
|
||||
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(list)) = RTGUI_RGB(212, 208, 200);
|
||||
RTGUI_WIDGET(view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
|
||||
|
||||
view->current_item = 0;
|
||||
view->items_count = 0;
|
||||
view->page_items = 0;
|
||||
|
||||
view->count = 0;
|
||||
view->current_directory = RT_NULL;
|
||||
view->pattern = RT_NULL;
|
||||
rtgui_list_init(&view->list);
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white;
|
||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(view)) = RTGUI_ALIGN_CENTER_VERTICAL;
|
||||
|
||||
file_image = rtgui_image_create_from_mem("xpm",
|
||||
(rt_uint8_t*)file_xpm, sizeof(file_xpm));
|
||||
folder_image = rtgui_image_create_from_mem("xpm",
|
||||
(rt_uint8_t*)folder_xpm, sizeof(folder_xpm));
|
||||
}
|
||||
|
||||
rtgui_type_t *filelist_view_type_get(void)
|
||||
|
@ -37,19 +242,158 @@ rtgui_type_t *filelist_view_type_get(void)
|
|||
return filelist_view_type;
|
||||
}
|
||||
|
||||
void filelist_view_ondraw(struct filelist_view* view)
|
||||
{
|
||||
struct rtgui_rect rect, item_rect, image_rect;
|
||||
struct rtgui_dc* dc;
|
||||
rt_uint16_t page_index, index;
|
||||
struct file_item* item;
|
||||
|
||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(view));
|
||||
if (dc == RT_NULL) return;
|
||||
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
rtgui_dc_fill_rect(dc, &rect);
|
||||
|
||||
/* get item base rect */
|
||||
item_rect = rect;
|
||||
item_rect.y1 += 1;
|
||||
item_rect.y2 = item_rect.y1 + (1 + rtgui_theme_get_selected_height());
|
||||
|
||||
/* get image base rect */
|
||||
image_rect.x1 = FILELIST_MARGIN; image_rect.y1 = 0;
|
||||
image_rect.x2 = FILELIST_MARGIN + file_image->w; image_rect.y2 = file_image->h;
|
||||
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
|
||||
/* get current page */
|
||||
page_index = (view->current_item / view->page_items) * view->page_items;
|
||||
for (index = 0; index < view->page_items; index ++)
|
||||
{
|
||||
if (page_index + index >= view->items_count) break;
|
||||
|
||||
item = &(view->items[page_index + index]);
|
||||
|
||||
if (page_index + index == view->current_item)
|
||||
{
|
||||
rtgui_theme_draw_selected(dc, &item_rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* draw background */
|
||||
rtgui_dc_fill_rect(dc, &item_rect);
|
||||
}
|
||||
|
||||
/* draw item */
|
||||
|
||||
if (item->type == FITEM_FILE)
|
||||
rtgui_image_blit(file_image, dc, &image_rect);
|
||||
else
|
||||
rtgui_image_blit(folder_image, dc, &image_rect);
|
||||
|
||||
/* draw text */
|
||||
item_rect.x1 += FILELIST_MARGIN + file_image->w + 2;
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
item_rect.x1 -= FILELIST_MARGIN + file_image->w + 2;
|
||||
|
||||
/* move to next item position */
|
||||
item_rect.y1 += (rtgui_theme_get_selected_height() + 1);
|
||||
item_rect.y2 += (rtgui_theme_get_selected_height() + 1);
|
||||
|
||||
image_rect.y1 += (rtgui_theme_get_selected_height() + 1);
|
||||
image_rect.y2 += (rtgui_theme_get_selected_height() + 1);
|
||||
}
|
||||
|
||||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
|
||||
void filelist_view_update_current(struct filelist_view* view, rt_uint16_t old_item)
|
||||
{
|
||||
struct rtgui_dc* dc;
|
||||
struct file_item* item;
|
||||
rtgui_rect_t rect, item_rect, image_rect;
|
||||
|
||||
if (old_item/view->page_items != view->current_item/view->page_items)
|
||||
{
|
||||
/* it's not a same page, update all */
|
||||
rtgui_widget_update(RTGUI_WIDGET(view));
|
||||
return;
|
||||
}
|
||||
|
||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(view));
|
||||
if (dc == RT_NULL) return;
|
||||
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
|
||||
/* get old item rect */
|
||||
item_rect = rect;
|
||||
item_rect.y1 += 1;
|
||||
item_rect.y1 += (old_item % view->page_items) * (1 + rtgui_theme_get_selected_height());
|
||||
item_rect.y2 = item_rect.y1 + (1 + rtgui_theme_get_selected_height());
|
||||
|
||||
/* get image rect */
|
||||
image_rect.x1 = FILELIST_MARGIN; image_rect.y1 = 0;
|
||||
image_rect.x2 = FILELIST_MARGIN + file_image->w; image_rect.y2 = file_image->h;
|
||||
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
|
||||
/* draw old item */
|
||||
rtgui_dc_fill_rect(dc, &item_rect);
|
||||
|
||||
item = &(view->items[old_item]);
|
||||
if (item->type == FITEM_FILE) /* draw item image */
|
||||
rtgui_image_blit(file_image, dc, &image_rect);
|
||||
else
|
||||
rtgui_image_blit(folder_image, dc, &image_rect);
|
||||
|
||||
item_rect.x1 += FILELIST_MARGIN + file_image->w + 2;
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
|
||||
/* draw current item */
|
||||
item_rect = rect;
|
||||
item_rect.y1 += 1;
|
||||
item_rect.y1 += (view->current_item % view->page_items) * (1 + rtgui_theme_get_selected_height());
|
||||
item_rect.y2 = item_rect.y1 + (1 + rtgui_theme_get_selected_height());
|
||||
|
||||
rtgui_theme_draw_selected(dc, &item_rect);
|
||||
|
||||
/* get image base rect */
|
||||
image_rect.x1 = FILELIST_MARGIN; image_rect.y1 = 0;
|
||||
image_rect.x2 = FILELIST_MARGIN + file_image->w; image_rect.y2 = file_image->h;
|
||||
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
|
||||
item = &(view->items[view->current_item]);
|
||||
if (item->type == FITEM_FILE) /* draw item image */
|
||||
rtgui_image_blit(file_image, dc, &image_rect);
|
||||
else
|
||||
rtgui_image_blit(folder_image, dc, &image_rect);
|
||||
|
||||
item_rect.x1 += FILELIST_MARGIN + file_image->w + 2;
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
|
||||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
|
||||
rt_bool_t filelist_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
|
||||
{
|
||||
struct filelist_view* view = RT_NULL;
|
||||
|
||||
view = FILELIST_VIEW(widget);
|
||||
switch (event.type)
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
break;
|
||||
filelist_view_ondraw(view);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUI_EVENT_RESIZE:
|
||||
{
|
||||
struct rtgui_event_resize* resize;
|
||||
|
||||
resize = (struct rtgui_event_resize*)event;
|
||||
|
||||
/* recalculate page items */
|
||||
if (file_image != RT_NULL)
|
||||
view->page_items = resize->h / (1 + rtgui_theme_get_selected_height());
|
||||
else
|
||||
view->page_items = resize->h / (2 + 14);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -58,44 +402,154 @@ rt_bool_t filelist_view_event_handler(struct rtgui_widget* widget, struct rtgui_
|
|||
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
||||
if (ekbd->type == RTGUI_KEYDOWN)
|
||||
{
|
||||
rt_uint16_t old_item;
|
||||
|
||||
old_item = view->current_item;
|
||||
switch (ekbd->key)
|
||||
{
|
||||
case RTGUIK_UP:
|
||||
break;
|
||||
if (view->current_item > 0)
|
||||
view->current_item --;
|
||||
filelist_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_DOWN:
|
||||
break;
|
||||
if (view->current_item < view->items_count - 1)
|
||||
view->current_item ++;
|
||||
filelist_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_LEFT:
|
||||
if (view->current_item - view->page_items >= 0)
|
||||
view->current_item -= view->page_items;
|
||||
filelist_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_RIGHT:
|
||||
if (view->current_item + view->page_items < view->items_count - 1)
|
||||
view->current_item += view->page_items;
|
||||
filelist_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_RETURN:
|
||||
if (view->items[view->current_item].type == FITEM_DIR)
|
||||
{
|
||||
char new_path[64];
|
||||
|
||||
if (strcmp(view->items[view->current_item].name, ".") == 0) return RT_FALSE;
|
||||
if (strcmp(view->items[view->current_item].name, "..") == 0)
|
||||
{
|
||||
char *ptr;
|
||||
ptr = strrchr(view->current_directory, PATH_SEPARATOR);
|
||||
|
||||
if (ptr == RT_NULL) return RT_FALSE;
|
||||
if (ptr == &(view->current_directory[0]))
|
||||
{
|
||||
/* it's root directory */
|
||||
new_path[0] = PATH_SEPARATOR;
|
||||
new_path[1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(new_path, view->current_directory, ptr - view->current_directory + 1);
|
||||
new_path[ptr - view->current_directory] = '\0';
|
||||
}
|
||||
rt_kprintf("new path: %s\n", new_path);
|
||||
}
|
||||
else if (view->current_item == 0 &&
|
||||
(view->current_directory[0] == '/') && (view->current_directory[1] == '\0'))
|
||||
{
|
||||
/* exit, close this view */
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(view)->parent);
|
||||
rtgui_workbench_remove_view(workbench, RTGUI_VIEW(view));
|
||||
filelist_view_destroy(view);
|
||||
|
||||
filelist_view = RT_NULL;
|
||||
return RT_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (view->current_directory[strlen(view->current_directory) - 1] != PATH_SEPARATOR)
|
||||
sprintf(new_path, "%s%c%s",view->current_directory, PATH_SEPARATOR,
|
||||
view->items[view->current_item].name);
|
||||
else
|
||||
sprintf(new_path, "%s%s",view->current_directory,
|
||||
view->items[view->current_item].name);
|
||||
}
|
||||
filelist_view_set_directory(view, new_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strstr(view->items[view->current_item].name, ".HDC") != RT_NULL ||
|
||||
strstr(view->items[view->current_item].name, ".hdc") != RT_NULL)
|
||||
{
|
||||
char new_path[64];
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(view)->parent);
|
||||
|
||||
if (view->current_directory[strlen(view->current_directory) - 1] != PATH_SEPARATOR)
|
||||
sprintf(new_path, "%s%c%s",view->current_directory, PATH_SEPARATOR,
|
||||
view->items[view->current_item].name);
|
||||
else
|
||||
sprintf(new_path, "%s%s",view->current_directory,
|
||||
view->items[view->current_item].name);
|
||||
}
|
||||
}
|
||||
return RT_FALSE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
/* use view event handler */
|
||||
return rtgui_view_event_handler(widget, event);
|
||||
}
|
||||
|
||||
filelist_view_t* filelist_view_create(const char* directory, const char* pattern)
|
||||
filelist_view_t* filelist_view_create(rtgui_workbench_t* workbench, const char* directory, const char* pattern, const rtgui_rect_t* rect)
|
||||
{
|
||||
struct filelist_view* view = RT_NULL;
|
||||
|
||||
view = (struct filelist_view*) rtgui_widget_create(FILELIST_VIEW_TYPE);
|
||||
if (view != RT_NULL)
|
||||
if (filelist_view != RT_NULL)
|
||||
{
|
||||
view->pattern = rt_strdup(pattern);
|
||||
filelist_view_set_directory(view, directory);
|
||||
rtgui_view_show(RTGUI_VIEW(filelist_view), RT_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* create a new view */
|
||||
view = (struct filelist_view*) rtgui_widget_create(FILELIST_VIEW_TYPE);
|
||||
if (view != RT_NULL)
|
||||
{
|
||||
view->items = RT_NULL;
|
||||
view->pattern = rt_strdup(pattern);
|
||||
view->page_items = rtgui_rect_height(*rect) / (1 + rtgui_theme_get_selected_height());
|
||||
filelist_view_set_directory(view, directory);
|
||||
|
||||
rtgui_workbench_add_view(workbench, RTGUI_VIEW(view));
|
||||
}
|
||||
filelist_view = view;
|
||||
}
|
||||
|
||||
return list;
|
||||
return view;
|
||||
}
|
||||
|
||||
void filelist_view_destroy(filelist_view_t* view)
|
||||
{
|
||||
/* delete all file items */
|
||||
filelist_view_clear(view);
|
||||
/* delete current directory and pattern */
|
||||
rtgui_free(view->current_directory); view->current_directory = RT_NULL;
|
||||
rtgui_free(view->pattern); view->pattern = RT_NULL;
|
||||
|
||||
/* delete image */
|
||||
rtgui_image_destroy(file_image);
|
||||
rtgui_image_destroy(folder_image);
|
||||
|
||||
/* destroy view */
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(view));
|
||||
|
@ -104,18 +558,24 @@ void filelist_view_destroy(filelist_view_t* view)
|
|||
/* clear all file items */
|
||||
void filelist_view_clear(filelist_view_t* view)
|
||||
{
|
||||
struct rtgui_list_node* node;
|
||||
rt_uint32_t index;
|
||||
struct file_item* item;
|
||||
|
||||
while (view->list.next != RT_NULL)
|
||||
{
|
||||
node = view->list.next;
|
||||
rtgui_list_remove(&view->list, node);
|
||||
for (index = 0; index < view->items_count; index ++)
|
||||
{
|
||||
item = &(view->items[index]);
|
||||
|
||||
item = rtgui_list_entry(node, struct file_item, list);
|
||||
rtgui_free(item->name);
|
||||
rtgui_free(item);
|
||||
}
|
||||
/* release item name */
|
||||
rt_free(item->name);
|
||||
item->name = RT_NULL;
|
||||
}
|
||||
|
||||
/* release items */
|
||||
rtgui_free(view->items);
|
||||
view->items = RT_NULL;
|
||||
|
||||
view->items_count = 0;
|
||||
view->current_item = 0;
|
||||
}
|
||||
|
||||
void filelist_view_set_directory(filelist_view_t* view, const char* directory)
|
||||
|
@ -129,57 +589,97 @@ void filelist_view_set_directory(filelist_view_t* view, const char* directory)
|
|||
filelist_view_clear(view);
|
||||
if (directory != RT_NULL)
|
||||
{
|
||||
DIR* dir;
|
||||
DIR* dir;
|
||||
struct stat s;
|
||||
rt_uint32_t index;
|
||||
struct dirent* dirent;
|
||||
|
||||
view->items_count = 0;
|
||||
dir = opendir(directory);
|
||||
if (dir != RT_NULL)
|
||||
{
|
||||
struct dfs_dirent* dirent;
|
||||
struct dfs_stat s;
|
||||
if (dir == RT_NULL) goto __return;
|
||||
|
||||
do
|
||||
{
|
||||
dirent = readdir(dir);
|
||||
if (dirent == RT_NULL) break;
|
||||
if (fnmatch(dirent->d_name, view->pattern, FNM_FILE_NAME) != 0) continue;
|
||||
/* current directory exists, set it */
|
||||
if (view->current_directory != RT_NULL) rt_free(view->current_directory);
|
||||
view->current_directory = rt_strdup(directory);
|
||||
|
||||
item = (struct file_item*) rt_malloc (sizeof(struct file_item));
|
||||
if (item == RT_NULL) break;
|
||||
do
|
||||
{
|
||||
dirent = readdir(dir);
|
||||
if (dirent == RT_NULL) break;
|
||||
|
||||
rt_memset(&s, 0, sizeof(struct dfs_stat));
|
||||
if (strcmp(dirent->d_name, ".") == 0) continue;
|
||||
if (strcmp(dirent->d_name, "..") == 0) continue;
|
||||
|
||||
/* build full path for the file */
|
||||
rt_sprintf(fullpath, "%s/%s", directory, dirent->d_name);
|
||||
view->items_count ++;
|
||||
} while (dirent != RT_NULL);
|
||||
closedir(dir);
|
||||
|
||||
item->name = strdup(direct->d_name);
|
||||
rtgui_list_init(&item->list);
|
||||
stat(fullpath, &s);
|
||||
if ( s.st_mode & DFS_S_IFDIR )
|
||||
{
|
||||
item->type = FITEM_DIR;
|
||||
item->size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->type = FITEM_FILE;
|
||||
item->size = s.st_size;
|
||||
}
|
||||
view->items_count ++; /* root directory for [x] exit, others for .. */
|
||||
|
||||
rtgui_list_append(&view->list, &item->list);
|
||||
view->count ++;
|
||||
} while (dirent != RT_NULL);
|
||||
view->items = (struct file_item*) rtgui_malloc(sizeof(struct file_item) * view->items_count);
|
||||
if (view->items == RT_NULL) return; /* no memory */
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
index = 0;
|
||||
if (directory[0] == '/' && directory[1] != '\0')
|
||||
{
|
||||
item = &(view->items[0]);
|
||||
|
||||
/* add .. directory */
|
||||
item->name = rt_strdup("..");
|
||||
item->type = FITEM_DIR;
|
||||
item->size = 0;
|
||||
|
||||
index ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = &(view->items[0]);
|
||||
|
||||
/* add .. directory */
|
||||
item->name = rt_strdup("Í˳öÎļþä¯ÀÀ");
|
||||
item->type = FITEM_DIR;
|
||||
item->size = 0;
|
||||
|
||||
index ++;
|
||||
}
|
||||
|
||||
/* reopen directory */
|
||||
dir = opendir(directory);
|
||||
for (; index < view->items_count; index ++)
|
||||
{
|
||||
dirent = readdir(dir);
|
||||
if (dirent == RT_NULL) break;
|
||||
|
||||
item = &(view->items[index]);
|
||||
item->name = rt_strdup(dirent->d_name);
|
||||
|
||||
rt_memset(&s, 0, sizeof(struct stat));
|
||||
|
||||
/* build full path for the file */
|
||||
if (directory[strlen(directory) - 1] != PATH_SEPARATOR)
|
||||
sprintf(fullpath, "%s%c%s", directory, PATH_SEPARATOR, dirent->d_name);
|
||||
else
|
||||
sprintf(fullpath, "%s%s", directory, dirent->d_name);
|
||||
|
||||
stat(fullpath, &s);
|
||||
if ( s.st_mode & S_IFDIR )
|
||||
{
|
||||
item->type = FITEM_DIR;
|
||||
item->size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->type = FITEM_FILE;
|
||||
item->size = s.st_size;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
if (view->count > 0)
|
||||
{
|
||||
/* select first one */
|
||||
view->selected = rtgui_list_entry(view->list.next,
|
||||
struct file_item, list);
|
||||
}
|
||||
else view->selected = RT_NULL;
|
||||
view->current_item = 0;
|
||||
|
||||
__return:
|
||||
/* update view */
|
||||
rtgui_widget_update(RTGUI_WIDGET(view));
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
#ifndef __FILE_LIST_VIEW_H__
|
||||
#define __FILE_LIST_VIEW_H__
|
||||
|
||||
#include <rtgui/widgets/view.h>
|
||||
|
||||
#define FITEM_FILE 0x0
|
||||
#define FITEM_DIR 0x1
|
||||
struct file_item
|
||||
{
|
||||
char* name;
|
||||
rt_uint8_t* name;
|
||||
|
||||
rt_uint32_t type;
|
||||
rt_uint32_t size;
|
||||
|
||||
/* files under same directory */
|
||||
rtgui_list_t list;
|
||||
};
|
||||
|
||||
/** Gets the type of a filelist view */
|
||||
|
@ -27,22 +26,30 @@ struct filelist_view
|
|||
|
||||
/* widget private data */
|
||||
|
||||
/* total number of items */
|
||||
rt_uint32_t count;
|
||||
|
||||
/* the selected item */
|
||||
struct file_item* selected;
|
||||
|
||||
/* current directory */
|
||||
rt_uint8_t* current_directory;
|
||||
rt_uint8_t* pattern;
|
||||
|
||||
/* the number of item in a page */
|
||||
rt_uint16_t page_items;
|
||||
rt_uint16_t items_count;
|
||||
|
||||
/* item_list */
|
||||
rtgui_list_t item_list;
|
||||
/* the selected item */
|
||||
rt_uint16_t current_item;
|
||||
|
||||
/* items array */
|
||||
struct file_item *items;
|
||||
};
|
||||
typedef struct filelist_view filelist_view_t;
|
||||
|
||||
rtgui_type_t *filelist_view_type_get(void);
|
||||
|
||||
filelist_view_t* filelist_view_create(rtgui_workbench_t* workbench, const char* directory, const char* pattern, const rtgui_rect_t* rect);
|
||||
void filelist_view_destroy(filelist_view_t* view);
|
||||
|
||||
void filelist_view_clear(filelist_view_t* view);
|
||||
|
||||
rt_bool_t filelist_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
|
||||
void filelist_view_set_directory(filelist_view_t* view, const char* directory);
|
||||
|
||||
#endif
|
|
@ -1,139 +0,0 @@
|
|||
#include <ctype.h>
|
||||
#include <fnmatch.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NOTFIRST 128
|
||||
|
||||
#define STRUCT_CHARCLASS(c) { #c , is##c }
|
||||
|
||||
static struct charclass {
|
||||
char * class;
|
||||
int (*istype)(int);
|
||||
} allclasses[] = {
|
||||
STRUCT_CHARCLASS(alnum),
|
||||
STRUCT_CHARCLASS(alpha),
|
||||
STRUCT_CHARCLASS(blank),
|
||||
STRUCT_CHARCLASS(cntrl),
|
||||
STRUCT_CHARCLASS(digit),
|
||||
STRUCT_CHARCLASS(graph),
|
||||
STRUCT_CHARCLASS(lower),
|
||||
STRUCT_CHARCLASS(print),
|
||||
STRUCT_CHARCLASS(punct),
|
||||
STRUCT_CHARCLASS(space),
|
||||
STRUCT_CHARCLASS(upper),
|
||||
STRUCT_CHARCLASS(xdigit),
|
||||
};
|
||||
|
||||
/* look for "class:]" in pattern */
|
||||
static struct charclass *charclass_lookup(const char *pattern) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i< sizeof(allclasses)/sizeof(*allclasses); i++) {
|
||||
int len = strlen(allclasses[i].class);
|
||||
if (!strncmp(pattern, allclasses[i].class, len)) {
|
||||
pattern += len;
|
||||
if (strncmp(pattern, ":]", 2)) goto noclass;
|
||||
return &allclasses[i];
|
||||
}
|
||||
}
|
||||
noclass:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int match(char c,char d,int flags) {
|
||||
if (flags&FNM_CASEFOLD)
|
||||
return (tolower(c)==tolower(d));
|
||||
else
|
||||
return (c==d);
|
||||
}
|
||||
|
||||
int fnmatch(const char *pattern, const char *string, int flags) {
|
||||
if (*string==0) {
|
||||
while (*pattern=='*') ++pattern;
|
||||
return (!!*pattern);
|
||||
}
|
||||
if (*string=='.' && *pattern!='.' && (flags&FNM_PERIOD)) {
|
||||
/* don't match if FNM_PERIOD and this is the first char */
|
||||
if (!(flags&NOTFIRST))
|
||||
return FNM_NOMATCH;
|
||||
/* don't match if FNM_PERIOD and FNM_PATHNAME and previous was '/' */
|
||||
if ((flags&(FNM_PATHNAME)) && string[-1]=='/')
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
flags|=NOTFIRST;
|
||||
switch (*pattern) {
|
||||
case '[':
|
||||
{
|
||||
int neg=0;
|
||||
const char* start; /* first member of character class */
|
||||
|
||||
++pattern;
|
||||
if (*string=='/' && flags&FNM_PATHNAME) return FNM_NOMATCH;
|
||||
if (*pattern=='!') { neg=1; ++pattern; }
|
||||
start=pattern;
|
||||
while (*pattern) {
|
||||
int res=0;
|
||||
|
||||
if (*pattern==']' && pattern!=start) break;
|
||||
if (*pattern=='[' && pattern[1]==':') {
|
||||
/* MEMBER - stupid POSIX char classes */
|
||||
const struct charclass *cc;
|
||||
|
||||
if (!(cc = charclass_lookup(pattern+2))) goto invalidclass;
|
||||
pattern += strlen(cc->class) + 4;
|
||||
if (flags&FNM_CASEFOLD
|
||||
&& (cc->istype == isupper || cc->istype == islower)) {
|
||||
res = islower(tolower(*string));
|
||||
} else {
|
||||
res = ((*(cc->istype))(*string));
|
||||
}
|
||||
} else {
|
||||
invalidclass:
|
||||
if (pattern[1]=='-' && pattern[2]!=']') {
|
||||
/* MEMBER - character range */
|
||||
if (*string>=*pattern && *string<=pattern[2]) res=1;
|
||||
if (flags&FNM_CASEFOLD) {
|
||||
if (tolower(*string)>=tolower(*pattern) && tolower(*string)<=tolower(pattern[2])) res=1;
|
||||
}
|
||||
pattern+=3;
|
||||
} else {
|
||||
/* MEMBER - literal character match */
|
||||
res=match(*pattern,*string,flags);
|
||||
++pattern;
|
||||
}
|
||||
}
|
||||
if ((res&&!neg) || ((neg&&!res) && *pattern==']')) {
|
||||
while (*pattern && *pattern!=']') ++pattern;
|
||||
return fnmatch(pattern+!!*pattern,string+1,flags);
|
||||
} else if (res && neg)
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '\\':
|
||||
if (flags&FNM_NOESCAPE) {
|
||||
if (*string=='\\')
|
||||
return fnmatch(pattern+1,string+1,flags);
|
||||
} else {
|
||||
if (*string==pattern[1])
|
||||
return fnmatch(pattern+2,string+1,flags);
|
||||
}
|
||||
break;
|
||||
case '*':
|
||||
if ((*string=='/' && flags&FNM_PATHNAME) || fnmatch(pattern,string+1,flags))
|
||||
return fnmatch(pattern+1,string,flags);
|
||||
return 0;
|
||||
case 0:
|
||||
if (*string==0 || (*string=='/' && (flags&FNM_LEADING_DIR)))
|
||||
return 0;
|
||||
break;
|
||||
case '?':
|
||||
if (*string=='/' && flags&FNM_PATHNAME) break;
|
||||
return fnmatch(pattern+1,string+1,flags);
|
||||
default:
|
||||
if (match(*pattern,*string,flags))
|
||||
return fnmatch(pattern+1,string+1,flags);
|
||||
break;
|
||||
}
|
||||
return FNM_NOMATCH;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef _FNMATCH_H
|
||||
#define _FNMATCH_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int fnmatch(const char *pattern, const char *string, int flags) __THROW;
|
||||
|
||||
#define FNM_NOESCAPE 1
|
||||
#define FNM_PATHNAME 2
|
||||
#define FNM_FILE_NAME 2
|
||||
#define FNM_PERIOD 4
|
||||
#define FNM_LEADING_DIR 8
|
||||
#define FNM_CASEFOLD 16
|
||||
|
||||
#define FNM_NOMATCH 1
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#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;
|
||||
|
@ -23,6 +24,18 @@ static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_ev
|
|||
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)
|
||||
{
|
||||
|
@ -48,7 +61,7 @@ static void info_entry(void* parameter)
|
|||
rtgui_thread_register(rt_thread_self(), mq);
|
||||
|
||||
network_image = rtgui_image_create_from_mem("xpm",
|
||||
network_xpm, sizeof(network_xpm));
|
||||
(rt_uint8_t*)network_xpm, sizeof(network_xpm));
|
||||
workbench = rtgui_workbench_create("info", "workbench");
|
||||
if (workbench == RT_NULL) return;
|
||||
|
||||
|
@ -57,7 +70,7 @@ static void info_entry(void* parameter)
|
|||
|
||||
rtgui_workbench_add_view(workbench, view);
|
||||
|
||||
rtgui_view_show(view);
|
||||
rtgui_view_show(view, RT_FALSE);
|
||||
|
||||
rtgui_workbench_event_loop(workbench);
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ static void key_thread_entry(void *parameter)
|
|||
while (1)
|
||||
{
|
||||
next_delay = 20;
|
||||
kbd_event.key = RTGUIK_UNKNOWN;
|
||||
|
||||
kbd_event.type = RTGUI_KEYDOWN;
|
||||
if ( key_enter_GETVALUE() == 0 )
|
||||
{
|
||||
|
@ -58,6 +60,7 @@ static void key_thread_entry(void *parameter)
|
|||
kbd_event.key = RTGUIK_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
if ( key_down_GETVALUE() == 0 )
|
||||
{
|
||||
rt_kprintf("key_down\n");
|
||||
|
@ -81,15 +84,23 @@ static void key_thread_entry(void *parameter)
|
|||
rt_kprintf("key_left\n");
|
||||
kbd_event.key = RTGUIK_LEFT;
|
||||
}
|
||||
/* post down event */
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
|
||||
if (kbd_event.key != RTGUIK_UNKNOWN)
|
||||
{
|
||||
/* post down event */
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
|
||||
next_delay = 10;
|
||||
/* delay to post up event */
|
||||
rt_thread_delay(next_delay);
|
||||
|
||||
/* post up event */
|
||||
kbd_event.type = RTGUI_KEYUP;
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
}
|
||||
|
||||
/* wait next key press */
|
||||
rt_thread_delay(next_delay);
|
||||
|
||||
/* post up event */
|
||||
kbd_event.type = RTGUI_KEYUP;
|
||||
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "fmt0371/FMT0371.h"
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
void rt_hw_lcd_update(rtgui_rect_t *rect);
|
||||
rt_uint8_t * rt_hw_lcd_get_framebuffer(void);
|
||||
|
@ -10,6 +12,7 @@ void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y);
|
|||
void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y);
|
||||
void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y);
|
||||
void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2);
|
||||
void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y);
|
||||
|
||||
struct rtgui_graphic_driver _rtgui_lcd_driver =
|
||||
{
|
||||
|
@ -22,7 +25,8 @@ struct rtgui_graphic_driver _rtgui_lcd_driver =
|
|||
rt_hw_lcd_set_pixel,
|
||||
rt_hw_lcd_get_pixel,
|
||||
rt_hw_lcd_draw_hline,
|
||||
rt_hw_lcd_draw_vline
|
||||
rt_hw_lcd_draw_vline,
|
||||
rt_hw_lcd_draw_raw_hline
|
||||
};
|
||||
|
||||
void rt_hw_lcd_update(rtgui_rect_t *rect)
|
||||
|
@ -123,6 +127,30 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t
|
|||
}
|
||||
}
|
||||
|
||||
void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y)
|
||||
{
|
||||
rt_uint16_t *ptr;
|
||||
|
||||
/* get pixel */
|
||||
ptr = (rt_uint16_t*) pixels;
|
||||
|
||||
/* set X point */
|
||||
LCD_ADDR = 0x02;
|
||||
LCD_DATA = x1;
|
||||
|
||||
/* set Y point */
|
||||
LCD_ADDR = 0x03;
|
||||
LCD_DATA16( y );
|
||||
|
||||
/* write pixel */
|
||||
LCD_ADDR = 0x0E;
|
||||
while (x1 < x2)
|
||||
{
|
||||
LCD_DATA16(*ptr);
|
||||
x1 ++; ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
rt_err_t rt_hw_lcd_init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
@ -145,6 +173,33 @@ rt_err_t rt_hw_lcd_init(void)
|
|||
return RT_EOK;
|
||||
}
|
||||
|
||||
void radio_rtgui_init()
|
||||
{
|
||||
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");
|
||||
|
||||
rt_hw_lcd_init();
|
||||
|
||||
info_init();
|
||||
player_init();
|
||||
}
|
||||
|
||||
#include <finsh.h>
|
||||
|
||||
void hline(rt_base_t x1, rt_base_t x2, rt_base_t y, rt_uint32_t pixel)
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
#include "listview.h"
|
||||
#include <rtgui/rtgui_theme.h>
|
||||
|
||||
#define LIST_MARGIN 5
|
||||
|
||||
static void _list_view_constructor(struct list_view *view)
|
||||
{
|
||||
/* default rect */
|
||||
struct rtgui_rect rect = {0, 0, 200, 200};
|
||||
|
||||
/* set default widget rect and set event handler */
|
||||
rtgui_widget_set_event_handler(RTGUI_WIDGET(view),list_view_event_handler);
|
||||
rtgui_widget_set_rect(RTGUI_WIDGET(view), &rect);
|
||||
|
||||
RTGUI_WIDGET(view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
|
||||
|
||||
view->current_item = 0;
|
||||
view->items_count = 0;
|
||||
view->page_items = 0;
|
||||
|
||||
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white;
|
||||
RTGUI_WIDGET_TEXTALIGN(RTGUI_WIDGET(view)) = RTGUI_ALIGN_CENTER_VERTICAL;
|
||||
}
|
||||
|
||||
rtgui_type_t *list_view_type_get(void)
|
||||
{
|
||||
static rtgui_type_t *list_view_type = RT_NULL;
|
||||
|
||||
if (!list_view_type)
|
||||
{
|
||||
list_view_type = rtgui_type_create("listview", RTGUI_VIEW_TYPE,
|
||||
sizeof(list_view_t), RTGUI_CONSTRUCTOR(_list_view_constructor), RT_NULL);
|
||||
}
|
||||
|
||||
return list_view_type;
|
||||
}
|
||||
|
||||
void list_view_ondraw(struct list_view* view)
|
||||
{
|
||||
struct rtgui_rect rect, item_rect;
|
||||
struct rtgui_dc* dc;
|
||||
rt_uint16_t page_index, index;
|
||||
struct list_item* item;
|
||||
|
||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(view));
|
||||
if (dc == RT_NULL) return;
|
||||
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
rtgui_dc_fill_rect(dc, &rect);
|
||||
|
||||
/* get item base rect */
|
||||
item_rect = rect;
|
||||
item_rect.y1 += 2;
|
||||
item_rect.y2 = item_rect.y1 + (2 + rtgui_theme_get_selected_height());
|
||||
|
||||
/* get current page */
|
||||
page_index = (view->current_item / view->page_items) * view->page_items;
|
||||
for (index = 0; index < view->page_items; index ++)
|
||||
{
|
||||
if (page_index + index >= view->items_count) break;
|
||||
|
||||
item = &(view->items[page_index + index]);
|
||||
|
||||
if (page_index + index == view->current_item)
|
||||
{
|
||||
rtgui_theme_draw_selected(dc, &item_rect);
|
||||
}
|
||||
item_rect.x1 += LIST_MARGIN;
|
||||
|
||||
if (item->image != RT_NULL)
|
||||
{
|
||||
rtgui_image_blit(item->image, dc, &item_rect);
|
||||
item_rect.x1 += item->image->w + 2;
|
||||
}
|
||||
/* draw text */
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
|
||||
if (item->image != RT_NULL)
|
||||
item_rect.x1 -= (item->image->w + 2);
|
||||
item_rect.x1 -= LIST_MARGIN;
|
||||
|
||||
/* move to next item position */
|
||||
item_rect.y1 += (rtgui_theme_get_selected_height() + 2);
|
||||
item_rect.y2 += (rtgui_theme_get_selected_height() + 2);
|
||||
}
|
||||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
|
||||
void list_view_update_current(struct list_view* view, rt_uint16_t old_item)
|
||||
{
|
||||
struct rtgui_dc* dc;
|
||||
struct list_item* item;
|
||||
rtgui_rect_t rect, item_rect;
|
||||
|
||||
if (old_item/view->page_items != view->current_item/view->page_items)
|
||||
{
|
||||
/* it's not a same page, update all */
|
||||
rtgui_widget_update(RTGUI_WIDGET(view));
|
||||
return;
|
||||
}
|
||||
|
||||
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(view));
|
||||
if (dc == RT_NULL) return;
|
||||
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
|
||||
|
||||
item_rect = rect;
|
||||
/* get old item's rect */
|
||||
item_rect.y1 += 2;
|
||||
item_rect.y1 += (old_item % view->page_items) * (2 + rtgui_theme_get_selected_height());
|
||||
item_rect.y2 = item_rect.y1 + (2 + rtgui_theme_get_selected_height());
|
||||
|
||||
/* draw old item */
|
||||
rtgui_dc_fill_rect(dc, &item_rect);
|
||||
|
||||
item_rect.x1 += LIST_MARGIN;
|
||||
|
||||
item = &(view->items[old_item]);
|
||||
if (item->image != RT_NULL)
|
||||
{
|
||||
rtgui_image_blit(item->image, dc, &item_rect);
|
||||
item_rect.x1 += item->image->w + 2;
|
||||
}
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
|
||||
/* draw current item */
|
||||
item_rect = rect;
|
||||
/* get current item's rect */
|
||||
item_rect.y1 += 2;
|
||||
item_rect.y1 += (view->current_item % view->page_items) * (2 + rtgui_theme_get_selected_height());
|
||||
item_rect.y2 = item_rect.y1 + (2 + rtgui_theme_get_selected_height());
|
||||
|
||||
/* draw current item */
|
||||
rtgui_theme_draw_selected(dc, &item_rect);
|
||||
|
||||
item_rect.x1 += LIST_MARGIN;
|
||||
|
||||
item = &(view->items[view->current_item]);
|
||||
if (item->image != RT_NULL)
|
||||
{
|
||||
rtgui_image_blit(item->image, dc, &item_rect);
|
||||
item_rect.x1 += (item->image->w + 2);
|
||||
}
|
||||
rtgui_dc_draw_text(dc, item->name, &item_rect);
|
||||
|
||||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
|
||||
rt_bool_t list_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
|
||||
{
|
||||
struct list_view* view = RT_NULL;
|
||||
|
||||
view = LIST_VIEW(widget);
|
||||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_PAINT:
|
||||
list_view_ondraw(view);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUI_EVENT_RESIZE:
|
||||
{
|
||||
struct rtgui_event_resize* resize;
|
||||
|
||||
resize = (struct rtgui_event_resize*)event;
|
||||
|
||||
/* recalculate page items */
|
||||
view->page_items = resize->h / (2 + rtgui_theme_get_selected_height());
|
||||
}
|
||||
break;
|
||||
|
||||
case RTGUI_EVENT_KBD:
|
||||
{
|
||||
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
||||
if (ekbd->type == RTGUI_KEYDOWN)
|
||||
{
|
||||
rt_uint16_t old_item;
|
||||
|
||||
old_item = view->current_item;
|
||||
switch (ekbd->key)
|
||||
{
|
||||
case RTGUIK_LEFT:
|
||||
if (view->current_item - view->page_items >= 0)
|
||||
view->current_item -= view->page_items;
|
||||
list_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_UP:
|
||||
if (view->current_item > 0)
|
||||
view->current_item --;
|
||||
list_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_RIGHT:
|
||||
if (view->current_item + view->page_items < view->items_count - 1)
|
||||
view->current_item += view->page_items;
|
||||
list_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_DOWN:
|
||||
if (view->current_item < view->items_count - 1)
|
||||
view->current_item ++;
|
||||
list_view_update_current(view, old_item);
|
||||
return RT_FALSE;
|
||||
|
||||
case RTGUIK_RETURN:
|
||||
if (view->items[view->current_item].action != RT_NULL)
|
||||
{
|
||||
view->items[view->current_item].action(view->items[view->current_item].parameter);
|
||||
}
|
||||
return RT_FALSE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
/* use view event handler */
|
||||
return rtgui_view_event_handler(widget, event);
|
||||
}
|
||||
|
||||
list_view_t* list_view_create(struct list_item* items, rt_uint16_t count, rtgui_rect_t *rect)
|
||||
{
|
||||
struct list_view* view = RT_NULL;
|
||||
|
||||
view = (struct list_view*) rtgui_widget_create(LIST_VIEW_TYPE);
|
||||
if (view != RT_NULL)
|
||||
{
|
||||
view->items = items;
|
||||
view->items_count = count;
|
||||
|
||||
view->page_items = rtgui_rect_height(*rect) / (2 + rtgui_theme_get_selected_height());
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
void list_view_destroy(list_view_t* view)
|
||||
{
|
||||
/* destroy view */
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(view));
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef __RTGUI_LIST_VIEW_H__
|
||||
#define __RTGUI_LIST_VIEW_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/image.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#include <rtgui/widgets/view.h>
|
||||
|
||||
typedef void (*item_action)(void* parameter);
|
||||
struct list_item
|
||||
{
|
||||
char* name;
|
||||
rtgui_image_t *image;
|
||||
|
||||
item_action action;
|
||||
void *parameter;
|
||||
};
|
||||
|
||||
/** Gets the type of a list view */
|
||||
#define LIST_VIEW_TYPE (list_view_type_get())
|
||||
/** Casts the object to a filelist */
|
||||
#define LIST_VIEW(obj) (RTGUI_OBJECT_CAST((obj), LIST_VIEW_TYPE, list_view_t))
|
||||
/** Checks if the object is a filelist view */
|
||||
#define IS_LIST_VIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), LIST_VIEW_TYPE))
|
||||
|
||||
struct list_view
|
||||
{
|
||||
struct rtgui_view parent;
|
||||
|
||||
/* widget private data */
|
||||
/* list item */
|
||||
struct list_item* items;
|
||||
|
||||
/* total number of items */
|
||||
rt_uint16_t items_count;
|
||||
/* the number of item in a page */
|
||||
rt_uint16_t page_items;
|
||||
/* current item */
|
||||
rt_uint16_t current_item;
|
||||
};
|
||||
typedef struct list_view list_view_t;
|
||||
|
||||
rtgui_type_t *list_view_type_get(void);
|
||||
|
||||
list_view_t* list_view_create(struct list_item* items, rt_uint16_t count,
|
||||
rtgui_rect_t *rect);
|
||||
void list_view_clear(list_view_t* view);
|
||||
|
||||
rt_bool_t list_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/image.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#include <rtgui/widgets/view.h>
|
||||
#include <rtgui/widgets/workbench.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "listview.h"
|
||||
|
||||
static rtgui_image_t *background = RT_NULL;
|
||||
|
||||
static struct rtgui_view* function_view;
|
||||
static struct rtgui_view* home_view;
|
||||
static struct rtgui_workbench* workbench;
|
||||
|
||||
void function_filelist(void* parameter)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rtgui_view_t *view;
|
||||
extern rtgui_view_t* filelist_view_create(rtgui_workbench_t* workbench,
|
||||
const char* directory, const char* pattern, rtgui_rect_t* rect);
|
||||
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
||||
view = (rtgui_view_t*)filelist_view_create(workbench, "/", "*.*", &rect);
|
||||
if (view != RT_NULL)
|
||||
{
|
||||
rtgui_view_show(view, RT_FALSE);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void function_device(void* parameter)
|
||||
{
|
||||
rtgui_view_t *view;
|
||||
extern rtgui_view_t* device_view_create(rtgui_workbench_t* workbench);
|
||||
|
||||
view = device_view_create(workbench);
|
||||
if (view != RT_NULL)
|
||||
{
|
||||
rtgui_view_show(view, RT_FALSE);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void function_player(void* parameter)
|
||||
{
|
||||
rtgui_view_show(home_view, RT_FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
void function_action(void* parameter)
|
||||
{
|
||||
rt_kprintf("item action!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
struct list_item function_list[] =
|
||||
{
|
||||
{"选择电台", RT_NULL, function_action, RT_NULL},
|
||||
{"更新电台", RT_NULL, function_action, RT_NULL},
|
||||
{"播放文件", RT_NULL, function_filelist, RT_NULL},
|
||||
{"设备信息", RT_NULL, function_device, RT_NULL},
|
||||
{"返回播放器", RT_NULL, function_player, RT_NULL},
|
||||
};
|
||||
|
||||
static rt_bool_t home_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);
|
||||
|
||||
/* draw background */
|
||||
background = rtgui_image_create_from_file("hdc",
|
||||
"/resource/bg.hdc", RT_FALSE);
|
||||
if (background != RT_NULL)
|
||||
{
|
||||
rtgui_image_blit(background, dc, &rect);
|
||||
rtgui_image_destroy(background);
|
||||
|
||||
background = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtgui_dc_fill_rect(dc, &rect);
|
||||
}
|
||||
rtgui_dc_end_drawing(dc);
|
||||
|
||||
return RT_FALSE;
|
||||
}
|
||||
else if (event->type == RTGUI_EVENT_KBD)
|
||||
{
|
||||
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
||||
if (ekbd->type == RTGUI_KEYDOWN)
|
||||
{
|
||||
switch (ekbd->key)
|
||||
{
|
||||
case RTGUIK_RIGHT:
|
||||
case RTGUIK_LEFT:
|
||||
break;
|
||||
|
||||
case RTGUIK_DOWN:
|
||||
rtgui_view_show(function_view, RT_FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
return rtgui_view_event_handler(widget, event);
|
||||
}
|
||||
|
||||
rt_bool_t today_workbench_event_handler(rtgui_widget_t *widget, rtgui_event_t *event)
|
||||
{
|
||||
if (event->type == RTGUI_EVENT_KBD)
|
||||
{
|
||||
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*)event;
|
||||
if ((ekbd->type == RTGUI_KEYUP) && ekbd->key == RTGUIK_HOME)
|
||||
{
|
||||
/* active home view */
|
||||
if (workbench->current_view != home_view)
|
||||
{
|
||||
rtgui_view_show(home_view, RT_FALSE);
|
||||
return RT_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rtgui_workbench_event_handler(widget, event);
|
||||
}
|
||||
|
||||
static void player_entry(void* parameter)
|
||||
{
|
||||
rt_mq_t mq;
|
||||
rtgui_rect_t rect;
|
||||
|
||||
mq = rt_mq_create("qPlayer", 256, 4, RT_IPC_FLAG_FIFO);
|
||||
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), today_workbench_event_handler);
|
||||
|
||||
/* add home view */
|
||||
home_view = rtgui_view_create("Home");
|
||||
rtgui_widget_set_event_handler(RTGUI_WIDGET(home_view), home_view_event_handler);
|
||||
|
||||
rtgui_workbench_add_view(workbench, home_view);
|
||||
/* this view can be focused */
|
||||
RTGUI_WIDGET(home_view)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
|
||||
/* set widget focus */
|
||||
rtgui_widget_focus(RTGUI_WIDGET(home_view));
|
||||
|
||||
rtgui_view_show(home_view, RT_FALSE);
|
||||
|
||||
/* add function view */
|
||||
rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect);
|
||||
function_view = (struct rtgui_view*)list_view_create(function_list,
|
||||
sizeof(function_list)/sizeof(struct list_item),
|
||||
&rect);
|
||||
rtgui_workbench_add_view(workbench, function_view);
|
||||
|
||||
rtgui_workbench_event_loop(workbench);
|
||||
|
||||
rtgui_thread_deregister(rt_thread_self());
|
||||
rt_mq_delete(mq);
|
||||
}
|
||||
|
||||
void player_init()
|
||||
{
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("player",
|
||||
player_entry, RT_NULL,
|
||||
2048, 25, 10);
|
||||
|
||||
if (tid != RT_NULL) rt_thread_startup(tid);
|
||||
}
|
|
@ -20,13 +20,13 @@ GRPOPT 6,(finsh),0,0,0
|
|||
GRPOPT 7,(Filesystem),0,0,0
|
||||
GRPOPT 8,(LwIP),0,0,0
|
||||
GRPOPT 9,(mp3),0,0,0
|
||||
GRPOPT 10,(RTGUI),1,0,0
|
||||
GRPOPT 10,(RTGUI),0,0,0
|
||||
|
||||
OPTFFF 1,1,5,0,0,0,0,0,<.\rtconfig.h><rtconfig.h>
|
||||
OPTFFF 1,2,5,0,0,0,0,0,<.\board.h><board.h>
|
||||
OPTFFF 1,3,5,0,0,0,0,0,<.\stm32f10x_conf.h><stm32f10x_conf.h>
|
||||
OPTFFF 1,4,1,0,0,0,0,0,<.\application.c><application.c>
|
||||
OPTFFF 1,5,1,83886080,0,0,0,0,<.\board.c><board.c>
|
||||
OPTFFF 1,5,1,0,0,0,0,0,<.\board.c><board.c>
|
||||
OPTFFF 1,6,1,335544320,0,0,0,0,<.\startup.c><startup.c>
|
||||
OPTFFF 1,7,1,0,0,0,0,0,<.\stm32f10x_it.c><stm32f10x_it.c>
|
||||
OPTFFF 1,8,1,0,0,0,0,0,<.\usart.c><usart.c>
|
||||
|
@ -34,7 +34,7 @@ OPTFFF 1,9,1,0,0,0,0,0,<.\sdcard.c><sdcard.c>
|
|||
OPTFFF 1,10,1,0,0,0,0,0,<.\rtc.c><rtc.c>
|
||||
OPTFFF 1,11,1,0,0,0,0,0,<.\wm8753.c><wm8753.c>
|
||||
OPTFFF 1,12,1,0,0,0,0,0,<.\dm9000.c><dm9000.c>
|
||||
OPTFFF 1,13,1,0,0,0,0,0,<.\fsmc_nand.c><fsmc_nand.c>
|
||||
OPTFFF 1,13,1,889192448,0,0,0,0,<.\fsmc_nand.c><fsmc_nand.c>
|
||||
OPTFFF 1,14,1,0,0,0,0,0,<.\fsmc_sram.c><fsmc_sram.c>
|
||||
OPTFFF 1,15,1,0,0,0,0,0,<.\fmt0371\fmt0371.c><fmt0371.c>
|
||||
OPTFFF 1,16,1,0,0,0,0,0,<.\http.c><http.c>
|
||||
|
@ -42,170 +42,175 @@ OPTFFF 1,17,1,0,0,0,0,0,<.\lcd.c><lcd.c>
|
|||
OPTFFF 1,18,1,620756992,0,0,0,0,<.\mp3.c><mp3.c>
|
||||
OPTFFF 1,19,1,369098752,0,0,0,0,<.\wav.c><wav.c>
|
||||
OPTFFF 1,20,1,620756992,0,0,0,0,<.\netbuffer.c><netbuffer.c>
|
||||
OPTFFF 1,21,1,33554432,0,0,0,0,<.\gui.c><gui.c>
|
||||
OPTFFF 1,22,1,0,0,0,0,0,<.\key.c><key.c>
|
||||
OPTFFF 1,23,1,0,0,0,0,0,<.\info.c><info.c>
|
||||
OPTFFF 1,24,1,0,0,0,0,0,<.\today.c><today.c>
|
||||
OPTFFF 2,25,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
|
||||
OPTFFF 2,26,1,0,0,0,0,0,<..\..\src\idle.c><idle.c>
|
||||
OPTFFF 2,27,1,671088640,0,0,0,0,<..\..\src\ipc.c><ipc.c>
|
||||
OPTFFF 2,28,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c>
|
||||
OPTFFF 2,29,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
|
||||
OPTFFF 2,30,1,0,0,0,0,0,<..\..\src\object.c><object.c>
|
||||
OPTFFF 2,31,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c>
|
||||
OPTFFF 2,32,1,285212672,0,0,0,0,<..\..\src\thread.c><thread.c>
|
||||
OPTFFF 2,33,1,0,0,0,0,0,<..\..\src\timer.c><timer.c>
|
||||
OPTFFF 2,34,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
|
||||
OPTFFF 2,35,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c>
|
||||
OPTFFF 2,36,1,0,0,0,0,0,<..\..\src\device.c><device.c>
|
||||
OPTFFF 2,37,1,0,0,0,0,0,<..\..\src\slab.c><slab.c>
|
||||
OPTFFF 3,38,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\stack.c><stack.c>
|
||||
OPTFFF 3,39,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\interrupt.c><interrupt.c>
|
||||
OPTFFF 3,40,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\cpu.c><cpu.c>
|
||||
OPTFFF 3,41,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\serial.c><serial.c>
|
||||
OPTFFF 3,42,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\context_rvds.S><context_rvds.S>
|
||||
OPTFFF 3,43,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\start_rvds.s><start_rvds.s>
|
||||
OPTFFF 3,44,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\fault.c><fault.c>
|
||||
OPTFFF 3,45,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
|
||||
OPTFFF 4,46,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
|
||||
OPTFFF 4,47,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
|
||||
OPTFFF 4,48,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
|
||||
OPTFFF 4,49,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c><stm32f10x_can.c>
|
||||
OPTFFF 4,50,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c><stm32f10x_crc.c>
|
||||
OPTFFF 4,51,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c><stm32f10x_dac.c>
|
||||
OPTFFF 4,52,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
|
||||
OPTFFF 4,53,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c><stm32f10x_dma.c>
|
||||
OPTFFF 4,54,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c><stm32f10x_exti.c>
|
||||
OPTFFF 4,55,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c><stm32f10x_flash.c>
|
||||
OPTFFF 4,56,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c><stm32f10x_fsmc.c>
|
||||
OPTFFF 4,57,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
|
||||
OPTFFF 4,58,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
|
||||
OPTFFF 4,59,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
|
||||
OPTFFF 4,60,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
|
||||
OPTFFF 4,61,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
|
||||
OPTFFF 4,62,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
|
||||
OPTFFF 4,63,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c><stm32f10x_sdio.c>
|
||||
OPTFFF 4,64,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c><stm32f10x_spi.c>
|
||||
OPTFFF 4,65,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c><stm32f10x_tim.c>
|
||||
OPTFFF 4,66,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c><stm32f10x_usart.c>
|
||||
OPTFFF 4,67,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
|
||||
OPTFFF 5,68,1,0,0,0,0,0,<.\Libraries\CMSIS\Core\CM3\core_cm3.c><core_cm3.c>
|
||||
OPTFFF 5,69,1,0,0,0,0,0,<.\Libraries\CMSIS\Core\CM3\system_stm32f10x.c><system_stm32f10x.c>
|
||||
OPTFFF 6,70,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
|
||||
OPTFFF 6,71,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c>
|
||||
OPTFFF 6,72,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c>
|
||||
OPTFFF 6,73,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c>
|
||||
OPTFFF 6,74,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c>
|
||||
OPTFFF 6,75,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c>
|
||||
OPTFFF 6,76,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c>
|
||||
OPTFFF 6,77,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c>
|
||||
OPTFFF 6,78,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c>
|
||||
OPTFFF 6,79,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c>
|
||||
OPTFFF 6,80,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c>
|
||||
OPTFFF 6,81,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c>
|
||||
OPTFFF 6,82,1,285212672,0,0,0,0,<..\..\finsh\cmd.c><cmd.c>
|
||||
OPTFFF 7,83,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
|
||||
OPTFFF 7,84,1,503316480,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
|
||||
OPTFFF 7,85,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
|
||||
OPTFFF 7,86,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
|
||||
OPTFFF 7,87,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
|
||||
OPTFFF 7,88,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
|
||||
OPTFFF 7,89,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
|
||||
OPTFFF 7,90,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
|
||||
OPTFFF 7,91,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
|
||||
OPTFFF 7,92,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
|
||||
OPTFFF 7,93,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
|
||||
OPTFFF 7,94,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
|
||||
OPTFFF 7,95,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
|
||||
OPTFFF 7,96,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
|
||||
OPTFFF 7,97,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
|
||||
OPTFFF 7,98,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
|
||||
OPTFFF 7,99,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
|
||||
OPTFFF 8,100,1,0,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
|
||||
OPTFFF 8,101,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c><dns.c>
|
||||
OPTFFF 8,102,1,0,0,0,0,0,<..\..\net\lwip\src\core\init.c><init.c>
|
||||
OPTFFF 8,103,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c><netif.c>
|
||||
OPTFFF 8,104,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c><pbuf.c>
|
||||
OPTFFF 8,105,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c><raw.c>
|
||||
OPTFFF 8,106,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c><stats.c>
|
||||
OPTFFF 8,107,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c><sys.c>
|
||||
OPTFFF 8,108,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp.c><tcp.c>
|
||||
OPTFFF 8,109,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c>
|
||||
OPTFFF 8,110,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c>
|
||||
OPTFFF 8,111,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c><udp.c>
|
||||
OPTFFF 8,112,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c>
|
||||
OPTFFF 8,113,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c>
|
||||
OPTFFF 8,114,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c>
|
||||
OPTFFF 8,115,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c>
|
||||
OPTFFF 8,116,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
|
||||
OPTFFF 8,117,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c>
|
||||
OPTFFF 8,118,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
|
||||
OPTFFF 8,119,1,285212672,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
|
||||
OPTFFF 8,120,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_in.c><msg_in.c>
|
||||
OPTFFF 8,121,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_out.c><msg_out.c>
|
||||
OPTFFF 8,122,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c><api_lib.c>
|
||||
OPTFFF 8,123,1,50331648,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c><api_msg.c>
|
||||
OPTFFF 8,124,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c><err.c>
|
||||
OPTFFF 8,125,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c><netbuf.c>
|
||||
OPTFFF 8,126,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c><netdb.c>
|
||||
OPTFFF 8,127,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c><netifapi.c>
|
||||
OPTFFF 8,128,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c><tcpip.c>
|
||||
OPTFFF 8,129,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c><etharp.c>
|
||||
OPTFFF 8,130,1,150994944,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c>
|
||||
OPTFFF 8,131,1,0,0,0,0,0,<..\..\net\lwip\src\netif\loopif.c><loopif.c>
|
||||
OPTFFF 8,132,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
|
||||
OPTFFF 8,133,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
|
||||
OPTFFF 8,134,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
|
||||
OPTFFF 8,135,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
|
||||
OPTFFF 9,136,1,268435456,0,0,0,0,<.\mp3\mp3dec.c><mp3dec.c>
|
||||
OPTFFF 9,137,1,0,0,0,0,0,<.\mp3\mp3tabs.c><mp3tabs.c>
|
||||
OPTFFF 9,138,1,0,0,0,0,0,<.\mp3\real\bitstream.c><bitstream.c>
|
||||
OPTFFF 9,139,1,83886080,0,0,0,0,<.\mp3\real\buffers.c><buffers.c>
|
||||
OPTFFF 9,140,1,0,0,0,0,0,<.\mp3\real\dct32.c><dct32.c>
|
||||
OPTFFF 9,141,1,0,0,0,0,0,<.\mp3\real\dequant.c><dequant.c>
|
||||
OPTFFF 9,142,1,0,0,0,0,0,<.\mp3\real\dqchan.c><dqchan.c>
|
||||
OPTFFF 9,143,1,0,0,0,0,0,<.\mp3\real\huffman.c><huffman.c>
|
||||
OPTFFF 9,144,1,0,0,0,0,0,<.\mp3\real\hufftabs.c><hufftabs.c>
|
||||
OPTFFF 9,145,1,0,0,0,0,0,<.\mp3\real\imdct.c><imdct.c>
|
||||
OPTFFF 9,146,1,0,0,0,0,0,<.\mp3\real\scalfact.c><scalfact.c>
|
||||
OPTFFF 9,147,1,0,0,0,0,0,<.\mp3\real\stproc.c><stproc.c>
|
||||
OPTFFF 9,148,1,0,0,0,0,0,<.\mp3\real\subband.c><subband.c>
|
||||
OPTFFF 9,149,1,0,0,0,0,0,<.\mp3\real\trigtabs.c><trigtabs.c>
|
||||
OPTFFF 9,150,2,0,0,0,0,0,<.\mp3\real\arm\asmpoly_thumb2.s><asmpoly_thumb2.s>
|
||||
OPTFFF 9,151,2,0,0,0,0,0,<.\mp3\real\arm\asmmisc.s><asmmisc.s>
|
||||
OPTFFF 10,152,1,0,0,0,0,0,<..\..\rtgui\common\rtgui_object.c><rtgui_object.c>
|
||||
OPTFFF 10,153,1,385875968,0,0,0,0,<..\..\rtgui\common\rtgui_system.c><rtgui_system.c>
|
||||
OPTFFF 10,154,1,0,0,0,0,0,<..\..\rtgui\common\rtgui_theme.c><rtgui_theme.c>
|
||||
OPTFFF 10,155,1,0,0,0,0,0,<..\..\rtgui\common\asc12font.c><asc12font.c>
|
||||
OPTFFF 10,156,1,402653184,0,0,0,0,<..\..\rtgui\common\asc16font.c><asc16font.c>
|
||||
OPTFFF 10,157,1,0,0,0,0,0,<..\..\rtgui\common\color.c><color.c>
|
||||
OPTFFF 10,158,1,0,0,0,0,0,<..\..\rtgui\common\dc.c><dc.c>
|
||||
OPTFFF 10,159,1,0,0,0,0,0,<..\..\rtgui\common\dc_buffer.c><dc_buffer.c>
|
||||
OPTFFF 10,160,1,0,0,0,0,0,<..\..\rtgui\common\dc_hw.c><dc_hw.c>
|
||||
OPTFFF 10,161,1,16777216,0,0,0,0,<..\..\rtgui\common\filerw.c><filerw.c>
|
||||
OPTFFF 10,162,1,83886080,0,0,0,0,<..\..\rtgui\common\font.c><font.c>
|
||||
OPTFFF 10,163,1,469762048,0,0,0,0,<..\..\rtgui\common\image.c><image.c>
|
||||
OPTFFF 10,164,1,0,0,0,0,0,<..\..\rtgui\common\image_xpm.c><image_xpm.c>
|
||||
OPTFFF 10,165,1,0,0,0,0,0,<..\..\rtgui\common\image_hdc.c><image_hdc.c>
|
||||
OPTFFF 10,166,1,0,0,0,0,0,<..\..\rtgui\common\region.c><region.c>
|
||||
OPTFFF 10,167,1,0,0,0,0,0,<..\..\rtgui\server\server.c><server.c>
|
||||
OPTFFF 10,168,1,0,0,0,0,0,<..\..\rtgui\server\driver.c><driver.c>
|
||||
OPTFFF 10,169,1,335544320,0,0,0,0,<..\..\rtgui\server\panel.c><panel.c>
|
||||
OPTFFF 10,170,1,0,0,0,0,0,<..\..\rtgui\widgets\widget.c><widget.c>
|
||||
OPTFFF 10,171,1,0,0,0,0,0,<..\..\rtgui\widgets\window.c><window.c>
|
||||
OPTFFF 10,172,1,0,0,0,0,0,<..\..\rtgui\widgets\workbench.c><workbench.c>
|
||||
OPTFFF 10,173,1,0,0,0,0,0,<..\..\rtgui\widgets\view.c><view.c>
|
||||
OPTFFF 10,174,1,0,0,0,0,0,<..\..\rtgui\widgets\box.c><box.c>
|
||||
OPTFFF 10,175,1,0,0,0,0,0,<..\..\rtgui\widgets\button.c><button.c>
|
||||
OPTFFF 10,176,1,0,0,0,0,0,<..\..\rtgui\widgets\container.c><container.c>
|
||||
OPTFFF 10,177,1,0,0,0,0,0,<..\..\rtgui\widgets\iconbox.c><iconbox.c>
|
||||
OPTFFF 10,178,1,0,0,0,0,0,<..\..\rtgui\widgets\label.c><label.c>
|
||||
OPTFFF 10,179,1,0,0,0,0,0,<..\..\rtgui\widgets\textbox.c><textbox.c>
|
||||
OPTFFF 10,180,1,0,0,0,0,0,<..\..\rtgui\widgets\title.c><title.c>
|
||||
OPTFFF 10,181,1,67108864,0,0,0,0,<..\..\rtgui\widgets\toplevel.c><toplevel.c>
|
||||
OPTFFF 10,182,1,0,0,0,0,0,<..\..\rtgui\server\mouse.c><mouse.c>
|
||||
OPTFFF 10,183,1,0,0,0,0,0,<..\..\rtgui\server\topwin.c><topwin.c>
|
||||
OPTFFF 10,184,1,0,0,0,0,0,<..\..\rtgui\common\caret.c><caret.c>
|
||||
OPTFFF 1,21,1,0,0,0,0,0,<.\key.c><key.c>
|
||||
OPTFFF 1,22,1,0,0,0,0,0,<.\info.c><info.c>
|
||||
OPTFFF 1,23,1,0,0,0,0,0,<E:\Projects\opensvn\rt-thread\google\bsp\stm32_radio\player.c><player.c>
|
||||
OPTFFF 1,24,1,0,0,0,0,0,<.\filelist.c><filelist.c>
|
||||
OPTFFF 1,25,1,0,0,0,0,0,<.\device_info.c><device_info.c>
|
||||
OPTFFF 1,26,1,0,0,0,0,0,<.\listview.c><listview.c>
|
||||
OPTFFF 2,27,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
|
||||
OPTFFF 2,28,1,0,0,0,0,0,<..\..\src\idle.c><idle.c>
|
||||
OPTFFF 2,29,1,671088640,0,0,0,0,<..\..\src\ipc.c><ipc.c>
|
||||
OPTFFF 2,30,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c>
|
||||
OPTFFF 2,31,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
|
||||
OPTFFF 2,32,1,0,0,0,0,0,<..\..\src\object.c><object.c>
|
||||
OPTFFF 2,33,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c>
|
||||
OPTFFF 2,34,1,285212672,0,0,0,0,<..\..\src\thread.c><thread.c>
|
||||
OPTFFF 2,35,1,0,0,0,0,0,<..\..\src\timer.c><timer.c>
|
||||
OPTFFF 2,36,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
|
||||
OPTFFF 2,37,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c>
|
||||
OPTFFF 2,38,1,0,0,0,0,0,<..\..\src\device.c><device.c>
|
||||
OPTFFF 2,39,1,0,0,0,0,0,<..\..\src\slab.c><slab.c>
|
||||
OPTFFF 3,40,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\stack.c><stack.c>
|
||||
OPTFFF 3,41,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\interrupt.c><interrupt.c>
|
||||
OPTFFF 3,42,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\cpu.c><cpu.c>
|
||||
OPTFFF 3,43,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\serial.c><serial.c>
|
||||
OPTFFF 3,44,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\context_rvds.S><context_rvds.S>
|
||||
OPTFFF 3,45,2,570425344,0,0,0,0,<..\..\libcpu\arm\stm32\start_rvds.s><start_rvds.s>
|
||||
OPTFFF 3,46,1,0,0,0,0,0,<..\..\libcpu\arm\stm32\fault.c><fault.c>
|
||||
OPTFFF 3,47,2,0,0,0,0,0,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
|
||||
OPTFFF 4,48,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
|
||||
OPTFFF 4,49,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
|
||||
OPTFFF 4,50,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
|
||||
OPTFFF 4,51,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c><stm32f10x_can.c>
|
||||
OPTFFF 4,52,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c><stm32f10x_crc.c>
|
||||
OPTFFF 4,53,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c><stm32f10x_dac.c>
|
||||
OPTFFF 4,54,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
|
||||
OPTFFF 4,55,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c><stm32f10x_dma.c>
|
||||
OPTFFF 4,56,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c><stm32f10x_exti.c>
|
||||
OPTFFF 4,57,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c><stm32f10x_flash.c>
|
||||
OPTFFF 4,58,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c><stm32f10x_fsmc.c>
|
||||
OPTFFF 4,59,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
|
||||
OPTFFF 4,60,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
|
||||
OPTFFF 4,61,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
|
||||
OPTFFF 4,62,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
|
||||
OPTFFF 4,63,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
|
||||
OPTFFF 4,64,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
|
||||
OPTFFF 4,65,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c><stm32f10x_sdio.c>
|
||||
OPTFFF 4,66,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c><stm32f10x_spi.c>
|
||||
OPTFFF 4,67,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c><stm32f10x_tim.c>
|
||||
OPTFFF 4,68,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c><stm32f10x_usart.c>
|
||||
OPTFFF 4,69,1,0,0,0,0,0,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
|
||||
OPTFFF 5,70,1,0,0,0,0,0,<.\Libraries\CMSIS\Core\CM3\core_cm3.c><core_cm3.c>
|
||||
OPTFFF 5,71,1,0,0,0,0,0,<.\Libraries\CMSIS\Core\CM3\system_stm32f10x.c><system_stm32f10x.c>
|
||||
OPTFFF 6,72,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
|
||||
OPTFFF 6,73,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c>
|
||||
OPTFFF 6,74,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c>
|
||||
OPTFFF 6,75,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c>
|
||||
OPTFFF 6,76,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c>
|
||||
OPTFFF 6,77,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c>
|
||||
OPTFFF 6,78,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c>
|
||||
OPTFFF 6,79,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c>
|
||||
OPTFFF 6,80,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c>
|
||||
OPTFFF 6,81,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c>
|
||||
OPTFFF 6,82,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c>
|
||||
OPTFFF 6,83,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c>
|
||||
OPTFFF 6,84,1,285212672,0,0,0,0,<..\..\finsh\cmd.c><cmd.c>
|
||||
OPTFFF 7,85,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
|
||||
OPTFFF 7,86,1,503316480,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
|
||||
OPTFFF 7,87,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
|
||||
OPTFFF 7,88,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
|
||||
OPTFFF 7,89,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
|
||||
OPTFFF 7,90,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
|
||||
OPTFFF 7,91,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
|
||||
OPTFFF 7,92,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
|
||||
OPTFFF 7,93,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
|
||||
OPTFFF 7,94,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
|
||||
OPTFFF 7,95,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
|
||||
OPTFFF 7,96,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
|
||||
OPTFFF 7,97,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
|
||||
OPTFFF 7,98,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
|
||||
OPTFFF 7,99,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
|
||||
OPTFFF 7,100,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
|
||||
OPTFFF 7,101,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
|
||||
OPTFFF 8,102,1,0,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
|
||||
OPTFFF 8,103,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c><dns.c>
|
||||
OPTFFF 8,104,1,0,0,0,0,0,<..\..\net\lwip\src\core\init.c><init.c>
|
||||
OPTFFF 8,105,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c><netif.c>
|
||||
OPTFFF 8,106,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c><pbuf.c>
|
||||
OPTFFF 8,107,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c><raw.c>
|
||||
OPTFFF 8,108,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c><stats.c>
|
||||
OPTFFF 8,109,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c><sys.c>
|
||||
OPTFFF 8,110,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp.c><tcp.c>
|
||||
OPTFFF 8,111,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c><tcp_in.c>
|
||||
OPTFFF 8,112,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c><tcp_out.c>
|
||||
OPTFFF 8,113,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c><udp.c>
|
||||
OPTFFF 8,114,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c><autoip.c>
|
||||
OPTFFF 8,115,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c><icmp.c>
|
||||
OPTFFF 8,116,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c><igmp.c>
|
||||
OPTFFF 8,117,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c><inet.c>
|
||||
OPTFFF 8,118,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
|
||||
OPTFFF 8,119,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c><ip.c>
|
||||
OPTFFF 8,120,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
|
||||
OPTFFF 8,121,1,285212672,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
|
||||
OPTFFF 8,122,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_in.c><msg_in.c>
|
||||
OPTFFF 8,123,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_out.c><msg_out.c>
|
||||
OPTFFF 8,124,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c><api_lib.c>
|
||||
OPTFFF 8,125,1,50331648,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c><api_msg.c>
|
||||
OPTFFF 8,126,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c><err.c>
|
||||
OPTFFF 8,127,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c><netbuf.c>
|
||||
OPTFFF 8,128,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c><netdb.c>
|
||||
OPTFFF 8,129,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c><netifapi.c>
|
||||
OPTFFF 8,130,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c><tcpip.c>
|
||||
OPTFFF 8,131,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c><etharp.c>
|
||||
OPTFFF 8,132,1,150994944,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c><ethernetif.c>
|
||||
OPTFFF 8,133,1,0,0,0,0,0,<..\..\net\lwip\src\netif\loopif.c><loopif.c>
|
||||
OPTFFF 8,134,1,285212672,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
|
||||
OPTFFF 8,135,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
|
||||
OPTFFF 8,136,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
|
||||
OPTFFF 8,137,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
|
||||
OPTFFF 9,138,1,268435456,0,0,0,0,<.\mp3\mp3dec.c><mp3dec.c>
|
||||
OPTFFF 9,139,1,0,0,0,0,0,<.\mp3\mp3tabs.c><mp3tabs.c>
|
||||
OPTFFF 9,140,1,0,0,0,0,0,<.\mp3\real\bitstream.c><bitstream.c>
|
||||
OPTFFF 9,141,1,83886080,0,0,0,0,<.\mp3\real\buffers.c><buffers.c>
|
||||
OPTFFF 9,142,1,0,0,0,0,0,<.\mp3\real\dct32.c><dct32.c>
|
||||
OPTFFF 9,143,1,0,0,0,0,0,<.\mp3\real\dequant.c><dequant.c>
|
||||
OPTFFF 9,144,1,0,0,0,0,0,<.\mp3\real\dqchan.c><dqchan.c>
|
||||
OPTFFF 9,145,1,0,0,0,0,0,<.\mp3\real\huffman.c><huffman.c>
|
||||
OPTFFF 9,146,1,0,0,0,0,0,<.\mp3\real\hufftabs.c><hufftabs.c>
|
||||
OPTFFF 9,147,1,0,0,0,0,0,<.\mp3\real\imdct.c><imdct.c>
|
||||
OPTFFF 9,148,1,0,0,0,0,0,<.\mp3\real\scalfact.c><scalfact.c>
|
||||
OPTFFF 9,149,1,0,0,0,0,0,<.\mp3\real\stproc.c><stproc.c>
|
||||
OPTFFF 9,150,1,0,0,0,0,0,<.\mp3\real\subband.c><subband.c>
|
||||
OPTFFF 9,151,1,0,0,0,0,0,<.\mp3\real\trigtabs.c><trigtabs.c>
|
||||
OPTFFF 9,152,2,0,0,0,0,0,<.\mp3\real\arm\asmpoly_thumb2.s><asmpoly_thumb2.s>
|
||||
OPTFFF 9,153,2,0,0,0,0,0,<.\mp3\real\arm\asmmisc.s><asmmisc.s>
|
||||
OPTFFF 10,154,1,0,0,0,0,0,<..\..\rtgui\common\rtgui_object.c><rtgui_object.c>
|
||||
OPTFFF 10,155,1,0,0,0,0,0,<..\..\rtgui\common\rtgui_system.c><rtgui_system.c>
|
||||
OPTFFF 10,156,1,620756992,0,0,0,0,<..\..\rtgui\common\rtgui_theme.c><rtgui_theme.c>
|
||||
OPTFFF 10,157,1,0,0,0,0,0,<..\..\rtgui\common\asc12font.c><asc12font.c>
|
||||
OPTFFF 10,158,1,402653184,0,0,0,0,<..\..\rtgui\common\asc16font.c><asc16font.c>
|
||||
OPTFFF 10,159,1,0,0,0,0,0,<..\..\rtgui\common\color.c><color.c>
|
||||
OPTFFF 10,160,1,0,0,0,0,0,<..\..\rtgui\common\dc.c><dc.c>
|
||||
OPTFFF 10,161,1,0,0,0,0,0,<..\..\rtgui\common\dc_buffer.c><dc_buffer.c>
|
||||
OPTFFF 10,162,1,0,0,0,0,0,<..\..\rtgui\common\dc_hw.c><dc_hw.c>
|
||||
OPTFFF 10,163,1,16777216,0,0,0,0,<..\..\rtgui\common\filerw.c><filerw.c>
|
||||
OPTFFF 10,164,1,0,0,0,0,0,<..\..\rtgui\common\font.c><font.c>
|
||||
OPTFFF 10,165,1,469762048,0,0,0,0,<..\..\rtgui\common\image.c><image.c>
|
||||
OPTFFF 10,166,1,0,0,0,0,0,<..\..\rtgui\common\image_xpm.c><image_xpm.c>
|
||||
OPTFFF 10,167,1,0,0,0,0,0,<..\..\rtgui\common\image_hdc.c><image_hdc.c>
|
||||
OPTFFF 10,168,1,0,0,0,0,0,<..\..\rtgui\common\region.c><region.c>
|
||||
OPTFFF 10,169,1,100663296,0,0,0,0,<..\..\rtgui\server\server.c><server.c>
|
||||
OPTFFF 10,170,1,0,0,0,0,0,<..\..\rtgui\server\driver.c><driver.c>
|
||||
OPTFFF 10,171,1,335544320,0,0,0,0,<..\..\rtgui\server\panel.c><panel.c>
|
||||
OPTFFF 10,172,1,0,0,0,0,0,<..\..\rtgui\widgets\widget.c><widget.c>
|
||||
OPTFFF 10,173,1,16777216,0,0,0,0,<..\..\rtgui\widgets\window.c><window.c>
|
||||
OPTFFF 10,174,1,0,0,0,0,0,<..\..\rtgui\widgets\workbench.c><workbench.c>
|
||||
OPTFFF 10,175,1,16777216,0,0,0,0,<..\..\rtgui\widgets\view.c><view.c>
|
||||
OPTFFF 10,176,1,0,0,0,0,0,<..\..\rtgui\widgets\box.c><box.c>
|
||||
OPTFFF 10,177,1,0,0,0,0,0,<..\..\rtgui\widgets\button.c><button.c>
|
||||
OPTFFF 10,178,1,0,0,0,0,0,<..\..\rtgui\widgets\container.c><container.c>
|
||||
OPTFFF 10,179,1,0,0,0,0,0,<..\..\rtgui\widgets\iconbox.c><iconbox.c>
|
||||
OPTFFF 10,180,1,0,0,0,0,0,<..\..\rtgui\widgets\label.c><label.c>
|
||||
OPTFFF 10,181,1,0,0,0,0,0,<..\..\rtgui\widgets\textbox.c><textbox.c>
|
||||
OPTFFF 10,182,1,0,0,0,0,0,<..\..\rtgui\widgets\title.c><title.c>
|
||||
OPTFFF 10,183,1,67108864,0,0,0,0,<..\..\rtgui\widgets\toplevel.c><toplevel.c>
|
||||
OPTFFF 10,184,1,0,0,0,0,0,<..\..\rtgui\server\mouse.c><mouse.c>
|
||||
OPTFFF 10,185,1,0,0,0,0,0,<..\..\rtgui\server\topwin.c><topwin.c>
|
||||
OPTFFF 10,186,1,0,0,0,0,0,<..\..\rtgui\common\caret.c><caret.c>
|
||||
OPTFFF 10,187,1,0,0,0,0,0,<..\..\rtgui\common\font_hz_file.c><font_hz_file.c>
|
||||
OPTFFF 10,188,1,0,0,0,0,0,<..\..\rtgui\common\hz16font.c><hz16font.c>
|
||||
OPTFFF 10,189,1,0,0,0,0,0,<..\..\rtgui\common\hz12font.c><hz12font.c>
|
||||
|
||||
|
||||
TARGOPT 1, (RT-Thread STM32 Radio)
|
||||
|
@ -224,11 +229,13 @@ TARGOPT 1, (RT-Thread STM32 Radio)
|
|||
OPTKEY 0,(ARMDBGFLAGS)()
|
||||
OPTKEY 0,(DLGUARM)((105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0))
|
||||
OPTKEY 0,(JL2CM3)(-U20090110 -O718 -S8 -C0 -JU1 -JI127.0.0.1 -JP0 -N00("ARM CoreSight SW-DP") -D00(00000000) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO27 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000)
|
||||
OPTBB 0,0,590,1,134251230,0,0,0,0,1,<dfs_raw.c>()()
|
||||
OPTBB 1,0,331,1,134431418,0,0,0,0,1,<window.c>()()
|
||||
OPTBB 0,0,590,1,134245962,0,0,0,0,1,<dfs_raw.c>()()
|
||||
OPTBB 1,0,129,1,134325656,0,0,0,0,1,<application.c>()()
|
||||
OPTBB 2,0,41,1,134354810,0,0,0,0,1,<rtgui_system.c>()()
|
||||
OPTBB 3,0,66,1,134343178,0,0,0,0,1,<font.c>()()
|
||||
OPTMM 1,8,(0x20005f34)
|
||||
OPTMM 2,8,(mimeBuffer)
|
||||
OPTDF 0x86
|
||||
OPTDF 0x82
|
||||
OPTLE <>
|
||||
OPTLC <>
|
||||
EndOpt
|
||||
|
|
|
@ -34,10 +34,12 @@ File 1,1,<.\lcd.c><lcd.c>
|
|||
File 1,1,<.\mp3.c><mp3.c>
|
||||
File 1,1,<.\wav.c><wav.c>
|
||||
File 1,1,<.\netbuffer.c><netbuffer.c>
|
||||
File 1,1,<.\gui.c><gui.c>
|
||||
File 1,1,<.\key.c><key.c>
|
||||
File 1,1,<.\info.c><info.c>
|
||||
File 1,1,<.\today.c><today.c>
|
||||
File 1,1,<E:\Projects\opensvn\rt-thread\google\bsp\stm32_radio\player.c><player.c>
|
||||
File 1,1,<.\filelist.c><filelist.c>
|
||||
File 1,1,<.\device_info.c><device_info.c>
|
||||
File 1,1,<.\listview.c><listview.c>
|
||||
File 2,1,<..\..\src\clock.c><clock.c>
|
||||
File 2,1,<..\..\src\idle.c><idle.c>
|
||||
File 2,1,<..\..\src\ipc.c><ipc.c>
|
||||
|
@ -198,6 +200,9 @@ File 10,1,<..\..\rtgui\widgets\toplevel.c><toplevel.c>
|
|||
File 10,1,<..\..\rtgui\server\mouse.c><mouse.c>
|
||||
File 10,1,<..\..\rtgui\server\topwin.c><topwin.c>
|
||||
File 10,1,<..\..\rtgui\common\caret.c><caret.c>
|
||||
File 10,1,<..\..\rtgui\common\font_hz_file.c><font_hz_file.c>
|
||||
File 10,1,<..\..\rtgui\common\hz16font.c><hz16font.c>
|
||||
File 10,1,<..\..\rtgui\common\hz12font.c><hz12font.c>
|
||||
|
||||
|
||||
Options 1,0,0 // Target 'RT-Thread STM32 Radio'
|
||||
|
@ -312,93 +317,3 @@ Options 1,9,0 // Group 'mp3'
|
|||
ADSAINCD ()
|
||||
EndOpt
|
||||
|
||||
Options 1,10,0 // Group 'RTGUI'
|
||||
PropFld { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
IncBld=2
|
||||
AlwaysBuild=2
|
||||
GenAsm=2
|
||||
AsmAsm=2
|
||||
PublicsOnly=2
|
||||
StopCode=11
|
||||
CustArgs ()
|
||||
LibMods ()
|
||||
ADSCCFLG { 2,84,85,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSCMISC (--gnu)
|
||||
ADSCDEFN ()
|
||||
ADSCUDEF ()
|
||||
ADSCINCD ()
|
||||
ADSASFLG { 170,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSAMISC ()
|
||||
ADSADEFN ()
|
||||
ADSAUDEF ()
|
||||
ADSAINCD ()
|
||||
EndOpt
|
||||
|
||||
Options 1,1,21 // File 'gui.c'
|
||||
PropFld { 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
IncBld=2
|
||||
AlwaysBuild=2
|
||||
GenAsm=2
|
||||
AsmAsm=2
|
||||
PublicsOnly=2
|
||||
StopCode=11
|
||||
CustArgs ()
|
||||
LibMods ()
|
||||
ADSCCFLG { 2,84,85,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSCMISC (--gnu)
|
||||
ADSCDEFN ()
|
||||
ADSCUDEF ()
|
||||
ADSCINCD ()
|
||||
EndOpt
|
||||
|
||||
Options 1,1,22 // File 'key.c'
|
||||
PropFld { 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
IncBld=2
|
||||
AlwaysBuild=2
|
||||
GenAsm=2
|
||||
AsmAsm=2
|
||||
PublicsOnly=2
|
||||
StopCode=11
|
||||
CustArgs ()
|
||||
LibMods ()
|
||||
ADSCCFLG { 2,84,85,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSCMISC (--gnu)
|
||||
ADSCDEFN ()
|
||||
ADSCUDEF ()
|
||||
ADSCINCD ()
|
||||
EndOpt
|
||||
|
||||
Options 1,1,23 // File 'info.c'
|
||||
PropFld { 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
IncBld=2
|
||||
AlwaysBuild=2
|
||||
GenAsm=2
|
||||
AsmAsm=2
|
||||
PublicsOnly=2
|
||||
StopCode=11
|
||||
CustArgs ()
|
||||
LibMods ()
|
||||
ADSCCFLG { 2,84,85,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSCMISC (--gnu)
|
||||
ADSCDEFN ()
|
||||
ADSCUDEF ()
|
||||
ADSCINCD ()
|
||||
EndOpt
|
||||
|
||||
Options 1,1,24 // File 'today.c'
|
||||
PropFld { 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
IncBld=2
|
||||
AlwaysBuild=2
|
||||
GenAsm=2
|
||||
AsmAsm=2
|
||||
PublicsOnly=2
|
||||
StopCode=11
|
||||
CustArgs ()
|
||||
LibMods ()
|
||||
ADSCCFLG { 2,84,85,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSCMISC (--gnu)
|
||||
ADSCDEFN ()
|
||||
ADSCUDEF ()
|
||||
ADSCINCD ()
|
||||
EndOpt
|
||||
|
||||
|
|
|
@ -81,11 +81,12 @@
|
|||
#define RT_USING_DFS
|
||||
#define RT_USING_DFS_EFSL
|
||||
// #define RT_USING_DFS_ELMFAT
|
||||
#define DFS_EFLS_USING_STATIC_CACHE
|
||||
/* SECTION: DFS options */
|
||||
/* the max number of mounted filesystem */
|
||||
#define DFS_FILESYSTEMS_MAX 1
|
||||
/* the max number of opened files */
|
||||
#define DFS_FD_MAX 2
|
||||
#define DFS_FD_MAX 8
|
||||
/* the max number of cached sector */
|
||||
#define DFS_CACHE_MAX_NUM 4
|
||||
|
||||
|
@ -118,7 +119,7 @@
|
|||
/* #define RT_LWIP_SNMP */
|
||||
|
||||
/* Using DHCP */
|
||||
/* #define RT_LWIP_DHCP */
|
||||
#define RT_LWIP_DHCP
|
||||
|
||||
/* Using DNS */
|
||||
#define RT_LWIP_DNS
|
||||
|
|
|
@ -3061,7 +3061,7 @@ void rt_hw_sdcard_init()
|
|||
SD_Error status;
|
||||
rt_uint8_t *sector;
|
||||
|
||||
SD_EnableWideBusOperation(SDIO_BusWide_4b);
|
||||
SD_EnableWideBusOperation(SDIO_BusWide_1b);
|
||||
|
||||
status = SD_GetCardInfo(&SDCardInfo);
|
||||
if (status != SD_OK) goto __return;
|
||||
|
|
|
@ -103,13 +103,6 @@ void rtthread_startup(void)
|
|||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_LWIP
|
||||
eth_system_device_init();
|
||||
|
||||
/* register ethernetif device */
|
||||
rt_hw_dm9000_init();
|
||||
#endif
|
||||
|
||||
wm8753_hw_init();
|
||||
|
||||
/* init hardware serial device */
|
||||
|
|
|
@ -36,6 +36,7 @@ void wav(char* filename)
|
|||
buf = sbuf_alloc();
|
||||
len = read(fd, (char*)buf, block_size);
|
||||
if (len > 0) rt_device_write(device, 0, buf, len);
|
||||
else sbuf_release(buf);
|
||||
} while (len != 0);
|
||||
|
||||
/* close device and file */
|
||||
|
|
|
@ -42,7 +42,8 @@ void lwip_sys_init()
|
|||
/* use DHCP client */
|
||||
dhcp_start(netif_default);
|
||||
|
||||
while (1) {
|
||||
while (netif_default->ip_addr.addr == 0)
|
||||
{
|
||||
rt_thread_delay(DHCP_FINE_TIMER_MSECS);
|
||||
|
||||
dhcp_fine_tmr();
|
||||
|
@ -53,6 +54,12 @@ void lwip_sys_init()
|
|||
mscnt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
rt_kprintf("Acquired IP address from DHCP server:");
|
||||
rt_kprintf("%d.%d.%d.%d\n", netif_default->ip_addr.addr & 0xff,
|
||||
(netif_default->ip_addr.addr>>8) & 0xff,
|
||||
(netif_default->ip_addr.addr>>16) & 0xff,
|
||||
(netif_default->ip_addr.addr>>24) & 0xff);
|
||||
#endif
|
||||
|
||||
#if defined(RT_USING_FINSH) && (LWIP_STATS_DISPLAY)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <rtgui/filerw.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#ifdef RT_USING_DFS_FILERW
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
#include <dfs_posix.h>
|
||||
|
||||
/* standard file read/write */
|
||||
|
@ -95,7 +95,7 @@ static int stdio_close(struct rtgui_filerw *context)
|
|||
|
||||
return -1;
|
||||
}
|
||||
#elif RT_USING_STDIO_FILERW
|
||||
#elif defined(RTGUI_USING_STDIO_FILERW)
|
||||
#include <stdio.h>
|
||||
|
||||
/* standard file read/write */
|
||||
|
@ -302,7 +302,7 @@ rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context)
|
|||
}
|
||||
|
||||
/* file read/write public interface */
|
||||
#ifdef RT_USING_DFS_FILERW
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
static int parse_mode(const char *mode)
|
||||
{
|
||||
int f=0;
|
||||
|
@ -352,7 +352,7 @@ struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char*
|
|||
|
||||
return &(rw->parent);
|
||||
}
|
||||
#elif RT_USING_STDIO_FILERW
|
||||
#elif defined(RTGUI_USING_STDIO_FILERW)
|
||||
struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char* mode)
|
||||
{
|
||||
FILE *fp;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <rtgui/font.h>
|
||||
#include <rtgui/tree.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#ifdef RTGUI_USING_HZ_FILE
|
||||
#include <dfs_posix.h>
|
||||
|
||||
#define HZ_CACHE_MAX 64
|
||||
|
@ -142,3 +143,4 @@ static void rtgui_hz_file_font_get_metrics(struct rtgui_font* font, const rt_uin
|
|||
rect->x2 = (rt_int16_t)(hz_file_font->font_size/2 * rt_strlen((const char*)text));
|
||||
rect->y2 = hz_file_font->font_size;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -12295,20 +12295,20 @@ struct rtgui_font rtgui_font_hz12 =
|
|||
#else
|
||||
const struct rtgui_hz_file_font hz12 =
|
||||
{
|
||||
{RT_NULL}, /* cache root */
|
||||
0, /* cache_size */
|
||||
12, /* font_size */
|
||||
-1, /* fd */
|
||||
"/resource/hz12" /* font_fn */
|
||||
{RT_NULL}, /* cache root */
|
||||
0, /* cache size */
|
||||
12, /* font size */
|
||||
32, /* font data size */
|
||||
-1, /* fd */
|
||||
"/resource/hzk12.fnt" /* font_fn */
|
||||
};
|
||||
|
||||
extern struct rtgui_hz_file_font_engine hz_file_font_engine;
|
||||
struct rtgui_font rtgui_font_hz12 =
|
||||
{
|
||||
"hz", /* family */
|
||||
12, /* height */
|
||||
1, /* refer count */
|
||||
&hz_file_font_engine,/* font engine */
|
||||
&rtgui_hz_file_font_engine,/* font engine */
|
||||
(void*)&hz12, /* font private data */
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -16740,7 +16740,7 @@ const struct rtgui_font_bitmap hz16 =
|
|||
};
|
||||
|
||||
extern struct rtgui_font_engine hz_bmp_font_engine;
|
||||
const struct rtgui_font rtgui_font_hz16 =
|
||||
struct rtgui_font rtgui_font_hz16 =
|
||||
{
|
||||
"hz", /* family */
|
||||
16, /* height */
|
||||
|
|
|
@ -77,7 +77,7 @@ static rt_bool_t rtgui_image_hdc_load(struct rtgui_image* image, struct rtgui_fi
|
|||
rtgui_filerw_read(file, (char*)&header, 1, sizeof(header));
|
||||
|
||||
/* set image information */
|
||||
image->w = header[1]; image->h = header[2];
|
||||
image->w = (rt_uint16_t)header[1]; image->h = (rt_uint16_t)header[2];
|
||||
image->engine = &rtgui_image_hdc_engine;
|
||||
image->data = hdc;
|
||||
hdc->filerw = file;
|
||||
|
@ -129,126 +129,108 @@ static void rtgui_image_hdc_unload(struct rtgui_image* image)
|
|||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_raw_hline(struct rtgui_dc_hw* dc, rt_uint8_t* raw_ptr, int x1, int x2, int y)
|
||||
{
|
||||
register rt_base_t index;
|
||||
register rt_base_t bpp;
|
||||
|
||||
/* convert logic to device */
|
||||
x1 = x1 + dc->owner->extent.x1;
|
||||
x2 = x2 + dc->owner->extent.x1;
|
||||
y = y + dc->owner->extent.y1;
|
||||
|
||||
bpp = dc->device->byte_per_pixel;
|
||||
if (dc->owner->clip.data == RT_NULL)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
|
||||
prect = &(dc->owner->clip.extents);
|
||||
|
||||
/* calculate hline intersect */
|
||||
if (prect->y1 > y || prect->y2 <= y ) return;
|
||||
if (prect->x2 <= x1 || prect->x1 > x2) return;
|
||||
|
||||
if (prect->x1 > x1) x1 = prect->x1;
|
||||
if (prect->x2 < x2) x2 = prect->x2;
|
||||
|
||||
/* draw raw hline */
|
||||
dc->device->draw_raw_hline(raw_ptr, x1, x2, y);
|
||||
}
|
||||
else for (index = 0; index < rtgui_region_num_rects(&(dc->owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
register rt_base_t draw_x1, draw_x2;
|
||||
|
||||
prect = ((rtgui_rect_t *)(dc->owner->clip.data + index + 1));
|
||||
draw_x1 = x1;
|
||||
draw_x2 = x2;
|
||||
|
||||
/* calculate hline clip */
|
||||
if (prect->y1 > y || prect->y2 <= y ) continue;
|
||||
if (prect->x2 <= x1 || prect->x1 > x2) continue;
|
||||
|
||||
if (prect->x1 > x1) draw_x1 = prect->x1;
|
||||
if (prect->x2 < x2) draw_x2 = prect->x2;
|
||||
|
||||
/* draw raw hline */
|
||||
dc->device->draw_raw_hline(raw_ptr + (draw_x1 - x1) * bpp, draw_x1, draw_x2, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* dst_rect)
|
||||
{
|
||||
rt_uint16_t y, w, h;
|
||||
rtgui_color_t foreground;
|
||||
struct rtgui_image_hdc* hdc;
|
||||
rt_uint16_t rect_pitch, hw_pitch;
|
||||
rtgui_rect_t dc_rect, _rect, *rect;
|
||||
|
||||
RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);
|
||||
|
||||
_rect = *dst_rect;
|
||||
rect = &_rect;
|
||||
|
||||
/* this dc is not visible */
|
||||
if (dc->get_visible(dc) != RT_TRUE) return;
|
||||
|
||||
hdc = (struct rtgui_image_hdc*) image->data;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* transfer logic coordinate to physical coordinate */
|
||||
if (dc->type == RTGUI_DC_HW)
|
||||
{
|
||||
dc_rect = ((struct rtgui_dc_hw*)dc)->owner->extent;
|
||||
}
|
||||
else rtgui_dc_get_rect(dc, &dc_rect);
|
||||
rtgui_rect_moveto(rect, dc_rect.x1, dc_rect.y1);
|
||||
if (dc->type != RTGUI_DC_HW) return;
|
||||
|
||||
/* the minimum rect */
|
||||
if (image->w < rtgui_rect_width(*rect)) w = image->w;
|
||||
else w = rtgui_rect_width(*rect);
|
||||
if (image->h < rtgui_rect_height(*rect)) h = image->h;
|
||||
else h = rtgui_rect_height(*rect);
|
||||
|
||||
/* get rect pitch */
|
||||
rect_pitch = w * hdc->byte_per_pixel;
|
||||
hw_pitch = hdc->hw_driver->width * hdc->hw_driver->byte_per_pixel;
|
||||
|
||||
/* save foreground color */
|
||||
foreground = rtgui_dc_get_color(dc);
|
||||
if (image->w < rtgui_rect_width(*dst_rect)) w = image->w;
|
||||
else w = rtgui_rect_width(*dst_rect);
|
||||
if (image->h < rtgui_rect_height(*dst_rect)) h = image->h;
|
||||
else h = rtgui_rect_height(*dst_rect);
|
||||
|
||||
if (hdc->pixels != RT_NULL)
|
||||
{
|
||||
if (hdc->hw_driver->get_framebuffer() != RT_NULL)
|
||||
rt_uint8_t* ptr;
|
||||
|
||||
/* get pixel pointer */
|
||||
ptr = hdc->pixels;
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
rt_uint8_t* rect_ptr;
|
||||
rt_uint8_t* hw_ptr;
|
||||
|
||||
/* get pixel pointer */
|
||||
hw_ptr = hdc->hw_driver->get_framebuffer();
|
||||
rect_ptr = hdc->pixels;
|
||||
|
||||
/* move hardware pixel pointer */
|
||||
hw_ptr += rect->y1 * hdc->pitch + rect->x1 * hdc->byte_per_pixel;
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
rt_memcpy(hw_ptr, rect_ptr, rect_pitch);
|
||||
hw_ptr += hw_pitch;
|
||||
rect_ptr += rect_pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_uint8_t* rect_ptr;
|
||||
|
||||
/* get pixel pointer */
|
||||
rect_ptr = hdc->pixels;
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
hdc->hw_driver->draw_raw_hline(rect_ptr, rect->x1, rect->x1 + w, rect->y1 + y);
|
||||
rect_ptr += hdc->pitch;
|
||||
}
|
||||
rtgui_image_hdc_raw_hline((struct rtgui_dc_hw*)dc, ptr, dst_rect->x1, dst_rect->x2, dst_rect->y1 + y);
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_uint8_t* rect_ptr;
|
||||
rect_ptr = rtgui_malloc(hdc->pitch);
|
||||
if (rect_ptr == RT_NULL) return; /* no memory */
|
||||
rt_uint8_t* ptr;
|
||||
ptr = rtgui_malloc(hdc->pitch);
|
||||
if (ptr == RT_NULL) return; /* no memory */
|
||||
|
||||
/* seek to the begin of pixel data */
|
||||
rtgui_filerw_seek(hdc->filerw, hdc->pixel_offset, RTGUI_FILE_SEEK_SET);
|
||||
|
||||
if (hdc->hw_driver->get_framebuffer() != RT_NULL)
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
rt_uint8_t* hw_ptr;
|
||||
/* read pixel data */
|
||||
if (rtgui_filerw_read(hdc->filerw, ptr, 1, hdc->pitch) != hdc->pitch)
|
||||
break; /* read data failed */
|
||||
|
||||
/* get pixel pointer */
|
||||
hw_ptr = hdc->hw_driver->get_framebuffer();
|
||||
/* move hardware pixel pointer */
|
||||
hw_ptr += rect->y1 * hdc->pitch + rect->x1 * hdc->byte_per_pixel;
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
/* read pixel data */
|
||||
if (rtgui_filerw_read(hdc->filerw, rect_ptr, 1, hdc->pitch) != hdc->pitch)
|
||||
break; /* read data failed */
|
||||
|
||||
rt_memcpy(hw_ptr, rect_ptr, rect_pitch);
|
||||
hw_ptr += hw_pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
/* read pixel data */
|
||||
if (rtgui_filerw_read(hdc->filerw, rect_ptr, 1, hdc->pitch) != hdc->pitch)
|
||||
break; /* read data failed */
|
||||
|
||||
hdc->hw_driver->draw_raw_hline(rect_ptr, rect->x1, rect->x1 + w, rect->y1 + y);
|
||||
}
|
||||
rtgui_image_hdc_raw_hline((struct rtgui_dc_hw*)dc, ptr, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y);
|
||||
}
|
||||
|
||||
rtgui_free(rect_ptr);
|
||||
rtgui_free(ptr);
|
||||
}
|
||||
|
||||
/* restore foreground */
|
||||
rtgui_dc_set_color(dc, foreground);
|
||||
}
|
||||
|
||||
void rtgui_image_hdc_init()
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/image.h>
|
||||
#include <rtgui/rtgui_theme.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/widgets/window.h>
|
||||
|
@ -31,6 +32,9 @@ void rtgui_system_server_init()
|
|||
/* init rtgui_thread */
|
||||
rtgui_thread_system_init();
|
||||
|
||||
/* init theme */
|
||||
rtgui_system_theme_init();
|
||||
|
||||
/* init image */
|
||||
rtgui_system_image_init();
|
||||
/* init font */
|
||||
|
@ -257,7 +261,6 @@ rtgui_thread_t* rtgui_thread_register(rt_thread_t tid, rt_mq_t mq)
|
|||
thread->tid = tid;
|
||||
thread->mq = mq;
|
||||
thread->widget = RT_NULL;
|
||||
thread->is_quit = RT_FALSE;
|
||||
|
||||
/* take semaphore */
|
||||
rt_sem_take(&_rtgui_thread_hash_semaphore, RT_WAITING_FOREVER);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#define WINTITLE_CB_WIDTH 14
|
||||
#define WINTITLE_CB_HEIGHT 14
|
||||
#define SELECTED_HEIGHT 25
|
||||
|
||||
static const rt_uint8_t *close_unpressed_xpm[] = {
|
||||
"14 14 55 1",
|
||||
|
@ -184,6 +185,15 @@ static const rt_uint8_t *close_pressed_xpm[] = {
|
|||
static rtgui_image_t* close_pressed = RT_NULL;
|
||||
static rtgui_image_t* close_unpressed = RT_NULL;
|
||||
|
||||
/* init theme */
|
||||
void rtgui_system_theme_init()
|
||||
{
|
||||
close_pressed = rtgui_image_create_from_mem("xpm",
|
||||
(const rt_uint8_t*)close_pressed_xpm, sizeof(close_pressed_xpm));
|
||||
close_unpressed = rtgui_image_create_from_mem("xpm",
|
||||
(const rt_uint8_t*)close_unpressed_xpm, sizeof(close_unpressed_xpm));
|
||||
}
|
||||
|
||||
/* window drawing */
|
||||
void rtgui_theme_draw_win(struct rtgui_topwin* win)
|
||||
{
|
||||
|
@ -288,7 +298,10 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
|
|||
|
||||
if (btn->pressed_image != RT_NULL)
|
||||
{
|
||||
rtgui_rect_t image_rect = {0, 0, btn->unpressed_image->w, btn->unpressed_image->h};
|
||||
rtgui_rect_t image_rect;
|
||||
image_rect.x1 = 0; image_rect.y1 = 0;
|
||||
image_rect.x2 = btn->unpressed_image->w;
|
||||
image_rect.y2 = btn->unpressed_image->h;
|
||||
rtgui_rect_moveto_align(&rect, &image_rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
|
||||
rtgui_image_blit(btn->pressed_image, dc, &image_rect);
|
||||
|
@ -298,7 +311,10 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
|
|||
{
|
||||
if (btn->pressed_image != RT_NULL)
|
||||
{
|
||||
rtgui_rect_t image_rect = {0, 0, btn->unpressed_image->w, btn->unpressed_image->h};
|
||||
rtgui_rect_t image_rect;
|
||||
image_rect.x1 = 0; image_rect.y1 = 0;
|
||||
image_rect.x2 = btn->unpressed_image->w;
|
||||
image_rect.y2 = btn->unpressed_image->h;
|
||||
rtgui_rect_moveto_align(&rect, &image_rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
|
||||
rtgui_image_blit(btn->pressed_image, dc, &image_rect);
|
||||
|
@ -318,7 +334,10 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
|
|||
{
|
||||
if (btn->unpressed_image != RT_NULL)
|
||||
{
|
||||
rtgui_rect_t image_rect = {0, 0, btn->unpressed_image->w, btn->unpressed_image->h};
|
||||
rtgui_rect_t image_rect;
|
||||
image_rect.x1 = 0; image_rect.y1 = 0;
|
||||
image_rect.x2 = btn->unpressed_image->w;
|
||||
image_rect.y2 = btn->unpressed_image->h;
|
||||
rtgui_rect_moveto_align(&rect, &image_rect, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
|
||||
|
||||
rtgui_image_blit(btn->unpressed_image, dc, &image_rect);
|
||||
|
@ -441,6 +460,28 @@ void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox)
|
|||
rtgui_dc_end_drawing(dc);
|
||||
}
|
||||
|
||||
rt_uint16_t rtgui_theme_get_selected_height()
|
||||
{
|
||||
return SELECTED_HEIGHT;
|
||||
}
|
||||
|
||||
void rtgui_theme_draw_selected(struct rtgui_dc* dc, rtgui_rect_t *rect)
|
||||
{
|
||||
rtgui_color_t saved;
|
||||
rtgui_rect_t focus_rect;
|
||||
|
||||
focus_rect = *rect;
|
||||
saved = rtgui_dc_get_color(dc);
|
||||
rtgui_dc_set_color(dc, blue);
|
||||
|
||||
rtgui_rect_inflate(&focus_rect, -1);
|
||||
rtgui_dc_draw_focus_rect(dc, &focus_rect);
|
||||
rtgui_rect_inflate(&focus_rect, -1);
|
||||
rtgui_dc_draw_focus_rect(dc, &focus_rect);
|
||||
|
||||
rtgui_dc_set_color(dc, saved);
|
||||
}
|
||||
|
||||
/* get default background color */
|
||||
rtgui_color_t rtgui_theme_default_bc()
|
||||
{
|
||||
|
@ -452,3 +493,4 @@ rtgui_color_t rtgui_theme_default_fc()
|
|||
{
|
||||
return default_foreground;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c)
|
|||
{
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = ((RTGUI_RGB_B(c)>> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3);
|
||||
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c)>> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
|
||||
|
||||
return pixel;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c)
|
|||
{
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = ((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3);
|
||||
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3));
|
||||
return pixel;
|
||||
}
|
||||
|
||||
|
|
|
@ -296,9 +296,9 @@ struct rtgui_event_clip_info
|
|||
/* the number of rects */
|
||||
rt_uint32_t num_rect;
|
||||
|
||||
struct rtgui_rect rects[0];
|
||||
/* rtgui_rect_t *rects */
|
||||
};
|
||||
#define RTGUI_EVENT_GET_RECT(e, i) (&(e->rects[0]) + i)
|
||||
#define RTGUI_EVENT_GET_RECT(e, i) &(((rtgui_rect_t*)(e + 1))[i])
|
||||
|
||||
#define RTGUI_EVENT_UPDATE_BEGIN_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_BEGIN)
|
||||
#define RTGUI_EVENT_UPDATE_END_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE_END)
|
||||
|
|
|
@ -16,4 +16,6 @@
|
|||
|
||||
#include <rtgui/image.h>
|
||||
|
||||
void rtgui_image_png_init(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -95,6 +95,13 @@ enum RTGUI_ARRAW
|
|||
RTGUI_ARRAW_RIGHT
|
||||
};
|
||||
|
||||
enum RTGUI_MODAL_CODE
|
||||
{
|
||||
RTGUI_MODAL_OK,
|
||||
RTGUI_MODAL_CANCEL
|
||||
};
|
||||
typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
|
||||
|
||||
#include <rtgui/rtgui_object.h>
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,18 +22,23 @@
|
|||
|
||||
/* #define RTGUI_USING_MOUSE_CURSOR */
|
||||
|
||||
/* #define RTGUI_USING_FONT12 */
|
||||
|
||||
#define RTGUI_USING_FONT16
|
||||
#define RTGUI_USING_FONTHZ
|
||||
|
||||
#ifdef _WIN32
|
||||
#define RTGUI_USING_STDIO_FILERW
|
||||
#define RTGUI_IMAGE_PNG
|
||||
#define RTGUI_IMAGE_JPG
|
||||
#else
|
||||
#define RTGUI_USING_DFS_FILERW
|
||||
#define RTGUI_USING_HZ_FILE
|
||||
|
||||
// #define RT_USING_STDIO_FILERW
|
||||
#define RT_USING_DFS_FILERW
|
||||
// #define RTGUI_IMAGE_PNG
|
||||
// #define RTGUI_IMAGE_JPG
|
||||
#endif
|
||||
|
||||
#define RTGUI_SVR_THREAD_PRIORITY 15
|
||||
#define RTGUI_SVR_THREAD_TIMESLICE 5
|
||||
#define RTGUI_SVR_THREAD_STACK_SIZE 2048
|
||||
|
||||
#define RTGUI_APP_THREAD_PRIORITY 25
|
||||
#define RTGUI_APP_THREAD_TIMESLICE 8
|
||||
|
|
|
@ -88,7 +88,6 @@ struct rtgui_object
|
|||
/* object type */
|
||||
rtgui_type_t* type;
|
||||
|
||||
char *name;
|
||||
rt_bool_t is_static;
|
||||
};
|
||||
rtgui_type_t *rtgui_object_type_get(void);
|
||||
|
|
|
@ -31,9 +31,6 @@ struct rtgui_thread
|
|||
|
||||
/* the owner of thread */
|
||||
struct rtgui_widget* widget;
|
||||
|
||||
/* quit of thread */
|
||||
rt_bool_t is_quit;
|
||||
};
|
||||
typedef struct rtgui_thread rtgui_thread_t;
|
||||
struct rtgui_timer;
|
||||
|
|
|
@ -26,12 +26,17 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void rtgui_system_theme_init(void);
|
||||
|
||||
void rtgui_theme_draw_win(struct rtgui_topwin* win);
|
||||
void rtgui_theme_draw_button(rtgui_button_t* btn);
|
||||
void rtgui_theme_draw_label(rtgui_label_t* label);
|
||||
void rtgui_theme_draw_textbox(rtgui_textbox_t* box);
|
||||
void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox);
|
||||
|
||||
rt_uint16_t rtgui_theme_get_selected_height(void);
|
||||
void rtgui_theme_draw_selected(struct rtgui_dc* dc, rtgui_rect_t *rect);
|
||||
|
||||
rtgui_color_t rtgui_theme_default_bc(void);
|
||||
rtgui_color_t rtgui_theme_default_fc(void);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ struct rtgui_container
|
|||
/* inherit from widget */
|
||||
struct rtgui_widget parent;
|
||||
|
||||
struct rtgui_widget* focused;
|
||||
rtgui_list_t children;
|
||||
};
|
||||
typedef struct rtgui_container rtgui_container_t;
|
||||
|
|
|
@ -37,9 +37,6 @@ struct rtgui_toplevel
|
|||
|
||||
/* server thread id */
|
||||
rt_thread_t server;
|
||||
|
||||
/* current focus widget */
|
||||
rtgui_widget_t* focus;
|
||||
};
|
||||
typedef struct rtgui_toplevel rtgui_toplevel_t;
|
||||
|
||||
|
@ -51,7 +48,4 @@ void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top,
|
|||
struct rtgui_event_clip_info* info);
|
||||
void rtgui_toplevel_update_clip(rtgui_toplevel_t* top);
|
||||
|
||||
void rtgui_toplevel_set_focus(struct rtgui_toplevel* top, rtgui_widget_t* focus);
|
||||
rtgui_widget_t* rtgui_toplevel_get_focus(struct rtgui_toplevel* top);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,8 +50,9 @@ rt_bool_t rtgui_view_event_handler(struct rtgui_widget* widget, struct rtgui_eve
|
|||
|
||||
void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box);
|
||||
|
||||
void rtgui_view_show(rtgui_view_t* view);
|
||||
rtgui_modal_code_t rtgui_view_show(rtgui_view_t* view, rt_bool_t is_modal);
|
||||
void rtgui_view_hide(rtgui_view_t* view);
|
||||
void rtgui_view_end_modal(rtgui_view_t* view, rtgui_modal_code_t modal_code);
|
||||
|
||||
char* rtgui_view_get_title(rtgui_view_t* view);
|
||||
void rtgui_view_set_title(rtgui_view_t* view, const char* title);
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
/** Checks if the object is an rtgui_win */
|
||||
#define RTGUI_IS_WIN(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WIN_TYPE))
|
||||
|
||||
#define RTGUI_WIN_STYLE_MODAL 0x00
|
||||
#define RTGUI_WIN_STYLE_MODAL_LESS 0x01
|
||||
#define RTGUI_WIN_STYLE_NO_TITLE 0x02
|
||||
#define RTGUI_WIN_STYLE_NO_BORDER 0x04
|
||||
#define RTGUI_WIN_STYLE_SHOW 0x08
|
||||
#define RTGUI_WIN_STYLE_CLOSEBOX 0x10
|
||||
#define RTGUI_WIN_STYLE_MINIBOX 0x20
|
||||
#define RTGUI_WIN_STYLE_ACTIVATE 0x40
|
||||
#define RTGUI_WIN_STYLE_NO_FOCUS 0x80
|
||||
#define RTGUI_WIN_STYLE_MODAL 0x01 /* modal mode window */
|
||||
#define RTGUI_WIN_STYLE_CLOSED 0x02 /* window is closed */
|
||||
#define RTGUI_WIN_STYLE_ACTIVATE 0x04 /* window is activated */
|
||||
#define RTGUI_WIN_STYLE_NO_FOCUS 0x08 /* non-focused window */
|
||||
|
||||
#define RTGUI_WIN_STYLE_NO_TITLE 0x10 /* no title window */
|
||||
#define RTGUI_WIN_STYLE_NO_BORDER 0x20 /* no border window */
|
||||
#define RTGUI_WIN_STYLE_CLOSEBOX 0x40 /* window has the close button */
|
||||
#define RTGUI_WIN_STYLE_MINIBOX 0x80 /* window has the mini button */
|
||||
|
||||
#define RTGUI_WIN_STYLE_DEFAULT (RTGUI_WIN_STYLE_CLOSEBOX | RTGUI_WIN_STYLE_MINIBOX)
|
||||
|
||||
|
@ -51,7 +51,8 @@ struct rtgui_win
|
|||
rtgui_toplevel_t* parent_toplevel;
|
||||
|
||||
/* top window style */
|
||||
rt_uint32_t style;
|
||||
rt_uint8_t style;
|
||||
rtgui_modal_code_t modal_code;
|
||||
|
||||
/* window title */
|
||||
char* title;
|
||||
|
@ -71,8 +72,10 @@ rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* tit
|
|||
rtgui_rect_t *rect, rt_uint32_t flag);
|
||||
void rtgui_win_destroy(rtgui_win_t* win);
|
||||
|
||||
void rtgui_win_show(rtgui_win_t* win);
|
||||
rtgui_modal_code_t rtgui_win_show(rtgui_win_t* win, rt_bool_t is_modal);
|
||||
void rtgui_win_hiden(rtgui_win_t* win);
|
||||
void rtgui_win_end_modal(rtgui_win_t* win, rtgui_modal_code_t modal_code);
|
||||
|
||||
rt_bool_t rtgui_win_is_activated(struct rtgui_win* win);
|
||||
|
||||
void rtgui_win_move(struct rtgui_win* win, int x, int y);
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
#include <rtgui/widgets/view.h>
|
||||
#include <rtgui/widgets/toplevel.h>
|
||||
|
||||
#define RTGUI_WORKBENCH_FLAG_VISIBLE 0x00
|
||||
#define RTGUI_WORKBENCH_FLAG_INVISIBLE 0x01
|
||||
#define RTGUI_WORKBENCH_FLAG_FULLSCREEN 0x02
|
||||
#define RTGUI_WORKBENCH_FLAG_VISIBLE 0x00 /* workbench is visible */
|
||||
#define RTGUI_WORKBENCH_FLAG_INVISIBLE 0x01 /* workbench is invisible */
|
||||
#define RTGUI_WORKBENCH_FLAG_FULLSCREEN 0x02 /* workbench is full screen */
|
||||
#define RTGUI_WORKBENCH_FLAG_MODAL_MODE 0x04 /* workbench is modal mode showing */
|
||||
|
||||
#define RTGUI_WORKBENCH_FLAG_CLOSEBLE 0x00
|
||||
#define RTGUI_WORKBENCH_FLAG_UNCLOSEBLE 0x10
|
||||
#define RTGUI_WORKBENCH_FLAG_CLOSED 0x20
|
||||
|
||||
#define RTGUI_WORKBENCH_FLAG_DEFAULT RTGUI_WORKBENCH_FLAG_VISIBLE | RTGUI_WORKBENCH_FLAG_CLOSEBLE
|
||||
|
||||
|
@ -48,6 +50,7 @@ struct rtgui_workbench
|
|||
|
||||
/* workbench flag */
|
||||
rt_uint8_t flag;
|
||||
rtgui_modal_code_t modal_code;
|
||||
|
||||
/* workbench title */
|
||||
unsigned char* title;
|
||||
|
@ -63,7 +66,7 @@ rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
|
|||
|
||||
void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag);
|
||||
|
||||
void rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
|
||||
rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench);
|
||||
|
||||
rt_err_t rtgui_workbench_show (rtgui_workbench_t* workbench);
|
||||
rt_err_t rtgui_workbench_hide (rtgui_workbench_t* workbench);
|
||||
|
|
|
@ -21,11 +21,8 @@
|
|||
#include "panel.h"
|
||||
#include "topwin.h"
|
||||
|
||||
static char rtgui_server_stack[2048];
|
||||
static struct rt_thread rtgui_server_thread;
|
||||
|
||||
static struct rt_messagequeue rtgui_server_mq;
|
||||
static char rtgui_server_msg_pool[2048];
|
||||
static struct rt_thread *rtgui_server_tid;
|
||||
static struct rt_messagequeue *rtgui_server_mq;
|
||||
|
||||
extern struct rtgui_topwin* rtgui_server_focus_topwin;
|
||||
struct rtgui_panel* rtgui_server_focus_panel = RT_NULL;
|
||||
|
@ -476,16 +473,11 @@ static void rtgui_server_entry(void* parameter)
|
|||
SetThreadPriority(hCurrentThread, THREAD_PRIORITY_HIGHEST);
|
||||
#endif
|
||||
|
||||
/* init rtgui server msgq */
|
||||
rt_mq_init(&rtgui_server_mq,
|
||||
"rtgui",
|
||||
&rtgui_server_msg_pool[0],
|
||||
256,
|
||||
sizeof(rtgui_server_msg_pool),
|
||||
RT_IPC_FLAG_FIFO);
|
||||
|
||||
/* create rtgui server msgq */
|
||||
rtgui_server_mq = rt_mq_create("rtgui",
|
||||
256, 8, RT_IPC_FLAG_FIFO);
|
||||
/* register rtgui server thread */
|
||||
rtgui_thread_register(&rtgui_server_thread, &rtgui_server_mq);
|
||||
rtgui_thread_register(rtgui_server_tid, rtgui_server_mq);
|
||||
|
||||
/* init mouse and show */
|
||||
rtgui_mouse_init();
|
||||
|
@ -610,18 +602,18 @@ static void rtgui_server_entry(void* parameter)
|
|||
|
||||
void rtgui_server_post_event(struct rtgui_event* event, rt_size_t size)
|
||||
{
|
||||
rt_mq_send(&rtgui_server_mq, event, size);
|
||||
rt_mq_send(rtgui_server_mq, event, size);
|
||||
}
|
||||
|
||||
void rtgui_server_init()
|
||||
{
|
||||
rt_thread_init(&rtgui_server_thread,
|
||||
"rtgui",
|
||||
rtgui_server_tid = rt_thread_create("rtgui",
|
||||
rtgui_server_entry, RT_NULL,
|
||||
&rtgui_server_stack[0], sizeof(rtgui_server_stack),
|
||||
RTGUI_SVR_THREAD_STACK_SIZE,
|
||||
RTGUI_SVR_THREAD_PRIORITY,
|
||||
RTGUI_SVR_THREAD_TIMESLICE);
|
||||
|
||||
/* start rtgui server thread */
|
||||
rt_thread_startup(&rtgui_server_thread);
|
||||
if (rtgui_server_tid != RT_NULL)
|
||||
rt_thread_startup(rtgui_server_tid);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,11 @@ static void _rtgui_container_constructor(rtgui_container_t *container)
|
|||
/* set event handler and init field */
|
||||
rtgui_widget_set_event_handler(RTGUI_WIDGET(container), rtgui_container_event_handler);
|
||||
rtgui_list_init(&(container->children));
|
||||
|
||||
/* set focused widget to itself */
|
||||
container->focused = RTGUI_WIDGET(container);
|
||||
/* set container as focusable widget */
|
||||
RTGUI_WIDGET(container)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE;
|
||||
}
|
||||
|
||||
static void _rtgui_container_destructor(rtgui_container_t *container)
|
||||
|
@ -138,18 +143,18 @@ rt_bool_t rtgui_container_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
|
|||
break;
|
||||
|
||||
case RTGUI_EVENT_MOUSE_MOTION:
|
||||
#if 0
|
||||
if (rtgui_container_dispatch_mouse_event(container,
|
||||
(struct rtgui_event_mouse*)event) == RT_FALSE)
|
||||
{
|
||||
#if 0
|
||||
/* handle event in current widget */
|
||||
if (widget->on_mousemotion != RT_NULL)
|
||||
{
|
||||
return widget->on_mousemotion(widget, event);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else return RT_TRUE;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RTGUI_EVENT_COMMAND:
|
||||
|
@ -215,6 +220,14 @@ void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t*
|
|||
RT_ASSERT(container != RT_NULL);
|
||||
RT_ASSERT(child != RT_NULL);
|
||||
|
||||
if (child == container->focused)
|
||||
{
|
||||
/* set focused to itself */
|
||||
container->focused = RTGUI_WIDGET(container);
|
||||
|
||||
rtgui_widget_focus(RTGUI_WIDGET(container));
|
||||
}
|
||||
|
||||
/* remove widget from parent's children list */
|
||||
rtgui_list_remove(&(container->children), &(child->sibling));
|
||||
|
||||
|
@ -237,10 +250,19 @@ void rtgui_container_destroy_children(rtgui_container_t *container)
|
|||
|
||||
if (RTGUI_IS_CONTAINER(child))
|
||||
{
|
||||
/* break parent firstly */
|
||||
child->parent = RT_NULL;
|
||||
|
||||
/* destroy children of child */
|
||||
rtgui_container_destroy_children(RTGUI_CONTAINER(child));
|
||||
}
|
||||
|
||||
/* remove widget from parent's children list */
|
||||
rtgui_list_remove(&(container->children), &(child->sibling));
|
||||
|
||||
/* set parent and toplevel widget */
|
||||
child->parent = RT_NULL;
|
||||
|
||||
/* destroy object and remove from parent */
|
||||
rtgui_object_destroy(RTGUI_OBJECT(child));
|
||||
|
||||
|
@ -248,22 +270,12 @@ void rtgui_container_destroy_children(rtgui_container_t *container)
|
|||
}
|
||||
|
||||
container->children.next = RT_NULL;
|
||||
container->focused = RTGUI_WIDGET(container);
|
||||
if (RTGUI_WIDGET(container)->parent != RT_NULL)
|
||||
rtgui_widget_focus(RTGUI_WIDGET(container));
|
||||
|
||||
/* update widget clip */
|
||||
#if 0
|
||||
rtgui_widget_update_clip(RTGUI_WIDGET(container));
|
||||
#else
|
||||
/* update toplevel widget clip */
|
||||
#if 0
|
||||
{
|
||||
rtgui_toplevel_t* top;
|
||||
|
||||
top = RTGUI_TOPLEVEL(RTGUI_WIDGET(container)->toplevel);
|
||||
if (RTGUI_IS_VIEW(top))
|
||||
}
|
||||
#endif
|
||||
rtgui_toplevel_update_clip(RTGUI_TOPLEVEL(RTGUI_WIDGET(container)->toplevel));
|
||||
#endif
|
||||
}
|
||||
|
||||
rtgui_widget_t* rtgui_container_get_first_child(rtgui_container_t* container)
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
#include <rtgui/widgets/textbox.h>
|
||||
#include <rtgui/rtgui_theme.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#define RTGUI_TEXTBOX_LINE_MAX 64
|
||||
#define RTGUI_TEXTBOX_MARGIN 3
|
||||
|
|
|
@ -26,7 +26,6 @@ static void _rtgui_toplevel_constructor(rtgui_toplevel_t *toplevel)
|
|||
toplevel->drawing = 0;
|
||||
toplevel->external_clip_rect = RT_NULL;
|
||||
toplevel->external_clip_size = 0;
|
||||
toplevel->focus = RT_NULL;
|
||||
|
||||
/* hide toplevel default */
|
||||
RTGUI_WIDGET_HIDE(RTGUI_WIDGET(toplevel));
|
||||
|
@ -44,7 +43,6 @@ static void _rtgui_toplevel_destructor(rtgui_toplevel_t* toplevel)
|
|||
rtgui_free(toplevel->external_clip_rect);
|
||||
toplevel->external_clip_rect = RT_NULL;
|
||||
toplevel->external_clip_size = 0;
|
||||
toplevel->focus = RT_NULL;
|
||||
}
|
||||
|
||||
rtgui_type_t *rtgui_toplevel_type_get(void)
|
||||
|
@ -69,9 +67,9 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev
|
|||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_KBD:
|
||||
if (toplevel->focus != RT_NULL)
|
||||
if (RTGUI_CONTAINER(toplevel)->focused != RT_NULL)
|
||||
{
|
||||
toplevel->focus->event_handler(toplevel->focus, event);
|
||||
RTGUI_CONTAINER(toplevel)->focused->event_handler(RTGUI_CONTAINER(toplevel)->focused, event);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -105,6 +103,7 @@ rt_bool_t rtgui_toplevel_event_handler(rtgui_widget_t* widget, rtgui_event_t* ev
|
|||
widget->on_command(widget, event);
|
||||
}
|
||||
}
|
||||
else return RT_TRUE;
|
||||
break;
|
||||
|
||||
default :
|
||||
|
@ -136,7 +135,7 @@ void rtgui_toplevel_handle_clip(struct rtgui_toplevel* top,
|
|||
top->external_clip_size = info->num_rect;
|
||||
|
||||
/* copy rect array */
|
||||
rt_memcpy(top->external_clip_rect, info->rects, sizeof(rtgui_rect_t) * info->num_rect);
|
||||
rt_memcpy(top->external_clip_rect, (void*)(info + 1), sizeof(rtgui_rect_t) * info->num_rect);
|
||||
}
|
||||
|
||||
#include <rtgui/driver.h> /* to get screen rect */
|
||||
|
@ -177,18 +176,3 @@ void rtgui_toplevel_update_clip(rtgui_toplevel_t* top)
|
|||
rtgui_widget_update_clip(child);
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_toplevel_set_focus(struct rtgui_toplevel* top, rtgui_widget_t* focus)
|
||||
{
|
||||
RT_ASSERT(top != RT_NULL);
|
||||
|
||||
top->focus = focus;
|
||||
}
|
||||
|
||||
rtgui_widget_t* rtgui_toplevel_get_focus(struct rtgui_toplevel* top)
|
||||
{
|
||||
RT_ASSERT(top != RT_NULL);
|
||||
|
||||
return top->focus;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,19 +113,48 @@ void rtgui_view_set_box(rtgui_view_t* view, rtgui_box_t* box)
|
|||
rtgui_widget_set_rect(RTGUI_WIDGET(box), &(RTGUI_WIDGET(view)->extent));
|
||||
}
|
||||
|
||||
void rtgui_view_show(rtgui_view_t* view)
|
||||
rtgui_modal_code_t rtgui_view_show(rtgui_view_t* view, rt_bool_t is_modal)
|
||||
{
|
||||
if (view == RT_NULL) return;
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
/* parameter check */
|
||||
if (view == RT_NULL) return RTGUI_MODAL_CANCEL;
|
||||
|
||||
if (RTGUI_WIDGET(view)->parent == RT_NULL)
|
||||
{
|
||||
RTGUI_WIDGET_UNHIDE(RTGUI_WIDGET(view));
|
||||
return;
|
||||
return RTGUI_MODAL_CANCEL;
|
||||
}
|
||||
|
||||
rtgui_workbench_show_view((rtgui_workbench_t*)(RTGUI_WIDGET(view)->parent), view);
|
||||
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(view)->parent);
|
||||
rtgui_workbench_show_view(workbench, view);
|
||||
if (RTGUI_WIDGET_IS_FOCUSABLE(RTGUI_WIDGET(view)))
|
||||
rtgui_widget_focus(RTGUI_WIDGET(view));
|
||||
|
||||
if (is_modal == RT_TRUE)
|
||||
{
|
||||
/* set modal mode */
|
||||
workbench->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||
|
||||
/* perform workbench event loop */
|
||||
rtgui_workbench_event_loop(workbench);
|
||||
return workbench->modal_code;
|
||||
}
|
||||
|
||||
/* no modal mode, always return modal_ok */
|
||||
return RTGUI_MODAL_OK;
|
||||
}
|
||||
|
||||
void rtgui_view_end_modal(rtgui_view_t* view, rtgui_modal_code_t modal_code)
|
||||
{
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
/* parameter check */
|
||||
if ((view == RT_NULL) || (RTGUI_WIDGET(view)->parent == RT_NULL))return ;
|
||||
|
||||
workbench = RTGUI_WORKBENCH(RTGUI_WIDGET(view)->parent);
|
||||
workbench->modal_code = modal_code;
|
||||
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||
}
|
||||
|
||||
void rtgui_view_hide(rtgui_view_t* view)
|
||||
|
|
|
@ -226,30 +226,45 @@ void rtgui_widget_set_oncommand(rtgui_widget_t* widget, rtgui_event_handler_ptr
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Focuses the widget. The focused widget is the one which receives the keyboard events
|
||||
* @brief Focuses the widget. The focused widget is the widget which can receive the keyboard events
|
||||
* @param widget a widget
|
||||
* @note The widget has to be attached to a toplevel widget, otherwise it will have no effect
|
||||
*/
|
||||
void rtgui_widget_focus(rtgui_widget_t *widget)
|
||||
{
|
||||
rtgui_widget_t *focused;
|
||||
rtgui_widget_t *focused;
|
||||
rtgui_container_t *parent;
|
||||
|
||||
if (!widget || !widget->toplevel || !RTGUI_WIDGET_IS_FOCUSABLE(widget) || !RTGUI_WIDGET_IS_ENABLE(widget))
|
||||
RT_ASSERT(widget != RT_NULL);
|
||||
|
||||
if (!widget->parent || !RTGUI_WIDGET_IS_FOCUSABLE(widget) || !RTGUI_WIDGET_IS_ENABLE(widget))
|
||||
return;
|
||||
|
||||
focused = rtgui_toplevel_get_focus(RTGUI_TOPLEVEL(widget->toplevel));
|
||||
|
||||
if ( focused != RT_NULL && widget == focused)
|
||||
return;
|
||||
|
||||
if (focused != RT_NULL)
|
||||
{
|
||||
rtgui_widget_unfocus(focused);
|
||||
}
|
||||
|
||||
rtgui_toplevel_set_focus(RTGUI_TOPLEVEL(widget->toplevel), widget);
|
||||
/* set widget as focused */
|
||||
widget->flag |= RTGUI_WIDGET_FLAG_FOCUS;
|
||||
|
||||
/* get parent container */
|
||||
parent = RTGUI_CONTAINER(widget->parent);
|
||||
|
||||
/* get old focused widget */
|
||||
focused = parent->focused;
|
||||
if (focused == widget) return ; /* it's the same focused widget */
|
||||
|
||||
if (focused != RT_NULL)
|
||||
rtgui_widget_unfocus(focused);
|
||||
|
||||
/* set widget as focused widget in parent link */
|
||||
parent->focused = widget;
|
||||
while (RTGUI_WIDGET(parent)->parent != RT_NULL)
|
||||
{
|
||||
parent = RTGUI_CONTAINER(RTGUI_WIDGET(parent)->parent);
|
||||
parent->focused = widget;
|
||||
|
||||
/* if the parent is hide, break it */
|
||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(parent))) break;
|
||||
}
|
||||
|
||||
/* invoke on focus in call back */
|
||||
if (widget->on_focus_in)
|
||||
widget->on_focus_in(widget, RT_NULL);
|
||||
}
|
||||
|
@ -260,16 +275,13 @@ void rtgui_widget_focus(rtgui_widget_t *widget)
|
|||
*/
|
||||
void rtgui_widget_unfocus(rtgui_widget_t *widget)
|
||||
{
|
||||
if (!widget || !widget->toplevel || !RTGUI_WIDGET_IS_FOCUS(widget))
|
||||
return;
|
||||
|
||||
if (rtgui_toplevel_get_focus(RTGUI_TOPLEVEL(widget->toplevel)) == widget)
|
||||
{
|
||||
rtgui_toplevel_set_focus(RTGUI_TOPLEVEL(widget->toplevel), RT_NULL);
|
||||
}
|
||||
RT_ASSERT(widget != RT_NULL);
|
||||
|
||||
widget->flag &= ~RTGUI_WIDGET_FLAG_FOCUS;
|
||||
|
||||
if (!widget->toplevel || !RTGUI_WIDGET_IS_FOCUS(widget))
|
||||
return;
|
||||
|
||||
if (widget->on_focus_out)
|
||||
widget->on_focus_out(widget, RT_NULL);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <rtgui/widgets/window.h>
|
||||
#include <rtgui/widgets/button.h>
|
||||
#include <rtgui/widgets/workbench.h>
|
||||
|
||||
static void _rtgui_win_constructor(rtgui_win_t *win)
|
||||
{
|
||||
|
@ -141,26 +142,43 @@ rtgui_win_t* rtgui_win_create(rtgui_toplevel_t* parent_toplevel, const char* tit
|
|||
|
||||
void rtgui_win_destroy(struct rtgui_win* win)
|
||||
{
|
||||
if (win->parent_toplevel == RT_NULL)
|
||||
if (win->parent_toplevel != RT_NULL)
|
||||
{
|
||||
rtgui_thread_t *rtgui_tid;
|
||||
if (win->style & RTGUI_WIN_STYLE_MODAL)
|
||||
{
|
||||
/* exit modal mode */
|
||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
||||
/* set style to closed */
|
||||
win->style |= RTGUI_WIN_STYLE_CLOSED;
|
||||
}
|
||||
else rtgui_widget_destroy(RTGUI_WIDGET(win));
|
||||
|
||||
rtgui_tid = (rtgui_thread_t*) rt_thread_self()->user_data;
|
||||
rtgui_tid->is_quit = RT_TRUE;
|
||||
}
|
||||
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(win));
|
||||
else if (win->style & RTGUI_WIN_STYLE_CLOSED)
|
||||
{
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(win));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* exit modal mode */
|
||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
||||
/* set style to closed */
|
||||
win->style |= RTGUI_WIN_STYLE_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_win_show(struct rtgui_win* win)
|
||||
rtgui_modal_code_t rtgui_win_show(struct rtgui_win* win, rt_bool_t is_modal)
|
||||
{
|
||||
rtgui_modal_code_t result;
|
||||
|
||||
RT_ASSERT(win != RT_NULL);
|
||||
result = RTGUI_MODAL_CANCEL;
|
||||
|
||||
/* if it does not register into server, create it in server */
|
||||
if (RTGUI_TOPLEVEL(win)->server == RT_NULL)
|
||||
{
|
||||
if (_rtgui_win_create_in_server(win) == RT_FALSE)
|
||||
return;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(win)))
|
||||
|
@ -174,13 +192,59 @@ void rtgui_win_show(struct rtgui_win* win)
|
|||
sizeof(struct rtgui_event_win_show)) != RT_EOK)
|
||||
{
|
||||
/* hide window failed */
|
||||
return;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* set window unhidden */
|
||||
RTGUI_WIDGET_UNHIDE(RTGUI_WIDGET(win));
|
||||
}
|
||||
else rtgui_widget_update(RTGUI_WIDGET(win));
|
||||
|
||||
if (is_modal == RT_TRUE)
|
||||
{
|
||||
if (win->parent_toplevel != RT_NULL)
|
||||
{
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
/* get root toplevel */
|
||||
workbench = RTGUI_WORKBENCH(win->parent_toplevel);
|
||||
workbench->flag |= RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||
|
||||
rtgui_workbench_event_loop(workbench);
|
||||
result = workbench->modal_code;
|
||||
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* which is a root window */
|
||||
win->style |= RTGUI_WIN_STYLE_MODAL;
|
||||
rtgui_win_event_loop(win);
|
||||
|
||||
result = win->modal_code;
|
||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void rtgui_win_end_modal(struct rtgui_win* win, rtgui_modal_code_t modal_code)
|
||||
{
|
||||
if (win->parent_toplevel != RT_NULL)
|
||||
{
|
||||
rtgui_workbench_t* workbench;
|
||||
|
||||
/* which is shown under workbench */
|
||||
workbench = RTGUI_WORKBENCH(win->parent_toplevel);
|
||||
workbench->modal_code = modal_code;
|
||||
workbench->flag &= ~RTGUI_WORKBENCH_FLAG_MODAL_MODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* which is a stand alone window */
|
||||
win->modal_code = modal_code;
|
||||
win->style &= ~RTGUI_WIN_STYLE_MODAL;
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_win_hiden(struct rtgui_win* win)
|
||||
|
@ -244,9 +308,6 @@ void rtgui_win_move(struct rtgui_win* win, int x, int y)
|
|||
|
||||
/* set window visible */
|
||||
RTGUI_WIDGET_UNHIDE(RTGUI_WIDGET(win));
|
||||
|
||||
/* update window */
|
||||
// rtgui_widget_update(RTGUI_WIDGET(win));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -284,7 +345,7 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
|||
switch (event->type)
|
||||
{
|
||||
case RTGUI_EVENT_WIN_SHOW:
|
||||
rtgui_win_show(win);
|
||||
rtgui_win_show(win, RT_FALSE);
|
||||
break;
|
||||
|
||||
case RTGUI_EVENT_WIN_HIDE:
|
||||
|
@ -304,13 +365,13 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
|||
return RT_TRUE;
|
||||
|
||||
case RTGUI_EVENT_WIN_MOVE:
|
||||
{
|
||||
struct rtgui_event_win_move* emove = (struct rtgui_event_win_move*)event;
|
||||
{
|
||||
struct rtgui_event_win_move* emove = (struct rtgui_event_win_move*)event;
|
||||
|
||||
/* move window */
|
||||
rtgui_win_move(win, emove->x, emove->y);
|
||||
}
|
||||
break;
|
||||
/* move window */
|
||||
rtgui_win_move(win, emove->x, emove->y);
|
||||
}
|
||||
break;
|
||||
|
||||
case RTGUI_EVENT_WIN_ACTIVATE:
|
||||
if (RTGUI_WIDGET_IS_HIDE(RTGUI_WIDGET(win)))
|
||||
|
@ -380,21 +441,36 @@ rt_bool_t rtgui_win_event_handler(struct rtgui_widget* widget, struct rtgui_even
|
|||
/* windows event loop */
|
||||
void rtgui_win_event_loop(rtgui_win_t* wnd)
|
||||
{
|
||||
rtgui_thread_t *rtgui_tid;
|
||||
/* the buffer uses to receive event */
|
||||
char event_buf[256];
|
||||
|
||||
struct rtgui_event* event = (struct rtgui_event*)&event_buf[0];
|
||||
rtgui_tid = (rtgui_thread_t*) rt_thread_self()->user_data;
|
||||
|
||||
while (rtgui_tid->is_quit == RT_FALSE)
|
||||
if (wnd->style & RTGUI_WIN_STYLE_MODAL)
|
||||
{
|
||||
if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
|
||||
while (wnd->style & RTGUI_WIN_STYLE_MODAL)
|
||||
{
|
||||
if (RTGUI_WIDGET(wnd)->event_handler(RTGUI_WIDGET(wnd), event) == RT_TRUE)
|
||||
rtgui_tid->is_quit = RT_TRUE;
|
||||
if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
|
||||
{
|
||||
/* perform event handler */
|
||||
RTGUI_WIDGET(wnd)->event_handler(RTGUI_WIDGET(wnd), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!(wnd->style & RTGUI_WIN_STYLE_CLOSED))
|
||||
{
|
||||
if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
|
||||
{
|
||||
/* perform event handler */
|
||||
RTGUI_WIDGET(wnd)->event_handler(RTGUI_WIDGET(wnd), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* destroy window */
|
||||
rtgui_widget_destroy(RTGUI_WIDGET(wnd));
|
||||
}
|
||||
|
||||
void rtgui_win_set_rect(rtgui_win_t* win, rtgui_rect_t* rect)
|
||||
|
|
|
@ -23,6 +23,7 @@ static void _rtgui_workbench_constructor(rtgui_workbench_t *workbench)
|
|||
/* set attributes */
|
||||
workbench->panel = RT_NULL;
|
||||
workbench->flag = RTGUI_WORKBENCH_FLAG_DEFAULT;
|
||||
workbench->modal_code = RTGUI_MODAL_OK;
|
||||
workbench->current_view = RT_NULL;
|
||||
}
|
||||
|
||||
|
@ -157,10 +158,8 @@ void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag)
|
|||
workbench->flag = flag;
|
||||
}
|
||||
|
||||
void rtgui_workbench_event_loop(rtgui_workbench_t* workbench)
|
||||
rt_bool_t rtgui_workbench_event_loop(rtgui_workbench_t* workbench)
|
||||
{
|
||||
int quit = 0;
|
||||
|
||||
/* the buffer uses to receive event */
|
||||
char event_buf[256];
|
||||
struct rtgui_event* event = (struct rtgui_event*)&event_buf[0];
|
||||
|
@ -168,13 +167,29 @@ void rtgui_workbench_event_loop(rtgui_workbench_t* workbench)
|
|||
/* show workbench firstly */
|
||||
rtgui_workbench_show(workbench);
|
||||
|
||||
while (!quit)
|
||||
if (workbench->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
|
||||
{
|
||||
if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
|
||||
/* event loop for modal mode shown view */
|
||||
while (workbench->flag & RTGUI_WORKBENCH_FLAG_MODAL_MODE)
|
||||
{
|
||||
RTGUI_WIDGET(workbench)->event_handler(RTGUI_WIDGET(workbench), event);
|
||||
if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
|
||||
{
|
||||
RTGUI_WIDGET(workbench)->event_handler(RTGUI_WIDGET(workbench), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!(workbench->flag & RTGUI_WORKBENCH_FLAG_CLOSED))
|
||||
{
|
||||
if (rtgui_thread_recv(event, sizeof(event_buf)) == RT_EOK)
|
||||
{
|
||||
RTGUI_WIDGET(workbench)->event_handler(RTGUI_WIDGET(workbench), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
rt_err_t rtgui_workbench_show(rtgui_workbench_t* workbench)
|
||||
|
@ -301,6 +316,13 @@ rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* e
|
|||
}
|
||||
else
|
||||
{
|
||||
if (RTGUI_CONTAINER(widget)->focused == widget)
|
||||
{
|
||||
/* set focused widget to the current view */
|
||||
if (workbench->current_view != RT_NULL)
|
||||
rtgui_widget_focus(RTGUI_WIDGET(RTGUI_CONTAINER(workbench->current_view)->focused));
|
||||
}
|
||||
|
||||
return rtgui_toplevel_event_handler(widget, event);
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +488,7 @@ void rtgui_workbench_hide_view(rtgui_workbench_t* workbench, rtgui_view_t* view)
|
|||
|
||||
if (next_view != RT_NULL)
|
||||
{
|
||||
rtgui_view_show(next_view);
|
||||
rtgui_view_show(next_view, RT_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue