diff --git a/README.md b/README.md index 0d17b7485f46d36705175f4c95adbfa807d2a091..754f6995e75a3adbb6f9aaa0be85cc14eb688dd5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ RT-Thread ========= +[![Build Status](https://travis-ci.org/RT-Thread/rt-thread.png)](https://travis-ci.org/RT-Thread/rt-thread) + RT-Thread is an open source real-time operating system for embedded devices. diff --git a/bsp/simulator/SConstruct b/bsp/simulator/SConstruct index 12dbd7a025cbcb8ddfc087e81f5e6ffbdd4897f1..ed5994d2f78caf7d10f74389245dbf34deb253b7 100755 --- a/bsp/simulator/SConstruct +++ b/bsp/simulator/SConstruct @@ -12,14 +12,14 @@ if os.getenv('RTT_RTGUI'): else: # set the rtgui root directory by hand # empty string means use the RTGUI in svn - # RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui') - RTT_RTGUI ='' + RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui') + # RTT_RTGUI ='' sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] from building import * -env = Environment() +env = Environment(TARGET_ARCH='x86') Export('RTT_ROOT') Export('rtconfig') @@ -51,13 +51,34 @@ if rtconfig.PLATFORM == 'cl': env.Append(LINKFLAGS=rtconfig.LFLAGS) env['LIBS']=libs env['CPPDEFINES']=definitions +elif rtconfig.PLATFORM == 'mingw': + libs = Split(''' + winmm + gdi32 + winspool + comdlg32 + advapi32 + shell32 + ole32 + oleaut32 + uuid + odbc32 + odbccp32 + ''') + TARGET = 'rtthread-win32.' + rtconfig.TARGET_EXT + env = Environment(tools = ['mingw'], + AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, + CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, + AR = rtconfig.AR, ARFLAGS = '-rc', + LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) + env['LIBS']=libs + env.PrependENVPath('PATH', rtconfig.EXEC_PATH) else: TARGET = 'rtthread' env.Append(CCFLAGS=rtconfig.CFLAGS) env.Append(LINKFLAGS=rtconfig.LFLAGS) env.Append(LIBS=['m']) - # prepare building environment objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False, remove_components=['rtgui']) @@ -85,8 +106,42 @@ if GetDepend('RT_USING_RTGUI'): if GetDepend('RT_USING_TC'): objs = objs + SConscript(RTT_ROOT + '/examples/kernel/SConscript', variant_dir = 'build/tc/kernel', duplicate=0) -# build program -program = env.Program(TARGET, objs) +def ObjRemove(objs, remove): + for item in objs: + # print type(item), os.path.basename(str(item)) + if os.path.basename(str(item)) in remove: + objs.remove(item) + return + +# build program -shared +if GetDepend('RT_USING_MODULE'): + # Remove module.c in $RTT_ROOT/src + ObjRemove(objs, ['module.obj', 'module.o']) + + AddOption('--def', + dest='def', + action='store_true', + default=False, + help='create rthread.def of rtthread.dll on windows') + if GetOption('def'): + if rtconfig.PLATFORM != 'mingw': + print "scons error: `--def' can only work with mingw" + exit(1) + + env['LINKFLAGS'] = rtconfig.DEFFILE_LFLAGS + env.SharedLibrary("rtthread.dll", objs) + program = '' + else: + if rtconfig.PLATFORM == 'cl': + objs += ['rtthread.def'] + elif rtconfig.PLATFORM == 'mingw': + rtconfig.POST_ACTION = 'del /Q rtthread.lib \n rename librtthread.a rtthread.lib\n' + # rtconfig.POST_ACTION = 'lib /machine:i386 /def:rtthread.def /out:rtthread.lib' + env.SharedLibrary("rtthread.dll", objs) + program = env.Program(TARGET, 'dummy.c', LIBS='rtthread', LIBPATH='.') + +else: + program = env.Program(TARGET, objs) # end building EndBuilding(TARGET, program) diff --git a/bsp/simulator/applications/SConscript b/bsp/simulator/applications/SConscript index 828b49f77f9592fe37e67b2e40016d20e64062bf..6dbd985812698abb936ebfcb0f686a868e348e2d 100644 --- a/bsp/simulator/applications/SConscript +++ b/bsp/simulator/applications/SConscript @@ -6,6 +6,8 @@ src = Glob('*.c') # remove no need file. if GetDepend('RT_USING_DFS_WINSHAREDIR') == False: SrcRemove(src, 'dfs_win32.c') +if GetDepend('RT_USING_MODULE') == False: + SrcRemove(src, ['module_win32.c']) CPPPATH = [cwd, str(Dir('#'))] group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/simulator/applications/application.c b/bsp/simulator/applications/application.c index 86db4113aa1eb25a1698f780f2ce245a62758efe..7aab9f2dbbfe456e7cf08340eff132101f40695d 100755 --- a/bsp/simulator/applications/application.c +++ b/bsp/simulator/applications/application.c @@ -25,11 +25,11 @@ void rt_init_thread_entry(void *parameter) pcap_netif_hw_init(); #endif + rt_platform_init(); + /* initialization RT-Thread Components */ rt_components_init(); - rt_platform_init(); - /* File system Initialization */ #ifdef RT_USING_DFS { diff --git a/bsp/simulator/applications/dfs_win32.c b/bsp/simulator/applications/dfs_win32.c index 121ed39b81bc5c531f77ef1375621785d430546c..51f0d295daadcf19d099ab305d22518229256dd5 100644 --- a/bsp/simulator/applications/dfs_win32.c +++ b/bsp/simulator/applications/dfs_win32.c @@ -27,6 +27,22 @@ #include #include +#if defined(__MINGW32__) && defined(_NO_OLDNAMES) +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_ACCMODE _O_ACCMODE +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT +#define O_SEQUENTIAL _O_SEQUENTIAL +#define O_RANDOM _O_RANDOM +#endif /* * RT-Thread DFS Interface for win-directory as an disk device */ @@ -95,7 +111,7 @@ static int dfs_win32_unmount(struct dfs_filesystem *fs) return 0; } -static int dfs_win32_mkfs(const char *device_name) +static int dfs_win32_mkfs(rt_device_t devid) { return -DFS_STATUS_ENOSYS; } @@ -132,6 +148,14 @@ static char *winpath_dirdup(char *des, const char *src) return path; } +/* This function can convert the path in rt-thread/dfs to the path in windows */ +char * dfs_win32_dirdup(char * path) +{ + char * file_path; + file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, path); + return file_path; +} + static int dfs_win32_open(struct dfs_fd *file) { int fd; diff --git a/bsp/simulator/applications/module_win32.c b/bsp/simulator/applications/module_win32.c new file mode 100644 index 0000000000000000000000000000000000000000..5247b4fc67fa745f35b195964e2ff25c93c7ecdb --- /dev/null +++ b/bsp/simulator/applications/module_win32.c @@ -0,0 +1,367 @@ +/* + * File : module.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2013-02-26 prife first version for win32 + */ + +#include +#include +#include + +#ifdef RT_USING_MODULE +static void rt_module_init_object_container(struct rt_module *module) +{ + RT_ASSERT(module != RT_NULL); + + /* initialize object container - thread */ + rt_list_init(&(module->module_object[RT_Object_Class_Thread].object_list)); + module->module_object[RT_Object_Class_Thread].object_size = sizeof(struct rt_thread); + module->module_object[RT_Object_Class_Thread].type = RT_Object_Class_Thread; + +#ifdef RT_USING_SEMAPHORE + /* initialize object container - semaphore */ + rt_list_init(&(module->module_object[RT_Object_Class_Semaphore].object_list)); + module->module_object[RT_Object_Class_Semaphore].object_size = sizeof(struct rt_semaphore); + module->module_object[RT_Object_Class_Semaphore].type = RT_Object_Class_Semaphore; +#endif + +#ifdef RT_USING_MUTEX + /* initialize object container - mutex */ + rt_list_init(&(module->module_object[RT_Object_Class_Mutex].object_list)); + module->module_object[RT_Object_Class_Mutex].object_size = sizeof(struct rt_mutex); + module->module_object[RT_Object_Class_Mutex].type = RT_Object_Class_Mutex; +#endif + +#ifdef RT_USING_EVENT + /* initialize object container - event */ + rt_list_init(&(module->module_object[RT_Object_Class_Event].object_list)); + module->module_object[RT_Object_Class_Event].object_size = sizeof(struct rt_event); + module->module_object[RT_Object_Class_Event].type = RT_Object_Class_Event; +#endif + +#ifdef RT_USING_MAILBOX + /* initialize object container - mailbox */ + rt_list_init(&(module->module_object[RT_Object_Class_MailBox].object_list)); + module->module_object[RT_Object_Class_MailBox].object_size = sizeof(struct rt_mailbox); + module->module_object[RT_Object_Class_MailBox].type = RT_Object_Class_MailBox; +#endif + +#ifdef RT_USING_MESSAGEQUEUE + /* initialize object container - message queue */ + rt_list_init(&(module->module_object[RT_Object_Class_MessageQueue].object_list)); + module->module_object[RT_Object_Class_MessageQueue].object_size = sizeof(struct rt_messagequeue); + module->module_object[RT_Object_Class_MessageQueue].type = RT_Object_Class_MessageQueue; +#endif + +#ifdef RT_USING_MEMHEAP + /* initialize object container - memory heap */ + rt_list_init(&(module->module_object[RT_Object_Class_MemHeap].object_list)); + module->module_object[RT_Object_Class_MemHeap].object_size = sizeof(struct rt_memheap); + module->module_object[RT_Object_Class_MemHeap].type = RT_Object_Class_MemHeap; +#endif + +#ifdef RT_USING_MEMPOOL + /* initialize object container - memory pool */ + rt_list_init(&(module->module_object[RT_Object_Class_MemPool].object_list)); + module->module_object[RT_Object_Class_MemPool].object_size = sizeof(struct rt_mempool); + module->module_object[RT_Object_Class_MemPool].type = RT_Object_Class_MemPool; +#endif + +#ifdef RT_USING_DEVICE + /* initialize object container - device */ + rt_list_init(&(module->module_object[RT_Object_Class_Device].object_list)); + module->module_object[RT_Object_Class_Device].object_size = sizeof(struct rt_device); + module->module_object[RT_Object_Class_Device].type = RT_Object_Class_Device; +#endif + + /* initialize object container - timer */ + rt_list_init(&(module->module_object[RT_Object_Class_Timer].object_list)); + module->module_object[RT_Object_Class_Timer].object_size = sizeof(struct rt_timer); + module->module_object[RT_Object_Class_Timer].type = RT_Object_Class_Timer; +} + +#ifdef RT_USING_HOOK +static void (*rt_module_load_hook)(rt_module_t module); +static void (*rt_module_unload_hook)(rt_module_t module); + +/** + * @addtogroup Hook + */ + +/*@{*/ + +/** + * This function will set a hook function, which will be invoked when module + * be loaded to system. + * + * @param hook the hook function + */ +void rt_module_load_sethook(void (*hook)(rt_module_t module)) +{ + rt_module_load_hook = hook; +} + +/** + * This function will set a hook function, which will be invoked when module + * be unloaded from system. + * + * @param hook the hook function + */ +void rt_module_unload_sethook(void (*hook)(rt_module_t module)) +{ + rt_module_unload_hook = hook; +} + +/*@}*/ +#endif + +/** + * @ingroup SystemInit + * + * This function will initialize system module + */ +void rt_system_module_init(void) +{ +} + +/** + * This function will return self module object + * + * @return the self module object + */ +rt_module_t rt_module_self(void) +{ + rt_thread_t tid; + + tid = rt_thread_self(); + if (tid == RT_NULL) + return RT_NULL; + + /* return current module */ + return (rt_module_t)tid->module_id; +} + +/** + * This function will find the specified module. + * + * @param name the name of module finding + * + * @return the module + */ +rt_module_t rt_module_find(const char *name) +{ + struct rt_object_information *information; + struct rt_object *object; + struct rt_list_node *node; + + extern struct rt_object_information rt_object_container[]; + + RT_DEBUG_NOT_IN_INTERRUPT; + + /* enter critical */ + rt_enter_critical(); + + /* try to find device object */ + information = &rt_object_container[RT_Object_Class_Module]; + for (node = information->object_list.next; + node != &(information->object_list); + node = node->next) + { + object = rt_list_entry(node, struct rt_object, list); + if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0) + { + /* leave critical */ + rt_exit_critical(); + + return (rt_module_t)object; + } + } + + /* leave critical */ + rt_exit_critical(); + + /* not found */ + return RT_NULL; +} + +#ifdef RT_USING_DFS +#include +#include +extern char * dfs_win32_dirdup(char * path); +static char* _module_name(const char *path) +{ + const char *first, *end, *ptr; + char *name; + int size; + + ptr = (char *)path; + first = ptr; + end = path + rt_strlen(path); + + while (*ptr != '\0') + { + if (*ptr == '/') + first = ptr + 1; + if (*ptr == '.') + end = ptr - 1; + + ptr ++; + } + + size = end - first + 1; + name = rt_malloc(size); + rt_strncpy(name, first, size); + name[size] = '\0'; + + return name; +} + +typedef int (*appentry_t)(void); +/** + * This function will load a module from a file + * + * @param path the full path of application module + * + * @return the module object + */ +rt_module_t rt_module_open(const char *path) +{ + struct dfs_filesystem *fs; + appentry_t fptr; + HINSTANCE hinstlib; + int len; + char * winpath; + rt_module_t module; + char * name; + + RT_DEBUG_NOT_IN_INTERRUPT; + + /* check parameters */ + RT_ASSERT(path != RT_NULL); + + /* app module should only in DFS_WIN32 */ + fs = dfs_filesystem_lookup(path); + if ((fs == RT_NULL) || (strcmp(fs->ops->name,"wdir") != 0)) + { + rt_kprintf("invalid path: %s\n", path); + return RT_NULL; + } + + /* change path */ + len = strlen(path+1); + if ((winpath = dfs_win32_dirdup((char *)path)) == RT_NULL) + { + rt_kprintf("out of memory, exit", path); + return RT_NULL; + } + + hinstlib = LoadLibrary(winpath); + if (hinstlib == NULL) + { + rt_kprintf("error: unable to open %s\n", winpath); + return RT_NULL; + } + + fptr = (appentry_t)GetProcAddress(hinstlib, "main"); + if (fptr == NULL) + { + rt_kprintf("error: unable to find function in %s\n", winpath); + FreeLibrary(hinstlib); + return RT_NULL; + } + + /* get the name of the module */ + name = _module_name(path); + + /* allocate module */ + module = (struct rt_module *)rt_object_allocate(RT_Object_Class_Module, + name); + if (!module) + return RT_NULL; + + module->nref = 0; + module->module_entry = fptr; + + /* init module object container */ + rt_module_init_object_container(module); + + /* increase module reference count */ + module->nref ++; + + if (module->module_entry != 0) + { + rt_uint32_t *stack_size; + rt_uint8_t *priority; + +#ifdef RT_USING_SLAB + /* init module memory allocator */ + module->mem_list = RT_NULL; + + /* create page array */ + module->page_array = + (void *)rt_malloc(PAGE_COUNT_MAX * sizeof(struct rt_page_info)); + module->page_cnt = 0; +#endif + + /* get the main thread stack size */ + module->stack_size = 2048; + module->thread_priority = RT_THREAD_PRIORITY_MAX - 2; + + /* create module thread */ + module->module_thread = + rt_thread_create(name, + (void(*)(void *))module->module_entry, + RT_NULL, + module->stack_size, + module->thread_priority, + 10); + + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("thread entry 0x%x\n", + module->module_entry)); + + /* set module id */ + module->module_thread->module_id = (void *)module; + module->parent.flag = RT_MODULE_FLAG_WITHENTRY; + + /* startup module thread */ + rt_thread_startup(module->module_thread); + } + else + { + /* without entry point */ + module->parent.flag |= RT_MODULE_FLAG_WITHOUTENTRY; + } + +#ifdef RT_USING_HOOK + if (rt_module_load_hook != RT_NULL) + { + rt_module_load_hook(module); + } +#endif + + rt_free(name); + return module; + /* FreeLibrary(hinstlib); */ +} + +#if defined(RT_USING_FINSH) +#include + +FINSH_FUNCTION_EXPORT_ALIAS(rt_module_open, exec, exec module from a file); +#endif + +#endif + +rt_err_t rt_module_destroy(rt_module_t module) +{ + return 0; +} +#endif diff --git a/bsp/simulator/drivers/board.c b/bsp/simulator/drivers/board.c index 669628df75858ae4f757fd018a38cbf893d125d7..dcb8d9a0490e3c9f2c82ece57b8163b2d73bca62 100755 --- a/bsp/simulator/drivers/board.c +++ b/bsp/simulator/drivers/board.c @@ -53,7 +53,7 @@ void rt_hw_win32_low_cpu(void) #endif } -#ifdef _WIN32 +#ifdef _MSC_VER #ifndef _CRT_TERMINATE_DEFINED #define _CRT_TERMINATE_DEFINED _CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code); diff --git a/bsp/simulator/drivers/sdl_fb.c b/bsp/simulator/drivers/sdl_fb.c index 714d263ba029c60f848da926ccfb3f8149fe1ce1..53779808ca91cc80e53cedd2fea7898dab85decc 100755 --- a/bsp/simulator/drivers/sdl_fb.c +++ b/bsp/simulator/drivers/sdl_fb.c @@ -151,6 +151,7 @@ static void sdlfb_hw_init(void) #include #ifdef _WIN32 +static HANDLE sdl_ok_event = NULL; static DWORD WINAPI sdl_loop(LPVOID lpParam) #else static void *sdl_loop(void *lpParam) @@ -172,7 +173,9 @@ static void *sdl_loop(void *lpParam) device = rt_device_find("sdl"); rtgui_graphic_set_device(device); - +#ifdef _WIN32 + SetEvent(sdl_ok_event); +#endif /* handle SDL event */ while (!quit) { @@ -307,7 +310,15 @@ void rt_hw_sdl_start(void) #ifdef _WIN32 HANDLE thread; DWORD thread_id; - + sdl_ok_event = CreateEvent(NULL, + FALSE, + FALSE, + NULL); + if (sdl_ok_event == NULL) + { + printf("error, create SDL event failed\n"); + exit(-1); + } /* create thread that loop sdl event */ thread = CreateThread(NULL, 0, @@ -322,6 +333,9 @@ void rt_hw_sdl_start(void) return; } ResumeThread(thread); + + /* wait until SDL LCD device is registered and seted */ + WaitForSingleObject(sdl_ok_event, INFINITE); #else /* Linux */ pthread_t pid; diff --git a/bsp/simulator/dummy.c b/bsp/simulator/dummy.c new file mode 100644 index 0000000000000000000000000000000000000000..67a38866cbc00b536b45ba5e872df995fffac966 --- /dev/null +++ b/bsp/simulator/dummy.c @@ -0,0 +1,4 @@ +int dummy_main() +{ + return 0; +} diff --git a/bsp/simulator/mingw.ld b/bsp/simulator/mingw.ld new file mode 100644 index 0000000000000000000000000000000000000000..d5ff228fa18f262f531d036cb140c76ba944189d --- /dev/null +++ b/bsp/simulator/mingw.ld @@ -0,0 +1,222 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT(pei-i386) +SEARCH_DIR("/usr/local/mingw32/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); +SECTIONS +{ + /* Make the virtual address and file offset synced if the alignment is + lower than the target page size. */ + . = SIZEOF_HEADERS; + . = ALIGN(__section_alignment__); + .text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) : + { + *(.init) + *(.text) + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + PROVIDE (etext = .); + *(.gcc_except_table) + } + + /* setction information for finsh shell begin */ + . = ALIGN(__section_alignment__); + FSymTab () : + { + ___fsymtab_start = .; __fsymtab_start = .; + KEEP(*(FSymTab)) + ___fsymtab_end = .; __fsymtab_end = .; + } + . = ALIGN(__section_alignment__); + VSymTab () : + { + ___vsymtab_start = .; __vsymtab_start = .; + KEEP(*(VSymTab)) + ___vsymtab_end = .; __vsymtab_end = .; + } + /* setction information for finsh shell end */ + + /* The Cygwin32 library uses a section to avoid copying certain data + on fork. This used to be named ".data". The linker used + to include this between __data_start__ and __data_end__, but that + breaks building the cygwin32 dll. Instead, we name the section + ".data_cygwin_nocopy" and explictly include it after __data_end__. */ + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data) + *(.data2) + *(SORT(.data$*)) + *(.jcr) + __data_end__ = . ; + *(.data_cygwin_nocopy) + } + + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + *(SORT(.rdata$*)) + *(.eh_frame) + ___RUNTIME_PSEUDO_RELOC_LIST__ = .; + __RUNTIME_PSEUDO_RELOC_LIST__ = .; + *(.rdata_runtime_pseudo_reloc) + ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + __RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + } + .pdata BLOCK(__section_alignment__) : + { + *(.pdata) + } + .bss BLOCK(__section_alignment__) : + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + .edata BLOCK(__section_alignment__) : + { + *(.edata) + } + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + } + .idata BLOCK(__section_alignment__) : + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + .CRT BLOCK(__section_alignment__) : + { + ___crt_xc_start__ = . ; + *(SORT(.CRT$XC*)) /* C initialization */ + ___crt_xc_end__ = . ; + ___crt_xi_start__ = . ; + *(SORT(.CRT$XI*)) /* C++ initialization */ + ___crt_xi_end__ = . ; + ___crt_xl_start__ = . ; + *(SORT(.CRT$XL*)) /* TLS callbacks */ + /* ___crt_xl_end__ is defined in the TLS Directory support code */ + ___crt_xp_start__ = . ; + *(SORT(.CRT$XP*)) /* Pre-termination */ + ___crt_xp_end__ = . ; + ___crt_xt_start__ = . ; + *(SORT(.CRT$XT*)) /* Termination */ + ___crt_xt_end__ = . ; + } + .tls BLOCK(__section_alignment__) : + { + ___tls_start__ = . ; + *(.tls) + *(.tls$) + *(SORT(.tls$*)) + ___tls_end__ = . ; + } + .endjunk BLOCK(__section_alignment__) : + { + /* end is deprecated, don't use it */ + PROVIDE (end = .); + PROVIDE ( _end = .); + __end__ = .; + } + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc) + *(SORT(.rsrc$*)) + } + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + *(.stab) + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + *(.stabstr) + } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section. Unlike other targets that fake this by putting the + section VMA at 0, the PE format will not allow it. */ + /* DWARF 1.1 and DWARF 2. */ + .debug_aranges BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_aranges) + } + .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_pubnames) + } + /* DWARF 2. */ + .debug_info BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_info) *(.gnu.linkonce.wi.*) + } + .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_abbrev) + } + .debug_line BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_line) + } + .debug_frame BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_frame) + } + .debug_str BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_str) + } + .debug_loc BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_loc) + } + .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_macinfo) + } + /* SGI/MIPS DWARF 2 extensions. */ + .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_weaknames) + } + .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_funcnames) + } + .debug_typenames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_typenames) + } + .debug_varnames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_varnames) + } + /* DWARF 3. */ + .debug_ranges BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_ranges) + } +} + diff --git a/bsp/simulator/readme.txt b/bsp/simulator/readme.txt index 7ef04e627de5190596142a018bcaeb47b3866cda..f0be818bf9c48cad72f67451f44263a225b826ef 100644 --- a/bsp/simulator/readme.txt +++ b/bsp/simulator/readme.txt @@ -1,23 +1,35 @@ 说明: 本BSP可以如下演示 -默认演示realtouch GUI效果,并提供了一个贪吃的demo用于演示 - -目前支持的功能有 -1). LWIP(可以打开LWIP选项,不过尚存在bug,不建议使用) -2). 文件系统支持,支持ELM FatFS,UFFS,JFFS2 -3). RTGUI支持 - 目前SVN中的RTGUI源码可以直接用于simulator。 - 如果读者想快速在simulator上体验RTGUI,那么不需要修改任何文件,首先在命令行中使用 - scons --target=vs -s - 生成工程后,打开project.vsproj编译,即可看到realtouch的ui出现,然后执行 - 在finsh中执行snake_main(),即可运行贪吃蛇demo - - 再补充说明一点,RTGUI的最新源码目前是托管在git上。 - github网页:https://github.com/RT-Thread/RTGUI - 如果要使用rtgui中的最新源码,共有两种方法。 + +一 平台及组件支持 +目前rtconfig.py中支持的编译器有 +1). msvc 用于windows平台 + 此平台支持的组件 + kernel + finsh + LWIP + DFS, ELM FatFS, UFFS, JFFS2, DFS_WIN32 + RTGUI + APP MODULE +2). mingw 用于windows平台 + kernel + finsh + DFS, ELM FatFS, UFFS, DFS_WIN32 + RTGUI + APP MODULE +3). gcc 用于linux平台 + kernel + finsh + DFS, ELM FatFS, UFFS + RTGUI + +二 组件配置 +1) RTGUI +当前代码中已经不含RTGUI源码,因此读者需要配置一下才能在simulator中使用RTGUI +RTGUI的最新源码目前是托管在github上:https://github.com/RT-Thread/RTGUI +共有两种方法。 方法1 添加环境变量 - 向系统环境变量中加入RTT_RTGUI,其值为刚才github上下载的rtgui源码包的路径。 - 例如笔者的rtgui源码包解压至 F:\Project\git\rt-gui\下 - 则将此环境变量配置为 F:\Project\git\rt-gui\components\rtgui + 向系统加入RTT_RTGUI环境变量,其值为刚才github上下载的rtgui源码包的路径。 + 例如笔者的rtgui源码包解压至 F:\Project\git\rt-gui\下, 则将此环境变量配置为 F:\Project\git\rt-gui\components\rtgui 方法2 不添加环境变量 打开SConstruct文件, .... @@ -37,106 +49,105 @@ 1)#号表示注释,类似于c语言中的//, 2)其中15行的路径为你的RTGUI路径源码,注意不是压缩包路径,而是压缩包路径下的 components\rtgui目录的绝对路径。 -1 编译: -1.1 使用Visual Studio(2005以上版本) - 在命令行中执行 scons --target=vs -s 可以生成vs2005的工程,名为project.vsproj - - 编译后运行 - -1.2 使用scons编译,在当前目录中打开cmd,输入 - scons -j4 - 编译完成后会在当前目录下生成 rtthrad-win32.exe,双击即可运行。 - -2. 测试文件系统 -运行: - 编译后运行,会弹出CMD命令行窗口,可以看到控制台的输出信息,如下所示 - - \ | / - - RT - Thread Operating System - / | \ 1.1.0 build Oct 21 2012 - 2006 - 2012 Copyright by rt-thread team - init jffs2 lock mutex okay - hello, world - finsh>>fatfs initialzation failed! - uffs initialzation failed! - jffs2 initialzation failed! - thread 29e4 exit - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - thread 2898 exit - - 注意上面的信息显示,fatfs/uffs/jffs2均挂载失败,这是因为我们还没有为sd.bin创建fat分区,并且sd上也没有目录用于挂载jffs2和uffs。 - - 并且此时当前bsp目录下,新增了三个文件用于模拟sd卡,nand flash与nor flash,它们是 - sd.bin--模拟SD卡,挂载fat,大小为16M - nand.bin-模拟nand flash,挂载uffs,参数page=2048+64bytes,block=64pages,16M - nor.bin--模拟nor flash,挂载jffs2,型号为sst25vf,2M - - 按下回车,出现finsh,然后输入如下命令格式化sd.bin +三 编译 +1) 使用Visual Studio(2005以上版本) +在当前目录中打开cmd,输入命令 +`scons --target=vs -s` +可以生成project.vsproj,双击运行 +2) 命令行编译 +修改rtconfig.py, 配置合适的编译器(msvc/mingw/gcc),及其路径 +在当前目录中打开cmd,输入命令 +`scons -j4` +编译完成后会在当前目录下生成 rtthrad-win32.exe,双击即可运行。 + +四 程序测试 +1) 测试文件系统 +此时当前目录下,新增了三个文件 + sd.bin--模拟SD卡,挂载fat,大小为16M + nand.bin-模拟nand flash,挂载uffs,参数page=2048+64bytes,block=64pages,16M + nor.bin--模拟nor flash,挂载jffs2,型号为sst25vf,2M +第一次启动时,会看到fatfs挂在失败。 +按下回车,出现finsh,然后输入`mkfs("elm", "sd0")`格式化SD卡,如下所示 finsh>>mkfs("elm", "sd0") 0, 0x00000000 - finsh>> - - 关闭程序重新运行,此时可以看到fatfs挂载成功,不过jffs2和uffs依然失败,如下所示。 - \ | / - - RT - Thread Operating System - / | \ 1.1.0 build Oct 21 2012 - 2006 - 2012 Copyright by rt-thread team - init jffs2 lock mutex okay - hello, world - finsh>>fatfs initialized! - uffs initialzation failed! - jffs2 initialzation failed! - - 这是因为sd上还没有目录来用于挂载jffs2和uffs,在finsh中输入如下命令在sd上创建nand与nor文件夹,分别用于挂载uffs与jffs2文件系统。 - - finsh>>mkdir("/nand") - 0, 0x00000000 - finsh>>mkdir("/nor") - 0, 0x00000000 - finsh>> - 然后再次关闭程序后重新运行,此时可以看到jffs2与uffs挂载成功。 - - 最终输出如下所示: - - \ | / - - RT - Thread Operating System - / | \ 1.1.0 build Oct 21 2012 - 2006 - 2012 Copyright by rt-thread team - init jffs2 lock mutex okay - hello, world - finsh>>fatfs initialized! - os : system memory alloc 320 bytes - flsh: ECC size 24 - flsh: UFFS consume spare data size 34 - os : system memory alloc 83520 bytes - os : system memory alloc 52400 bytes - os : system memory alloc 2048 bytes - tree: DIR 0, FILE 0, DATA 0 - uffs initialized! - jffs2 initialized! - thread 2fb4 exit - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - hello, world - thread 312c exit - -Ok,到现在,一个完整的文件系统测试环境就搭建完毕了,enjoy~~ - -3 测试RTGUI - 启动后就会看到GUI窗口,分辨率800×480串口,并出现图形界面。 - 此时在finsh中输入 snake_main()并回车,即可运行贪吃蛇程序。 +然后重启程序,就可以看到fatfs挂载成功了 + +2) 测试RTGUI +启动后就会看到GUI窗口,分辨率800x480,此时在finsh中输入snake_main()并回车,即可运行贪吃蛇程序 + +3) 测试APP module +rtconfig.h中需要打开RT_USING_MODULE + +a. 生成rtthread.def文件 +使用msv编译主程序时需要此文件,使用MingW编译主程序时不需要 +msvc需要此文件才能生成正确导出符号的rtthread.dll和rtthread-win32.exe。 +此目录下默认自带了一个rtthread.def文件,当修改了rtconfig.h,禁用了某些组件时,则需要重新生成rtthread.def文件. +生成方法: +需要借助MingW工具,修改rtconfig.py中CROSS_TOOL为'mingw',然后打开CMD执行`scons --def`就会自动更新rtthread.def。 + +b. 生成主程序 + 主程序可以使用msvc和mingw生成 + 如果rtconfig.h中的使能了RTGUI,则需要参考第二节第1小节配置RTGUI + a.1 使用msvc + 修改rtconfig.py中CROSS_TOOL为'msvc' + 首先要保证当前目录下有合适的rtthread.def文件,如果没有对默认的rtconfig.h作修改,则使用默认的rtthread.def即可 + CMD命令行执行`scons -j4`,即可生成rtthread.dll和 rtthread-win32.exe + a.2 使用mingw + 修改rtconfig.py中CROSS_TOOL为'mingw' + CMD命令行执行`scons -j4`,这就会生成 rtthread.dll和 rtthread-win32.exe + +c. 生成app module + 进入testdll目录,再次修改 testdll/SConstruct, 同样需要配置RTT_RTGUI路径,同 1中3) + 在此目录下执行 + `scons --app=basicapp` + 就会在 basicapp/building目录下生成 basicapp.dll。 + + 然后运行simulator目录下的 rtthread-win32.exe, 在finsh中运行 + `exec("/testdll/basicapp/building/basicapp.dll")` + 如果觉得这个路径太长,就把 basicapp.dll复制到 simualtor目录下,执行 + `exec("/basicapp.dll")` + +如果想编译RTGUI应用,如testdll目录下的snake,则需要对RTGUI打一点补丁,共有两个方法 +1. 注释掉 //#define RTGUI_USING_CAST_CHECK` +找到rtgui_config.h源码,注释掉如下语句 +//#define RTGUI_USING_CAST_CHECK` + +然后在testdll目录下打开CMD窗口,执行`scons --app=snake`,才可以正确编译,如果不注释掉上面的宏,则会出现链接错误。 + +2. 不注释掉#define RTGUI_USING_CAST_CHECK` +那么需要如下两个补丁 +1) 修改testdll/SConstruct文件 +diff --git a/bsp/simulator/testdll/SConstruct b/bsp/simulator/testdll/SConstruct +index 3324f88..005289c 100644 +--- a/bsp/simulator/testdll/SConstruct ++++ b/bsp/simulator/testdll/SConstruct +@@ -70,6 +70,7 @@ env.Append(CCFLAGS=rtconfig.CFLAGS) + env.Append(LINKFLAGS=rtconfig.LFLAGS) + env.Append(CPPPATH=CPPPATH) + env.Append(LIBS='rtthread', LIBPATH='../') ++env.Append(CPPDEFINES=['RTT_IN_MODULE']) + env.PrependENVPath('PATH', rtconfig.EXEC_PATH) + + PrepareModuleBuilding(env, RTT_ROOT) + +2) 修改RTGUI源码 +diff --git a/components/rtgui/include/rtgui/rtgui_object.h b/components/rtgui/include/rtgui/rtgui_object.h +index 57fd47f..b32ee17 100644 +--- a/components/rtgui/include/rtgui/rtgui_object.h ++++ b/components/rtgui/include/rtgui/rtgui_object.h +@@ -56,7 +56,12 @@ extern "C" { + typedef struct rtgui_type rtgui_type_t; + #define RTGUI_TYPE(type) (struct rtgui_type*)&(_rtgui_##type) + ++#ifdef RTT_IN_MODULE ++#define DECLARE_CLASS_TYPE(type) _declspec(dllimport) const struct rtgui_type _rtgui_##type ++#else + #define DECLARE_CLASS_TYPE(type) extern const struct rtgui_type _rtgui_##type ++#endif ++ + #define DEFINE_CLASS_TYPE(type, name, parent, constructor, destructor, size) \ + const struct rtgui_type _rtgui_##type = { \ + name, \ + +然后再编译snake,可以正确生成。测试方法同basicapp diff --git a/bsp/simulator/rtconfig.h b/bsp/simulator/rtconfig.h index 3e9fb2e74eedd4e00335648831164aac9dbc4e31..5e0f9ead12fa8d3a5d26f75de135a426d90f36e3 100755 --- a/bsp/simulator/rtconfig.h +++ b/bsp/simulator/rtconfig.h @@ -21,6 +21,10 @@ #elif defined(__GNUC__) #define RT_USING_NOLIBC + +#if defined(__MINGW32__) +#define _NO_OLDNAMES /* to ignore: mode_t in sys/type.h */ +#endif #endif /* SECTION: basic kernel options */ @@ -83,6 +87,7 @@ /* SECTION: Device System */ /* Using Device System */ #define RT_USING_DEVICE +#define RT_USING_DEVICE_IPC /* #define RT_USING_UART1 */ /* SECTION: Console options */ @@ -94,11 +99,14 @@ /* SECTION: component options */ #define RT_USING_COMPONENTS_INIT +/* SECTION: APP MODULE */ +#define RT_USING_MODULE + /* SECTION: MTD interface options */ /* using mtd nand flash */ #define RT_USING_MTD_NAND /* using mtd nor flash */ -#define RT_USING_MTD_NOR +/* #define RT_USING_MTD_NOR */ /* SECTION: finsh, a C-Express shell */ #define RT_USING_FINSH diff --git a/bsp/simulator/rtconfig.py b/bsp/simulator/rtconfig.py index 4007e0b1d8db0b811876d21fc51f1636475c7768..2b396c5455f3eb3b9ceaeceb755de0bb3bc6926c 100755 --- a/bsp/simulator/rtconfig.py +++ b/bsp/simulator/rtconfig.py @@ -1,7 +1,7 @@ # toolchains options ARCH='sim' #CROSS_TOOL='msvc' or 'gcc' or 'mingw' (mingw is not supported yet!) -CROSS_TOOL='msvc' +CROSS_TOOL='mingw' # cross_tool provides the cross compiler # EXEC_PATH is the compiler execute path @@ -10,11 +10,20 @@ if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = '/usr/bin/gcc' -if CROSS_TOOL == 'msvc': +elif CROSS_TOOL == 'mingw': + CPU = 'win32' + PLATFORM = 'mingw' + EXEC_PATH = r'D:\Program Files\CodeBlocks\MinGW\bin' + +elif CROSS_TOOL == 'msvc': CPU = 'win32' PLATFORM = 'cl' EXEC_PATH = '' +else : + print "bad CROSS TOOL!" + exit(1) + BUILD = 'debug' #BUILD = '' @@ -48,6 +57,35 @@ if PLATFORM == 'gcc': POST_ACTION = '' +elif PLATFORM == 'mingw': + # toolchains + PREFIX = '' + CC = PREFIX + 'gcc' + AS = PREFIX + 'gcc' + AR = PREFIX + 'ar' + LINK = PREFIX + 'gcc' + TARGET_EXT = 'exe' + SIZE = PREFIX + 'size' + OBJDUMP = PREFIX + 'objdump' + OBJCPY = PREFIX + 'objcopy' + + DEVICE = ' -ffunction-sections -fdata-sections' + DEVICE = ' ' + CFLAGS = DEVICE + AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + DEFFILE_LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map,--output-def,rtthread.def -T mingw.ld ' + LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map -T mingw.ld ' + CPATH = '' + LPATH = '' + + if BUILD == 'debug': + CFLAGS += ' -g -O0 -gdwarf-2' + AFLAGS += ' -gdwarf-2' + else: + CFLAGS += ' -O2' + + POST_ACTION = '' + elif PLATFORM == 'cl': # toolchains PREFIX = '' diff --git a/bsp/simulator/rtthread.def b/bsp/simulator/rtthread.def new file mode 100644 index 0000000000000000000000000000000000000000..05b631f527ca17e414d89d02c32decc6e1234fe4 --- /dev/null +++ b/bsp/simulator/rtthread.def @@ -0,0 +1,1430 @@ +EXPORTS + MS_VC_EXCEPTION @1 DATA + OP_add_byte @2 + OP_add_dword @3 + OP_add_word @4 + OP_and_byte @5 + OP_and_dword @6 + OP_and_word @7 + OP_bw_byte @8 + OP_bw_dword @9 + OP_bw_word @10 + OP_call @11 + OP_div_byte @12 + OP_div_dword @13 + OP_div_word @14 + OP_ld_byte @15 + OP_ld_dword @16 + OP_ld_value_byte @17 + OP_ld_value_byte_stack @18 + OP_ld_value_dword @19 + OP_ld_value_dword_stack @20 + OP_ld_value_word @21 + OP_ld_value_word_stack @22 + OP_ld_word @23 + OP_mod_byte @24 + OP_mod_dword @25 + OP_mod_word @26 + OP_mul_byte @27 + OP_mul_dword @28 + OP_mul_word @29 + OP_no_op @30 + OP_or_byte @31 + OP_or_dword @32 + OP_or_word @33 + OP_pop @34 + OP_shl_byte @35 + OP_shl_dword @36 + OP_shl_word @37 + OP_shr_byte @38 + OP_shr_dword @39 + OP_shr_word @40 + OP_st_byte @41 + OP_st_dword @42 + OP_st_word @43 + OP_sub_byte @44 + OP_sub_dword @45 + OP_sub_word @46 + OP_xor_byte @47 + OP_xor_dword @48 + OP_xor_word @49 + RegisterSimulateInterrupt @50 + SysTickInterruptHandle @51 + TriggerSimulateInterrupt @52 + WinThreadScheduler @53 + YieldInterruptHandle @54 + _BufFlush @55 + _CheckObjBufRef @56 + _FindMinimunPageIdFromDirtyList @57 + __fsym_application @58 DATA + __fsym_application_desc @59 DATA + __fsym_application_name @60 DATA + __fsym_cat @61 DATA + __fsym_cat_desc @62 DATA + __fsym_cat_name @63 DATA + __fsym_copy @64 DATA + __fsym_copy_desc @65 DATA + __fsym_copy_name @66 DATA + __fsym_demo_xml @67 DATA + __fsym_demo_xml_desc @68 DATA + __fsym_demo_xml_name @69 DATA + __fsym_df @70 DATA + __fsym_df_desc @71 DATA + __fsym_df_name @72 DATA + __fsym_digfont_file @73 DATA + __fsym_digfont_file_desc @74 DATA + __fsym_digfont_file_name @75 DATA + __fsym_dump_tree @76 DATA + __fsym_dump_tree_desc @77 DATA + __fsym_dump_tree_name @78 DATA + __fsym_hello @79 DATA + __fsym_hello_desc @80 DATA + __fsym_hello_name @81 DATA + __fsym_list @82 DATA + __fsym_list_desc @83 DATA + __fsym_list_device @84 DATA + __fsym_list_device_desc @85 DATA + __fsym_list_device_name @86 DATA + __fsym_list_event @87 DATA + __fsym_list_event_desc @88 DATA + __fsym_list_event_name @89 DATA + __fsym_list_mailbox @90 DATA + __fsym_list_mailbox_desc @91 DATA + __fsym_list_mailbox_name @92 DATA + __fsym_list_mem @93 DATA + __fsym_list_mem_desc @94 DATA + __fsym_list_mem_name @95 DATA + __fsym_list_mod_detail @96 DATA + __fsym_list_mod_detail_desc @97 DATA + __fsym_list_mod_detail_name @98 DATA + __fsym_list_module @99 DATA + __fsym_list_module_desc @100 DATA + __fsym_list_module_name @101 DATA + __fsym_list_msgqueue @102 DATA + __fsym_list_msgqueue_desc @103 DATA + __fsym_list_msgqueue_name @104 DATA + __fsym_list_mutex @105 DATA + __fsym_list_mutex_desc @106 DATA + __fsym_list_mutex_name @107 DATA + __fsym_list_name @108 DATA + __fsym_list_sem @109 DATA + __fsym_list_sem_desc @110 DATA + __fsym_list_sem_name @111 DATA + __fsym_list_thread @112 DATA + __fsym_list_thread_desc @113 DATA + __fsym_list_thread_name @114 DATA + __fsym_list_timer @115 DATA + __fsym_list_timer_desc @116 DATA + __fsym_list_timer_name @117 DATA + __fsym_ls @118 DATA + __fsym_ls_desc @119 DATA + __fsym_ls_name @120 DATA + __fsym_mkdir @121 DATA + __fsym_mkdir_desc @122 DATA + __fsym_mkdir_name @123 DATA + __fsym_mkfs @124 DATA + __fsym_mkfs_desc @125 DATA + __fsym_mkfs_name @126 DATA + __fsym_nand_eraseall @127 DATA + __fsym_nand_eraseall_desc @128 DATA + __fsym_nand_eraseall_name @129 DATA + __fsym_rm @130 DATA + __fsym_rm_desc @131 DATA + __fsym_rm_name @132 DATA + __fsym_rt_hw_exit @133 DATA + __fsym_rt_hw_exit_desc @134 DATA + __fsym_rt_hw_exit_name @135 DATA + __fsym_rt_module_open @136 DATA + __fsym_rt_module_open_desc @137 DATA + __fsym_rt_module_open_name @138 DATA + __fsym_screenshot @139 DATA + __fsym_screenshot_desc @140 DATA + __fsym_screenshot_name @141 DATA + __fsym_sd_erase @142 DATA + __fsym_sd_erase_desc @143 DATA + __fsym_sd_erase_name @144 DATA + __fsym_snake_main @145 DATA + __fsym_snake_main_desc @146 DATA + __fsym_snake_main_name @147 DATA + __fsym_version @148 DATA + __fsym_version_desc @149 DATA + __fsym_version_name @150 DATA + __vsym_dummy @151 DATA + __vsym_dummy_desc @152 DATA + __vsym_dummy_name @153 DATA + _device @154 DATA + _draw_default @155 + _driver @156 DATA + _framebuffer_mono_ops @157 DATA + _framebuffer_rgb565_ops @158 DATA + _framebuffer_rgb565p_ops @159 DATA + _onidle @160 + _pipe @161 DATA + _pixel_mono_ops @162 DATA + _pixel_rgb565_ops @163 DATA + _pixel_rgb565p_ops @164 DATA + _pixel_rgb888_ops @165 DATA + _rt_errno @166 + _rtgui_application @167 DATA + _rtgui_box @168 DATA + _rtgui_button @169 DATA + _rtgui_checkbox @170 DATA + _rtgui_combobox @171 DATA + _rtgui_container @172 DATA + _rtgui_cursor @173 DATA + _rtgui_digtube @174 DATA + _rtgui_edit @175 DATA + _rtgui_edit_constructor @176 + _rtgui_edit_deconstructor @177 + _rtgui_filelist @178 DATA + _rtgui_groupbox @179 DATA + _rtgui_iconbox @180 DATA + _rtgui_label @181 DATA + _rtgui_listbox @182 DATA + _rtgui_listctrl @183 DATA + _rtgui_listctrl_item_draw @184 + _rtgui_listview @185 DATA + _rtgui_menu @186 DATA + _rtgui_mv_model @187 DATA + _rtgui_mv_view @188 DATA + _rtgui_mywidget @189 DATA + _rtgui_notebook @190 DATA + _rtgui_object @191 DATA + _rtgui_panel @192 DATA + _rtgui_plot @193 DATA + _rtgui_plot_curve @194 DATA + _rtgui_progressbar @195 DATA + _rtgui_radiobox @196 DATA + _rtgui_scrollbar @197 DATA + _rtgui_scrollbar_get_length @198 + _rtgui_slider @199 DATA + _rtgui_staticline @200 DATA + _rtgui_textbox @201 DATA + _rtgui_textview @202 DATA + _rtgui_widget @203 DATA + _rtgui_win @204 DATA + _rtgui_wintitle @205 DATA + _syscall_table_begin @206 DATA + _syscall_table_end @207 DATA + _sysvar_table_begin @208 DATA + _sysvar_table_end @209 DATA + animation_event_handler @210 + application @211 + application_init @212 + asc12 @213 DATA + asc12_font @214 DATA + asc16 @215 DATA + asc16_font @216 DATA + atoi @217 + auto_window_close @218 + benchmark_event_handler @219 + black @220 DATA + blue @221 DATA + bmp_align_write @222 + bmp_font_engine @223 DATA + bmpdt @224 DATA + cat @225 + close @226 + closedir @227 + clust2sect @228 + copy @229 + cos_ydata @230 DATA + dark_grey @231 DATA + dc_client_engine @232 DATA + dc_event_handler @233 + dc_hw_engine @234 DATA + default_background @235 DATA + default_foreground @236 DATA + demo_bitmap_open @237 + demo_bitmap_showbox @238 + demo_edit_event_handler @239 + demo_edit_get_mem @240 + demo_edit_readin_file @241 + demo_edit_saveas_file @242 + demo_image_rotate @243 + demo_image_zoom_in @244 + demo_image_zoom_out @245 + demo_plot @246 + demo_view @247 + demo_view_animation @248 + demo_view_benchmark @249 + demo_view_bmp @250 + demo_view_box @251 + demo_view_buffer_animation @252 + demo_view_button @253 + demo_view_checkbox @254 + demo_view_combobox @255 + demo_view_dc @256 + demo_view_dc_buffer @257 + demo_view_digtube @258 + demo_view_edit @259 + demo_view_get_logic_rect @260 + demo_view_get_rect @261 + demo_view_instrument_panel @262 + demo_view_label @263 + demo_view_listbox @264 + demo_view_listctrl @265 + demo_view_menu @266 + demo_view_mywidget @267 + demo_view_next @268 + demo_view_notebook @269 + demo_view_prev @270 + demo_view_progressbar @271 + demo_view_radiobox @272 + demo_view_scrollbar @273 + demo_view_slider @274 + demo_view_textbox @275 + demo_view_window @276 + demo_xml @277 + df @278 + dfs_elm_close @279 + dfs_elm_flush @280 + dfs_elm_getdents @281 + dfs_elm_ioctl @282 + dfs_elm_lseek @283 + dfs_elm_mkfs @284 + dfs_elm_mount @285 + dfs_elm_open @286 + dfs_elm_read @287 + dfs_elm_rename @288 + dfs_elm_stat @289 + dfs_elm_statfs @290 + dfs_elm_unlink @291 + dfs_elm_unmount @292 + dfs_elm_write @293 + dfs_file_close @294 + dfs_file_flush @295 + dfs_file_getdents @296 + dfs_file_ioctl @297 + dfs_file_lseek @298 + dfs_file_open @299 + dfs_file_read @300 + dfs_file_rename @301 + dfs_file_stat @302 + dfs_file_unlink @303 + dfs_file_write @304 + dfs_filesystem_get_partition @305 + dfs_filesystem_lookup @306 + dfs_init @307 + dfs_lock @308 + dfs_mkfs @309 + dfs_mount @310 + dfs_normalize_path @311 + dfs_register @312 + dfs_statfs @313 + dfs_subdir @314 + dfs_uffs_init @315 + dfs_unlock @316 + dfs_unmount @317 + dfs_win32_dirdup @318 + dfs_win32_init @319 + diag_close @320 + digfont_file @321 + digitfont_40 @322 DATA + digtube_code_table @323 DATA + disable_foreground @324 DATA + disk_initialize @325 + disk_ioctl @326 + disk_read @327 + disk_status @328 + disk_write @329 + dump_tree @330 + ecc_hamming_compute256x @331 + elm_get_vol @332 + elm_init @333 + f_chmod @334 + f_close @335 + f_getfree @336 + f_lseek @337 + f_mkdir @338 + f_mkfs @339 + f_mount @340 + f_open @341 + f_opendir @342 + f_read @343 + f_readdir @344 + f_rename @345 + f_seekdir @346 + f_stat @347 + f_sync @348 + f_truncate @349 + f_unlink @350 + f_utime @351 + f_write @352 + fd_get @353 + fd_is_open @354 + fd_new @355 + fd_put @356 + fd_table @357 DATA + ff_cre_syncobj @358 + ff_del_syncobj @359 + ff_rel_grant @360 + ff_req_grant @361 + filesystem_operation_table @362 DATA + filesystem_table @363 DATA + finsh_auto_complete @364 + finsh_compile_pc @365 DATA + finsh_compile_sp @366 DATA + finsh_compiler_run @367 + finsh_errno @368 + finsh_error_init @369 + finsh_error_set @370 + finsh_error_string @371 + finsh_flush @372 + finsh_get_device @373 + finsh_get_echo @374 + finsh_handle_history @375 + finsh_heap @376 DATA + finsh_heap_allocate @377 + finsh_heap_free @378 + finsh_heap_init @379 + finsh_init @380 + finsh_node_allocate @381 + finsh_node_init @382 + finsh_node_new_char @383 + finsh_node_new_id @384 + finsh_node_new_int @385 + finsh_node_new_long @386 + finsh_node_new_ptr @387 + finsh_node_new_string @388 + finsh_parser_init @389 + finsh_parser_run @390 + finsh_pc @391 DATA + finsh_push_history @392 + finsh_reset @393 + finsh_run_line @394 + finsh_set_device @395 + finsh_set_echo @396 + finsh_sp @397 DATA + finsh_stack_bottom @398 + finsh_syscall_append @399 + finsh_syscall_lookup @400 + finsh_system_function_init @401 + finsh_system_init @402 + finsh_system_var_init @403 + finsh_sysvar_append @404 + finsh_sysvar_lookup @405 + finsh_thread_entry @406 + finsh_token_get_token @407 + finsh_token_init @408 + finsh_token_token @409 + finsh_var_delete @410 + finsh_var_init @411 + finsh_var_insert @412 + finsh_var_lookup @413 + finsh_vm_run @414 + finsh_vm_stack @415 DATA + food_deinit @416 + food_init @417 + food_num @418 DATA + fstat @419 + get_fat @420 + get_fattime @421 + get_sbar_active_len @422 + get_scrollbar_pos @423 + getcwd @424 + global_errno @425 DATA + global_node_table @426 DATA + global_syscall_list @427 DATA + global_sysvar_list @428 DATA + global_variable @429 DATA + green @430 DATA + heap @431 DATA + hello @432 + high_light @433 DATA + hz16 @434 DATA + hz16_font @435 DATA + hz_bmp_font_engine @436 DATA + instrument_panel_event_handler @437 + isalpha @438 + isprint @439 + items @440 DATA + kbd_event_set_key @441 + light_grey @442 DATA + list @443 + list_device @444 + list_event @445 + list_mailbox @446 + list_mem @447 + list_mod_detail @448 + list_module @449 + list_msgqueue @450 + list_mutex @451 + list_prefix @452 + list_sem @453 + list_thread @454 + list_timer @455 + ls @456 + lseek @457 + main @458 + main_win @459 DATA + map @460 DATA + map_deinit @461 + map_init @462 + mkdir @463 + mkfs @464 + nand_eraseall @465 + nand_ops @466 DATA + newdir @467 DATA + normal_window @468 DATA + normal_window_label @469 DATA + op_table @470 DATA + open @471 + opendir @472 + play_image @473 DATA + prevdir @474 DATA + progressbar_timeout @475 + put_fat @476 + read @477 + readdir @478 + red @479 DATA + rename @480 + rewinddir @481 + rgbRecord @482 DATA + rm @483 + rmdir @484 + rt_application_init @485 + rt_calloc @486 + rt_completion_done @487 + rt_completion_init @488 + rt_completion_wait @489 + rt_components_init @490 + rt_console_get_device @491 + rt_console_set_device @492 + rt_current_priority @493 DATA + rt_current_thread @494 DATA + rt_data_queue_init @495 + rt_data_queue_peak @496 + rt_data_queue_pop @497 + rt_data_queue_push @498 + rt_data_queue_reset @499 + rt_device_close @500 + rt_device_control @501 + rt_device_find @502 + rt_device_init @503 + rt_device_init_all @504 + rt_device_open @505 + rt_device_read @506 + rt_device_register @507 + rt_device_set_rx_indicate @508 + rt_device_set_tx_complete @509 + rt_device_unregister @510 + rt_device_write @511 + rt_enter_critical @512 + rt_event_control @513 + rt_event_create @514 + rt_event_delete @515 + rt_event_detach @516 + rt_event_init @517 + rt_event_recv @518 + rt_event_send @519 + rt_exit_critical @520 + rt_free @521 + rt_free_align @522 + rt_free_sethook @523 + rt_get_errno @524 + rt_hw_board_init @525 + rt_hw_context_switch @526 + rt_hw_context_switch_interrupt @527 + rt_hw_context_switch_to @528 + rt_hw_exit @529 + rt_hw_interrupt_disable @530 + rt_hw_interrupt_enable @531 + rt_hw_mtd_nand_init @532 + rt_hw_sdcard_init @533 + rt_hw_sdl_start @534 + rt_hw_serial_init @535 + rt_hw_serial_register @536 + rt_hw_sram_init @537 + rt_hw_stack_init @538 + rt_hw_usart_init @539 + rt_hw_win32_low_cpu @540 + rt_init_thread_entry @541 + rt_interrupt_enter @542 + rt_interrupt_from_thread @543 DATA + rt_interrupt_get_nest @544 + rt_interrupt_leave @545 + rt_interrupt_nest @546 DATA + rt_interrupt_to_thread @547 DATA + rt_kprintf @548 + rt_lowest_bitmap @549 DATA + rt_malloc @550 + rt_malloc_align @551 + rt_malloc_sethook @552 + rt_mb_control @553 + rt_mb_create @554 + rt_mb_delete @555 + rt_mb_detach @556 + rt_mb_init @557 + rt_mb_recv @558 + rt_mb_send @559 + rt_mb_send_wait @560 + rt_memcmp @561 + rt_memcpy @562 + rt_memmove @563 + rt_memory_info @564 + rt_memset @565 + rt_module_destroy @566 + rt_module_find @567 + rt_module_load_sethook @568 + rt_module_open @569 + rt_module_self @570 + rt_module_unload_sethook @571 + rt_mq_control @572 + rt_mq_create @573 + rt_mq_delete @574 + rt_mq_detach @575 + rt_mq_init @576 + rt_mq_recv @577 + rt_mq_send @578 + rt_mq_urgent @579 + rt_mtd_nand_register_device @580 + rt_mutex_control @581 + rt_mutex_create @582 + rt_mutex_delete @583 + rt_mutex_detach @584 + rt_mutex_init @585 + rt_mutex_release @586 + rt_mutex_take @587 + rt_object_allocate @588 + rt_object_attach_sethook @589 + rt_object_container @590 DATA + rt_object_delete @591 + rt_object_detach @592 + rt_object_detach_sethook @593 + rt_object_find @594 + rt_object_get_information @595 + rt_object_init @596 + rt_object_is_systemobject @597 + rt_object_put_hook @598 DATA + rt_object_put_sethook @599 + rt_object_take_hook @600 DATA + rt_object_take_sethook @601 + rt_object_trytake_hook @602 DATA + rt_object_trytake_sethook @603 + rt_pipe_create @604 + rt_pipe_destroy @605 + rt_platform_init @606 + rt_realloc @607 + rt_ringbuffer_get @608 + rt_ringbuffer_getchar @609 + rt_ringbuffer_init @610 + rt_ringbuffer_put @611 + rt_ringbuffer_putchar @612 + rt_schedule @613 + rt_schedule_insert_thread @614 + rt_schedule_remove_thread @615 + rt_scheduler_sethook @616 + rt_sem_control @617 + rt_sem_create @618 + rt_sem_delete @619 + rt_sem_detach @620 + rt_sem_init @621 + rt_sem_release @622 + rt_sem_take @623 + rt_sem_trytake @624 + rt_set_errno @625 + rt_show_version @626 + rt_snprintf @627 + rt_sprintf @628 + rt_strcasecmp @629 + rt_strcmp @630 + rt_strdup @631 + rt_strlen @632 + rt_strncmp @633 + rt_strncpy @634 + rt_strstr @635 + rt_system_heap_init @636 + rt_system_module_init @637 + rt_system_object_init @638 + rt_system_scheduler_init @639 + rt_system_scheduler_start @640 + rt_system_tick_init @641 + rt_system_timer_init @642 + rt_system_timer_thread_init @643 + rt_thread_control @644 + rt_thread_create @645 + rt_thread_defunct @646 DATA + rt_thread_delay @647 + rt_thread_delete @648 + rt_thread_detach @649 + rt_thread_find @650 + rt_thread_idle_excute @651 + rt_thread_idle_init @652 + rt_thread_idle_sethook @653 + rt_thread_init @654 + rt_thread_priority_table @655 DATA + rt_thread_ready_priority_group @656 DATA + rt_thread_resume @657 + rt_thread_self @658 + rt_thread_sleep @659 + rt_thread_startup @660 + rt_thread_suspend @661 + rt_thread_switch_interrupt_flag @662 DATA + rt_thread_timeout @663 + rt_thread_yield @664 + rt_tick_from_millisecond @665 + rt_tick_get @666 + rt_tick_increase @667 + rt_tick_set @668 + rt_timer_check @669 + rt_timer_control @670 + rt_timer_create @671 + rt_timer_delete @672 + rt_timer_detach @673 + rt_timer_init @674 + rt_timer_next_timeout_tick @675 + rt_timer_start @676 + rt_timer_stop @677 + rt_timer_timeout_sethook @678 + rt_vsprintf @679 + rt_win_sharedir_init @680 + rtgui_ack @681 + rtgui_app_activate @682 + rtgui_app_close @683 + rtgui_app_create @684 + rtgui_app_destroy @685 + rtgui_app_event_handler @686 + rtgui_app_exit @687 + rtgui_app_get_onidle @688 + rtgui_app_run @689 + rtgui_app_self @690 + rtgui_app_set_as_wm @691 + rtgui_app_set_main_win @692 + rtgui_app_set_onidle @693 + rtgui_bitmap_font_draw_char @694 + rtgui_blit_line_2_2_inv @695 + rtgui_blit_line_direct @696 + rtgui_blit_line_get @697 + rtgui_blit_line_get_inv @698 + rtgui_box_create @699 + rtgui_box_destroy @700 + rtgui_box_layout @701 + rtgui_box_layout_rect @702 + rtgui_button_create @703 + rtgui_button_destroy @704 + rtgui_button_event_handler @705 + rtgui_button_set_onbutton @706 + rtgui_button_set_pressed_image @707 + rtgui_button_set_unpressed_image @708 + rtgui_checkbox_create @709 + rtgui_checkbox_destroy @710 + rtgui_checkbox_event_handler @711 + rtgui_checkbox_get_checked @712 + rtgui_checkbox_set_checked @713 + rtgui_checkbox_set_onbutton @714 + rtgui_combobox_create @715 + rtgui_combobox_destroy @716 + rtgui_combobox_event_handler @717 + rtgui_combobox_pdwin_ondeactive @718 + rtgui_combobox_pdwin_onitem @719 + rtgui_combobox_set_onselected @720 + rtgui_combox_get_select @721 + rtgui_container_add_child @722 + rtgui_container_broadcast_event @723 + rtgui_container_create @724 + rtgui_container_destroy @725 + rtgui_container_destroy_children @726 + rtgui_container_dispatch_event @727 + rtgui_container_dispatch_mouse_event @728 + rtgui_container_event_handler @729 + rtgui_container_get_first_child @730 + rtgui_container_layout @731 + rtgui_container_remove_child @732 + rtgui_container_set_box @733 + rtgui_dc_begin_drawing @734 + rtgui_dc_buffer_create @735 + rtgui_dc_buffer_get_pixel @736 + rtgui_dc_client_create @737 + rtgui_dc_client_init @738 + rtgui_dc_destory @739 + rtgui_dc_draw_annulus @740 + rtgui_dc_draw_arc @741 + rtgui_dc_draw_border @742 + rtgui_dc_draw_byte @743 + rtgui_dc_draw_circle @744 + rtgui_dc_draw_digitfont @745 + rtgui_dc_draw_digitfont_code @746 + rtgui_dc_draw_ellipse @747 + rtgui_dc_draw_focus_rect @748 + rtgui_dc_draw_horizontal_line @749 + rtgui_dc_draw_line @750 + rtgui_dc_draw_mono_bmp @751 + rtgui_dc_draw_polygon @752 + rtgui_dc_draw_rect @753 + rtgui_dc_draw_regular_polygon @754 + rtgui_dc_draw_round_rect @755 + rtgui_dc_draw_sector @756 + rtgui_dc_draw_shaded_rect @757 + rtgui_dc_draw_text @758 + rtgui_dc_draw_text_stroke @759 + rtgui_dc_draw_vertical_line @760 + rtgui_dc_draw_word @761 + rtgui_dc_end_drawing @762 + rtgui_dc_fill_circle @763 + rtgui_dc_fill_ellipse @764 + rtgui_dc_fill_polygon @765 + rtgui_dc_fill_rect_forecolor @766 + rtgui_dc_fill_round_rect @767 + rtgui_dc_fill_sector @768 + rtgui_dc_hw_create @769 + rtgui_digitfont_create @770 + rtgui_digtube_create @771 + rtgui_digtube_destroy @772 + rtgui_digtube_event_handler @773 + rtgui_edit_append_line @774 + rtgui_edit_connect_line @775 + rtgui_edit_create @776 + rtgui_edit_delete_line @777 + rtgui_edit_destroy @778 + rtgui_edit_event_handler @779 + rtgui_edit_get_current_point @780 + rtgui_edit_get_index_by_line @781 + rtgui_edit_get_line_by_index @782 + rtgui_edit_get_mem_consume @783 + rtgui_edit_insert_line @784 + rtgui_edit_ondraw @785 + rtgui_edit_readin_file @786 + rtgui_edit_saveas_file @787 + rtgui_edit_set_text @788 + rtgui_edit_update @789 + rtgui_empty_point @790 DATA + rtgui_empty_rect @791 DATA + rtgui_filelist_view_create @792 + rtgui_filelist_view_destroy @793 + rtgui_filelist_view_event_handler @794 + rtgui_filelist_view_get_fullpath @795 + rtgui_filelist_view_ondraw @796 + rtgui_filelist_view_set_directory @797 + rtgui_filelist_view_update_current @798 + rtgui_filerw_close @799 + rtgui_filerw_create_file @800 + rtgui_filerw_create_mem @801 + rtgui_filerw_eof @802 + rtgui_filerw_mem_getdata @803 + rtgui_filerw_read @804 + rtgui_filerw_seek @805 + rtgui_filerw_tell @806 + rtgui_filerw_unlink @807 + rtgui_filerw_write @808 + rtgui_font_asc12 @809 DATA + rtgui_font_asc16 @810 DATA + rtgui_font_default @811 + rtgui_font_derefer @812 + rtgui_font_draw @813 + rtgui_font_get_metrics @814 + rtgui_font_get_string_width @815 + rtgui_font_hz16 @816 DATA + rtgui_font_refer @817 + rtgui_font_set_defaut @818 + rtgui_font_system_add_font @819 + rtgui_font_system_init @820 + rtgui_font_system_remove_font @821 + rtgui_framebuffer_get_ops @822 + rtgui_free @823 + rtgui_get_digfont_metrics @824 + rtgui_get_mainwin_rect @825 + rtgui_get_screen_rect @826 + rtgui_get_server @827 + rtgui_graphic_driver_get_default @828 + rtgui_graphic_driver_get_default_framebuffer @829 + rtgui_graphic_driver_get_framebuffer @830 + rtgui_graphic_driver_get_rect @831 + rtgui_graphic_driver_screen_update @832 + rtgui_graphic_set_device @833 + rtgui_groupbox_add_widget @834 + rtgui_groupbox_create @835 + rtgui_groupbox_destroy @836 + rtgui_groupbox_event_handler @837 + rtgui_groupbox_get_selected @838 + rtgui_groupbox_layout @839 + rtgui_groupbox_select_widget @840 + rtgui_iconbox_create @841 + rtgui_iconbox_destroy @842 + rtgui_iconbox_event_handler @843 + rtgui_iconbox_set_selected @844 + rtgui_iconbox_set_text_position @845 + rtgui_image_blit @846 + rtgui_image_bmp_engine @847 DATA + rtgui_image_bmp_header_cfg @848 + rtgui_image_bmp_init @849 + rtgui_image_create @850 + rtgui_image_create_from_file @851 + rtgui_image_create_from_mem @852 + rtgui_image_destroy @853 + rtgui_image_get_engine_by_filename @854 + rtgui_image_get_rect @855 + rtgui_image_hdc_engine @856 DATA + rtgui_image_hdc_init @857 + rtgui_image_hdcmm_engine @858 DATA + rtgui_image_palette_create @859 + rtgui_image_register_engine @860 + rtgui_image_rotate @861 + rtgui_image_xpm_engine @862 DATA + rtgui_image_xpm_init @863 + rtgui_image_zoom @864 + rtgui_label_create @865 + rtgui_label_destroy @866 + rtgui_label_event_handler @867 + rtgui_label_get_text @868 + rtgui_label_set_text @869 + rtgui_list_view_create @870 + rtgui_list_view_destroy @871 + rtgui_list_view_event_handler @872 + rtgui_list_view_ondraw @873 + rtgui_list_view_update_list @874 + rtgui_listbox_create @875 + rtgui_listbox_destroy @876 + rtgui_listbox_event_handler @877 + rtgui_listbox_ondraw @878 + rtgui_listbox_set_current_item @879 + rtgui_listbox_set_items @880 + rtgui_listbox_set_onitem @881 + rtgui_listctrl_create @882 + rtgui_listctrl_destroy @883 + rtgui_listctrl_event_handler @884 + rtgui_listctrl_get_item_rect @885 + rtgui_listctrl_set_current_item @886 + rtgui_listctrl_set_itemheight @887 + rtgui_listctrl_set_items @888 + rtgui_listctrl_set_onitem @889 + rtgui_mainwin_create @890 + rtgui_malloc @891 + rtgui_menu_create @892 + rtgui_menu_destroy @893 + rtgui_menu_hide @894 + rtgui_menu_pop @895 + rtgui_menu_set_onmenuhide @896 + rtgui_menu_set_onmenupop @897 + rtgui_mouse_fini @898 + rtgui_mouse_init @899 + rtgui_mouse_monitor_append @900 + rtgui_mouse_monitor_contains_point @901 + rtgui_mouse_monitor_remove @902 + rtgui_mouse_moveto @903 + rtgui_mouse_set_position @904 + rtgui_mv_model_add_view @905 + rtgui_mv_model_create @906 + rtgui_mv_model_destroy @907 + rtgui_mv_model_get_data @908 + rtgui_mv_model_has_view @909 + rtgui_mv_model_notify @910 + rtgui_mv_model_remove_view @911 + rtgui_mv_model_set_data @912 + rtgui_mv_model_set_dimension @913 + rtgui_mv_view_create @914 + rtgui_mv_view_destroy @915 + rtgui_mv_view_foreach_in_model @916 + rtgui_mywidget_create @917 + rtgui_mywidget_destroy @918 + rtgui_mywidget_event_handler @919 + rtgui_notebook_add @920 + rtgui_notebook_add_image @921 + rtgui_notebook_create @922 + rtgui_notebook_destroy @923 + rtgui_notebook_event_handler @924 + rtgui_notebook_get_client_rect @925 + rtgui_notebook_get_count @926 + rtgui_notebook_get_current @927 + rtgui_notebook_get_current_index @928 + rtgui_notebook_get_widget_at @929 + rtgui_notebook_remove @930 + rtgui_notebook_set_current @931 + rtgui_notebook_set_current_by_index @932 + rtgui_object_check_cast @933 + rtgui_object_create @934 + rtgui_object_destroy @935 + rtgui_object_event_handler @936 + rtgui_object_object_type_get @937 + rtgui_object_set_event_handler @938 + rtgui_panel_create @939 + rtgui_panel_destroy @940 + rtgui_panel_event_handler @941 + rtgui_pixel_device_get_ops @942 + rtgui_plot_create @943 + rtgui_plot_curve_create @944 + rtgui_plot_curve_destroy @945 + rtgui_plot_curve_get_x @946 + rtgui_plot_curve_get_y @947 + rtgui_plot_curve_set_x @948 + rtgui_plot_curve_set_y @949 + rtgui_plot_destroy @950 + rtgui_plot_event_handler @951 + rtgui_plot_ondraw @952 + rtgui_plot_onmvmodel @953 + rtgui_plot_set_base @954 + rtgui_progressbar_create @955 + rtgui_progressbar_destroy @956 + rtgui_progressbar_event_handler @957 + rtgui_progressbar_get_range @958 + rtgui_progressbar_get_value @959 + rtgui_progressbar_set_range @960 + rtgui_progressbar_set_value @961 + rtgui_pushbutton_create @962 + rtgui_radiobox_create @963 + rtgui_radiobox_event_handler @964 + rtgui_radiobox_get_selection @965 + rtgui_radiobox_set_orientation @966 + rtgui_radiobox_set_selection @967 + rtgui_realloc @968 + rtgui_rect_contains_point @969 + rtgui_rect_inflate @970 + rtgui_rect_intersect @971 + rtgui_rect_is_empty @972 + rtgui_rect_is_equal @973 + rtgui_rect_is_intersect @974 + rtgui_rect_moveto @975 + rtgui_rect_moveto_align @976 + rtgui_rect_set @977 + rtgui_recv @978 + rtgui_recv_filter @979 + rtgui_recv_nosuspend @980 + rtgui_region_append @981 + rtgui_region_contains_point @982 + rtgui_region_contains_rectangle @983 + rtgui_region_copy @984 + rtgui_region_dump @985 + rtgui_region_empty @986 + rtgui_region_extents @987 + rtgui_region_fini @988 + rtgui_region_init @989 + rtgui_region_init_rect @990 + rtgui_region_init_with_extents @991 + rtgui_region_intersect @992 + rtgui_region_intersect_rect @993 + rtgui_region_inverse @994 + rtgui_region_is_flat @995 + rtgui_region_not_empty @996 + rtgui_region_num_rects @997 + rtgui_region_rects @998 + rtgui_region_reset @999 + rtgui_region_subtract @1000 + rtgui_region_subtract_rect @1001 + rtgui_region_translate @1002 + rtgui_region_union @1003 + rtgui_region_union_rect @1004 + rtgui_region_validate @1005 + rtgui_screen_lock @1006 + rtgui_screen_unlock @1007 + rtgui_scrollbar_create @1008 + rtgui_scrollbar_destroy @1009 + rtgui_scrollbar_event_handler @1010 + rtgui_scrollbar_get_thumb_rect @1011 + rtgui_scrollbar_hide @1012 + rtgui_scrollbar_ondraw @1013 + rtgui_scrollbar_set_line_step @1014 + rtgui_scrollbar_set_onscroll @1015 + rtgui_scrollbar_set_orientation @1016 + rtgui_scrollbar_set_page_step @1017 + rtgui_scrollbar_set_range @1018 + rtgui_scrollbar_set_thumbbar_len @1019 + rtgui_scrollbar_set_value @1020 + rtgui_send @1021 + rtgui_send_sync @1022 + rtgui_send_urgent @1023 + rtgui_server_handle_kbd @1024 + rtgui_server_handle_monitor_add @1025 + rtgui_server_handle_monitor_remove @1026 + rtgui_server_handle_mouse_btn @1027 + rtgui_server_handle_mouse_motion @1028 + rtgui_server_handle_update @1029 + rtgui_server_init @1030 + rtgui_server_post_event @1031 + rtgui_server_post_event_sync @1032 + rtgui_set_mainwin_rect @1033 + rtgui_slider_create @1034 + rtgui_slider_event_handler @1035 + rtgui_slider_get_value @1036 + rtgui_slider_set_orientation @1037 + rtgui_slider_set_range @1038 + rtgui_slider_set_value @1039 + rtgui_staticline_create @1040 + rtgui_staticline_destroy @1041 + rtgui_staticline_event_handler @1042 + rtgui_staticline_set_orientation @1043 + rtgui_system_image_init @1044 + rtgui_system_server_init @1045 + rtgui_system_theme_init @1046 + rtgui_textbox_create @1047 + rtgui_textbox_destroy @1048 + rtgui_textbox_event_handler @1049 + rtgui_textbox_get_edit_rect @1050 + rtgui_textbox_get_mask_char @1051 + rtgui_textbox_get_value @1052 + rtgui_textbox_ondraw @1053 + rtgui_textbox_set_line_length @1054 + rtgui_textbox_set_mask_char @1055 + rtgui_textbox_set_value @1056 + rtgui_textview_create @1057 + rtgui_textview_destroy @1058 + rtgui_textview_event_handler @1059 + rtgui_textview_set_text @1060 + rtgui_theme_default_bc @1061 + rtgui_theme_default_fc @1062 + rtgui_theme_draw_button @1063 + rtgui_theme_draw_checkbox @1064 + rtgui_theme_draw_iconbox @1065 + rtgui_theme_draw_label @1066 + rtgui_theme_draw_progressbar @1067 + rtgui_theme_draw_radiobox @1068 + rtgui_theme_draw_radiobutton @1069 + rtgui_theme_draw_selected @1070 + rtgui_theme_draw_slider @1071 + rtgui_theme_draw_staticline @1072 + rtgui_theme_draw_textbox @1073 + rtgui_theme_draw_win @1074 + rtgui_theme_get_selected_height @1075 + rtgui_timer_create @1076 + rtgui_timer_destory @1077 + rtgui_timer_start @1078 + rtgui_timer_stop @1079 + rtgui_topwin_activate @1080 + rtgui_topwin_activate_topwin @1081 + rtgui_topwin_add @1082 + rtgui_topwin_append_monitor_rect @1083 + rtgui_topwin_dump_tree @1084 + rtgui_topwin_get_focus @1085 + rtgui_topwin_get_wnd @1086 + rtgui_topwin_get_wnd_no_modaled @1087 + rtgui_topwin_hide @1088 + rtgui_topwin_init @1089 + rtgui_topwin_modal_enter @1090 + rtgui_topwin_move @1091 + rtgui_topwin_remove @1092 + rtgui_topwin_remove_monitor_rect @1093 + rtgui_topwin_resize @1094 + rtgui_topwin_show @1095 + rtgui_topwin_title_onmouse @1096 + rtgui_type_destructors_call @1097 + rtgui_type_inherits_from @1098 + rtgui_type_name_get @1099 + rtgui_type_object_construct @1100 + rtgui_type_parent_type_get @1101 + rtgui_widget_create @1102 + rtgui_widget_destroy @1103 + rtgui_widget_event_handler @1104 + rtgui_widget_focus @1105 + rtgui_widget_get_extent @1106 + rtgui_widget_get_next_sibling @1107 + rtgui_widget_get_parent_background @1108 + rtgui_widget_get_parent_foreground @1109 + rtgui_widget_get_prev_sibling @1110 + rtgui_widget_get_rect @1111 + rtgui_widget_get_toplevel @1112 + rtgui_widget_hide @1113 + rtgui_widget_move_to_logic @1114 + rtgui_widget_onhide @1115 + rtgui_widget_onshow @1116 + rtgui_widget_onupdate_toplvl @1117 + rtgui_widget_point_to_device @1118 + rtgui_widget_point_to_logic @1119 + rtgui_widget_rect_to_device @1120 + rtgui_widget_rect_to_logic @1121 + rtgui_widget_set_border @1122 + rtgui_widget_set_minheight @1123 + rtgui_widget_set_minsize @1124 + rtgui_widget_set_minwidth @1125 + rtgui_widget_set_onfocus @1126 + rtgui_widget_set_onunfocus @1127 + rtgui_widget_set_parent @1128 + rtgui_widget_set_rect @1129 + rtgui_widget_set_rectangle @1130 + rtgui_widget_show @1131 + rtgui_widget_unfocus @1132 + rtgui_widget_update @1133 + rtgui_widget_update_clip @1134 + rtgui_win_activate @1135 + rtgui_win_close @1136 + rtgui_win_create @1137 + rtgui_win_destroy @1138 + rtgui_win_end_modal @1139 + rtgui_win_event_handler @1140 + rtgui_win_get_title @1141 + rtgui_win_hide @1142 + rtgui_win_is_activated @1143 + rtgui_win_move @1144 + rtgui_win_set_onactivate @1145 + rtgui_win_set_onclose @1146 + rtgui_win_set_ondeactivate @1147 + rtgui_win_set_onkey @1148 + rtgui_win_set_rect @1149 + rtgui_win_set_title @1150 + rtgui_win_show @1151 + rtgui_win_update_clip @1152 + rtgui_wintitle_create @1153 + rtgui_wintitle_destroy @1154 + rtgui_wintitle_get_title @1155 + rtgui_wintitle_set_title @1156 + rtgui_xml_create @1157 + rtgui_xml_destroy @1158 + rtgui_xml_event_str @1159 + rtgui_xml_parse @1160 + rtthread_startup @1161 + run_state @1162 DATA + screenshot @1163 + sd_erase @1164 + second_node @1165 DATA + seekdir @1166 + seial_save_byte @1167 + selected_color @1168 DATA + serial1 @1169 DATA + shell @1170 DATA + sin_ydata @1171 DATA + snake_deinit @1172 + snake_head @1173 DATA + snake_init @1174 + snake_len @1175 DATA + snake_main @1176 + snake_restart @1177 + snake_step @1178 + stat @1179 + statfs @1180 + stop_image @1181 DATA + strcasecmp @1182 + strcmp @1183 + strdup @1184 + telldir @1185 + text_segment @1186 DATA + the_notebook @1187 DATA + timeout @1188 + token_get_string @1189 + uffs_BadBlockAdd @1190 + uffs_BadBlockInit @1191 + uffs_BadBlockProcess @1192 + uffs_BadBlockProcessSuspend @1193 + uffs_BadBlockRecover @1194 + uffs_BlockInfoExpire @1195 + uffs_BlockInfoExpireAll @1196 + uffs_BlockInfoFindInCache @1197 + uffs_BlockInfoGet @1198 + uffs_BlockInfoInitCache @1199 + uffs_BlockInfoIsAllFree @1200 + uffs_BlockInfoLoad @1201 + uffs_BlockInfoPut @1202 + uffs_BlockInfoReleaseCache @1203 + uffs_BreakFromEntry @1204 + uffs_BufClone @1205 + uffs_BufDecRef @1206 + uffs_BufFind @1207 + uffs_BufFindFreeGroupSlot @1208 + uffs_BufFindFrom @1209 + uffs_BufFindGroupSlot @1210 + uffs_BufFlush @1211 + uffs_BufFlushAll @1212 + uffs_BufFlushEx @1213 + uffs_BufFlushGroup @1214 + uffs_BufFlushGroupEx @1215 + uffs_BufFlushGroupMatchParent @1216 + uffs_BufFlushMostDirtyGroup @1217 + uffs_BufFreeClone @1218 + uffs_BufGet @1219 + uffs_BufGetEx @1220 + uffs_BufIncRef @1221 + uffs_BufInit @1222 + uffs_BufInspect @1223 + uffs_BufIsAllEmpty @1224 + uffs_BufIsAllFree @1225 + uffs_BufLoadPhyData @1226 + uffs_BufLockGroup @1227 + uffs_BufMarkEmpty @1228 + uffs_BufNew @1229 + uffs_BufPut @1230 + uffs_BufRead @1231 + uffs_BufReleaseAll @1232 + uffs_BufSetAllEmpty @1233 + uffs_BufUnLockGroup @1234 + uffs_BufWrite @1235 + uffs_BuildTree @1236 + uffs_CloseObject @1237 + uffs_CompareFileName @1238 + uffs_CreateNewFile @1239 + uffs_CreateObject @1240 + uffs_CreateObjectEx @1241 + uffs_DeleteObject @1242 + uffs_DeviceInitLock @1243 + uffs_DeviceLock @1244 + uffs_DeviceReleaseLock @1245 + uffs_DeviceUnLock @1246 + uffs_DirEntryBufGetPool @1247 + uffs_DirEntryBufInit @1248 + uffs_DirEntryBufPutAll @1249 + uffs_DirEntryBufRelease @1250 + uffs_DumpDevice @1251 + uffs_EccCorrect @1252 + uffs_EccCorrect8 @1253 + uffs_EccMake @1254 + uffs_EccMake8 @1255 + uffs_EndOfFile @1256 + uffs_FdSignatureIncrease @1257 + uffs_FindBestPageInBlock @1258 + uffs_FindFirstFreePage @1259 + uffs_FindFreeFsnSerial @1260 + uffs_FindFromTree @1261 + uffs_FindObjectClose @1262 + uffs_FindObjectCount @1263 + uffs_FindObjectFirst @1264 + uffs_FindObjectNext @1265 + uffs_FindObjectOpen @1266 + uffs_FindObjectOpenEx @1267 + uffs_FindObjectRewind @1268 + uffs_FindObjectTell @1269 + uffs_FindPageInBlockWithPageId @1270 + uffs_FlashCheckErasedBlock @1271 + uffs_FlashEraseBlock @1272 + uffs_FlashInterfaceInit @1273 + uffs_FlashInterfaceRelease @1274 + uffs_FlashIsBadBlock @1275 + uffs_FlashMakeSpare @1276 + uffs_FlashMarkBadBlock @1277 + uffs_FlashMarkDirtyPage @1278 + uffs_FlashReadPage @1279 + uffs_FlashReadPageTag @1280 + uffs_FlashUnloadSpare @1281 + uffs_FlashWritePageCombine @1282 + uffs_FlushObject @1283 + uffs_FormatDevice @1284 + uffs_GetBlockFileDataLength @1285 + uffs_GetBlockTimeStamp @1286 + uffs_GetCurDateTime @1287 + uffs_GetCurOffset @1288 + uffs_GetDeviceFree @1289 + uffs_GetDeviceFromMountPoint @1290 + uffs_GetDeviceFromMountPointEx @1291 + uffs_GetDeviceMountPoint @1292 + uffs_GetDeviceTotal @1293 + uffs_GetDeviceUsed @1294 + uffs_GetFirstBlockTimeStamp @1295 + uffs_GetFreeObjectHandlers @1296 + uffs_GetFreePagesCount @1297 + uffs_GetMainVersion @1298 + uffs_GetMatchedMountPointSize @1299 + uffs_GetMinorVersion @1300 + uffs_GetNextBlockTimeStamp @1301 + uffs_GetObject @1302 + uffs_GetObjectByIndex @1303 + uffs_GetObjectIndex @1304 + uffs_GetObjectInfo @1305 + uffs_GetObjectPool @1306 + uffs_GetTrivialVersion @1307 + uffs_GetVersion @1308 + uffs_GlobalFsLockLock @1309 + uffs_GlobalFsLockUnlock @1310 + uffs_InitDevice @1311 + uffs_InitFileSystemObjects @1312 + uffs_InitGlobalFsLock @1313 + uffs_InitObjectBuf @1314 + uffs_InsertNodeToTree @1315 + uffs_InsertToErasedListHead @1316 + uffs_IsBlockPagesFullUsed @1317 + uffs_IsPageErased @1318 + uffs_IsSrcNewerThanObj @1319 + uffs_IsThisBlockUsed @1320 + uffs_LoadMiniHeader @1321 + uffs_LoadPhyDataToBufEccUnCare @1322 + uffs_MakeSum16 @1323 + uffs_MakeSum8 @1324 + uffs_MemSetupSystemAllocator @1325 + uffs_Mount @1326 + uffs_MoveObjectEx @1327 + uffs_MtbGetMounted @1328 + uffs_MtbGetUnMounted @1329 + uffs_OSGetTaskId @1330 + uffs_OpenObject @1331 + uffs_OpenObjectEx @1332 + uffs_ParseObject @1333 + uffs_PoolCheckFreeList @1334 + uffs_PoolFindNextAllocated @1335 + uffs_PoolGet @1336 + uffs_PoolGetBufByIndex @1337 + uffs_PoolGetFreeCount @1338 + uffs_PoolGetIndex @1339 + uffs_PoolGetLocked @1340 + uffs_PoolInit @1341 + uffs_PoolPut @1342 + uffs_PoolPutAll @1343 + uffs_PoolPutLocked @1344 + uffs_PoolRelease @1345 + uffs_PoolVerify @1346 + uffs_PutAllObjectBuf @1347 + uffs_PutDevice @1348 + uffs_PutObject @1349 + uffs_ReInitObject @1350 + uffs_ReadObject @1351 + uffs_RegisterMountTable @1352 + uffs_ReleaseDevice @1353 + uffs_ReleaseFileSystemObjects @1354 + uffs_ReleaseGlobalFsLock @1355 + uffs_ReleaseObjectBuf @1356 + uffs_RenameObject @1357 + uffs_SeekObject @1358 + uffs_SemCreate @1359 + uffs_SemDelete @1360 + uffs_SemSignal @1361 + uffs_SemWait @1362 + uffs_SetupDebugOutput @1363 + uffs_TreeCompareFileName @1364 + uffs_TreeFindBadNodeByBlock @1365 + uffs_TreeFindDataNode @1366 + uffs_TreeFindDataNodeByBlock @1367 + uffs_TreeFindDirNode @1368 + uffs_TreeFindDirNodeByBlock @1369 + uffs_TreeFindDirNodeByName @1370 + uffs_TreeFindDirNodeWithParent @1371 + uffs_TreeFindErasedNodeByBlock @1372 + uffs_TreeFindFileNode @1373 + uffs_TreeFindFileNodeByBlock @1374 + uffs_TreeFindFileNodeByName @1375 + uffs_TreeFindFileNodeWithParent @1376 + uffs_TreeFindNodeByBlock @1377 + uffs_TreeFindSuspendNode @1378 + uffs_TreeGetErasedNode @1379 + uffs_TreeInit @1380 + uffs_TreeInsertToBadBlockList @1381 + uffs_TreeInsertToErasedListTail @1382 + uffs_TreeInsertToErasedListTailEx @1383 + uffs_TreeRelease @1384 + uffs_TreeRemoveSuspendNode @1385 + uffs_TreeSetNodeBlock @1386 + uffs_TreeSuspendAdd @1387 + uffs_TruncateObject @1388 + uffs_UnMount @1389 + uffs_UnRegisterMountTable @1390 + uffs_Version2Str @1391 + uffs_WriteObject @1392 + uffs_close @1393 + uffs_closedir @1394 + uffs_crc16sum @1395 + uffs_crc16update @1396 + uffs_eof @1397 + uffs_flush @1398 + uffs_flush_all @1399 + uffs_format @1400 + uffs_fstat @1401 + uffs_ftruncate @1402 + uffs_get_error @1403 + uffs_lstat @1404 + uffs_mkdir @1405 + uffs_open @1406 + uffs_opendir @1407 + uffs_read @1408 + uffs_readdir @1409 + uffs_remove @1410 + uffs_rename @1411 + uffs_rewinddir @1412 + uffs_rmdir @1413 + uffs_seek @1414 + uffs_seekdir @1415 + uffs_set_error @1416 + uffs_setup_storage @1417 + uffs_space_free @1418 + uffs_space_total @1419 + uffs_space_used @1420 + uffs_stat @1421 + uffs_tell @1422 + uffs_version @1423 + uffs_write @1424 + unlink @1425 + version @1426 + white @1427 DATA + write @1428 + xml_str @1429 DATA diff --git a/bsp/simulator/testdll/SConstruct b/bsp/simulator/testdll/SConstruct new file mode 100644 index 0000000000000000000000000000000000000000..3324f888f7d0c1ce7124c4b06def0572bbad3247 --- /dev/null +++ b/bsp/simulator/testdll/SConstruct @@ -0,0 +1,84 @@ +import os +import sys +import SCons.cpp +import rtconfig + +if os.getenv('RTT_ROOT'): + RTT_ROOT = os.getenv('RTT_ROOT') +else: + RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') + +if os.getenv('RTT_RTGUI'): + RTT_RTGUI = os.getenv('RTT_RTGUI') +else: + # set the rtgui root directory by hand + # empty string means use the RTGUI in svn + RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui') + # RTT_RTGUI ='' + +sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] +from building import * + +Export('RTT_ROOT') + +# add target option +AddOption('--app', + dest='app', + nargs=1, type='string', + action='store', + metavar='DIR', + help='installation prefix') + +# add target option +AddOption('--type', + dest='type', + nargs=1, type='string', + action='store', + metavar='DIR', + help='installation prefix') + +app = GetOption('app') +env = Environment() +CPPPATH = [ + RTT_ROOT + '/include', + RTT_ROOT + '/bsp/' + rtconfig.BSP, + RTT_ROOT + '/components/finsh', + RTT_ROOT + '/components/libdl', + RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread', + RTT_ROOT + '/components/external/ftk/ftk/src/demos', + RTT_ROOT + '/components/external/ftk/ftk/apps/common', + RTT_ROOT + '/components/external/ftk/ftk/src', + RTT_ROOT + '/components/dfs', + RTT_ROOT + '/components/dfs/include', + RTT_ROOT + '/components/libc/newlib', + RTT_ROOT + '/components/external/cairo/cairo-1.10.2/src', + RTT_ROOT + '/components/external/cairo/' +] +if RTT_RTGUI: + RTGUI_ROOT = RTT_RTGUI +else: + RTGUI_ROOT = RTT_ROOT + '/components/rtgui' +RTGUI_PATH = [ + RTGUI_ROOT + '/include', + RTGUI_ROOT + '/common', + RTGUI_ROOT + '/server', + RTGUI_ROOT + '/widgets', +] +CPPPATH += RTGUI_PATH + +env.Append(CCFLAGS=rtconfig.CFLAGS) +env.Append(LINKFLAGS=rtconfig.LFLAGS) +env.Append(CPPPATH=CPPPATH) +env.Append(LIBS='rtthread', LIBPATH='../') +env.PrependENVPath('PATH', rtconfig.EXEC_PATH) + +PrepareModuleBuilding(env, RTT_ROOT) + +#dir = app + '/build/' + rtconfig.BSP +dir = app + '/build/' +objs = SConscript(app + '/Sconscript', variant_dir=dir, duplicate=0) +TARGET = dir + '/' + app + '.' + rtconfig.TARGET_EXT + +# build program +#env.Program(TARGET, objs) +env.SharedLibrary(TARGET, objs) diff --git a/bsp/simulator/testdll/basicapp/Sconscript b/bsp/simulator/testdll/basicapp/Sconscript new file mode 100644 index 0000000000000000000000000000000000000000..d8dd99964e17081bd6d07dfd91a6dc240e2446ee --- /dev/null +++ b/bsp/simulator/testdll/basicapp/Sconscript @@ -0,0 +1,7 @@ +import rtconfig +Import('RTT_ROOT') +from building import * + +src = Glob('*.c') +group = DefineGroup('', src, depend = ['']) +Return('group') \ No newline at end of file diff --git a/bsp/simulator/testdll/basicapp/basicapp.c b/bsp/simulator/testdll/basicapp/basicapp.c new file mode 100644 index 0000000000000000000000000000000000000000..3a1927277eecb3a4751dc95bad88457bff106b0c --- /dev/null +++ b/bsp/simulator/testdll/basicapp/basicapp.c @@ -0,0 +1,30 @@ +#include + +static int a = 0; +static int b = 1000000; +int c = 100; + +static void function(int count1, int count2, int count3) +{ + rt_kprintf("Hello RT-Thread %d %d\n", count1, count2, count3); +} + +int main(void) +{ + int i; + + rt_kprintf("application entry\n"); + rt_kprintf("[addr]a-0x%x,b-0x%x,c-0x%x\n", &a, &b, &c); + rt_kprintf("[value]a-%d,b-%d,c-%d\n", a, b, c); + + for(i=0; i<100; i++) + { + a++; + b--; + c++; + function(a, c, b ); + } + + return 0; +} + diff --git a/bsp/simulator/testdll/label/Sconscript b/bsp/simulator/testdll/label/Sconscript new file mode 100644 index 0000000000000000000000000000000000000000..d8dd99964e17081bd6d07dfd91a6dc240e2446ee --- /dev/null +++ b/bsp/simulator/testdll/label/Sconscript @@ -0,0 +1,7 @@ +import rtconfig +Import('RTT_ROOT') +from building import * + +src = Glob('*.c') +group = DefineGroup('', src, depend = ['']) +Return('group') \ No newline at end of file diff --git a/bsp/simulator/testdll/label/label_demo1.c b/bsp/simulator/testdll/label/label_demo1.c new file mode 100644 index 0000000000000000000000000000000000000000..9a72c31fd2c0bbaf0a4419d58168663cb2547872 --- /dev/null +++ b/bsp/simulator/testdll/label/label_demo1.c @@ -0,0 +1,74 @@ +#include + +#include +#include +#include +#include +#include + +/* LCDϴһڣǵһ */ +static void win_thread_entry(void *parameter) +{ + struct rtgui_app *app; + struct rtgui_win *win; + struct rtgui_label *label; + struct rtgui_rect rect; + + app = rtgui_app_create(rt_thread_self(), "MyApp"); + RT_ASSERT(app != RT_NULL); + + /* create a full screen window */ + rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect); + + win = rtgui_win_create(RT_NULL, "MainWin", &rect, + RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE); + if (win == RT_NULL) + { + rtgui_app_destroy(app); + return; + } + + /* һlabelΪhelloworld */ + label = rtgui_label_create("Hello World!"); + + /* labelλãǾ */ + rect.x1 = 0; + rect.y1 = 100; + rect.x2 = 240; + rect.y2 = 140; + rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); + + rt_kprintf("bc: %x\n", RTGUI_WIDGET_BACKGROUND(label)); + rt_kprintf("fc: %x\n", RTGUI_WIDGET_FOREGROUND(label)); +#if 0 + RTGUI_WIDGET_BACKGROUND(label) = 0; + RTGUI_WIDGET_FOREGROUND(label) = RTGUI_RGB(0xFF, 0xFF, 0); +#endif + + /*label*/ + rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label)); + + /* ʾ */ + rtgui_win_show(win, RT_FALSE); + + /* ѭ */ + rtgui_app_run(app); + + rtgui_win_destroy(win); + rtgui_app_destroy(app); + rt_kprintf("MyApp Quit.\n"); +} + +int main() +{ + rt_thread_t tid; + + tid = rt_thread_create("win", win_thread_entry, RT_NULL, + 2048, 20, 20); + if (tid != RT_NULL) + { + rt_thread_startup(tid); + } + + return 0; +} diff --git a/bsp/simulator/testdll/rtconfig.py b/bsp/simulator/testdll/rtconfig.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ea824d753abfef1bd95abb85f8089e3eb8afc3 --- /dev/null +++ b/bsp/simulator/testdll/rtconfig.py @@ -0,0 +1,51 @@ +# bsp name +BSP = 'simulator' + +# toolchains +EXEC_PATH = '' +PREFIX = '' +TARGET_EXT = 'dll' +AS = PREFIX + 'cl' +CC = PREFIX + 'cl' +AR = PREFIX + 'cl' +LINK = PREFIX + 'cl' +AFLAGS = '' +CFLAGS = '' +LFLAGS = '' +BUILD = 'debug' + +if BUILD == 'debug': + CFLAGS += ' /MTd' + LFLAGS += ' /DEBUG' +else: + CFLAGS += ' /MT' + LFLAGS += '' + +CFLAGS += ' /ZI /Od /W 3 /WL' +LFLAGS += ' /DEF:rttapp.def /SUBSYSTEM:CONSOLE /MACHINE:X86' +#LFLAGS += ' /DEF:rttapp.def /SUBSYSTEM:WINDOWS /MACHINE:X86' #/ENTRY:mainCRTStartup + +CPATH = '' +LPATH = '' + +''' +EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' +PREFIX = 'arm-none-eabi-' +CC = PREFIX + 'gcc' +CXX = PREFIX + 'g++' +AS = PREFIX + 'gcc' +AR = PREFIX + 'ar' +LINK = PREFIX + 'gcc' +TARGET_EXT = 'so' +SIZE = PREFIX + 'size' +OBJDUMP = PREFIX + 'objdump' +OBJCPY = PREFIX + 'objcopy' + +DEVICE = ' -mcpu=arm920t' +CFLAGS = DEVICE + ' -O0 -fPIC -DFTK_AS_PLUGIN -DRT_THREAD ' +AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' +LFLAGS = DEVICE + ' -Wl,-z,max-page-size=0x4 -shared -fPIC -nostdlib -s' + +CPATH = '' +LPATH = '' +''' diff --git a/bsp/simulator/testdll/rttapp.def b/bsp/simulator/testdll/rttapp.def new file mode 100644 index 0000000000000000000000000000000000000000..a3a3ca51a807a93ad79be1c982aad10971b6589e --- /dev/null +++ b/bsp/simulator/testdll/rttapp.def @@ -0,0 +1,3 @@ +LIBRARY app +EXPORTS +main diff --git a/bsp/simulator/testdll/snake/SConscript b/bsp/simulator/testdll/snake/SConscript new file mode 100644 index 0000000000000000000000000000000000000000..f9808e4fe76117dd260fdc6cb05456fedb5e012d --- /dev/null +++ b/bsp/simulator/testdll/snake/SConscript @@ -0,0 +1,7 @@ +import rtconfig +Import('RTT_ROOT') +from building import * + +src = Glob('*.c') +group = DefineGroup('', src, depend = ['']) +Return('group') diff --git a/bsp/simulator/testdll/snake/snake.c b/bsp/simulator/testdll/snake/snake.c new file mode 100644 index 0000000000000000000000000000000000000000..87e1c8b36ff76d2ead7ea37abf48702d796e5049 --- /dev/null +++ b/bsp/simulator/testdll/snake/snake.c @@ -0,0 +1,271 @@ +#include +#include +#include +#include "snake.h" + +#define ASSERT_RET(x, ret) \ + do{ \ + if (x) \ + return ret; \ + }while(0) + +rt_list_t snake_head; +SNAKE_DIR prevdir, newdir; + +static SNAKE_DIR dir_adjust(SNAKE_DIR dir) +{ + if ((SNAKE_DIR_UP == prevdir && SNAKE_DIR_DOWN != dir) + || (SNAKE_DIR_DOWN == prevdir && SNAKE_DIR_UP != dir) + || (SNAKE_DIR_LEFT == prevdir && SNAKE_DIR_RIGHT != dir) + || (SNAKE_DIR_RIGHT == prevdir && SNAKE_DIR_LEFT != dir) + ) + { + newdir = dir; + } + else + { + rt_kprintf("dirction change error\n\r"); + } + + return newdir; +} + +static void across_XY(point_t *node, const map_t *map) +{ + RT_ASSERT(node != RT_NULL && map != RT_NULL); + + // ȳǰ߿ԴԽǽ + node->x = (node->x + map->width) % map->width; + node->y = (node->y + map->height) % map->height; +} + +static SYS_STE node_update(snake_t *tail, const point_t *node, map_t *map) +{ + SYS_STE ret; + point_t *pos; + + RT_ASSERT(tail != RT_NULL && node != RT_NULL && map != RT_NULL); + + pos = map->snake_flush; + pos[0].x = pos[0].y = -1; + pos[1].x = pos[1].y = -1; + + ret = (SYS_STE)map->range[node->y * map->width + node->x]; + + if (FOOD == map->range[node->y * map->width + node->x]) + { + // һʳһڵ + snake_t *new = (snake_t *)rt_malloc(sizeof(snake_t)); + if (!new) + return NORMAL; + + pos[0] = *node; + new->body = *node; + rt_list_insert_after(&snake_head, &new->list); + } + else if (NORMAL == map->range[node->y * map->width + node->x]) + { + // β޸ĺõͷ + rt_list_remove(&tail->list); + map->range[tail->body.y * map->width + tail->body.x] = NORMAL; + + pos[0] = *node; + pos[1] = tail->body; + + tail->body = *node; + rt_list_insert_after(&snake_head, &tail->list); + } + + map->range[node->y * map->width + node->x] = OVER; + + if (ret != OVER) + prevdir = newdir; + + return ret; +} + + +map_t *map_init(rt_uint32_t width, rt_uint32_t heigth) +{ + map_t *map = rt_malloc(sizeof(map_t)); + + if (map != RT_NULL) + { + map->range = rt_malloc(heigth * width); + + if (!map->range) + { + rt_free(map); + map = RT_NULL; + } + else + { + map->width = width; + map->height = heigth; + memset(map->range, NORMAL, heigth * width); + } + } + + return map; +} + +// һָȵָ +rt_bool_t snake_init(const point_t *start, const int length, const SNAKE_DIR dir, map_t *map) +{ + rt_int32_t i; + rt_int32_t inc_x, inc_y; + point_t old = *start; + + ASSERT_RET(!map || !start, RT_FALSE); + + rt_list_init(&snake_head); + + if (dir == SNAKE_DIR_UP || dir == SNAKE_DIR_DOWN) + { + if (map->height <= length) + return RT_FALSE; + + inc_x = 0; + inc_y = dir == SNAKE_DIR_DOWN ? 1 : -1; // ӳӣͷָλ + old.y -= inc_y; + } + else + { + if (map->width <= length) + return RT_FALSE; + + inc_y = 0; + inc_x = dir == SNAKE_DIR_RIGHT ? -1 : 1; + old.x -= inc_x; + } + + for (i = 0; i < length; i++) + { + snake_t *new = (snake_t *)rt_malloc(sizeof(snake_t)); + if (!new) + return RT_FALSE; + + new->body.y = inc_y + old.y; + new->body.x = inc_x + old.x; + + // ȳǰ߿ԴԽǽ + across_XY(&new->body, map); + + map->range[new->body.y * map->width + new->body.x] = OVER; + + old = new->body; + rt_list_insert_before(&snake_head, &new->list); + } + + prevdir = dir; + + return RT_TRUE; +} + +// ʳ +rt_bool_t food_init(map_t *map, rt_uint32_t max_num) +{ + point_t food; + +#ifndef FOOD_TIMEOUT +#define FOOD_TIMEOUT 10 +#endif + + rt_uint32_t timeout, num; + + ASSERT_RET(!map, RT_FALSE); + + num = 0; + timeout = rt_tick_get(); + srand(rand()); + + map->food_flush[0].x = map->food_flush[0].y = -1; + + do + { + food.x = rand() % map->width; + food.y = rand() % map->height; + + if (map->range[food.y * map->width + food.x] == NORMAL) + { + map->food_flush[0] = food; + map->range[food.y * map->width + food.x] = FOOD; + num++; + } + } + while (num < max_num && rt_tick_get() - timeout < FOOD_TIMEOUT); + + return num; +} + +void map_deinit(map_t *map) +{ + if (map) + { + if (map->range) + { + rt_free(map->range); + map->range = RT_NULL; + } + rt_free(map); + } +} + +void snake_deinit(void) +{ + snake_t *node; + + while (!rt_list_isempty(&snake_head)) + { + node = rt_list_entry(snake_head.prev, snake_t, list); + rt_list_remove(&node->list); + rt_free(node); + } +} + +void food_deinit(void) +{ + +} + +SYS_STE snake_step(SNAKE_DIR dir, map_t *map) +{ + snake_t *tail, *head; + point_t node; + + ASSERT_RET(!map, RT_FALSE); + + dir = dir_adjust(dir); + + // ȡͷβڵ㣬ڵ㲻Ҫı + tail = rt_list_entry(snake_head.prev, snake_t, list); + head = rt_list_entry(snake_head.next, snake_t, list); + + node = head->body; + + // һµͷ + switch (dir) + { + case SNAKE_DIR_UP: + case SNAKE_DIR_DOWN: + node.y = head->body.y + (dir == SNAKE_DIR_DOWN ? -1 : 1); + break; + case SNAKE_DIR_LEFT: + case SNAKE_DIR_RIGHT: + node.x = head->body.x + (dir == SNAKE_DIR_RIGHT ? 1 : -1); + break; + } + across_XY(&node, map); + + return node_update(tail, &node, map); +} + +rt_bool_t snake_restart(const point_t *start, const int length, const SNAKE_DIR dir, map_t *map) +{ + ASSERT_RET(!map || !start, RT_FALSE); + + snake_deinit(); + memset(map->range, NORMAL, map->width * map->height); + + return snake_init(start, length, dir, map); +} diff --git a/bsp/simulator/testdll/snake/snake.h b/bsp/simulator/testdll/snake/snake.h new file mode 100644 index 0000000000000000000000000000000000000000..557d4d9241353b9b748a3e4b6d72f96c07d2dcd3 --- /dev/null +++ b/bsp/simulator/testdll/snake/snake.h @@ -0,0 +1,68 @@ +#ifndef _SNAKE_H_ +#define _SNAKE_H_ + +#include + +#define snake_length_max 20 //߳ +#define snake_length_init 3 //ʼ߳ +#define snake_room_size_hight 8 //Ӹ 0-255 >8 +#define snake_room_size_widht 8 //ӿ 0-255 >8 + +#define snake_init_pointx 1 +#define snake_init_pointy 2 + +typedef struct +{ + rt_int32_t x, y; +} point_t; + +typedef struct +{ + rt_int32_t width; // max x + rt_int32_t height; // max y + rt_uint8_t *range; // map, map->range[y * map->width + x] + point_t snake_flush[2]; + point_t food_flush[1]; +} map_t; + +typedef enum +{ + SNAKE_DIR_UP, + SNAKE_DIR_DOWN, + SNAKE_DIR_LEFT, + SNAKE_DIR_RIGHT +} SNAKE_DIR; + +typedef enum +{ + FOOD, // Եˮ + OVER, // ҧ + NORMAL // ж +} SYS_STE; + +typedef struct +{ + point_t body; + rt_list_t list; +} snake_t; + +// һͼ +map_t *map_init(rt_uint32_t width, rt_uint32_t heigth); + +// һָȵָ +rt_bool_t snake_init(const point_t *start, const int length, const SNAKE_DIR dir, map_t *map); + +// ʳ +rt_bool_t food_init(map_t *map, rt_uint32_t max_num); + +void map_deinit(map_t *map); + +void snake_deinit(void); + +void food_deinit(void); + +SYS_STE snake_step(SNAKE_DIR dir, map_t *map); + +rt_bool_t snake_restart(const point_t *start, const int length, const SNAKE_DIR dir, map_t *map); + +#endif diff --git a/bsp/simulator/testdll/snake/snake_gui.c b/bsp/simulator/testdll/snake/snake_gui.c new file mode 100644 index 0000000000000000000000000000000000000000..5ad2c8d7c533916642f02797081077e19c8c0820 --- /dev/null +++ b/bsp/simulator/testdll/snake/snake_gui.c @@ -0,0 +1,397 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include "snake.h" + +#define LATTICE_SIZE (20) +#define FOOD_MAX (8) + +#define WALL_COLOR RTGUI_RGB(255, 0, 0) +#define SNAKE_COLOR RTGUI_RGB(0, 100, 200) +#define SNAKE_HEAD_COLOR RTGUI_RGB(180, 70, 130) +#define BACKGROUND_COLOR RTGUI_RGB(153, 153, 0) +#define FOOD_COLOR RTGUI_RGB(128, 0, 0) + +static rtgui_timer_t *timer; +static rt_size_t room_size_x, room_size_y; +static rt_size_t lattice_size_x, lattice_size_y; +static struct rtgui_rect room_rect, lattice_rect; + +map_t *map; +SNAKE_DIR run_state; +rt_int32_t snake_len; +rt_int32_t food_num; +point_t second_node; + +static void snake_fill_lattice(struct rtgui_dc *dc, + rt_uint32_t x, + rt_uint32_t y, + rtgui_color_t color) +{ + struct rtgui_rect rect; + + // coordinate conversion + y = (lattice_size_y - 1) - y; + + RTGUI_DC_BC(dc) = color; + + rect.x1 = lattice_rect.x1 + (LATTICE_SIZE * x); + rect.x2 = rect.x1 + LATTICE_SIZE; + rect.x1 += 2; + + rect.y1 = lattice_rect.y1 + (LATTICE_SIZE * y); + rect.y2 = rect.y1 + LATTICE_SIZE; + rect.y1 += 2; + + rtgui_dc_fill_rect(dc, &rect); +} + +static void snake_draw(struct rtgui_widget *widget) +{ + struct rtgui_dc *dc; + struct rtgui_rect rect; + rt_uint32_t i; + + dc = rtgui_dc_begin_drawing(widget); + if (dc == RT_NULL) + { + rt_kprintf("dc == RT_NULL\r\n"); + return; + } + + /* get room size, run once frist. */ + if ((room_size_x == 0) || (room_size_y == 0)) + { + rt_size_t tmp; + + rtgui_widget_get_rect(widget, &rect); + rt_kprintf("rect => x1:%d x2:%d, y1:%d y2:%d\r\n", rect.x1, rect.x2, rect.y1, rect.y2); + + room_size_x = rect.x2 - rect.x1; + room_size_y = rect.y2 - rect.y1; + memcpy(&room_rect, &rect, sizeof(struct rtgui_rect)); + rt_kprintf("room_rect => x1:%d x2:%d, y1:%d y2:%d\r\n", + room_rect.x1, room_rect.x2, + room_rect.y1, room_rect.y2); + + lattice_size_x = (room_rect.x2 - room_rect.x1) / LATTICE_SIZE; + lattice_size_y = (room_rect.y2 - room_rect.y1) / LATTICE_SIZE; + lattice_size_x -= 2; + lattice_size_y -= 2; + rt_kprintf("lattice_size_x:%d lattice_size_y:%d\r\n", + lattice_size_x, + lattice_size_y); + + tmp = (room_rect.x2 - room_rect.x1) - (LATTICE_SIZE * lattice_size_x); + lattice_rect.x1 = room_rect.x1 + (tmp / 2); + lattice_rect.x2 = lattice_rect.x1 + (LATTICE_SIZE * lattice_size_x); + + tmp = (room_rect.y2 - room_rect.y1) - (LATTICE_SIZE * lattice_size_y); + lattice_rect.y1 = room_rect.y1 + (tmp / 2); + lattice_rect.y2 = lattice_rect.y1 + (LATTICE_SIZE * lattice_size_y); + rt_kprintf("lattice_rect => x1:%d x2:%d, y1:%d y2:%d\r\n", + lattice_rect.x1, lattice_rect.x2, + lattice_rect.y1, lattice_rect.y2); + + /* create snake. */ + { + point_t start; + map = map_init(lattice_size_x, lattice_size_y); + if (map != RT_NULL) + { + start.x = snake_init_pointx; + start.y = snake_init_pointy; + run_state = SNAKE_DIR_DOWN; + + if (snake_init(&start, snake_length_init, run_state, map)) + { + food_num = 1; + food_init(map, food_num); + } + else + { + map_deinit(map); + map = RT_NULL; + } + } + } + } + + RTGUI_DC_BC(dc) = BACKGROUND_COLOR; + rtgui_dc_fill_rect(dc, &room_rect); + + memcpy(&rect, &lattice_rect, sizeof(struct rtgui_rect)); + rect.x2 += 1; + rect.y2 += 1; + RTGUI_DC_FC(dc) = WALL_COLOR; + rtgui_dc_draw_rect(dc, &rect); + + for (i = 1; i < lattice_size_y; i++) + { + memcpy(&rect, &lattice_rect, sizeof(struct rtgui_rect)); + rect.x1 += 1; + rect.x2 -= 1; + rtgui_dc_draw_horizontal_line(dc, rect.x1, rect.x2, + rect.y1 + (LATTICE_SIZE * i)); + } + + for (i = 1; i < lattice_size_x; i++) + { + memcpy(&rect, &lattice_rect, sizeof(struct rtgui_rect)); + rect.y1 += 1; + rect.y2 -= 1; + rtgui_dc_draw_vertical_line(dc, rect.x1 + (LATTICE_SIZE * i), + rect.y1, rect.y2); + } + + /* draw snake. */ + { + rt_int32_t x, y; + rt_bool_t first_node = RT_TRUE; + + for (y = 0; y < map->height; y++) + { + for (x = 0; x < map->width; x++) + { + switch (map->range[y * map->width + x]) + { + case NORMAL: + break; + case FOOD: + snake_fill_lattice(dc, x, y, FOOD_COLOR); + break; + case OVER: + if (first_node) + { + first_node = RT_FALSE; + second_node.x = x; + second_node.y = y; + snake_fill_lattice(dc, x, y, SNAKE_HEAD_COLOR); + } + else + { + snake_fill_lattice(dc, x, y, SNAKE_COLOR); + } + break; + } + } + + } + } + + rtgui_dc_end_drawing(dc); + + return; +} + +static void snake_update(struct rtgui_widget *widget) +{ + struct rtgui_dc *dc; + rt_int32_t x, y; + rt_uint32_t i; + + dc = rtgui_dc_begin_drawing(widget); + if (dc == RT_NULL) + { + rt_kprintf("dc == RT_NULL\r\n"); + return; + } + + snake_fill_lattice(dc, second_node.x, second_node.y, SNAKE_COLOR); + second_node = map->snake_flush[0]; + + for (i = 0; i < 3; i++) + { + if (i < 2) + { + x = map->snake_flush[i].x; + y = map->snake_flush[i].y; + } + else + { + x = map->food_flush[0].x; + y = map->food_flush[0].y; + } + + if ((x >= 0) && (y >= 0)) + { + switch (map->range[(map->width * y) + x]) + { + case NORMAL: + snake_fill_lattice(dc, x, y, BACKGROUND_COLOR); + break; + case FOOD: + snake_fill_lattice(dc, x, y, FOOD_COLOR); + break; + case OVER: + if (0 == i) + snake_fill_lattice(dc, x, y, SNAKE_HEAD_COLOR); + else + snake_fill_lattice(dc, x, y, SNAKE_COLOR); + break; + } + } + } + + rtgui_dc_end_drawing(dc); + return; +} + +static void snake_handler(struct rtgui_widget *widget, rtgui_event_t *event) +{ + struct rtgui_event_kbd *ekbd; + + ekbd = (struct rtgui_event_kbd *) event; + if (ekbd->type == RTGUI_KEYDOWN) + { + switch (ekbd->key) + { + case RTGUIK_UP: + rt_kprintf("RTGUIK_UP\r\n"); + run_state = SNAKE_DIR_UP; + break; + case RTGUIK_DOWN: + rt_kprintf("RTGUIK_DOWN\r\n"); + run_state = SNAKE_DIR_DOWN; + break; + case RTGUIK_LEFT: + rt_kprintf("RTGUIK_LEFT\r\n"); + run_state = SNAKE_DIR_LEFT; + break; + case RTGUIK_RIGHT: + rt_kprintf("RTGUIK_RIGHT\r\n"); + run_state = SNAKE_DIR_RIGHT; + break; + default: + break; + } + } +} + +static rt_bool_t event_handler(struct rtgui_object *object, rtgui_event_t *event) +{ + struct rtgui_widget *widget = RTGUI_WIDGET(object); + + rt_kprintf("event_handler\r\n"); + + if (event->type == RTGUI_EVENT_PAINT) + { + rt_kprintf("RTGUI_EVENT_PAINT\r\n"); + rtgui_win_event_handler((struct rtgui_object *)object, event); + snake_draw(widget); + rtgui_timer_start(timer); + } + else if (event->type == RTGUI_EVENT_SHOW) + { + rt_kprintf("RTGUI_EVENT_SHOW\r\n"); + rtgui_win_event_handler((struct rtgui_object *)object, event); + snake_draw(widget); + rtgui_timer_start(timer); + } + else if (event->type == RTGUI_EVENT_HIDE) + { + rt_kprintf("RTGUI_EVENT_HIDE\r\n"); + rtgui_win_event_handler((struct rtgui_object *)object, event); + rtgui_timer_stop(timer); + } + else if (event->type == RTGUI_EVENT_WIN_DEACTIVATE) + { + rt_kprintf("RTGUI_EVENT_WIN_DEACTIVATE\r\n"); + rtgui_win_event_handler((struct rtgui_object *)object, event); + rtgui_timer_stop(timer); + } + else if (event->type == RTGUI_EVENT_KBD) + { + rtgui_win_event_handler((struct rtgui_object *)object, event); + snake_handler(widget, event); + } + else + { + rt_kprintf("event->type:%d\r\n", event->type); + return rtgui_win_event_handler((struct rtgui_object *)object, event); + } + + return RT_FALSE; +} + +static void timeout(struct rtgui_timer *timer, void *parameter) +{ + struct rtgui_widget *widget; + SYS_STE ret; + + if (!map) + return; + + ret = snake_step(run_state, map); + if (OVER == ret) + return; + + if (FOOD == ret) + { + snake_len++; + if (snake_len >= (map->width * map->height) / 3) + { + point_t start; + + start.x = snake_init_pointx; + start.y = snake_init_pointy; + run_state = SNAKE_DIR_DOWN; + snake_len = snake_length_init; + + if (!snake_restart(&start, snake_len, run_state, map)) + { + map_deinit(map); + snake_deinit(); + map = RT_NULL; + } + } + + food_init(map, 1); + } + + widget = RTGUI_WIDGET(parameter); + snake_update(widget); +} + +void main(void) +{ + struct rtgui_app *application; + struct rtgui_win *win; + rtgui_rect_t rect; + + application = rtgui_app_create("sanke_app"); + if (application != RT_NULL) + { + rtgui_get_screen_rect(&rect); + rtgui_set_mainwin_rect(&rect); + win = rtgui_mainwin_create(RT_NULL, + "sanke_win", + RTGUI_WIN_STYLE_MAINWIN | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE); + if (win == RT_NULL) + { + rt_kprintf("sanke_win create fail!\r\n"); + return; + } + + rtgui_object_set_event_handler(RTGUI_OBJECT(win), event_handler); + + timer = rtgui_timer_create(RT_TICK_PER_SECOND / 2, + RT_TIMER_FLAG_PERIODIC, + timeout, + (void *)win); + + rtgui_win_show(win, RT_TRUE); + + //˳ŷ + map_deinit(map); + snake_deinit(); + food_deinit(); + rtgui_app_destroy(application); + } +} diff --git a/bsp/simulator/testdll/var/Sconscript b/bsp/simulator/testdll/var/Sconscript new file mode 100644 index 0000000000000000000000000000000000000000..d8dd99964e17081bd6d07dfd91a6dc240e2446ee --- /dev/null +++ b/bsp/simulator/testdll/var/Sconscript @@ -0,0 +1,7 @@ +import rtconfig +Import('RTT_ROOT') +from building import * + +src = Glob('*.c') +group = DefineGroup('', src, depend = ['']) +Return('group') \ No newline at end of file diff --git a/bsp/simulator/testdll/var/var.c b/bsp/simulator/testdll/var/var.c new file mode 100644 index 0000000000000000000000000000000000000000..41eba40f38bdd35eb61a35e3fcec99a998500f55 --- /dev/null +++ b/bsp/simulator/testdll/var/var.c @@ -0,0 +1,20 @@ +#include + +/* rtgui\common\rtgui_object.c */ +_declspec(dllimport) void * _rtgui_object; + +/* rtgui\common\color.c */ +_declspec(dllimport) rt_uint32_t blue; +//extern rt_uint32_t * green; + +int main(void) +{ + int i; + + //rt_kprintf("green = %x, *green", green, *(rt_uint32_t *)green); + rt_kprintf("blue = %x\n", blue); + rt_kprintf("_rtgui_object = %x\n", _rtgui_object); + + return 0; +} + diff --git a/bsp/stm32f10x/SConscript b/bsp/stm32f10x/SConscript index b18c1ec467ff1b23369afab648cbebc55a610619..496f6560befcc7bc97ec86d7f0f734fef786aa9e 100644 --- a/bsp/stm32f10x/SConscript +++ b/bsp/stm32f10x/SConscript @@ -15,7 +15,7 @@ if GetDepend('RT_USING_LWIP'): src_drv += ['enc28j60.c'] + ['dm9000a.c'] if GetDepend('RT_USING_RTGUI'): - src_drv += ['touch.c', 'calibration.c'] + src_drv += ['touch.c'] if GetDepend('RT_USING_RTGUI'): if rtconfig.RT_USING_LCD_TYPE == 'FMT0371': diff --git a/bsp/stm32f10x/application.c b/bsp/stm32f10x/application.c index 692c770611408216e0b15e584f57fc5dceb0cb9d..041405129d14dafd875de9594d3f7f48385d1b74 100644 --- a/bsp/stm32f10x/application.c +++ b/bsp/stm32f10x/application.c @@ -41,6 +41,7 @@ #include #include #include +#include #endif #include "led.h" @@ -73,6 +74,23 @@ static void led_thread_entry(void* parameter) } } +#ifdef RT_USING_RTGUI +rt_bool_t cali_setup(void) +{ + rt_kprintf("cali setup entered\n"); + return RT_FALSE; +} + +void cali_store(struct calibration_data *data) +{ + rt_kprintf("cali finished (%d, %d), (%d, %d)\n", + data->min_x, + data->max_x, + data->min_y, + data->max_y); +} +#endif + void rt_init_thread_entry(void* parameter) { /* Filesystem Initialization */ @@ -149,6 +167,10 @@ void rt_init_thread_entry(void* parameter) /* init rtgui system server */ rtgui_system_server_init(); + + calibration_set_restore(cali_setup); + calibration_set_after(cali_store); + calibration_init(); } #endif /* #ifdef RT_USING_RTGUI */ } diff --git a/bsp/stm32f10x/calibration.c b/bsp/stm32f10x/calibration.c deleted file mode 100644 index 00c5255d0f55001188fe23e305fb2344c36e7621..0000000000000000000000000000000000000000 --- a/bsp/stm32f10x/calibration.c +++ /dev/null @@ -1,284 +0,0 @@ -#include -#include -#include -#include - -#include "touch.h" - -#define CALIBRATION_STEP_LEFTTOP 0 -#define CALIBRATION_STEP_RIGHTTOP 1 -#define CALIBRATION_STEP_RIGHTBOTTOM 2 -#define CALIBRATION_STEP_LEFTBOTTOM 3 -#define CALIBRATION_STEP_CENTER 4 - -#define TOUCH_WIN_UPDATE 1 -#define TOUCH_WIN_CLOSE 2 - -#define CALIBRATION_WIDTH 15 -#define CALIBRATION_HEIGHT 15 - -struct calibration_session -{ - rt_uint8_t step; - - struct calibration_data data; - - rt_uint16_t width; rt_uint16_t height; - - rt_device_t device; - rt_thread_t tid; -}; -static struct calibration_session* calibration_ptr = RT_NULL; - -static void calibration_data_post(rt_uint16_t x, rt_uint16_t y) -{ - if (calibration_ptr != RT_NULL) - { - switch (calibration_ptr->step) - { - case CALIBRATION_STEP_LEFTTOP: - calibration_ptr->data.min_x = x; - calibration_ptr->data.min_y = y; - break; - - case CALIBRATION_STEP_RIGHTTOP: - calibration_ptr->data.max_x = x; - calibration_ptr->data.min_y = (calibration_ptr->data.min_y + y)/2; - break; - - case CALIBRATION_STEP_LEFTBOTTOM: - calibration_ptr->data.min_x = (calibration_ptr->data.min_x + x)/2; - calibration_ptr->data.max_y = y; - break; - - case CALIBRATION_STEP_RIGHTBOTTOM: - calibration_ptr->data.max_x = (calibration_ptr->data.max_x + x)/2; - calibration_ptr->data.max_y = (calibration_ptr->data.max_y + y)/2; - break; - - case CALIBRATION_STEP_CENTER: - /* calibration done */ - { - rt_uint16_t w, h; - - struct rtgui_event_command ecmd; - RTGUI_EVENT_COMMAND_INIT(&ecmd); - ecmd.command_id = TOUCH_WIN_CLOSE; - - /* calculate calibrated data */ - if (calibration_ptr->data.max_x > calibration_ptr->data.min_x) - w = calibration_ptr->data.max_x - calibration_ptr->data.min_x; - else - w = calibration_ptr->data.min_x - calibration_ptr->data.max_x; - w = (w/(calibration_ptr->width - 2 * CALIBRATION_WIDTH)) * CALIBRATION_WIDTH; - - if (calibration_ptr->data.max_y > calibration_ptr->data.min_y) - h = calibration_ptr->data.max_y - calibration_ptr->data.min_y; - else - h = calibration_ptr->data.min_y - calibration_ptr->data.max_y; - h = (h/(calibration_ptr->height - 2 * CALIBRATION_HEIGHT)) * CALIBRATION_HEIGHT; - - rt_kprintf("w: %d, h: %d\n", w, h); - - if (calibration_ptr->data.max_x > calibration_ptr->data.min_x) - { - calibration_ptr->data.min_x -= w; - calibration_ptr->data.max_x += w; - } - else - { - calibration_ptr->data.min_x += w; - calibration_ptr->data.max_x -= w; - } - - if (calibration_ptr->data.max_y > calibration_ptr->data.min_y) - { - calibration_ptr->data.min_y -= h; - calibration_ptr->data.max_y += h; - } - else - { - calibration_ptr->data.min_y += h; - calibration_ptr->data.max_y -= h; - } - - rt_kprintf("calibration data: (%d, %d), (%d, %d)\n", - calibration_ptr->data.min_x, - calibration_ptr->data.max_x, - calibration_ptr->data.min_y, - calibration_ptr->data.max_y); - rtgui_thread_send(calibration_ptr->tid, &ecmd.parent, sizeof(struct rtgui_event_command)); - } - return; - } - - calibration_ptr->step ++; - - /* post command event */ - { - struct rtgui_event_command ecmd; - RTGUI_EVENT_COMMAND_INIT(&ecmd); - ecmd.command_id = TOUCH_WIN_UPDATE; - - rtgui_thread_send(calibration_ptr->tid, &ecmd.parent, sizeof(struct rtgui_event_command)); - } - } -} - -rt_bool_t calibration_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; - - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) break; - - /* get rect information */ - rtgui_widget_get_rect(widget, &rect); - - /* clear whole window */ - RTGUI_WIDGET_BACKGROUND(widget) = white; - rtgui_dc_fill_rect(dc, &rect); - - /* reset color */ - RTGUI_WIDGET_BACKGROUND(widget) = green; - RTGUI_WIDGET_FOREGROUND(widget) = black; - - switch (calibration_ptr->step) - { - case CALIBRATION_STEP_LEFTTOP: - rtgui_dc_draw_hline(dc, 0, 2 * CALIBRATION_WIDTH, CALIBRATION_HEIGHT); - rtgui_dc_draw_vline(dc, CALIBRATION_WIDTH, 0, 2 * CALIBRATION_HEIGHT); - RTGUI_WIDGET_FOREGROUND(widget) = red; - rtgui_dc_fill_circle(dc, CALIBRATION_WIDTH, CALIBRATION_HEIGHT, 4); - break; - - case CALIBRATION_STEP_RIGHTTOP: - rtgui_dc_draw_hline(dc, calibration_ptr->width - 2 * CALIBRATION_WIDTH, - calibration_ptr->width, CALIBRATION_HEIGHT); - rtgui_dc_draw_vline(dc, calibration_ptr->width - CALIBRATION_WIDTH, 0, 2 * CALIBRATION_HEIGHT); - RTGUI_WIDGET_FOREGROUND(widget) = red; - rtgui_dc_fill_circle(dc, calibration_ptr->width - CALIBRATION_WIDTH, CALIBRATION_HEIGHT, 4); - break; - - case CALIBRATION_STEP_LEFTBOTTOM: - rtgui_dc_draw_hline(dc, 0, 2 * CALIBRATION_WIDTH, calibration_ptr->height - CALIBRATION_HEIGHT); - rtgui_dc_draw_vline(dc, CALIBRATION_WIDTH, calibration_ptr->height - 2 * CALIBRATION_HEIGHT, calibration_ptr->height); - RTGUI_WIDGET_FOREGROUND(widget) = red; - rtgui_dc_fill_circle(dc, CALIBRATION_WIDTH, calibration_ptr->height - CALIBRATION_HEIGHT, 4); - break; - - case CALIBRATION_STEP_RIGHTBOTTOM: - rtgui_dc_draw_hline(dc, calibration_ptr->width - 2 * CALIBRATION_WIDTH, - calibration_ptr->width, calibration_ptr->height - CALIBRATION_HEIGHT); - rtgui_dc_draw_vline(dc, calibration_ptr->width - CALIBRATION_WIDTH, calibration_ptr->height - 2 * CALIBRATION_HEIGHT, calibration_ptr->height); - RTGUI_WIDGET_FOREGROUND(widget) = red; - rtgui_dc_fill_circle(dc, calibration_ptr->width - CALIBRATION_WIDTH, calibration_ptr->height - CALIBRATION_HEIGHT, 4); - break; - - case CALIBRATION_STEP_CENTER: - rtgui_dc_draw_hline(dc, calibration_ptr->width/2 - CALIBRATION_WIDTH, calibration_ptr->width/2 + CALIBRATION_WIDTH, calibration_ptr->height/2); - rtgui_dc_draw_vline(dc, calibration_ptr->width/2, calibration_ptr->height/2 - CALIBRATION_HEIGHT, calibration_ptr->height/2 + CALIBRATION_HEIGHT); - RTGUI_WIDGET_FOREGROUND(widget) = red; - rtgui_dc_fill_circle(dc, calibration_ptr->width/2, calibration_ptr->height/2, 4); - break; - } - rtgui_dc_end_drawing(dc); - } - break; - - case RTGUI_EVENT_COMMAND: - { - struct rtgui_event_command* ecmd = (struct rtgui_event_command*)event; - - switch (ecmd->command_id) - { - case TOUCH_WIN_UPDATE: - rtgui_widget_update(widget); - break; - case TOUCH_WIN_CLOSE: - rtgui_win_close(RTGUI_WIN(widget)); - break; - } - } - return RT_TRUE; - - default: - rtgui_win_event_handler(widget, event); - } - - return RT_FALSE; -} - -void calibration_entry(void* parameter) -{ - rt_mq_t mq; - rtgui_win_t* win; - struct rtgui_rect rect; - - mq = rt_mq_create("cali", 40, 8, RT_IPC_FLAG_FIFO); - if (mq == RT_NULL) return; - - rtgui_thread_register(rt_thread_self(), mq); - - rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect); - - /* set screen rect */ - calibration_ptr->width = rect.x2; - calibration_ptr->height = rect.y2; - - /* create calibration window */ - win = rtgui_win_create(RT_NULL, - "calibration", &rect, RTGUI_WIN_STYLE_NO_TITLE | RTGUI_WIN_STYLE_NO_BORDER); - rtgui_widget_set_event_handler(RTGUI_WIDGET(win), calibration_event_handler); - if (win != RT_NULL) - { - rtgui_win_show(win, RT_FALSE); - // rtgui_widget_update(RTGUI_WIDGET(win)); - rtgui_win_event_loop(win); - } - - rtgui_thread_deregister(rt_thread_self()); - rt_mq_delete(mq); - - /* set calibration data */ - rt_device_control(calibration_ptr->device, RT_TOUCH_CALIBRATION_DATA, &calibration_ptr->data); - - /* recover to normal */ - rt_device_control(calibration_ptr->device, RT_TOUCH_NORMAL, RT_NULL); - - /* release memory */ - rt_free(calibration_ptr); - calibration_ptr = RT_NULL; -} - -void calibration_init() -{ - rt_device_t device; - - device = rt_device_find("touch"); - if (device == RT_NULL) return; /* no this device */ - - calibration_ptr = (struct calibration_session*)rt_malloc(sizeof(struct calibration_session)); - rt_memset(calibration_ptr, 0, sizeof(struct calibration_data)); - calibration_ptr->device = device; - - rt_device_control(calibration_ptr->device, RT_TOUCH_CALIBRATION, (void*)calibration_data_post); - - calibration_ptr->tid = rt_thread_create("cali", calibration_entry, RT_NULL, - 2048, 20, 5); - if (calibration_ptr->tid != RT_NULL) rt_thread_startup(calibration_ptr->tid); -} - -#ifdef RT_USING_FINSH -#include -void calibration() -{ - calibration_init(); -} -FINSH_FUNCTION_EXPORT(calibration, perform touch calibration); -#endif diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index 0b85b54810e39b2d337b76c148b088bef970d91d..4a69b6a64f4be801f1b55d3ebaad3f311b73e922 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -14,8 +14,12 @@ * 2011-11-23 Bernard fixed the rename issue. * 2012-07-26 aozima implement ff_memalloc and ff_memfree. * 2012-12-19 Bernard fixed the O_APPEND and lseek issue. + * 2013-03-01 aozima fixed the stat(st_mtime) issue. */ +#include +#include + #include #include "ffconf.h" #include "ff.h" @@ -178,7 +182,7 @@ int dfs_elm_mkfs(rt_device_t dev_id) { #define FSM_STATUS_INIT 0 #define FSM_STATUS_USE_TEMP_DRIVER 1 - FATFS *fat; + FATFS *fat = RT_NULL; int flag; FRESULT result; int index; @@ -710,8 +714,38 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) st->st_mode &= ~(DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH); st->st_size = file_info.fsize; - st->st_mtime = file_info.ftime; st->st_blksize = 512; + + /* get st_mtime. */ + { + struct tm tm_file; + int year, mon, day, hour, min, sec; + WORD tmp; + + tmp = file_info.fdate; + day = tmp & 0x1F; /* bit[4:0] Day(1..31) */ + tmp >>= 5; + mon = tmp & 0x0F; /* bit[8:5] Month(1..12) */ + tmp >>= 4; + year = (tmp & 0x7F) + 1980; /* bit[15:9] Year origin from 1980(0..127) */ + + tmp = file_info.ftime; + sec = (tmp & 0x1F) * 2; /* bit[4:0] Second/2(0..29) */ + tmp >>= 5; + min = tmp & 0x3F; /* bit[10:5] Minute(0..59) */ + tmp >>= 6; + hour = tmp & 0x1F; /* bit[15:11] Hour(0..23) */ + + memset(&tm_file, 0, sizeof(tm_file)); + tm_file.tm_year = year - 1900; /* Years since 1900 */ + tm_file.tm_mon = mon - 1; /* Months *since* january: 0-11 */ + tm_file.tm_mday = day; /* Day of the month: 1-31 */ + tm_file.tm_hour = hour; /* Hours since midnight: 0-23 */ + tm_file.tm_min = min; /* Minutes: 0-59 */ + tm_file.tm_sec = sec; /* Seconds: 0-59 */ + + st->st_mtime = mktime(&tm_file); + } /* get st_mtime. */ } #if _USE_LFN diff --git a/components/net/lwip/src/netif/ethernetif.c b/components/net/lwip/src/netif/ethernetif.c index 42e6ac39f40df90b8e2e3b5f75d06c23a9ff3247..3f0fd21e594bc24a88b51a6f78d957e3dc26eab1 100644 --- a/components/net/lwip/src/netif/ethernetif.c +++ b/components/net/lwip/src/netif/ethernetif.c @@ -12,15 +12,16 @@ * 2010-07-07 Bernard fix send mail to mailbox issue. * 2011-07-30 mbbill port lwIP 1.4.0 to RT-Thread * 2012-04-10 Bernard add more compatible with RT-Thread. - * 2012-11-12 Bernard The network interface can be initialized + * 2012-11-12 Bernard The network interface can be initialized * after lwIP initialization. + * 2013-02-28 aozima fixed list_tcps bug: ipaddr_ntoa isn't reentrant. */ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -29,21 +30,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -71,8 +72,8 @@ */ struct eth_tx_msg { - struct netif *netif; - struct pbuf *buf; + struct netif *netif; + struct pbuf *buf; }; static struct rt_mailbox eth_tx_thread_mb; @@ -99,288 +100,288 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE]; static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p) { - struct eth_tx_msg msg; - struct eth_device* enetif; + struct eth_tx_msg msg; + struct eth_device* enetif; - enetif = (struct eth_device*)netif->state; + enetif = (struct eth_device*)netif->state; - /* send a message to eth tx thread */ - msg.netif = netif; - msg.buf = p; - if (rt_mb_send(ð_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK) - { - /* waiting for ack */ - rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER); - } + /* send a message to eth tx thread */ + msg.netif = netif; + msg.buf = p; + if (rt_mb_send(ð_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK) + { + /* waiting for ack */ + rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER); + } - return ERR_OK; + return ERR_OK; } static err_t eth_netif_device_init(struct netif *netif) { - struct eth_device *ethif; + struct eth_device *ethif; - ethif = (struct eth_device*)netif->state; - if (ethif != RT_NULL) - { - rt_device_t device; + ethif = (struct eth_device*)netif->state; + if (ethif != RT_NULL) + { + rt_device_t device; - /* get device object */ - device = (rt_device_t) ethif; - if (rt_device_init(device) != RT_EOK) - { - return ERR_IF; - } + /* get device object */ + device = (rt_device_t) ethif; + if (rt_device_init(device) != RT_EOK) + { + return ERR_IF; + } - /* copy device flags to netif flags */ - netif->flags = ethif->flags; + /* copy device flags to netif flags */ + netif->flags = ethif->flags; - /* set default netif */ - if (netif_default == RT_NULL) - netif_set_default(ethif->netif); + /* set default netif */ + if (netif_default == RT_NULL) + netif_set_default(ethif->netif); #if LWIP_DHCP - if (ethif->flags & NETIF_FLAG_DHCP) - { - /* if this interface uses DHCP, start the DHCP client */ - dhcp_start(ethif->netif); - } - else + if (ethif->flags & NETIF_FLAG_DHCP) + { + /* if this interface uses DHCP, start the DHCP client */ + dhcp_start(ethif->netif); + } + else #endif - { - /* set interface up */ - netif_set_up(ethif->netif); - } + { + /* set interface up */ + netif_set_up(ethif->netif); + } #ifdef LWIP_NETIF_LINK_CALLBACK - netif_set_link_up(ethif->netif); + netif_set_link_up(ethif->netif); #endif - return ERR_OK; - } + return ERR_OK; + } - return ERR_IF; + return ERR_IF; } /* Keep old drivers compatible in RT-Thread */ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint8_t flags) { - struct netif* netif; - - netif = (struct netif*) rt_malloc (sizeof(struct netif)); - if (netif == RT_NULL) - { - rt_kprintf("malloc netif failed\n"); - return -RT_ERROR; - } - rt_memset(netif, 0, sizeof(struct netif)); - - /* set netif */ - dev->netif = netif; - /* device flags, which will be set to netif flags when initializing */ - dev->flags = flags; - /* link changed status of device */ - dev->link_changed = 0x00; - dev->parent.type = RT_Device_Class_NetIf; - /* register to RT-Thread device manager */ - rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR); - rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO); - - /* set name */ - netif->name[0] = name[0]; - netif->name[1] = name[1]; - - /* set hw address to 6 */ - netif->hwaddr_len = 6; - /* maximum transfer unit */ - netif->mtu = ETHERNET_MTU; - - /* get hardware MAC address */ - rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr); - - /* set output */ - netif->output = etharp_output; - netif->linkoutput = ethernetif_linkoutput; - - /* if tcp thread has been started up, we add this netif to the system */ - if (rt_thread_find("tcpip") != RT_NULL) - { - struct ip_addr ipaddr, netmask, gw; + struct netif* netif; + + netif = (struct netif*) rt_malloc (sizeof(struct netif)); + if (netif == RT_NULL) + { + rt_kprintf("malloc netif failed\n"); + return -RT_ERROR; + } + rt_memset(netif, 0, sizeof(struct netif)); + + /* set netif */ + dev->netif = netif; + /* device flags, which will be set to netif flags when initializing */ + dev->flags = flags; + /* link changed status of device */ + dev->link_changed = 0x00; + dev->parent.type = RT_Device_Class_NetIf; + /* register to RT-Thread device manager */ + rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR); + rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO); + + /* set name */ + netif->name[0] = name[0]; + netif->name[1] = name[1]; + + /* set hw address to 6 */ + netif->hwaddr_len = 6; + /* maximum transfer unit */ + netif->mtu = ETHERNET_MTU; + + /* get hardware MAC address */ + rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr); + + /* set output */ + netif->output = etharp_output; + netif->linkoutput = ethernetif_linkoutput; + + /* if tcp thread has been started up, we add this netif to the system */ + if (rt_thread_find("tcpip") != RT_NULL) + { + struct ip_addr ipaddr, netmask, gw; #if !LWIP_DHCP - IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3); - IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3); - IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3); + IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3); + IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3); + IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3); #else - IP4_ADDR(&ipaddr, 0, 0, 0, 0); - IP4_ADDR(&gw, 0, 0, 0, 0); - IP4_ADDR(&netmask, 0, 0, 0, 0); + IP4_ADDR(&ipaddr, 0, 0, 0, 0); + IP4_ADDR(&gw, 0, 0, 0, 0); + IP4_ADDR(&netmask, 0, 0, 0, 0); #endif - - netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input); - } - return RT_EOK; + netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input); + } + + return RT_EOK; } rt_err_t eth_device_init(struct eth_device * dev, char *name) { - rt_uint8_t flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP; + rt_uint8_t flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP; #if LWIP_DHCP - /* DHCP support */ - flags |= NETIF_FLAG_DHCP; + /* DHCP support */ + flags |= NETIF_FLAG_DHCP; #endif #if LWIP_IGMP - /* IGMP support */ - flags |= NETIF_FLAG_IGMP; + /* IGMP support */ + flags |= NETIF_FLAG_IGMP; #endif - return eth_device_init_with_flag(dev, name, flags); + return eth_device_init_with_flag(dev, name, flags); } rt_err_t eth_device_ready(struct eth_device* dev) { - if (dev->netif) - /* post message to Ethernet thread */ - return rt_mb_send(ð_rx_thread_mb, (rt_uint32_t)dev); - else - return ERR_OK; /* netif is not initialized yet, just return. */ + if (dev->netif) + /* post message to Ethernet thread */ + return rt_mb_send(ð_rx_thread_mb, (rt_uint32_t)dev); + else + return ERR_OK; /* netif is not initialized yet, just return. */ } rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up) { - rt_uint32_t level; + rt_uint32_t level; - RT_ASSERT(dev != RT_NULL); + RT_ASSERT(dev != RT_NULL); - level = rt_hw_interrupt_disable(); - dev->link_changed = 0x01; - if (up == RT_TRUE) - dev->link_status = 0x01; - else - dev->link_status = 0x00; - rt_hw_interrupt_enable(level); + level = rt_hw_interrupt_disable(); + dev->link_changed = 0x01; + if (up == RT_TRUE) + dev->link_status = 0x01; + else + dev->link_status = 0x00; + rt_hw_interrupt_enable(level); - /* post message to ethernet thread */ - return rt_mb_send(ð_rx_thread_mb, (rt_uint32_t)dev); + /* post message to ethernet thread */ + return rt_mb_send(ð_rx_thread_mb, (rt_uint32_t)dev); } /* Ethernet Tx Thread */ static void eth_tx_thread_entry(void* parameter) { - struct eth_tx_msg* msg; - - while (1) - { - if (rt_mb_recv(ð_tx_thread_mb, (rt_uint32_t*)&msg, RT_WAITING_FOREVER) == RT_EOK) - { - struct eth_device* enetif; - - RT_ASSERT(msg->netif != RT_NULL); - RT_ASSERT(msg->buf != RT_NULL); - - enetif = (struct eth_device*)msg->netif->state; - if (enetif != RT_NULL) - { - /* call driver's interface */ - if (enetif->eth_tx(&(enetif->parent), msg->buf) != RT_EOK) - { - rt_kprintf("transmit eth packet failed\n"); - } - } - - /* send ACK */ - rt_sem_release(&(enetif->tx_ack)); - } - } + struct eth_tx_msg* msg; + + while (1) + { + if (rt_mb_recv(ð_tx_thread_mb, (rt_uint32_t*)&msg, RT_WAITING_FOREVER) == RT_EOK) + { + struct eth_device* enetif; + + RT_ASSERT(msg->netif != RT_NULL); + RT_ASSERT(msg->buf != RT_NULL); + + enetif = (struct eth_device*)msg->netif->state; + if (enetif != RT_NULL) + { + /* call driver's interface */ + if (enetif->eth_tx(&(enetif->parent), msg->buf) != RT_EOK) + { + rt_kprintf("transmit eth packet failed\n"); + } + } + + /* send ACK */ + rt_sem_release(&(enetif->tx_ack)); + } + } } /* Ethernet Rx Thread */ static void eth_rx_thread_entry(void* parameter) { - struct eth_device* device; - - while (1) - { - if (rt_mb_recv(ð_rx_thread_mb, (rt_uint32_t*)&device, RT_WAITING_FOREVER) == RT_EOK) - { - struct pbuf *p; - - /* check link status */ - if (device->link_changed) - { - int status; - rt_uint32_t level; - - level = rt_hw_interrupt_disable(); - status = device->link_status; - device->link_changed = 0x00; - rt_hw_interrupt_enable(level); - - if (status) - netifapi_netif_set_link_up(device->netif); - else - netifapi_netif_set_link_down(device->netif); - } - - /* receive all of buffer */ - while (1) - { - p = device->eth_rx(&(device->parent)); - if (p != RT_NULL) - { - /* notify to upper layer */ - if( device->netif->input(p, device->netif) != ERR_OK ) - { - LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: Input error\n")); - pbuf_free(p); - p = NULL; - } - } - else break; - } - } - else - { - LWIP_ASSERT("Should not happen!\n",0); - } - } + struct eth_device* device; + + while (1) + { + if (rt_mb_recv(ð_rx_thread_mb, (rt_uint32_t*)&device, RT_WAITING_FOREVER) == RT_EOK) + { + struct pbuf *p; + + /* check link status */ + if (device->link_changed) + { + int status; + rt_uint32_t level; + + level = rt_hw_interrupt_disable(); + status = device->link_status; + device->link_changed = 0x00; + rt_hw_interrupt_enable(level); + + if (status) + netifapi_netif_set_link_up(device->netif); + else + netifapi_netif_set_link_down(device->netif); + } + + /* receive all of buffer */ + while (1) + { + p = device->eth_rx(&(device->parent)); + if (p != RT_NULL) + { + /* notify to upper layer */ + if( device->netif->input(p, device->netif) != ERR_OK ) + { + LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: Input error\n")); + pbuf_free(p); + p = NULL; + } + } + else break; + } + } + else + { + LWIP_ASSERT("Should not happen!\n",0); + } + } } void eth_system_device_init() { - rt_err_t result = RT_EOK; - - /* initialize Rx thread. - * initialize mailbox and create Ethernet Rx thread */ - result = rt_mb_init(ð_rx_thread_mb, "erxmb", - ð_rx_thread_mb_pool[0], sizeof(eth_rx_thread_mb_pool)/4, - RT_IPC_FLAG_FIFO); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_init(ð_rx_thread, "erx", eth_rx_thread_entry, RT_NULL, - ð_rx_thread_stack[0], sizeof(eth_rx_thread_stack), - RT_LWIP_ETHTHREAD_PRIORITY, 16); - RT_ASSERT(result == RT_EOK); - result = rt_thread_startup(ð_rx_thread); - RT_ASSERT(result == RT_EOK); - - /* initialize Tx thread */ - /* initialize mailbox and create Ethernet Tx thread */ - result = rt_mb_init(ð_tx_thread_mb, "etxmb", - ð_tx_thread_mb_pool[0], sizeof(eth_tx_thread_mb_pool)/4, - RT_IPC_FLAG_FIFO); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_init(ð_tx_thread, "etx", eth_tx_thread_entry, RT_NULL, - ð_tx_thread_stack[0], sizeof(eth_tx_thread_stack), - RT_ETHERNETIF_THREAD_PREORITY, 16); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_startup(ð_tx_thread); - RT_ASSERT(result == RT_EOK); + rt_err_t result = RT_EOK; + + /* initialize Rx thread. + * initialize mailbox and create Ethernet Rx thread */ + result = rt_mb_init(ð_rx_thread_mb, "erxmb", + ð_rx_thread_mb_pool[0], sizeof(eth_rx_thread_mb_pool)/4, + RT_IPC_FLAG_FIFO); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_init(ð_rx_thread, "erx", eth_rx_thread_entry, RT_NULL, + ð_rx_thread_stack[0], sizeof(eth_rx_thread_stack), + RT_LWIP_ETHTHREAD_PRIORITY, 16); + RT_ASSERT(result == RT_EOK); + result = rt_thread_startup(ð_rx_thread); + RT_ASSERT(result == RT_EOK); + + /* initialize Tx thread */ + /* initialize mailbox and create Ethernet Tx thread */ + result = rt_mb_init(ð_tx_thread_mb, "etxmb", + ð_tx_thread_mb_pool[0], sizeof(eth_tx_thread_mb_pool)/4, + RT_IPC_FLAG_FIFO); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_init(ð_tx_thread, "etx", eth_tx_thread_entry, RT_NULL, + ð_tx_thread_stack[0], sizeof(eth_tx_thread_stack), + RT_ETHERNETIF_THREAD_PREORITY, 16); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_startup(ð_tx_thread); + RT_ASSERT(result == RT_EOK); } #ifdef RT_USING_FINSH @@ -436,12 +437,12 @@ FINSH_FUNCTION_EXPORT(set_if, set network interface address); #include void set_dns(char* dns_server) { - struct ip_addr addr; - - if ((dns_server != RT_NULL) && ipaddr_aton(dns_server, &addr)) - { - dns_setserver(0, &addr); - } + struct ip_addr addr; + + if ((dns_server != RT_NULL) && ipaddr_aton(dns_server, &addr)) + { + dns_setserver(0, &addr); + } } FINSH_FUNCTION_EXPORT(set_dns, set DNS server address); #endif @@ -451,11 +452,16 @@ void list_if(void) rt_ubase_t index; struct netif * netif; + rt_enter_critical(); + netif = netif_list; while( netif != RT_NULL ) { - rt_kprintf("network interface: %c%c%s\n", netif->name[0], netif->name[1], (netif == netif_default)?" (Default)":""); + rt_kprintf("network interface: %c%c%s\n", + netif->name[0], + netif->name[1], + (netif == netif_default)?" (Default)":""); rt_kprintf("MTU: %d\n", netif->mtu); rt_kprintf("MAC: "); for (index = 0; index < netif->hwaddr_len; index ++) @@ -489,6 +495,8 @@ void list_if(void) } } #endif /**< #if LWIP_DNS */ + + rt_exit_critical(); } FINSH_FUNCTION_EXPORT(list_if, list network interface information); @@ -496,42 +504,62 @@ FINSH_FUNCTION_EXPORT(list_if, list network interface information); #include #include -void list_tcps() +void list_tcps(void) { - struct tcp_pcb *pcb; - extern struct tcp_pcb *tcp_active_pcbs; - extern union tcp_listen_pcbs_t tcp_listen_pcbs; - extern struct tcp_pcb *tcp_tw_pcbs; - extern const char *tcp_state_str[]; - - rt_enter_critical(); - rt_kprintf("Active PCB states:\n"); - for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) - { - rt_kprintf("%s:%d <==> %s:%d snd_nxt %d rcv_nxt %d ", - ipaddr_ntoa(&(pcb->local_ip)), pcb->local_port, - ipaddr_ntoa(&(pcb->remote_ip)), pcb->remote_port, - pcb->snd_nxt, pcb->rcv_nxt); - rt_kprintf("state: %s\n", tcp_state_str[pcb->state]); - } - - rt_kprintf("Listen PCB states:\n"); - for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) - { - rt_kprintf("local port %d ", pcb->local_port); - rt_kprintf("state: %s\n", tcp_state_str[pcb->state]); - } - - rt_kprintf("TIME-WAIT PCB states:\n"); - for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) - { - rt_kprintf("%s:%d <==> %s:%d snd_nxt %d rcv_nxt %d ", - ipaddr_ntoa(&(pcb->local_ip)), pcb->local_port, - ipaddr_ntoa(&(pcb->remote_ip)), pcb->remote_port, - pcb->snd_nxt, pcb->rcv_nxt); - rt_kprintf("state: %s\n", tcp_state_str[pcb->state]); - } - rt_exit_critical(); + rt_uint32_t num = 0; + struct tcp_pcb *pcb; + char local_ip_str[16]; + char remote_ip_str[16]; + + extern struct tcp_pcb *tcp_active_pcbs; + extern union tcp_listen_pcbs_t tcp_listen_pcbs; + extern struct tcp_pcb *tcp_tw_pcbs; + extern const char *tcp_state_str[]; + + rt_enter_critical(); + rt_kprintf("Active PCB states:\n"); + for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) + { + strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip))); + strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip))); + + rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ", + num++, + local_ip_str, + pcb->local_port, + remote_ip_str, + pcb->remote_port, + pcb->snd_nxt, + pcb->rcv_nxt); + rt_kprintf("state: %s\n", tcp_state_str[pcb->state]); + } + + rt_kprintf("Listen PCB states:\n"); + num = 0; + for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) + { + rt_kprintf("#%d local port %d ", num++, pcb->local_port); + rt_kprintf("state: %s\n", tcp_state_str[pcb->state]); + } + + rt_kprintf("TIME-WAIT PCB states:\n"); + num = 0; + for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) + { + strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip))); + strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip))); + + rt_kprintf("#%d %s:%d <==> %s:%d snd_nxt 0x%08X rcv_nxt 0x%08X ", + num++, + local_ip_str, + pcb->local_port, + remote_ip_str, + pcb->remote_port, + pcb->snd_nxt, + pcb->rcv_nxt); + rt_kprintf("state: %s\n", tcp_state_str[pcb->state]); + } + rt_exit_critical(); } FINSH_FUNCTION_EXPORT(list_tcps, list all of tcp connections); #endif diff --git a/examples/gui/SConscript b/examples/gui/SConscript deleted file mode 100644 index 1d82cccdb0c6e06265c97ab491b17b92f7cbdced..0000000000000000000000000000000000000000 --- a/examples/gui/SConscript +++ /dev/null @@ -1,60 +0,0 @@ -from building import * -import os - -''' -demo_view_dc_buffer.c -demo_fnview.c -demo_listview.c -demo_listview_icon.c -demo_panel_single.c -demo_view_box.c -demo_view_image.c -demo_view_module.c -''' - -src = Split(""" -demo_application.c -demo_view.c -demo_xml.c -demo_view_benchmark.c -demo_view_dc.c -demo_view_ttf.c -demo_view_dc_buffer.c -demo_view_animation.c -demo_view_buffer_animation.c -demo_view_instrument_panel.c -demo_view_window.c -demo_view_label.c -demo_view_button.c -demo_view_checkbox.c -demo_view_progressbar.c -demo_view_scrollbar.c -demo_view_radiobox.c -demo_view_textbox.c -demo_view_listbox.c -demo_view_menu.c -demo_view_listctrl.c -demo_view_combobox.c -demo_view_slider.c -demo_view_notebook.c -demo_view_mywidget.c -demo_view_box.c -demo_view_edit.c -demo_view_bmp.c -demo_plot.c -mywidget.c -demo_view_digtube.c -""") - -if GetDepend('RTGUI_USING_FONT_COMPACT'): - import stract_cjk as sf - fl1 = sf.get_font_lib('hz16') - fl2 = sf.get_font_lib('hz12') - cwd = GetCurrentDir() - for i in src: - fl1.push_file(open(os.path.join(cwd, i), 'r')) - fl2.push_file(open(os.path.join(cwd, i), 'r')) - -group = DefineGroup('gui_examples', src, depend = ['RT_USING_RTGUI']) - -Return('group') diff --git a/examples/gui/demo_application.c b/examples/gui/demo_application.c deleted file mode 100644 index 45ce95251a156bdf1bd81a32dc37a1cae0786941..0000000000000000000000000000000000000000 --- a/examples/gui/demo_application.c +++ /dev/null @@ -1,156 +0,0 @@ -#include -#include -#include - -#include -#include - -struct rtgui_notebook *the_notebook; - -static rt_bool_t demo_handle_key(struct rtgui_object *object, struct rtgui_event *event) -{ - struct rtgui_event_kbd *ekbd = (struct rtgui_event_kbd *)event; - - if (ekbd->type == RTGUI_KEYUP) - { - if (ekbd->key == RTGUIK_RIGHT) - { - demo_view_next(RT_NULL, RT_NULL); - return RT_TRUE; - } - else if (ekbd->key == RTGUIK_LEFT) - { - demo_view_prev(RT_NULL, RT_NULL); - return RT_TRUE; - } - } - return RT_TRUE; -} - -struct rtgui_win *main_win; -static void application_entry(void *parameter) -{ - struct rtgui_app *app; - struct rtgui_rect rect; - - app = rtgui_app_create("gui_demo"); - if (app == RT_NULL) - return; - - /* create a full screen window */ - rtgui_graphic_driver_get_rect(rtgui_graphic_driver_get_default(), &rect); - - main_win = rtgui_win_create(RT_NULL, "demo_win", &rect, - RTGUI_WIN_STYLE_NO_BORDER | RTGUI_WIN_STYLE_NO_TITLE); - if (main_win == RT_NULL) - { - rtgui_app_destroy(app); - return; - } - - rtgui_win_set_onkey(main_win, demo_handle_key); - - /* create a no title notebook that we can switch demo on it easily. */ - the_notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_NOTAB); - if (the_notebook == RT_NULL) - { - rtgui_win_destroy(main_win); - rtgui_app_destroy(app); - return; - } - - rtgui_container_add_child(RTGUI_CONTAINER(main_win), RTGUI_WIDGET(the_notebook)); - - //demo_view_box(); - - /* ʼӵͼ */ - demo_view_benchmark(); - - demo_view_dc(); -#ifdef RTGUI_USING_TTF - demo_view_ttf(); -#endif - -#ifndef RTGUI_USING_SMALL_SIZE - demo_view_dc_buffer(); -#endif - demo_view_animation(); -#ifndef RTGUI_USING_SMALL_SIZE - demo_view_buffer_animation(); - demo_view_instrument_panel(); -#endif - demo_view_window(); - demo_view_label(); - demo_view_button(); - demo_view_checkbox(); - demo_view_progressbar(); - demo_view_scrollbar(); - demo_view_radiobox(); - demo_view_textbox(); - demo_view_listbox(); - demo_view_menu(); - demo_view_listctrl(); - demo_view_combobox(); - demo_view_slider(); - demo_view_notebook(); - demo_view_mywidget(); - demo_plot(); - demo_view_digtube(); - -#if defined(RTGUI_USING_DFS_FILERW) - demo_view_edit(); - demo_view_bmp(); -#endif - -#if 0 -#if defined(RTGUI_USING_DFS_FILERW) - demo_view_image(); -#endif -#ifdef RT_USING_MODULE -#if defined(RTGUI_USING_DFS_FILERW) - demo_view_module(); -#endif -#endif - demo_listview_view(); - demo_listview_icon_view(); -#if defined(RTGUI_USING_DFS_FILERW) - demo_fn_view(); -#endif -#endif - - rtgui_win_show(main_win, RT_FALSE); - - /* ִй̨¼ѭ */ - rtgui_app_run(app); - - rtgui_app_destroy(app); -} - -void application_init() -{ - static rt_bool_t inited = RT_FALSE; - - if (inited == RT_FALSE) /* ظʼı */ - { - rt_thread_t tid; - - tid = rt_thread_create("wb", - application_entry, RT_NULL, - 2048 * 2, 25, 10); - - if (tid != RT_NULL) - rt_thread_startup(tid); - - inited = RT_TRUE; - } -} - -#ifdef RT_USING_FINSH -#include -void application() -{ - application_init(); -} -/* finshֱִapplication()ִĺ */ -FINSH_FUNCTION_EXPORT(application, application demo) -#endif diff --git a/examples/gui/demo_fnview.c b/examples/gui/demo_fnview.c deleted file mode 100644 index af170101b4bc534bc451e531f66e2b1fa08c8e44..0000000000000000000000000000000000000000 --- a/examples/gui/demo_fnview.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 嵥ļбͼʾ - * - * ӻȴһʾõviewİťʱᰴģʽʾʽʾ - * µļбͼ - */ -#include "demo_view.h" -#include -#include -#include - -#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) -/* ʾѡļıǩ */ -static rtgui_label_t *label; -/* ļбͼİťص */ -static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event) -{ - rtgui_filelist_view_t *view; - rtgui_workbench_t *workbench; - rtgui_rect_t rect; - - /* öworkbench */ - workbench = RTGUI_APPLICATION(rtgui_widget_get_toplevel(widget)); - rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect); - - /* Win32ƽ̨ƽ̨IJͬʵĿ¼λ */ -#ifdef _WIN32 - view = rtgui_filelist_view_create(workbench, "d:\\", "*.*", &rect); -#else - view = rtgui_filelist_view_create(workbench, "/", "*.*", &rect); -#endif - - /* ģʽʽʾļбͼ */ - if (rtgui_container_show(RTGUI_CONTAINER(view), RT_TRUE) == RTGUI_MODAL_OK) - { - char path[32]; - - /* ļбͼгɹѡļӦ· */ - rtgui_filelist_view_get_fullpath(view, path, sizeof(path)); - - /* ļ·ıǩ */ - rtgui_label_set_text(label, path); - } - - /* ɾ ļб ͼ */ - rtgui_container_destroy(RTGUI_CONTAINER(view)); -} - -/* ʾļбͼͼ */ -rtgui_container_t *demo_fn_view(rtgui_workbench_t *workbench) -{ - rtgui_rect_t rect; - rtgui_container_t *view; - rtgui_button_t *open_btn; - rtgui_font_t *font; - - /* Ĭϲ12ʾ */ - font = rtgui_font_refer("asc", 12); - - /* ʾõͼ */ - view = demo_view(workbench, "FileList View"); - /* ʾͼλϢ */ - demo_view_get_rect(view, &rect); - - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* ʾļ·õıǩ */ - label = rtgui_label_create("fn: "); - rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label)); - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font; - - /* ʾͼλϢ */ - demo_view_get_rect(view, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 80; - rect.y1 += 30; - rect.y2 = rect.y1 + 20; - /* ťԴһµļбͼ */ - open_btn = rtgui_button_create("Open File"); - rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(open_btn)); - rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect); - RTGUI_WIDGET_FONT(RTGUI_WIDGET(open_btn)) = font; - rtgui_button_set_onbutton(open_btn, open_btn_onbutton); - - return view; -} -#endif diff --git a/examples/gui/demo_listview.c b/examples/gui/demo_listview.c deleted file mode 100644 index 0d0bbeba8dedb0949ee4a871b978e5d2e451833a..0000000000000000000000000000000000000000 --- a/examples/gui/demo_listview.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 嵥бͼʾ - * - * ӻȴһʾõcontainerİťʱᰴģʽʾʽʾ - * µбͼ - */ -#include "demo_view.h" -#include -#include -#include -#include - -static struct rtgui_application *application = RT_NULL; -static rtgui_list_view_t *_view = RT_NULL; -// static rtgui_image_t* return_image = RT_NULL; - -/* бĶ */ -static void listitem_action(rtgui_widget_t *widget, void *parameter) -{ - char label_text[32]; - rtgui_win_t *win; - rtgui_label_t *label; - rtgui_rect_t rect = {0, 0, 150, 80}; - int no = (int)parameter; - - rtgui_rect_moveto(&rect, 20, 50); - - /* ʾϢ */ - win = rtgui_win_create(RTGUI_TOPLEVEL(application), - "", &rect, RTGUI_WIN_STYLE_DEFAULT); - - rect.x1 += 20; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - - /* Ӧıǩ */ - rt_sprintf(label_text, " %d", no); - label = rtgui_label_create(label_text); - - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(win, RTGUI_WIDGET(label)); - - /* ģ̬ʾ */ - rtgui_win_show(win, RT_FALSE); -} - -/* عܵĶ */ -static void return_action(rtgui_widget_t *widget, void *parameter) -{ - rtgui_container_end_modal(RTGUI_CONTAINER(_view), RTGUI_MODAL_OK); -} - -/* б */ -static struct rtgui_list_item items[] = -{ - {"б1", RT_NULL, listitem_action, (void *)1}, - {"б2", RT_NULL, listitem_action, (void *)2}, - {"б3", RT_NULL, listitem_action, (void *)3}, - {"б4", RT_NULL, listitem_action, (void *)4}, - {"б5", RT_NULL, listitem_action, (void *)5}, - {"", RT_NULL, return_action, RT_NULL}, -}; - -/* бͼõİť */ -static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event) -{ - rtgui_rect_t rect; - - /* öapplication */ - application = RTGUI_APPLICATION(rtgui_widget_get_toplevel(widget)); - rtgui_widget_get_rect(RTGUI_WIDGET(application), &rect); - - /* һбͼ ָΪitems */ - _view = rtgui_list_view_create(items, sizeof(items) / sizeof(struct rtgui_list_item), - &rect, RTGUI_LIST_VIEW_LIST); - - rtgui_application_add_container(application, RTGUI_CONTAINER(_view)); - - /* ģʽʾͼ */ - rtgui_container_show(RTGUI_CONTAINER(_view), RT_TRUE); - rtgui_container_destroy(RTGUI_CONTAINER(_view)); - _view = RT_NULL; -} - -/* ʾбͼͼ */ -rtgui_container_t *demo_listview_view(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_button_t *open_btn; - - container = demo_view("бͼʾ"); - - /* Ӷť */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 80; - rect.y1 += 30; - rect.y2 = rect.y1 + 20; - open_btn = rtgui_button_create("б"); - rtgui_container_add_child(container, RTGUI_WIDGET(open_btn)); - rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect); - rtgui_button_set_onbutton(open_btn, open_btn_onbutton); - - return container; -} diff --git a/examples/gui/demo_listview_icon.c b/examples/gui/demo_listview_icon.c deleted file mode 100644 index 6014172582e627ff629d3686e7ec7f900c39d84e..0000000000000000000000000000000000000000 --- a/examples/gui/demo_listview_icon.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 嵥бͼʾ - * - * ӻȴһʾõviewİťʱᰴģʽʾʽʾ - * µбͼ - */ -#include "demo_view.h" -#include -#include -#include -#include - -static struct rtgui_application *application = RT_NULL; -static rtgui_list_view_t *_view = RT_NULL; - -/* бĶ */ -static void listitem_action(rtgui_widget_t *widget, void *parameter) -{ - char label_text[32]; - rtgui_win_t *win; - rtgui_label_t *label; - rtgui_rect_t rect = {0, 0, 150, 80}; - int no = (int)parameter; - - rtgui_rect_moveto(&rect, 20, 50); - - /* ʾϢ */ - win = rtgui_win_create(RTGUI_TOPLEVEL(application), - "", &rect, RTGUI_WIN_STYLE_DEFAULT); - - rect.x1 += 20; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - - /* Ӧıǩ */ - rt_sprintf(label_text, " %d", no); - label = rtgui_label_create(label_text); - - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label)); - - /* ģ̬ʾ */ - rtgui_win_show(win, RT_FALSE); -} - -/* عܵĶ */ -static void return_action(rtgui_widget_t *widget, void *parameter) -{ - /* ˳ģ̬ʾ */ - rtgui_container_end_modal(RTGUI_CONTAINER(_view), RTGUI_MODAL_OK); -} - -/* б */ -#define ITEM_MAX 50 -static struct rtgui_list_item *items = RT_NULL; -static rtgui_image_t *item_icon = RT_NULL; -static rtgui_image_t *exit_icon = RT_NULL; - -static const char *image_xpm[] = -{ - "16 16 106 2", - " c None", - ". c #D0C83F", - "+ c #D0C840", - "@ c #D0C030", - "# c #D0B820", - "$ c #D0B020", - "% c #D0B01F", - "& c #5F571F", - "* c #F0F0C0", - "= c #FFF8D0", - "- c #FFF8C0", - "; c #FFF8B0", - "> c #FFF8A0", - ", c #F0E870", - "' c #707030", - ") c #4F87EF", - "! c #4F78C0", - "~ c #5088E0", - "{ c #5078C0", - "] c #C0D0F0", - "^ c #FFF8E0", - "/ c #FFF090", - "( c #F0E070", - "_ c #6F97D0", - ": c #C0D8FE", - "< c #80A8F0", - "[ c #7088D0", - "} c #B0D0FF", - "| c #90B0F0", - "1 c #1040A0", - "2 c #F0F080", - "3 c #707040", - "4 c #7098F0", - "5 c #3068E0", - "6 c #A0B8F0", - "7 c #4070C0", - "8 c #002880", - "9 c #404040", - "0 c #505050", - "a c #F0F090", - "b c #F0E860", - "c c #F0D860", - "d c #807840", - "e c #2F5FC0", - "f c #1050D0", - "g c #1048B0", - "h c #002870", - "i c #C0C080", - "j c #C0C070", - "k c #F0F070", - "l c #F0E060", - "m c #E0D050", - "n c #00277F", - "o c #00287F", - "p c #1F3F6F", - "q c #1048C0", - "r c #0040B0", - "s c #204080", - "t c #FFF890", - "u c #F0D850", - "v c #E0C840", - "w c #807040", - "x c #A0B06F", - "y c #204880", - "z c #2048A0", - "A c #90A8C0", - "B c #FFF080", - "C c #F0D050", - "D c #C0A830", - "E c #6F682F", - "F c #F0F0A0", - "G c #E0D060", - "H c #B0A040", - "I c #D0B840", - "J c #E0C040", - "K c #D0B030", - "L c #706820", - "M c #5F581F", - "N c #CFBF3F", - "O c #FFF0A0", - "P c #A09830", - "Q c #A08820", - "R c #908030", - "S c #807830", - "T c #707020", - "U c #605820", - "V c #6F672F", - "W c #D0C040", - "X c #F0E880", - "Y c #907820", - "Z c #B09820", - "` c #B09010", - " . c #B08820", - ".. c #806820", - "+. c #5F5F1F", - "@. c #F0E080", - "#. c #B09020", - "$. c #C0B040", - "%. c #A09030", - "&. c #908020", - "*. c #606020", - "=. c #6F5F1F", - "-. c #9F982F", - ";. c #A0872F", - ">. c #6F681F", - ",. c #706020", - " ", - " . + + + @ @ # # $ % & ", - " + * = = = = - ; > , ' ", - " ) ! ~ { ] ^ = - - > / ( ' ", - "_ : < { [ } | 1 - ; > > / 2 ( 3 ", - "{ 4 5 1 6 7 5 8 9 0 a / , b c d ", - "e f g h 8 8 g h i j / k l c m d ", - " n o p q r s t 2 , l c u v w ", - " x y z A B , l u C v D E ", - " @ F > t k G H I J K L M ", - " N @ O / 2 l P Q R S T U V ", - " W m 2 X l I Y Z ` ...+. ", - " W @.l u I R #.Z Y U M ", - " $.G I $.%.R &.Y *.& =. ", - " -.;.>.,.L L ,.& M ", - " " -}; - -static const char *exit_xpm[] = -{ - "16 16 71 1", - " c None", - ". c #CF673F", - "+ c #D0673F", - "@ c #C05F3F", - "# c #BF5F3F", - "$ c #D0674F", - "% c #E07050", - "& c #F07850", - "* c #FF7040", - "= c #F06830", - "- c #E05830", - "; c #D05030", - "> c #B04F2F", - ", c #D06F4F", - "' c #F08060", - ") c #FF9070", - "! c #FF8860", - "~ c #FF8050", - "{ c #FF5820", - "] c #FF4810", - "^ c #D04810", - "/ c #B0482F", - "( c #FF9880", - "_ c #FF6030", - ": c #F04000", - "< c #C04010", - "[ c #A03F2F", - "} c #E06840", - "| c #FF9870", - "1 c #FF7850", - "2 c #FF6840", - "3 c #F04010", - "4 c #E03800", - "5 c #A03820", - "6 c #8F372F", - "7 c #F06840", - "8 c #FF8060", - "9 c #FFFFFF", - "0 c #FFF8F0", - "a c #FFF0F0", - "b c #FFE8E0", - "c c #FFD0C0", - "d c #E04010", - "e c #B03010", - "f c #7F2F1F", - "g c #FFD8D0", - "h c #FFC8C0", - "i c #C03000", - "j c #6F281F", - "k c #F04810", - "l c #FF6830", - "m c #FFE0D0", - "n c #F0C0B0", - "o c #D04010", - "p c #5F1F1F", - "q c #E04820", - "r c #FF4000", - "s c #FF5020", - "t c #FF5010", - "u c #D03800", - "v c #D03000", - "w c #B02800", - "x c #5F170F", - "y c #C05020", - "z c #F03800", - "A c #802010", - "B c #4F0F0F", - "C c #A02800", - "D c #C03810", - "E c #5F0F00", - "F c #A03810", - " ", - " .+@@@# ", - " $%&*=-;> ", - " ,')!~*{]^/ ", - " +&)()~*_]:<[ ", - " .}~!||!12{3456 ", - " +7899990abcdef ", - " @{19990bgchdij ", - " @kl0abmchcnoip ", - " @qr]stt]3duvwx ", - " #yz:::z44uvvAB ", - " >o4444uvvvCB ", - " /DvvvvvvCE ", - " [FeiiwAB ", - " 6fjpxB ", - " " -}; - -/* бͼõİť */ -static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event) -{ - rtgui_rect_t rect; - rt_uint32_t index; - - /* öapplication */ - application = RTGUI_APPLICATION(rtgui_widget_get_toplevel(widget)); - rtgui_widget_get_rect(RTGUI_WIDGET(application), &rect); - - /* ʼͼб */ - if (items == RT_NULL) - { - char item_name[32]; - - items = (struct rtgui_list_item *) rtgui_malloc((ITEM_MAX + 1) * sizeof(struct rtgui_list_item)); - for (index = 0; index < ITEM_MAX; index ++) - { - rt_snprintf(item_name, sizeof(item_name), "ͼ%d", index); - items[index].action = listitem_action; - items[index].image = item_icon; - items[index].name = rt_strdup(item_name); - items[index].parameter = (void *) index; - } - - items[ITEM_MAX].action = return_action; - items[ITEM_MAX].image = exit_icon; - items[ITEM_MAX].name = "˳"; - items[ITEM_MAX].parameter = RT_NULL; - } - - /* һбͼ ָΪitems */ - _view = rtgui_list_view_create(items, ITEM_MAX + 1, &rect, RTGUI_LIST_VIEW_ICON); - /* applicationӦͼ */ - rtgui_application_add_container(application, RTGUI_CONTAINER(_view)); - - /* ģʽʾͼ */ - rtgui_container_show(RTGUI_CONTAINER(_view), RT_TRUE); - rtgui_container_destroy(RTGUI_CONTAINER(_view)); - - _view = RT_NULL; -} - -/* ʾбͼͼ */ -rtgui_container_t *demo_listview_icon_view(struct rtgui_application *app) -{ - rtgui_rect_t rect; - rtgui_container_t *view; - rtgui_button_t *open_btn; - - view = demo_view(app, "ͼͼʾ"); - - if (item_icon == RT_NULL) - item_icon = rtgui_image_create_from_mem("xpm", - (const rt_uint8_t *)image_xpm, sizeof(image_xpm), RT_TRUE); - if (exit_icon == RT_NULL) - exit_icon = rtgui_image_create_from_mem("xpm", - (const rt_uint8_t *)exit_xpm, sizeof(exit_xpm), RT_TRUE); - - /* Ӷť */ - demo_view_get_rect(view, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 80; - rect.y1 += 30; - rect.y2 = rect.y1 + 20; - open_btn = rtgui_button_create("ͼб"); - rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(open_btn)); - rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect); - rtgui_button_set_onbutton(open_btn, open_btn_onbutton); - - return view; -} diff --git a/examples/gui/demo_panel.c b/examples/gui/demo_panel.c deleted file mode 100644 index 339b67cc7da040b3b60d06f606684a99d5917c61..0000000000000000000000000000000000000000 --- a/examples/gui/demo_panel.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -/* - * Panel demo for 240x320 - * info panel: (0, 0) - (240, 25) - * main panel: (0, 25) - (240, 320) - */ -void panel_init(void) -{ - rtgui_rect_t rect; - - /* 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); - rtgui_panel_set_default_focused("main"); -} diff --git a/examples/gui/demo_panel_single.c b/examples/gui/demo_panel_single.c deleted file mode 100644 index c31e878f4acfe0d4044277a5924626f1003f6bd5..0000000000000000000000000000000000000000 --- a/examples/gui/demo_panel_single.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include - -/* - * a single panel - */ -void panel_init(void) -{ - rtgui_rect_t rect; - - /* register main panel */ - rect.x1 = 0; - rect.y1 = 0; - rect.x2 = rtgui_graphic_driver_get_default()->width; - rect.y2 = rtgui_graphic_driver_get_default()->height; - rtgui_panel_register("main", &rect); - rtgui_panel_set_default_focused("main"); -} diff --git a/examples/gui/demo_plot.c b/examples/gui/demo_plot.c deleted file mode 100644 index 14595cb1e9eef93e28e6026954e1c3f7fe764999..0000000000000000000000000000000000000000 --- a/examples/gui/demo_plot.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include - -#include "demo_view.h" - -/* sin data */ -rt_int16_t sin_ydata[] = { - 0, 9, 19, 29, 38, 47, 56, 64, 71, 78, 84, 89, 93, 96, 98, 99, 99, 99, 97, - 94, 90, 86, 80, 74, 67, 59, 51, 42, 33, 23, 14, 4, -5, -15, -25, -35, -44, - -52, -61, -68, -75, -81, -87, -91, -95, -97, -99, -99, -99, -98, -95, -92, - -88, -83, -77, -70, -63, -55, -46, -37, -27, -18, -8, 1, 11, 21, 31 -}; -rt_int16_t cos_ydata[] = { - 50, 49, 46, 41, 34, 27, 18, 8, -1, -11, -20, -29, -36, -42, -47, -49, -49, - -48, -44, -39, -32, -24, -15, -5, 4, 14, 23, 31, 38, 44, 48, 49, 49, 47, - 43, 37, 30, 21, 12, 2, -7, -16, -25, -33, -40, -45, -48, -49, -49, -46, - -41, -35, -28, -19, -9, 0, 10, 19, 28, 36, 42, 46, 49, 49, 48, 45, 40, 33, - 25, 16, 6, -3, -12, -22, -30, -37, -43, -47, -49, -49, -47, -44, -38, -31, - -23, -13, -3, 6, 15, 24, 33, 39, 45, 48, 49, 49, 46, 42, 36, 29, 20, 10, 1, - -8, -18, -27, -35, -41, -46, -49, -49, -48, -45, -41, -34, -26, -17, -8, 1, - 11, 21, 29, 37, 43, 47, 49, 49, 48, 44, 39, 32, 24, 14, 5, -4, -14, -23, - -32, -39, -44, -48, -49, -49, -47, -43, -37, -30, -21, -12, -2, 7, 17, 26, - 34, 40, 45, 48, 49, 49, 46, 41, 35, 27, 18, 9, 0, -10, -20, -28, -36, -42, - -46, -49, -49, -48, -45, -40, -33, -25, -16, -6, 3, 13, 22, 31, 38, 43, 47, - 49, 49, 47, 43, 38 -}; - -struct rtgui_container* demo_plot(void) -{ - struct rtgui_container *cnt; - struct rtgui_plot_curve *curve1, *curve2, *curve3; - struct rtgui_plot *plot; - struct rtgui_rect rect; - - cnt = demo_view("߻ͼ"); - - plot = rtgui_plot_create(); - - curve1 = rtgui_plot_curve_create(); - rtgui_plot_curve_set_y(curve1, sin_ydata); - RTGUI_MV_MODEL(curve1)->length = sizeof(sin_ydata)/sizeof(sin_ydata[0]); - curve1->min_x = 0; - curve1->max_x = sizeof(sin_ydata)/sizeof(sin_ydata[0]); - curve1->min_y = -100; - curve1->max_y = 100; - curve1->color = red; - rtgui_mv_model_add_view(RTGUI_MV_MODEL(curve1), RTGUI_MV_VIEW(plot)); - - curve2 = rtgui_plot_curve_create(); - rtgui_plot_curve_set_y(curve2, cos_ydata); - RTGUI_MV_MODEL(curve2)->length = sizeof(cos_ydata)/sizeof(cos_ydata[0]); - curve2->min_x = 0; - curve2->max_x = sizeof(cos_ydata)/sizeof(cos_ydata[0]); - curve2->min_y = -50; - curve2->max_y = 50; - curve2->color = blue; - rtgui_mv_model_add_view(RTGUI_MV_MODEL(curve2), RTGUI_MV_VIEW(plot)); - - curve3 = rtgui_plot_curve_create(); - rtgui_plot_curve_set_x(curve3, cos_ydata); - rtgui_plot_curve_set_y(curve3, sin_ydata); - curve3->min_x = -50; - curve3->max_x = 50; - curve3->min_y = -100; - curve3->max_y = 100; - RTGUI_MV_MODEL(curve3)->length = sizeof(sin_ydata)/sizeof(sin_ydata[0]); - curve3->color = black; - rtgui_mv_model_add_view(RTGUI_MV_MODEL(curve3), RTGUI_MV_VIEW(plot)); - - rtgui_widget_get_rect(RTGUI_WIDGET(cnt), &rect); - rtgui_widget_set_rect(RTGUI_WIDGET(plot), &rect); - rtgui_plot_set_base(plot, -100, -300); - - rtgui_container_add_child(cnt, RTGUI_WIDGET(plot)); - - return cnt; -} diff --git a/examples/gui/demo_simple_workbench.c b/examples/gui/demo_simple_workbench.c deleted file mode 100644 index 7baa0b0c500fe532df1aa0d3e458b6908df59042..0000000000000000000000000000000000000000 --- a/examples/gui/demo_simple_workbench.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * A simple workbench - */ -#include -#include -#include -#include -#include - -static void workbench_entry(void *parameter) -{ - rt_mq_t mq; - rtgui_container_t *view; - rtgui_label_t *label; - struct rtgui_workbench *workbench; - rtgui_rect_t rect; - - mq = rt_mq_create("wmq", 256, 8, RT_IPC_FLAG_FIFO); - /* עᵱǰ߳ΪGUI߳ */ - rtgui_thread_register(rt_thread_self(), mq); - /* һ̨ */ - workbench = rtgui_workbench_create("main", "workbench #1"); - if (workbench == RT_NULL) return; - - view = rtgui_container_create("view"); - if (view == RT_NULL) return; - /* ָͼıɫ */ - RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view)) = white; - - /* һlabel */ - label = rtgui_label_create("ãRT-Thread"); - rect.x1 = 10; - rect.y1 = 10; - rect.x2 = 210; - rect.y2 = 30; - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(label)); - - /* ӵworkbench */ - rtgui_workbench_add_view(workbench, view); - /* ģʽʽʾͼ */ - rtgui_container_show(view, RT_FALSE); - - /* ִй̨¼ѭ */ - rtgui_workbench_event_loop(workbench); - - /* ȥעGUI߳ */ - rtgui_thread_deregister(rt_thread_self()); - - /* delete message queue */ - rt_mq_delete(mq); -} - -/* ʼworkbench */ -void wb_init() -{ - rt_thread_t tid; - - tid = rt_thread_create("wb1", workbench_entry, RT_NULL, 2048, 20, 5); - if (tid != RT_NULL) rt_thread_startup(tid); -} diff --git a/examples/gui/demo_view.c b/examples/gui/demo_view.c deleted file mode 100644 index 42f0680b8874e8b895386ea91df088f0edee32db..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view.c +++ /dev/null @@ -1,132 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include - -extern struct rtgui_notebook *the_notebook; - -void demo_view_next(struct rtgui_object *object, struct rtgui_event *event) -{ - rtgui_notebook_set_current_by_index(the_notebook, - (rtgui_notebook_get_current_index(the_notebook) + 1) % - rtgui_notebook_get_count(the_notebook)); -} - -void demo_view_prev(struct rtgui_object *object, struct rtgui_event *event) -{ - rt_int16_t cur_idx = rtgui_notebook_get_current_index(the_notebook); - - if (cur_idx == 0) - rtgui_notebook_set_current_by_index(the_notebook, - rtgui_notebook_get_count(the_notebook) - 1); - else - rtgui_notebook_set_current_by_index(the_notebook, - --cur_idx); -} - -rtgui_container_t *demo_view(const char *title) -{ - struct rtgui_container *container; - struct rtgui_label *label; - struct rtgui_staticline *line; - struct rtgui_button *next_btn, *prev_btn; - struct rtgui_rect rect; - - container = rtgui_container_create(); - if (container == RT_NULL) - return RT_NULL; - - rtgui_notebook_add(the_notebook, title, RTGUI_WIDGET(container)); - - /* ͼλϢ(ڼ뵽 notebook ʱnotebook Զ container - * ĴС) */ - rtgui_widget_get_rect(RTGUI_WIDGET(container), &rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(container), &rect); - rect.x1 += 5; - rect.y1 += 5; - rect.x2 = rect.x1 + rt_strlen(title)*8; - rect.y2 = rect.y1 + 20; - - /* õıǩ */ - label = rtgui_label_create(title); - /* ñǩλϢ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* ӱǩͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - rtgui_widget_get_rect(RTGUI_WIDGET(container), &rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(container), &rect); - rect.y1 += 20 + 5; - rect.y2 = rect.y1 + 2; - /* һˮƽ staticline */ - line = rtgui_staticline_create(RTGUI_HORIZONTAL); - /* þ̬ߵλϢ */ - rtgui_widget_set_rect(RTGUI_WIDGET(line), &rect); - /* Ӿ̬ߵͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(line)); - - /* ͼλϢ */ - rtgui_widget_get_rect(RTGUI_WIDGET(container), &rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(container), &rect); - rect.x2 -= 5; - rect.y2 -= 5; - rect.x1 = rect.x2 - 100; - rect.y1 = rect.y2 - 25; - - /* "һ"ť */ - next_btn = rtgui_button_create("һ"); - /* onbuttondemo_view_next */ - rtgui_button_set_onbutton(next_btn, demo_view_next); - /* ðťλϢ */ - rtgui_widget_set_rect(RTGUI_WIDGET(next_btn), &rect); - /* Ӱťͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(next_btn)); - - /* ͼλϢ */ - rtgui_widget_get_rect(RTGUI_WIDGET(container), &rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(container), &rect); - rect.x1 += 5; - rect.y2 -= 5; - rect.x2 = rect.x1 + 100; - rect.y1 = rect.y2 - 25; - - /* "һ"ť */ - prev_btn = rtgui_button_create("һ"); - /* onbuttondemo_view_prev */ - rtgui_button_set_onbutton(prev_btn, demo_view_prev); - /* ðťλϢ */ - rtgui_widget_set_rect(RTGUI_WIDGET(prev_btn), &rect); - /* Ӱťͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(prev_btn)); - - /* شͼ */ - return container; -} - -/* ڷʾͼĶ */ -void demo_view_get_rect(rtgui_container_t *container, rtgui_rect_t *rect) -{ - RT_ASSERT(container != RT_NULL); - RT_ASSERT(rect != RT_NULL); - - rtgui_widget_get_rect(RTGUI_WIDGET(container), rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(container), rect); - /* ȥʾ·ť */ - rect->y1 += 45; - rect->y2 -= 35; -} - -void demo_view_get_logic_rect(rtgui_container_t *container, rtgui_rect_t *rect) -{ - RT_ASSERT(container != RT_NULL); - RT_ASSERT(rect != RT_NULL); - - rtgui_widget_get_rect(RTGUI_WIDGET(container), rect); - /* ȥʾ·ť */ - rect->y1 += 45; - rect->y2 -= 35; -} diff --git a/examples/gui/demo_view.h b/examples/gui/demo_view.h deleted file mode 100644 index 8ab8ffeb9760205b43ebc448a56695ae05eb5785..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 程序清单:view演示 - * - * 这是一个视图的演示,也是为了配合整个GUI演示而制作的视图,或者说,其他大多数控件的演示 - * 都是采用,先创建一个demo_view(演示视图),然后再在这个演示视图上添加相应的控件。 - * - * 这个演示视图默认上方带一个演示标题,下方带两个按钮,点击它切换到前一个视图或后一个视图。 - * 针对控件演示而言,这个演示视图最重要的是提供了一个可显示的区域,只需要在这块区域上添加 - * 控件即可达到演示的目的。 - * - * 获得这个显示区域的函数是: - * demo_view_get_rect函数。 - */ -#ifndef __DEMO_VIEW_H__ -#define __DEMO_VIEW_H__ - -#include -#include -#include - -/* 如果是标准版本,可以启用box自动布局引擎 */ -#ifndef RTGUI_USING_SMALL_SIZE -#include -#endif - -/* 创建一个演示视图,需要给出这个视图的演示标题 */ -rtgui_container_t *demo_view(const char *title); -/* 获得演示视图提供给演示控件用的区域信息 */ -void demo_view_get_rect(rtgui_container_t *view, rtgui_rect_t *rect); -void demo_view_get_logic_rect(rtgui_container_t *view, rtgui_rect_t *rect); -void demo_view_show(void); - -#endif - diff --git a/examples/gui/demo_view_animation.c b/examples/gui/demo_view_animation.c deleted file mode 100644 index 4145ba2055024ef67ce769ecf634a1ecfdf98b16..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_animation.c +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include -#include -#include "demo_view.h" - -/* - * ֱDCϻͼʵֶЧ - * - * ڶʱģ·ʾ - * "ҷ" - */ -static rt_int8_t dx = 1, dy = 1; -static rtgui_rect_t text_rect; -static rtgui_timer_t *timer; - -void timeout(struct rtgui_timer *timer, void *parameter) -{ - struct rtgui_dc *dc; - struct rtgui_rect rect; - struct rtgui_widget *widget; - - /* ؼ(container)ͨparameterݸʱ */ - widget = RTGUI_WIDGET(parameter); - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - return ; - - /* demo containerͼҪжϱ߽ */ - demo_view_get_rect(RTGUI_CONTAINER(widget), &rect); - rect.y2 -= 5; - - /* жǷǵһλͼ */ - if ((text_rect.x1 == 0) && (text_rect.y1 == 0)) - { - rtgui_rect_moveto(&text_rect, rect.x1, rect.y1); - } - else - { - /* ϵ */ - rtgui_dc_fill_rect(dc, &text_rect); - } - - /* dxdy */ - if (text_rect.x2 >= rect.x2) dx = -1; - if (text_rect.x1 < rect.x1) dx = 1; - if (text_rect.y2 >= rect.y2) dy = -1; - if (text_rect.y1 < rect.y1) dy = 1; - - /* ƶıλ */ - text_rect.x1 += dx; - text_rect.x2 += dx; - text_rect.y1 += dy; - text_rect.y2 += dy; - - /* ͼ */ - rtgui_dc_draw_text(dc, "ҷ", &text_rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); -} - -static rt_bool_t animation_on_show(struct rtgui_object *object, struct rtgui_event *event) -{ - rt_kprintf("animation on show\n"); - if (timer != RT_NULL) - rtgui_timer_start(timer); - return RT_TRUE; -} - -static rt_bool_t animation_on_hide(struct rtgui_object *object, struct rtgui_event *event) -{ - rt_kprintf("animation on hide\n"); - if (timer != RT_NULL) - rtgui_timer_stop(timer); - return RT_TRUE; -} - -rt_bool_t animation_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - - /* Ϊõdemo container汾һֿؼڻͼʱҪdemo containerȻͼ */ - rtgui_container_event_handler(object, event); - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - return RT_FALSE; - - /* demo containerͼ */ - demo_view_get_rect(RTGUI_CONTAINER(widget), &rect); - - /* */ - rtgui_dc_fill_rect(dc, &rect); - - /* ͼ */ - rtgui_dc_draw_text(dc, "ҷ", &text_rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - else if (event->type == RTGUI_EVENT_SHOW) - { - rtgui_container_event_handler(object, event); - animation_on_show(object, event); - } - else if (event->type == RTGUI_EVENT_HIDE) - { - rtgui_container_event_handler(object, event); - animation_on_hide(object, event); - } - else - { - /* Ĭϵ¼ */ - return rtgui_container_event_handler(object, event); - } - - return RT_FALSE; -} - -rtgui_container_t *demo_view_animation() -{ - rtgui_container_t *container; - - container = demo_view("DC "); - if (container != RT_NULL) - rtgui_object_set_event_handler(RTGUI_OBJECT(container), animation_event_handler); - - rtgui_font_get_metrics(RTGUI_WIDGET_FONT(container), "ҷ", &text_rect); - rtgui_rect_moveto(&text_rect, 0, 45); - timer = rtgui_timer_create(2, RT_TIMER_FLAG_PERIODIC, timeout, (void *)container); - - return container; -} diff --git a/examples/gui/demo_view_benchmark.c b/examples/gui/demo_view_benchmark.c deleted file mode 100644 index 8664759b5c243738dc1fb8df85132a9607fe98b8..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_benchmark.c +++ /dev/null @@ -1,146 +0,0 @@ -#include -#include -#include -#include -#include -#include "demo_view.h" - -#define RAND(x1, x2) ((rand() % (x2 - x1)) + x1) -#define _int_swap(x, y) do {x ^= y; y ^= x; x ^= y; } while(0) - -static struct rtgui_container *container = RT_NULL; -static int running = 0; -static rt_tick_t ticks; -static long long area; - -static rt_bool_t _benchmark_onshow(struct rtgui_object *obj, struct rtgui_event *ev) -{ - rtgui_widget_focus(RTGUI_WIDGET(obj)); - - return RT_TRUE; -} - -void _onidle(struct rtgui_object *object, rtgui_event_t *event) -{ - rtgui_color_t color; - rtgui_rect_t rect, draw_rect; - struct rtgui_dc *dc; - - /* ÿؼDC */ - // dc = rtgui_dc_hw_create(RTGUI_WIDGET(container)); - dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(container)); - if (dc == RT_NULL) - return; - - demo_view_get_logic_rect(RTGUI_CONTAINER(container), &rect); - draw_rect.x1 = RAND(rect.x1, rect.x2); - draw_rect.y1 = RAND(rect.y1, rect.y2); - draw_rect.x2 = RAND(rect.x1, rect.x2); - draw_rect.y2 = RAND(rect.y1, rect.y2); - - if(draw_rect.x1 > draw_rect.x2) _int_swap(draw_rect.x1, draw_rect.x2); - if(draw_rect.y1 > draw_rect.y2) _int_swap(draw_rect.y1, draw_rect.y2); - - area += rtgui_rect_width(draw_rect) * rtgui_rect_height(draw_rect); - color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255); - RTGUI_WIDGET_BACKGROUND(container) = color; - - rtgui_dc_fill_rect(dc, &draw_rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); - if(rt_tick_get()-ticks >= RT_TICK_PER_SECOND) - { - char buf[16]; - sprintf(buf, "%.2f", (double)area/(800*480)); - rt_kprintf("frames per second: %s fps\n", buf); - area = 0; - ticks = rt_tick_get(); - } -} - -void _draw_default(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - struct rtgui_dc *dc; - rtgui_rect_t rect; - - /* Ϊõdemo container汾һֿؼڻͼʱҪdemo containerȻͼ */ - rtgui_container_event_handler(object, event); - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - return; - - /* demo containerͼ */ - demo_view_get_logic_rect(RTGUI_CONTAINER(widget), &rect); - - /* */ - RTGUI_WIDGET_BACKGROUND(widget) = default_background; - rtgui_dc_fill_rect(dc, &rect); - - /* ʾʾ */ - rtgui_dc_draw_text(dc, "ʼ/ֹͣ...", &rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); -} - -rt_bool_t benchmark_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - if (event->type == RTGUI_EVENT_PAINT) - { - _draw_default(object, event); - } - else if (event->type == RTGUI_EVENT_SHOW) - { - rtgui_container_event_handler(object, event); - _benchmark_onshow(object, event); - } - else if (event->type == RTGUI_EVENT_KBD) - { - struct rtgui_event_kbd *kbd = (struct rtgui_event_kbd *)event; - - if (kbd->key == RTGUIK_LEFT || kbd->key == RTGUIK_RIGHT) - return RT_FALSE; - - if (RTGUI_KBD_IS_UP(kbd)) - { - if (running) - { - /* stop */ - rtgui_app_set_onidle(rtgui_app_self(), RT_NULL); - _draw_default(object, event); - } - else - { - /* run */ - ticks = rt_tick_get(); - area = 0; - rtgui_app_set_onidle(rtgui_app_self(), _onidle); - } - - running = !running; - } - - return RT_TRUE; - } - else - { - /* Ĭϵ¼ */ - return rtgui_container_event_handler(object, event); - } - - return RT_FALSE; -} - -rtgui_container_t *demo_view_benchmark(void) -{ - srand(100); - container = demo_view("ͼ"); - RTGUI_WIDGET(container)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE; - rtgui_object_set_event_handler(RTGUI_OBJECT(container), benchmark_event_handler); - - return container; -} diff --git a/examples/gui/demo_view_bmp.c b/examples/gui/demo_view_bmp.c deleted file mode 100644 index 304f3defcfd97b5a92afc13d997281d842260070..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_bmp.c +++ /dev/null @@ -1,304 +0,0 @@ -/* -* 嵥bmp_zoomʾ -*/ -#include "demo_view.h" -#include -#include -#include -#include -#include -#include -#include - -#if defined(RTGUI_USING_DFS_FILERW) -struct demo_bmp_dt -{ - float scale, angle; - char *filename; - struct rtgui_image *image; - struct rtgui_image *showimg; - rtgui_container_t *showbox; - rtgui_textbox_t *box; - rtgui_rect_t lastrect; -}bmpdt; - -rt_bool_t demo_bitmap_showbox(struct rtgui_object* object, struct rtgui_event* event) -{ - rtgui_container_t *container; - rtgui_widget_t *widget; - - RT_ASSERT(object != RT_NULL); - - container = RTGUI_CONTAINER(object); - widget = RTGUI_WIDGET(object); - - if(event->type == RTGUI_EVENT_PAINT) - { - int w, h; - rtgui_rect_t rect; - struct rtgui_dc *dc; - struct rtgui_image *image = bmpdt.showimg; - /* ǩлǰǩ, imageӦRT_NULL, */ - if(image == RT_NULL && bmpdt.image != RT_NULL) - { - image = bmpdt.image; - bmpdt.scale = 1.0f; - bmpdt.angle = 0.0f; - rtgui_widget_get_rect(RTGUI_WIDGET(bmpdt.showbox), &bmpdt.lastrect); - rtgui_rect_inflate(&bmpdt.lastrect, -RTGUI_WIDGET_BORDER(bmpdt.showbox)); - } - - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) - return RT_FALSE; - - rtgui_widget_get_rect(widget, &rect); - /* ڻƱ߿, ٽrectС䱳, Խ˸ */ - rtgui_dc_draw_border(dc, &rect, RTGUI_WIDGET_BORDER_STYLE(widget)); - rtgui_rect_inflate(&rect, -RTGUI_WIDGET_BORDER(widget)); - w = rtgui_rect_width(bmpdt.lastrect); - h = rtgui_rect_height(bmpdt.lastrect); - if(w > rtgui_rect_width(rect)) w = rtgui_rect_width(rect); - if(h > rtgui_rect_height(rect)) h = rtgui_rect_height(rect); - - /* fill container with background */ - /* - * lastrect¼һλͼ - * ÿػʱ,ֻlastrectȽ,ɵ֪ЩҪˢ - * 統ŴͼƬʱ,lastrectȵǰͼС,±, - * СͼƬʱ, ҲҪ»ͼlastrect. - */ - if(image != RT_NULL) - { /* ٲҪĻͼ */ - rtgui_rect_t rc; - if(w > image->w) - { - rc.x1 = image->w; - rc.y1 = bmpdt.lastrect.y1; - rc.x2 = bmpdt.lastrect.x2; - rc.y2 = (h > image->h) ? image->h : bmpdt.lastrect.y2; - rtgui_dc_fill_rect(dc, &rc); - } - if(h > image->h) - { - rc.x1 = bmpdt.lastrect.x1; - rc.y1 = image->h; - rc.x2 = bmpdt.lastrect.x2; - rc.y2 = bmpdt.lastrect.y2; - rtgui_dc_fill_rect(dc, &rc); - } - } - else - rtgui_dc_fill_rect(dc, &bmpdt.lastrect); - - /* ͼblit */ - if (image != RT_NULL) - { - int value; - rtgui_image_blit(image, dc, &rect); - bmpdt.lastrect.x1 = bmpdt.lastrect.y1 = RTGUI_WIDGET_BORDER(bmpdt.showbox); - - if(image->w > rtgui_rect_width(rect)) - value = rtgui_rect_width(rect); - else - value = image->w; - bmpdt.lastrect.x2 = bmpdt.lastrect.x1 + value; - - if(image->h > rtgui_rect_height(rect)) - value = rtgui_rect_height(rect); - else - value = image->h; - bmpdt.lastrect.y2 = bmpdt.lastrect.y1 + value; - } - - rtgui_dc_end_drawing(dc); - return RT_FALSE; - } - return rtgui_container_event_handler(object, event); -} - -void demo_bitmap_open(struct rtgui_object* object, struct rtgui_event* event) -{ - char *str; - rtgui_button_t *button = RTGUI_BUTTON(object); - /* textboxؼȡļ */ - str = (char*)rtgui_textbox_get_value(bmpdt.box); - if(str == RT_NULL) return; - if(*str == '/' && (rt_strstr(str, ".bmp")!=RT_NULL || rt_strstr(str, ".BMP")!=RT_NULL)) - { /* bmpļ, ļЧ, ͼ */ - if(bmpdt.filename != RT_NULL) - rt_free(bmpdt.filename); - bmpdt.filename = rt_strdup(str); - - if(bmpdt.image != RT_NULL) - rtgui_image_destroy(bmpdt.image); - - bmpdt.image = rtgui_image_create_from_file("bmp", bmpdt.filename, RT_TRUE); - - if(bmpdt.image != RT_NULL) - { - bmpdt.showimg = bmpdt.image; - bmpdt.scale = 1.0; - bmpdt.angle = 0.0; - rtgui_widget_update(RTGUI_WIDGET(bmpdt.showbox)); - } - } - else - rt_kprintf("Bad filename!"); -} - -void demo_image_zoom_in(struct rtgui_object* object, struct rtgui_event* event) -{ - rtgui_button_t *button = RTGUI_BUTTON(object); - - if (bmpdt.image == RT_NULL) return; - - if (bmpdt.scale > 0.45) - { /* ű */ - if (bmpdt.scale > 1.0) bmpdt.scale -= (float)0.5; - else bmpdt.scale -= (float)0.1; - } - /* ű, ԭʼͼ, õͼεָ */ - bmpdt.showimg = rtgui_image_zoom(bmpdt.image, bmpdt.scale, bmpdt.scale, RTGUI_IMG_ZOOM_BILINEAR); - if (bmpdt.showimg != RT_NULL) - rtgui_widget_update(RTGUI_WIDGET(bmpdt.showbox)); - else - return; - if(bmpdt.showimg != bmpdt.image) - { /* ͷŵͼõԴ */ - rtgui_image_destroy(bmpdt.showimg); - bmpdt.showimg = RT_NULL; - } -} - -void demo_image_zoom_out(struct rtgui_object* object, struct rtgui_event* event) -{ - rtgui_button_t *button = RTGUI_BUTTON(object); - - if (bmpdt.image == RT_NULL) return; - - if (bmpdt.scale < 4.95) - { /* ű */ - if (bmpdt.scale > 0.95) bmpdt.scale += (float)0.5; - else bmpdt.scale += (float)0.1; - } - - bmpdt.showimg = rtgui_image_zoom(bmpdt.image, bmpdt.scale, bmpdt.scale, RTGUI_IMG_ZOOM_BILINEAR); - if (bmpdt.showimg != RT_NULL) - rtgui_widget_update(RTGUI_WIDGET(bmpdt.showbox)); - else - return; - if(bmpdt.showimg != bmpdt.image) - { - rtgui_image_destroy(bmpdt.showimg); - bmpdt.showimg = RT_NULL; - } -} - -void demo_image_rotate(struct rtgui_object* object, struct rtgui_event* event) -{ - rtgui_button_t *button = RTGUI_BUTTON(object); - - if (bmpdt.image == RT_NULL) return; - /* ͼתǶ */ - if (bmpdt.angle < 360.0) - bmpdt.angle += (float)1.0; - else - bmpdt.angle = 0.0; - /* תִת, ȡһµͼָ */ - bmpdt.showimg = rtgui_image_rotate(bmpdt.image, bmpdt.angle); - if (bmpdt.showimg != RT_NULL) - rtgui_widget_update(RTGUI_WIDGET(bmpdt.showbox)); - else - return; - if(bmpdt.showimg != bmpdt.image) - { - rtgui_image_destroy(bmpdt.showimg); - bmpdt.showimg = RT_NULL; - } -} - -rtgui_container_t *demo_view_bmp(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container, *showbox; - rtgui_button_t *button; - rtgui_textbox_t *box; - /* bmpdtṹ¼һЩ */ - rt_memset(&bmpdt, 0, sizeof(struct demo_bmp_dt)); - bmpdt.scale = 1.0; - bmpdt.angle = 0.0; - /* ʾؼ */ - container = demo_view("Bmp File:"); - - demo_view_get_rect(container, &rect); - rect.x1 += 85; - rect.x2 -= 5; - rect.y1 -= 42; - rect.y2 = rect.y1 + 20; - box = rtgui_textbox_create("", RTGUI_TEXTBOX_SINGLE); - rtgui_widget_set_rect(RTGUI_WIDGET(box), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(box)); - bmpdt.box = box; - /* create a button "open" */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 60; - rect.y1 -= 10; - rect.y2 = rect.y1 + 24; - button = rtgui_button_create("open"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_bitmap_open); - - /* create a button "zoom in" */ - demo_view_get_rect(container, &rect); - rect.x1 += 85; - rect.x2 = rect.x1 + 70; - rect.y1 -= 10; - rect.y2 = rect.y1 + 24; - button = rtgui_button_create("zoom in"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_image_zoom_in); - - /* create a button "zoom out" */ - demo_view_get_rect(container, &rect); - rect.x1 += 165; - rect.x2 = rect.x1 + 70; - rect.y1 -= 10; - rect.y2 = rect.y1 + 24; - button = rtgui_button_create("zoom out"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_image_zoom_out); - - /* create a button "rotate" */ - demo_view_get_rect(container, &rect); - rect.x1 += 245; - rect.x2 = rect.x1 + 70; - rect.y1 -= 10; - rect.y2 = rect.y1 + 24; - button = rtgui_button_create("rotate"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_image_rotate); - - /* create a container "showbox" */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 20; - rect.y2 -= 0; - showbox = rtgui_container_create(); - rtgui_widget_set_rect(RTGUI_WIDGET(showbox), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(showbox)); - rtgui_widget_set_border(RTGUI_WIDGET(showbox), RTGUI_BORDER_SIMPLE); - bmpdt.showbox = showbox; - rtgui_object_set_event_handler(RTGUI_OBJECT(showbox), demo_bitmap_showbox); - rtgui_widget_get_rect(RTGUI_WIDGET(showbox), &bmpdt.lastrect); - rtgui_rect_inflate(&bmpdt.lastrect, -RTGUI_WIDGET_BORDER(showbox)); - - return container; -} -#endif diff --git a/examples/gui/demo_view_box.c b/examples/gui/demo_view_box.c deleted file mode 100644 index 51e264aefe89326c2031cff9faf8fbeb92d37613..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_box.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "demo_view.h" -#include -#include -#include -#include - -rtgui_container_t *demo_view_box(void) -{ - rtgui_rect_t rect; - rtgui_container_t *view; - struct rtgui_panel *panel; - struct rtgui_box *box; - - struct rtgui_label *label; - struct rtgui_button *button; - - view = demo_view("Box View"); - demo_view_get_rect(view, &rect); - - panel = rtgui_panel_create(RTGUI_BORDER_NONE); - rtgui_widget_set_rect(RTGUI_WIDGET(panel), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(view), RTGUI_WIDGET(panel)); - - box = rtgui_box_create(RTGUI_VERTICAL, 5); - rtgui_container_set_box(RTGUI_CONTAINER(panel), box); - - label = rtgui_label_create("label 1"); - rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(label)); - label = rtgui_label_create("label 2"); - rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(label)); - - button = rtgui_button_create("button 1"); - rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button)); - - button = rtgui_button_create("button 2"); - rtgui_container_add_child(RTGUI_CONTAINER(panel), RTGUI_WIDGET(button)); - rtgui_widget_set_minheight(RTGUI_WIDGET(button), 25); - RTGUI_WIDGET_ALIGN(button) = RTGUI_ALIGN_EXPAND; - - rtgui_container_layout(RTGUI_CONTAINER(panel)); - - return view; -} - diff --git a/examples/gui/demo_view_buffer_animation.c b/examples/gui/demo_view_buffer_animation.c deleted file mode 100644 index 6f17feaea0fd3a4aafeef157554a3fc139f23451..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_buffer_animation.c +++ /dev/null @@ -1,157 +0,0 @@ -#include -#include -#include -#include "demo_view.h" - -/* - * ֱDCϻͼʵֶЧ - * - * ڶʱģ·ʾ - * "ҷ" - */ -static rt_int8_t dx = 1, dy = 1; -static rtgui_rect_t text_rect; -static rtgui_timer_t *timer; -static struct rtgui_dc *dc_buffer; -static void timeout(struct rtgui_timer *timer, void *parameter) -{ - struct rtgui_dc *dc; - rtgui_rect_t rect; - rtgui_widget_t *widget; - - /* ؼ(view)ͨparameterݸʱ */ - widget = (rtgui_widget_t *)parameter; - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - return ; - - /* demo viewͼҪжϱ߽ */ - demo_view_get_logic_rect(RTGUI_CONTAINER(widget), &rect); - rect.y2 -= 5; - - /* жǷǵһλͼ */ - if ((text_rect.x1 == 0) && (text_rect.y1 == 0)) - { - rtgui_rect_moveto(&text_rect, rect.x1, rect.y1); - } - - /* dxdy */ - if (text_rect.x2 >= rect.x2) dx = -1; - if (text_rect.x1 < rect.x1) dx = 1; - if (text_rect.y2 >= rect.y2) dy = -1; - if (text_rect.y1 < rect.y1) dy = 1; - - /* ƶıλ */ - text_rect.x1 += dx; - text_rect.x2 += dx; - text_rect.y1 += dy; - text_rect.y2 += dy; - - /* ͼ */ - rect = text_rect; - rect.x2 += 2; - rect.y2 += 2; - rtgui_dc_blit(dc_buffer, NULL, dc, &rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); -} - -static rt_bool_t animation_on_show(struct rtgui_object *object, struct rtgui_event *event) -{ - rt_kprintf("buffer animation on show\n"); - rtgui_timer_start(timer); - - return RT_TRUE; -} - -static rt_bool_t animation_on_hide(struct rtgui_object *object, struct rtgui_event *event) -{ - rt_kprintf("buffer animation on hide\n"); - rtgui_timer_stop(timer); - - return RT_TRUE; -} - -static rt_bool_t animation_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - - /* Ϊõdemo view汾һֿؼڻͼʱҪdemo viewȻͼ */ - rtgui_container_event_handler(object, event); - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - return RT_FALSE; - - /* demo viewͼ */ - demo_view_get_logic_rect(RTGUI_CONTAINER(widget), &rect); - - /* ͼ */ - rect = text_rect; - rtgui_rect_inflate(&rect, +1); - rtgui_dc_blit(dc_buffer, NULL, dc, &rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - else if (event->type == RTGUI_EVENT_SHOW) - { - rtgui_container_event_handler(object, event); - animation_on_show(object, event); - } - else if (event->type == RTGUI_EVENT_HIDE) - { - rtgui_container_event_handler(object, event); - animation_on_hide(object, event); - } - else - { - /* Ĭϵ¼ */ - return rtgui_container_event_handler(object, event); - } - - return RT_FALSE; -} - -struct rtgui_container *demo_view_buffer_animation(void) -{ - struct rtgui_container *container; - - container = demo_view("DC "); - if (container != RT_NULL) - rtgui_object_set_event_handler(RTGUI_OBJECT(container), animation_event_handler); - - rtgui_font_get_metrics(RTGUI_WIDGET_FONT(container), "嶯", &text_rect); - if (dc_buffer == RT_NULL) - { - rtgui_rect_t rect; - - rect.x1 = 0; - rect.x2 = rtgui_rect_width(text_rect) + 2; - rect.y1 = 0; - rect.y2 = rtgui_rect_height(text_rect) + 2; - - /* DC Buffer 50 50 */ - dc_buffer = rtgui_dc_buffer_create(rtgui_rect_width(rect), rtgui_rect_height(rect)); - RTGUI_DC_FC(dc_buffer) = RTGUI_WIDGET_BACKGROUND(container); - rtgui_dc_fill_rect(dc_buffer, &rect); - RTGUI_DC_FC(dc_buffer) = black; - rect.x1 = 1; - rect.y1 = 1; - rtgui_dc_draw_text(dc_buffer, "嶯", &rect); - } - - /* ʱԴ */ - timer = rtgui_timer_create(1, RT_TIMER_FLAG_PERIODIC, timeout, (void *)container); - - return container; -} diff --git a/examples/gui/demo_view_button.c b/examples/gui/demo_view_button.c deleted file mode 100644 index 2fc73727bbeb51b483ae519b2549a9d9d15eca74..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_button.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 嵥buttonؼʾ - * - * ӻڴcontainerӼͬ͵buttonؼ - */ - -#include "demo_view.h" -#include - -/* ʾbuttonؼͼ */ -rtgui_container_t *demo_view_button(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_button_t *button; - rtgui_font_t *font; - - /* ȴһʾõͼ */ - container = demo_view("Button View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һbuttonؼ */ - button = rtgui_button_create("Red"); - /* labelؼǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(button) = red; - /* buttonλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25; - rect.y2 = rect.y1 + 20; - /* һbuttonؼ */ - button = rtgui_button_create("Blue"); - /* labelؼǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(button) = blue; - /* buttonλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һbuttonؼ */ - button = rtgui_button_create("12 font"); - /* Ϊ12asc */ - font = rtgui_font_refer("asc", 12); - RTGUI_WIDGET_FONT(button) = font; - /* buttonλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һbuttonؼ */ - button = rtgui_button_create("16 font"); - /* Ϊ16asc */ - font = rtgui_font_refer("asc", 16); - RTGUI_WIDGET_FONT(button) = font; - /* buttonλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - - return container; -} diff --git a/examples/gui/demo_view_checkbox.c b/examples/gui/demo_view_checkbox.c deleted file mode 100644 index 0dc3c751dc6a69781d826767edfb907cade1331a..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_checkbox.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 嵥checkboxؼʾ - * - * ӻڴcontainerӼcheckboxؼ - */ - -#include "demo_view.h" -#include - -/* ʾcheckboxؼͼ */ -rtgui_container_t *demo_view_checkbox(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_checkbox_t *checkbox; - rtgui_font_t *font; - - /* ȴһʾõͼ */ - container = demo_view("CheckBox View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һcheckboxؼ */ - checkbox = rtgui_checkbox_create("Red", RT_TRUE); - /* ǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(checkbox) = red; - /* checkboxλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25; - rect.y2 = rect.y1 + 20; - /* һcheckboxؼ */ - checkbox = rtgui_checkbox_create("Blue", RT_TRUE); - /* ǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(checkbox) = blue; - /* checkboxλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һcheckboxؼ */ - checkbox = rtgui_checkbox_create("12 font", RT_TRUE); - /* Ϊ12 */ - font = rtgui_font_refer("asc", 12); - RTGUI_WIDGET_FONT(checkbox) = font; - /* checkboxλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һcheckboxؼ */ - checkbox = rtgui_checkbox_create("16 font", RT_TRUE); - /* Ϊ16 */ - font = rtgui_font_refer("asc", 16); - RTGUI_WIDGET_FONT(checkbox) = font; - /* checkboxλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(checkbox), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(checkbox)); - - return container; -} diff --git a/examples/gui/demo_view_combobox.c b/examples/gui/demo_view_combobox.c deleted file mode 100644 index 4d57a175e0dc2c9fed249c2e6af2191224019751..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_combobox.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 嵥labelؼʾ - * - * ӻڴcontainerӼͬ͵labelؼ - */ -#include "demo_view.h" -#include - -struct rtgui_listbox_item items[] = -{ - {"item 1", RT_NULL}, - {"item 2", RT_NULL}, - {"item 3", RT_NULL}, - {"item 4", RT_NULL}, - {"item 5", RT_NULL}, -}; - -/* ʾcomboboxؼͼ */ -rtgui_container_t *demo_view_combobox(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_combobox_t *box; - - /* ȴһʾõͼ */ - container = demo_view("ComboBox View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - box = rtgui_combobox_create(items, sizeof(items) / sizeof(items[0]), &rect); - /* containerһcontainerؼadd_childboxؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(box)); - - return container; -} diff --git a/examples/gui/demo_view_dc.c b/examples/gui/demo_view_dc.c deleted file mode 100644 index 695f3e6ab3ba5198d727e0628728f8310c1a54c3..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_dc.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 嵥DCʾ - * - * ӻڴviewϽDCʾ - */ - -#include "demo_view.h" -#include -#include -#include -#include -#include - -#include "play.hdh" -#include "stop.hdh" -struct rtgui_image_hdcmm play_image = RTGUI_IMAGE_HDC_DEF(2, 0x1c, 0x16, play_hdh); -struct rtgui_image_hdcmm stop_image = RTGUI_IMAGE_HDC_DEF(2, 0x1c, 0x16, stop_hdh); - -/* - * view¼ - */ -rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - - /* PAINT¼д */ - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - const int vx[] = {20, 50, 60, 45, 60, 20}; - const int vy[] = {150, 50, 90, 60, 45, 50}; - - /* - * Ϊõdemo view汾һֿؼڻͼʱҪdemo view - * Ȼͼ - */ - rtgui_container_event_handler(RTGUI_OBJECT(widget), event); - - /************************************************************************/ - /* DCIJ */ - /************************************************************************/ - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - if (dc == RT_NULL) - return RT_FALSE; - - /* demo viewͼ */ - demo_view_get_logic_rect(RTGUI_CONTAINER(widget), &rect); - - RTGUI_DC_TEXTALIGN(dc) = RTGUI_ALIGN_BOTTOM | RTGUI_ALIGN_CENTER_HORIZONTAL; - /* ʾGUIİ汾Ϣ */ -#ifdef RTGUI_USING_SMALL_SIZE - rtgui_dc_draw_text(dc, "RT-Thread/GUIСͰ汾", &rect); -#else - rtgui_dc_draw_text(dc, "RT-Thread/GUI׼汾", &rect); -#endif - - { - rtgui_rect_t rect = {0, 0, 0x1c, 0x16}; - rtgui_rect_moveto(&rect, 80, 80); - rtgui_image_blit((rtgui_image_t *)&play_image, dc, &rect); - - rect.x1 = 0; - rect.y1 = 0; - rect.x2 = 0x1c; - rect.y2 = 0x16; - rtgui_rect_moveto(&rect, 130, 80); - rtgui_image_blit((rtgui_image_t *)&stop_image, dc, &rect); - } - /* һԲ */ - RTGUI_DC_FC(dc) = red; - rtgui_dc_draw_circle(dc, rect.x1 + 10, rect.y1 + 10, 10); - - /* һԲ */ - RTGUI_DC_FC(dc) = green; - rtgui_dc_fill_circle(dc, rect.x1 + 30, rect.y1 + 10, 10); -#if 0 - /* һԲǾ */ - rect.x1 = 150; - rect.y1 = 180; - rect.x2 = 210; - rect.y2 = 260; - RTGUI_DC_FC(dc) = RTGUI_RGB(25, 70, 150); - rtgui_dc_draw_round_rect(dc, &rect, 10); - - rect.x1 = 160; - rect.y1 = 190; - rect.x2 = 200; - rect.y2 = 250; - RTGUI_DC_FC(dc) = RTGUI_RGB(170, 7, 80); - rtgui_dc_fill_round_rect(dc, &rect, 7); - - /* һԲ */ - RTGUI_DC_FC(dc) = RTGUI_RGB(250, 120, 120); - rtgui_dc_draw_arc(dc, rect.x1 + 120, rect.y1 + 60, 30, 0, 120); - - /* һԲ */ - RTGUI_DC_FC(dc) = RTGUI_RGB(150, 23, 100); - rtgui_dc_draw_annulus(dc, 180, 170, 30, 50, 210, 330); - - /* */ - RTGUI_DC_FC(dc) = blue; - rtgui_dc_draw_polygon(dc, vx, vy, 6); - -#endif - RTGUI_DC_FC(dc) = blue; - - /* Ʋͬı߿ */ - { - rtgui_rect_t rect = {0, 0, 16, 16}; - rtgui_rect_moveto(&rect, 30, 120); - - rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_RAISE); - rect.x1 += 20; - rect.x2 += 20 + 50; - rtgui_dc_draw_text(dc, "raise", &rect); - rect.x1 -= 20; - rect.x2 -= 20 + 50; - rect.y1 += 20; - rect.y2 += 20; - - rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_SIMPLE); - rect.x1 += 20; - rect.x2 += 20 + 50; - rtgui_dc_draw_text(dc, "simple", &rect); - rect.x1 -= 20; - rect.x2 -= 20 + 50; - rect.y1 += 20; - rect.y2 += 20; - - rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_SUNKEN); - rect.x1 += 20; - rect.x2 += 20 + 50; - rtgui_dc_draw_text(dc, "sunken", &rect); - rect.x1 -= 20; - rect.x2 -= 20 + 50; - rect.y1 += 20; - rect.y2 += 20; - - rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_BOX); - rect.x1 += 20; - rect.x2 += 20 + 50; - rtgui_dc_draw_text(dc, "box", &rect); - rect.x1 -= 20; - rect.x2 -= 20 + 50; - rect.y1 += 20; - rect.y2 += 20; - - rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_STATIC); - rect.x1 += 20; - rect.x2 += 20 + 50; - rtgui_dc_draw_text(dc, "static", &rect); - rect.x1 -= 20; - rect.x2 -= 20 + 50; - rect.y1 += 20; - rect.y2 += 20; - - rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_EXTRA); - rect.x1 += 20; - rect.x2 += 20 + 50; - rtgui_dc_draw_text(dc, "extera", &rect); - rect.x1 -= 20; - rect.x2 -= 20 + 50; - rect.y1 += 20; - rect.y2 += 20; - } - - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - else - { - /* ¼Ĭϵ¼ */ - return rtgui_container_event_handler(object, event); - } - - return RT_FALSE; -} - -/* DCʾõͼ */ -rtgui_container_t *demo_view_dc(void) -{ - rtgui_container_t *view; - - view = demo_view("DC Demo"); - if (view != RT_NULL) - /* óԼ¼ */ - rtgui_object_set_event_handler(RTGUI_OBJECT(view), dc_event_handler); - - return view; -} diff --git a/examples/gui/demo_view_dc_buffer.c b/examples/gui/demo_view_dc_buffer.c deleted file mode 100644 index b8ba4a5ca6e145fdf6017ceebf87e28bc6a94a87..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_dc_buffer.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 嵥DC Bufferʾ - * - * ӻڴviewϽDC Bufferʾ - */ - -#include "demo_view.h" -#include -#include -#include -#include - - -/* - * view¼ - */ -static rt_bool_t dc_buffer_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - struct rtgui_dc *dc_buffer; - - /* PAINT¼д */ - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - - /* - * Ϊõdemo view汾һֿؼڻͼʱҪdemo view - * Ȼͼ - */ - rtgui_container_event_handler(object, event); - dc_buffer = (struct rtgui_dc*)widget->user_data; - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - if (dc == RT_NULL) - return RT_FALSE; - - /* demo viewͼ */ - demo_view_get_logic_rect(RTGUI_CONTAINER(widget), &rect); - - rect.x1 += 10; - rect.y1 += 10; - rtgui_dc_blit(dc_buffer, NULL, dc, &rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - else - { - /* ¼Ĭϵ¼ */ - return rtgui_container_event_handler(object, event); - } - - return RT_FALSE; -} - -/* DC Bufferʾõͼ */ -rtgui_container_t *demo_view_dc_buffer() -{ - rtgui_container_t *view; - struct rtgui_dc *dc_buffer=RT_NULL; - - if (dc_buffer == RT_NULL) - { - rtgui_rect_t rect = {0, 0, 50, 50}; - - /* DC Buffer 50 50 */ - dc_buffer = rtgui_dc_buffer_create(50, 50); - RTGUI_DC_BC(dc_buffer) = blue; - rtgui_dc_fill_rect(dc_buffer, &rect); - - RTGUI_DC_FC(dc_buffer) = red; - rtgui_dc_draw_circle(dc_buffer, 25, 25, 10); - } - - view = demo_view("DCʾ"); - if (view != RT_NULL) - /* óԼ¼ */ - rtgui_object_set_event_handler(RTGUI_OBJECT(view), dc_buffer_event_handler); - RTGUI_WIDGET(view)->user_data = (rt_uint32_t)dc_buffer; - - return view; -} diff --git a/examples/gui/demo_view_digtube.c b/examples/gui/demo_view_digtube.c deleted file mode 100644 index cff1d34f5e1c9034da31d21f50c5a190076794d6..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_digtube.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "demo_view.h" -#include - -/* digit tube codes: "ERROR" */ -static char digitbuf[5] = {0x79, 0x77, 0x77, 0x3F, 0x77}; - -rtgui_container_t * demo_view_digtube(void) -{ - struct rtgui_rect rect; - rtgui_container_t *container; - struct rtgui_digtube * digtube; - struct rtgui_digitfont digitfont; - - container = demo_view("Digit Tube View"); - /* add digtube 1: use the default digit font */ - digtube = rtgui_digtube_create(RT_NULL, 5, (void *)4213, 0); - rtgui_container_add_child(container, RTGUI_WIDGET(digtube)); - - demo_view_get_rect(container, &rect); - rect.y2 = rect.y1 + 80; - rtgui_widget_set_rect(RTGUI_WIDGET(digtube), &rect); - - /* add digtube 2: show hex */ - digitfont.seg1_len = 20; - digitfont.seg1_hspace = 4; - digitfont.seg1_nr = 3; - digitfont.seg2_len = 20; - digitfont.seg3_len = 20; - digitfont.seg1_vspace = 1; - digitfont.data = RT_NULL; - - digtube = rtgui_digtube_create(&digitfont, 5, (void *)0xABC, RTGUI_DIGTUBE_STYLE_NOBACKFONT | RTGUI_DIGTUBE_STYLE_DISHEXNUM); - rtgui_container_add_child(container, RTGUI_WIDGET(digtube)); - rect.y1 = rect.y2 + 10;; - rect.y2 = rect.y1 + 60; - rtgui_widget_set_rect(RTGUI_WIDGET(digtube), &rect); - - /* add digtube 3: show custom codes table */ - digitfont.seg1_len = 25; - digitfont.seg1_hspace = 5; - digitfont.seg1_nr = 5; - digitfont.seg2_len = 25; - digitfont.seg3_len = 25; - digitfont.seg1_vspace = 1; - digitfont.data = RT_NULL; - digtube = rtgui_digtube_create(&digitfont, 5, (void *)digitbuf, RTGUI_DIGTUBE_STYLE_DISCODES); - rtgui_container_add_child(container, RTGUI_WIDGET(digtube)); - rect.y1 = rect.y2 + 5; - rect.y2 = rect.y1 + 80; - rtgui_widget_set_rect(RTGUI_WIDGET(digtube), &rect); - RTGUI_WIDGET_BACKGROUND(digtube) = RTGUI_RGB(0x00, 0x00, 0x00); - RTGUI_WIDGET_FOREGROUND(digtube) = RTGUI_RGB(0x00, 0xFF, 0x00); - digtube->digit_bc = RTGUI_RGB(0x00, 0xFF, 0xFF); - - return container; -} \ No newline at end of file diff --git a/examples/gui/demo_view_edit.c b/examples/gui/demo_view_edit.c deleted file mode 100644 index fd3f81e94902d4de95214a85ddeec31afc3ece1d..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_edit.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 嵥editؼʾ - * - * ӻconatinerϽeditؼʾ - */ - -#include "demo_view.h" -#include -#include -#include -#include -#include -#include - -#ifdef RTGUI_USING_DFS_FILERW -void demo_edit_readin_file(struct rtgui_object *object, struct rtgui_event *event) -{ - rtgui_button_t *button; - struct rtgui_edit *edit; - const char *filename = "/test_readin.txt"; - struct rtgui_filerw *file; - - RT_ASSERT(object != RT_NULL); - button = RTGUI_BUTTON(object); - /* ȡeditָ */ - edit = RTGUI_EDIT(RTGUI_WIDGET(button)->user_data); - - /* жļǷ */ - file = rtgui_filerw_create_file(filename, "rb"); - if (file == RT_NULL) - { - /* ڴ,򴴽 */ - rt_kprintf("file:\"%s\" does not exist!\n", filename); - - return; - } - rtgui_filerw_close(file); - - rt_kprintf("read-in file:\"%s\"\n", filename); - rtgui_edit_readin_file(edit, filename); -} - -void demo_edit_saveas_file(struct rtgui_object *object, struct rtgui_event *event) -{ - rtgui_button_t *button; - struct rtgui_edit *edit; - const char* filename = "/test_saveas.txt"; - struct rtgui_filerw *file; - - RT_ASSERT(object != RT_NULL); - button = RTGUI_BUTTON(object); - /* ȡeditָ */ - edit = RTGUI_EDIT(RTGUI_WIDGET(button)->user_data); - - /* жļǷ, ɾ֮ */ - file = rtgui_filerw_create_file(filename, "rb"); - if (file != RT_NULL) - { - rtgui_filerw_close(file); - /* win32е, ֹɾļ, NTļֻ,unlinkɾ */ - if (rtgui_filerw_unlink(filename) == -1) - rt_kprintf("Could not delete %s\n", filename); - } - - rt_kprintf("save as file:\"%s\"\n", filename); - rtgui_edit_saveas_file(edit, filename); -} - -void demo_edit_get_mem(struct rtgui_object* object, struct rtgui_event* event) -{ - rtgui_button_t *button; - struct rtgui_edit *edit; - - RT_ASSERT(object != RT_NULL); - - button = RTGUI_BUTTON(object); - edit = RTGUI_EDIT( RTGUI_WIDGET(button)->user_data ); - rt_kprintf("edit mem consume: %d\n", rtgui_edit_get_mem_consume(edit)); -} - -rt_bool_t demo_edit_event_handler(struct rtgui_object* object, struct rtgui_event *event) -{ - rt_bool_t result; - char buf[32]; - rtgui_point_t p; - struct rtgui_edit *edit = RTGUI_EDIT(object); - struct rtgui_label *label = (struct rtgui_label*)RTGUI_WIDGET(edit)->user_data; - - result = rtgui_edit_event_handler(object, event); - - p = rtgui_edit_get_current_point(edit); - rt_sprintf(buf, "TRACK: line:%d, col:%d", p.y, p.x); - rtgui_label_set_text(label, buf); - - return result; -} - -/* ʾeditؼͼ */ -rtgui_container_t *demo_view_edit(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - struct rtgui_edit *edit; - struct rtgui_label *label; - struct rtgui_button *button; - - /* ȴһʾõͼ */ - container = demo_view("Edit View"); - - edit = rtgui_edit_create(container, 10, 35, 220, 200); - rtgui_edit_set_text(edit, - "Edit beta v0.1\n" - "Hello RT-Thread\n" - "this's edit demo\n" - "rtgui_edit_create\n" - "rtgui_edit_append_line\n" - "rtgui_edit_insert_line\n" - "rtgui_edit_delete_line\n" - "rtgui_edit_connect_line\n" - "˫ֽڲ\n" - "a\n" - "b\n" - "c\n" - "d\n" - "1234567890\n"); - - /* һť, ȡijļ */ - demo_view_get_rect(container, &rect); - rect.x1 += 10; - rect.x2 = rect.x1 + 100; - rect.y1 += 200; - rect.y2 = rect.y1 + 22; - button = rtgui_button_create("ReadIn File"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_edit_readin_file); - /* ʹuser_dataeditָ */ - RTGUI_WIDGET(button)->user_data = (rt_uint32_t)edit; - - /* һť, Ϊijļ */ - demo_view_get_rect(container, &rect); - rect.x1 += 130; - rect.x2 = rect.x1 + 100; - rect.y1 += 200; - rect.y2 = rect.y1 + 22; - button = rtgui_button_create("SaveAs File"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_edit_saveas_file); - /* ʹuser_dataeditָ */ - RTGUI_WIDGET(button)->user_data = (rt_uint32_t)edit; - - /* һǩ, ʾEDITҪ */ - demo_view_get_rect(container, &rect); - rect.x1 += 10; - rect.x2 = rect.x1 + 220; - rect.y1 += 225; - rect.y2 = rect.y1 + 18; - label = rtgui_label_create("TRACK:"); - RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT | RTGUI_ALIGN_CENTER_VERTICAL; - RTGUI_WIDGET_FOREGROUND(label) = blue; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - RTGUI_WIDGET(edit)->user_data = (rt_uint32_t)label; - rtgui_object_set_event_handler(RTGUI_OBJECT(edit), demo_edit_event_handler); - - /* һť, ȡEDITڴ */ - demo_view_get_rect(container, &rect); - rect.x1 += 150; - rect.x2 = rect.x1 + 80; - rect.y1 -= 42; - rect.y2 = rect.y1 + 20; - button = rtgui_button_create("Get Mem"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_edit_get_mem); - RTGUI_WIDGET(button)->user_data = (rt_uint32_t)edit; - - return container; -} -#endif diff --git a/examples/gui/demo_view_image.c b/examples/gui/demo_view_image.c deleted file mode 100644 index b4dc9231924972b78982c20492a9532418bfea0f..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_image.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 嵥DCʾͼʾ - * - * ӻڴcontainerʾͼ - */ - -#include "demo_view.h" -#include -#include -#include - -static rtgui_image_t *image = RT_NULL; -static rtgui_container_t *_container = RT_NULL; - -#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW) -/* 򿪰ťĻص */ -static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event) -{ - rtgui_filelist_view_t *filelist; - struct rtgui_rect rect = {0, 100, 240, 280}; - - /* WIN32ƽ̨Ϻʵ豸ϵijʼ· */ -#ifdef _WIN32 - filelist = rtgui_filelist_view_create("e:\\", "*.*", &rect); -#else - filelist = rtgui_filelist_view_create("/", "*.*", &rect); -#endif - /* ģ̬ʾһļбͼṩûѡͼļ */ - if (rtgui_widget_show(RTGUI_WIDGET(filelist), RT_TRUE) == RTGUI_MODAL_OK) - { - char path[32], image_type[8]; - - /* ļ·ıǩ */ - rtgui_filelist_view_get_fullpath(filelist, path, sizeof(path)); - if (image != RT_NULL) - { - rtgui_image_destroy(image); - image = RT_NULL; - } - - rt_memset(image_type, 0, sizeof(image_type)); - - /* ͼ */ - if (rt_strstr(path, ".bmp") != RT_NULL || - rt_strstr(path, ".BMP") != RT_NULL) - strcat(image_type, "bmp"); - if (rt_strstr(path, ".png") != RT_NULL || - rt_strstr(path, ".PNG") != RT_NULL) - strcat(image_type, "png"); - if (rt_strstr(path, ".jpg") != RT_NULL || - rt_strstr(path, ".JPG") != RT_NULL) - strcat(image_type, "jpeg"); - if (rt_strstr(path, ".hdc") != RT_NULL || - rt_strstr(path, ".HDC") != RT_NULL) - strcat(image_type, "hdc"); - - /* ͼļЧӦrtgui_image */ - if (image_type[0] != '\0') - image = rtgui_image_create_from_file(image_type, path, RT_TRUE); - } - - /* ɾ ļб ͼ */ - rtgui_container_destroy(RTGUI_CONTAINER(filelist)); - rtgui_container_show(_container, RT_FALSE); -} - -/* ʾͼ¼ */ -static rt_bool_t demo_view_event_handler(rtgui_widget_t *widget, rtgui_event_t *event) -{ - rt_bool_t result; - - /* ȵĬϵ¼(ֻPAINT¼ʾͼбһЩؼ) */ - result = rtgui_container_event_handler(widget, event); - - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - if (dc == RT_NULL) - /* DC(ؼ򸸿ؼ״̬DCǻȡɹ) */ - return RT_FALSE; - - /* demo containerͼ */ - demo_view_get_rect(RTGUI_CONTAINER(widget), &rect); - - /* ͼʾ */ - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 30; - - if (image != RT_NULL) - rtgui_image_blit(image, dc, &rect); - - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - - return result; -} - -/* ʾͼʾͼ */ -rtgui_container_t *demo_view_image(void) -{ - rtgui_rect_t rect; - rtgui_button_t *open_btn; - - /* ȴһʾͼ */ - _container = demo_view("ͼʾ"); - if (_container != RT_NULL) - /* Ĭϵ¼demo_view_event_handler */ - rtgui_object_set_event_handler(RTGUI_WIDGET(_container), demo_view_event_handler); - - /* һť */ - demo_view_get_rect(_container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 120; - rect.y2 = rect.y1 + 20; - open_btn = rtgui_button_create("ͼļ"); - rtgui_container_add_child(RTGUI_CONTAINER(_container), RTGUI_WIDGET(open_btn)); - rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect); - rtgui_button_set_onbutton(open_btn, open_btn_onbutton); - - return _container; -} -#endif diff --git a/examples/gui/demo_view_instrument_panel.c b/examples/gui/demo_view_instrument_panel.c deleted file mode 100644 index 1efe3c85ec0c43e570079d805316e1f3a70f84b2..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_instrument_panel.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 嵥DCʾ - * - * ӻڴcontainerϽDCʾ - */ - -#include "demo_view.h" -#include -#include -#include -#include -#include -#include - -/* - * container¼ - */ -rt_bool_t instrument_panel_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - char ac[4]; - int i; - int x0 = 120; - int y0 = 170; - int x, y; - int default_color; - - /* PAINT¼д */ - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - const int arrowx[] = {120 + 75, 120 + 75, 120 + 85}; - const int arrowy[] = {170 - 5, 170 + 5, 170}; - - /* - * Ϊõdemo container汾һֿؼڻͼʱҪdemo container - * Ȼͼ - */ - rtgui_container_event_handler(RTGUI_OBJECT(widget), event); - - /************************************************************************/ - /* DCIJ */ - /************************************************************************/ - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - if (dc == RT_NULL) - return RT_FALSE; - - /* demo containerͼ */ - demo_view_get_rect(RTGUI_CONTAINER(widget), &rect); - - RTGUI_DC_TEXTALIGN(dc) = RTGUI_ALIGN_BOTTOM | RTGUI_ALIGN_CENTER_HORIZONTAL; - /* ʾGUIİ汾Ϣ */ -#ifdef RTGUI_USING_SMALL_SIZE - rtgui_dc_draw_text(dc, "RT-Thread/GUIСͰ汾", &rect); -#else - rtgui_dc_draw_text(dc, "RT-Thread/GUI׼汾", &rect); -#endif - - - RTGUI_DC_TEXTALIGN(dc) = RTGUI_ALIGN_CENTER_VERTICAL | RTGUI_ALIGN_CENTER_HORIZONTAL; - RTGUI_DC_FC(dc) = blue; - rect.y2 = 270; - rtgui_dc_draw_text(dc, "rtgui-panel", &rect); - - for (i = 0; i < 6; i++) - { - rtgui_dc_draw_arc(dc, x0, y0, 117 - i, 150, 30); - } - - RTGUI_DC_FC(dc) = black; - - RTGUI_DC_TEXTALIGN(dc) = RTGUI_ALIGN_LEFT; - for (i = 0; i <= 23; i++) - { - if (i < 12) - { - x = x0 + 105 * cos((150 + i * 10) * 3.1415926 / 180); - y = y0 + 105 * sin((150 + i * 10) * 3.1415926 / 180); - rect.x1 = x; - rect.y1 = y; - rect.x2 = rect.x1 + 12 * 3; - rect.y2 = rect.y1 + 12; - rt_sprintf(ac, "%d", 10 * i); - rtgui_dc_draw_text(dc, ac, &rect); - } - else - { - RTGUI_DC_TEXTALIGN(dc) = RTGUI_ALIGN_RIGHT; - - x = x0 + 105 * cos((160 + i * 10) * 3.1415926 / 180); - y = y0 + 105 * sin((160 + i * 10) * 3.1415926 / 180); - - rect.x1 = x - 12 * 3; - rect.y1 = y; - rect.x2 = rect.x1 + 12 * 3; - rect.y2 = rect.y1 + 12; - rt_sprintf(ac, "%d", 10 * i); - rtgui_dc_draw_text(dc, ac, &rect); - } - - x = x0 + 107 * cos((150 + i * 10) * 3.1415926 / 180); - y = y0 + 107 * sin((150 + i * 10) * 3.1415926 / 180); - rtgui_dc_fill_circle(dc, x, y, 3); - } - RTGUI_DC_FC(dc) = RTGUI_RGB(166, 0, 166); - rtgui_dc_fill_circle(dc, x0, y0, 3); - RTGUI_DC_FC(dc) = RTGUI_RGB(120, 141, 30); - rtgui_dc_draw_circle(dc, x0, y0, 5); - - default_color = RTGUI_DC_BC(dc); - RTGUI_DC_BC(dc) = red; - rect.x1 = x0 + 7; - rect.y1 = y0 - 1; - rect.x2 = x0 + 75; - rect.y2 = y0 + 1; - rtgui_dc_fill_rect(dc, &rect); - - RTGUI_DC_BC(dc) = default_color; - - rtgui_dc_fill_polygon(dc, arrowx, arrowy, 3); - - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - else - { - /* ¼Ĭϵ¼ */ - return rtgui_container_event_handler(RTGUI_OBJECT(widget), event); - } - - return RT_FALSE; -} - -/* DCʾõͼ */ -rtgui_container_t *demo_view_instrument_panel(void) -{ - rtgui_container_t *container; - - container = demo_view("instrument panel Demo"); - if (container != RT_NULL) - /* óԼ¼ */ - rtgui_object_set_event_handler(RTGUI_OBJECT(container), instrument_panel_event_handler); - - return container; -} diff --git a/examples/gui/demo_view_label.c b/examples/gui/demo_view_label.c deleted file mode 100644 index 7355cca6488ae0378bcc53986b3772b9edd41c06..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_label.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 嵥labelؼʾ - * - * ӻڴcontainerӼͬ͵labelؼ - */ -#include "demo_view.h" -#include - -/* ʾlabelؼͼ */ -rtgui_container_t *demo_view_label(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_label_t *label; - rtgui_font_t *font; - - /* ȴһʾõͼ */ - container = demo_view("Label View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("Red Left"); - /* labelؼϵı뷽ʽΪ */ - RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT; - /* labelؼǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(label) = red; - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5 + 25; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("Blue Right"); - /* labelؼϵı뷽ʽΪҶ */ - RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_RIGHT; - /* labelؼǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(label) = blue; - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("Green Center"); - /* labelؼǰɫΪɫ */ - RTGUI_WIDGET_FOREGROUND(label) = green; - /* labelؼϵı뷽ʽΪҶ */ - RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER_HORIZONTAL; - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5 + 25 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("12 font"); - /* Ϊ12asc */ - font = rtgui_font_refer("asc", 12); - RTGUI_WIDGET_FONT(label) = font; - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.y1 += 5 + 25 + 25 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("16 font"); - /* Ϊ16asc */ - font = rtgui_font_refer("asc", 16); - RTGUI_WIDGET_FONT(label) = font; - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - return container; -} - diff --git a/examples/gui/demo_view_listbox.c b/examples/gui/demo_view_listbox.c deleted file mode 100644 index 9b7f4ed302e08c4bb22263b082e80883d992318b..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_listbox.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 嵥labelؼʾ - * - * ӻڴcontainerӼͬ͵labelؼ - */ -#include "demo_view.h" -#include -#include - -static rtgui_image_t *item_icon = RT_NULL; -static const char *image_xpm[] = -{ - "16 16 106 2", - " c None", - ". c #D0C83F", - "+ c #D0C840", - "@ c #D0C030", - "# c #D0B820", - "$ c #D0B020", - "% c #D0B01F", - "& c #5F571F", - "* c #F0F0C0", - "= c #FFF8D0", - "- c #FFF8C0", - "; c #FFF8B0", - "> c #FFF8A0", - ", c #F0E870", - "' c #707030", - ") c #4F87EF", - "! c #4F78C0", - "~ c #5088E0", - "{ c #5078C0", - "] c #C0D0F0", - "^ c #FFF8E0", - "/ c #FFF090", - "( c #F0E070", - "_ c #6F97D0", - ": c #C0D8FE", - "< c #80A8F0", - "[ c #7088D0", - "} c #B0D0FF", - "| c #90B0F0", - "1 c #1040A0", - "2 c #F0F080", - "3 c #707040", - "4 c #7098F0", - "5 c #3068E0", - "6 c #A0B8F0", - "7 c #4070C0", - "8 c #002880", - "9 c #404040", - "0 c #505050", - "a c #F0F090", - "b c #F0E860", - "c c #F0D860", - "d c #807840", - "e c #2F5FC0", - "f c #1050D0", - "g c #1048B0", - "h c #002870", - "i c #C0C080", - "j c #C0C070", - "k c #F0F070", - "l c #F0E060", - "m c #E0D050", - "n c #00277F", - "o c #00287F", - "p c #1F3F6F", - "q c #1048C0", - "r c #0040B0", - "s c #204080", - "t c #FFF890", - "u c #F0D850", - "v c #E0C840", - "w c #807040", - "x c #A0B06F", - "y c #204880", - "z c #2048A0", - "A c #90A8C0", - "B c #FFF080", - "C c #F0D050", - "D c #C0A830", - "E c #6F682F", - "F c #F0F0A0", - "G c #E0D060", - "H c #B0A040", - "I c #D0B840", - "J c #E0C040", - "K c #D0B030", - "L c #706820", - "M c #5F581F", - "N c #CFBF3F", - "O c #FFF0A0", - "P c #A09830", - "Q c #A08820", - "R c #908030", - "S c #807830", - "T c #707020", - "U c #605820", - "V c #6F672F", - "W c #D0C040", - "X c #F0E880", - "Y c #907820", - "Z c #B09820", - "` c #B09010", - " . c #B08820", - ".. c #806820", - "+. c #5F5F1F", - "@. c #F0E080", - "#. c #B09020", - "$. c #C0B040", - "%. c #A09030", - "&. c #908020", - "*. c #606020", - "=. c #6F5F1F", - "-. c #9F982F", - ";. c #A0872F", - ">. c #6F681F", - ",. c #706020", - " ", - " . + + + @ @ # # $ % & ", - " + * = = = = - ; > , ' ", - " ) ! ~ { ] ^ = - - > / ( ' ", - "_ : < { [ } | 1 - ; > > / 2 ( 3 ", - "{ 4 5 1 6 7 5 8 9 0 a / , b c d ", - "e f g h 8 8 g h i j / k l c m d ", - " n o p q r s t 2 , l c u v w ", - " x y z A B , l u C v D E ", - " @ F > t k G H I J K L M ", - " N @ O / 2 l P Q R S T U V ", - " W m 2 X l I Y Z ` ...+. ", - " W @.l u I R #.Z Y U M ", - " $.G I $.%.R &.Y *.& =. ", - " -.;.>.,.L L ,.& M ", - " " -}; - -static struct rtgui_listbox_item items[] = -{ - {"list #0", RT_NULL}, - {"list #1", RT_NULL}, - {"list #2", RT_NULL}, - {"list #3", RT_NULL}, -}; - -static rt_bool_t on_items(struct rtgui_object *object, struct rtgui_event *event) -{ - rtgui_listbox_t *box; - /* get listbox */ - box = RTGUI_LISTBOX(object); - - /* ӡǰ */ - rt_kprintf("current item: %d\n", box->current_item); - - return RT_TRUE; -} - -/* ʾlabelؼͼ */ -rtgui_container_t *demo_view_listbox(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_label_t *label; - rtgui_listbox_t *box; - - /* ȴһʾõͼ */ - container = demo_view("ListBox Demo"); - - if (item_icon == RT_NULL) - item_icon = rtgui_image_create_from_mem("xpm", - (const rt_uint8_t *)image_xpm, sizeof(image_xpm), RT_TRUE); - items[1].image = item_icon; - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("listbox: "); - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - rect.y1 = rect.y2 + 3; - rect.y2 = 250; - box = rtgui_listbox_create(items, sizeof(items) / sizeof(struct rtgui_listbox_item), &rect); - rtgui_listbox_set_onitem(box, on_items); - /* containerһcontainerؼadd_childlistboxؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(box)); - - return container; -} diff --git a/examples/gui/demo_view_listctrl.c b/examples/gui/demo_view_listctrl.c deleted file mode 100644 index 166e4412aeb796d5890bb121521b2be949e67b7b..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_listctrl.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 嵥labelؼʾ - * - * ӻڴcontainerӼͬ͵labelؼ - */ -#include "demo_view.h" -#include -#include - -static rtgui_image_t *item_icon = RT_NULL; -static const char *image_xpm[] = -{ - "16 16 106 2", - " c None", - ". c #D0C83F", - "+ c #D0C840", - "@ c #D0C030", - "# c #D0B820", - "$ c #D0B020", - "% c #D0B01F", - "& c #5F571F", - "* c #F0F0C0", - "= c #FFF8D0", - "- c #FFF8C0", - "; c #FFF8B0", - "> c #FFF8A0", - ", c #F0E870", - "' c #707030", - ") c #4F87EF", - "! c #4F78C0", - "~ c #5088E0", - "{ c #5078C0", - "] c #C0D0F0", - "^ c #FFF8E0", - "/ c #FFF090", - "( c #F0E070", - "_ c #6F97D0", - ": c #C0D8FE", - "< c #80A8F0", - "[ c #7088D0", - "} c #B0D0FF", - "| c #90B0F0", - "1 c #1040A0", - "2 c #F0F080", - "3 c #707040", - "4 c #7098F0", - "5 c #3068E0", - "6 c #A0B8F0", - "7 c #4070C0", - "8 c #002880", - "9 c #404040", - "0 c #505050", - "a c #F0F090", - "b c #F0E860", - "c c #F0D860", - "d c #807840", - "e c #2F5FC0", - "f c #1050D0", - "g c #1048B0", - "h c #002870", - "i c #C0C080", - "j c #C0C070", - "k c #F0F070", - "l c #F0E060", - "m c #E0D050", - "n c #00277F", - "o c #00287F", - "p c #1F3F6F", - "q c #1048C0", - "r c #0040B0", - "s c #204080", - "t c #FFF890", - "u c #F0D850", - "v c #E0C840", - "w c #807040", - "x c #A0B06F", - "y c #204880", - "z c #2048A0", - "A c #90A8C0", - "B c #FFF080", - "C c #F0D050", - "D c #C0A830", - "E c #6F682F", - "F c #F0F0A0", - "G c #E0D060", - "H c #B0A040", - "I c #D0B840", - "J c #E0C040", - "K c #D0B030", - "L c #706820", - "M c #5F581F", - "N c #CFBF3F", - "O c #FFF0A0", - "P c #A09830", - "Q c #A08820", - "R c #908030", - "S c #807830", - "T c #707020", - "U c #605820", - "V c #6F672F", - "W c #D0C040", - "X c #F0E880", - "Y c #907820", - "Z c #B09820", - "` c #B09010", - " . c #B08820", - ".. c #806820", - "+. c #5F5F1F", - "@. c #F0E080", - "#. c #B09020", - "$. c #C0B040", - "%. c #A09030", - "&. c #908020", - "*. c #606020", - "=. c #6F5F1F", - "-. c #9F982F", - ";. c #A0872F", - ">. c #6F681F", - ",. c #706020", - " ", - " . + + + @ @ # # $ % & ", - " + * = = = = - ; > , ' ", - " ) ! ~ { ] ^ = - - > / ( ' ", - "_ : < { [ } | 1 - ; > > / 2 ( 3 ", - "{ 4 5 1 6 7 5 8 9 0 a / , b c d ", - "e f g h 8 8 g h i j / k l c m d ", - " n o p q r s t 2 , l c u v w ", - " x y z A B , l u C v D E ", - " @ F > t k G H I J K L M ", - " N @ O / 2 l P Q R S T U V ", - " W m 2 X l I Y Z ` ...+. ", - " W @.l u I R #.Z Y U M ", - " $.G I $.%.R &.Y *.& =. ", - " -.;.>.,.L L ,.& M ", - " " -}; - -static struct list_item -{ - const char *name; - const char *gender; - int age; - rtgui_image_t *image; -} items[] = -{ - {"index0", "00", 30, RT_NULL}, - {"index1", "m1", 30, RT_NULL}, - {"index2", "m2", 30, RT_NULL}, - {"index3", "m3", 30, RT_NULL}, - {"index4", "m4", 30, RT_NULL}, - {"index5", "m5", 30, RT_NULL}, - {"index6", "m6", 30, RT_NULL}, - {"index7", "m7", 30, RT_NULL}, - {"index8", "m8", 30, RT_NULL}, - {"index9", "m9", 30, RT_NULL}, - {"index10", "m10", 30, RT_NULL}, - {"index11", "m11", 30, RT_NULL}, - {"index12", "m12", 30, RT_NULL}, - {"index13", "m13", 30, RT_NULL}, - {"index14", "m14", 30, RT_NULL}, - {"index15", "m15", 30, RT_NULL}, - {"index16", "m16", 30, RT_NULL}, - {"index17", "m17", 30, RT_NULL}, - {"index18", "m18", 30, RT_NULL}, - {"index19", "m19", 30, RT_NULL}, -}; - -void _rtgui_listctrl_item_draw(struct rtgui_listctrl *list, - struct rtgui_dc *dc, - rtgui_rect_t *rect, - rt_uint16_t index) -{ - char age_str[8]; - rtgui_rect_t item_rect; - struct list_item *items, *item; - - item_rect = *rect; - item_rect.x1 += 5; - items = (struct list_item *)list->items; - item = &items[index]; - - /* draw text */ - rtgui_dc_draw_text(dc, item->name, &item_rect); - item_rect.x1 += 60; - rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2); - - item_rect.x1 += 5; - rtgui_dc_draw_text(dc, item->gender, &item_rect); - item_rect.x1 += 60; - rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2); - - item_rect.x1 += 5; - rt_snprintf(age_str, sizeof(age_str), "%d", item->age); - rtgui_dc_draw_text(dc, age_str, &item_rect); - item_rect.x1 += 40; - rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2); - - item_rect.x1 += 5; - - /* draw image */ - if (item->image != RT_NULL) - { - rtgui_rect_t image_rect; - - image_rect.x1 = 0; - image_rect.y1 = 0; - image_rect.x2 = item->image->w; - image_rect.y2 = item->image->h; - rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL); - rtgui_image_blit(item->image, dc, &image_rect); - } -} - -static rt_bool_t on_items(struct rtgui_object *object, struct rtgui_event *event) -{ - rtgui_listctrl_t *ctrl; - /* get listctrl */ - ctrl = RTGUI_LISTCTRL(object); - - /* ӡǰ */ - rt_kprintf("current item: %d\n", ctrl->current_item); - - return RT_TRUE; -} - -/* ʾlabelؼͼ */ -rtgui_container_t *demo_view_listctrl(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_label_t *label; - rtgui_listctrl_t *box; - - /* ȴһʾõͼ */ - container = demo_view("List Control Demo"); - - if (item_icon == RT_NULL) - item_icon = rtgui_image_create_from_mem("xpm", - (const rt_uint8_t *)image_xpm, sizeof(image_xpm), RT_TRUE); - items[1].image = item_icon; - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("List Control: "); - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* containerһcontainerؼadd_childlabelؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - rect.y1 = rect.y2 + 3; - rect.y2 = 250; - box = rtgui_listctrl_create((rt_uint32_t)items, sizeof(items) / sizeof(items[0]), &rect, - _rtgui_listctrl_item_draw); - rtgui_listctrl_set_onitem(box, on_items); - /* containerһcontainerؼadd_childlistctrlؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(box)); - - return container; -} diff --git a/examples/gui/demo_view_menu.c b/examples/gui/demo_view_menu.c deleted file mode 100644 index e49ceca2390fc015815c988a0874d74d0abe58f1..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_menu.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 嵥menuؼʾ - * - * ӻڴcontainerӼͬ͵labelؼ - */ -#include "demo_view.h" -#include -#include - -static rt_bool_t _onmenuitem(struct rtgui_object *object, struct rtgui_event *event) -{ - rt_kprintf("menu action!!\n"); - return RT_TRUE; -} - -static const rtgui_menu_item_t sub_items[] = -{ - {RTGUI_ITEM_NORMAL, "item #1", RT_NULL, RT_NULL, 0, _onmenuitem}, - {RTGUI_ITEM_NORMAL, "item #2", RT_NULL, RT_NULL, 0, RT_NULL}, - {RTGUI_ITEM_SEPARATOR, RT_NULL, RT_NULL, RT_NULL, 0, RT_NULL}, - {RTGUI_ITEM_NORMAL, "item #3", RT_NULL, RT_NULL, 0, RT_NULL}, -}; -static const rtgui_menu_item_t items[] = -{ - {RTGUI_ITEM_NORMAL, "item #1", RT_NULL, RT_NULL, 0, RT_NULL}, - {RTGUI_ITEM_NORMAL, "item #2", RT_NULL, RT_NULL, 0, RT_NULL}, - {RTGUI_ITEM_SEPARATOR, RT_NULL, RT_NULL, RT_NULL, 0, RT_NULL}, - { - RTGUI_ITEM_SUBMENU, "item #3", RT_NULL, - (struct rtgui_menu_item_t *)sub_items, - sizeof(sub_items) / sizeof(sub_items[0]), RT_NULL - }, -}; -static rtgui_menu_t *menu; - -static rt_bool_t _onmenu(struct rtgui_object *object, struct rtgui_event *event) -{ - rtgui_rect_t rect; - - rtgui_widget_get_rect(RTGUI_WIDGET(object), &rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(object), &rect); - - if (menu != RT_NULL) - rtgui_menu_pop(menu, rect.x1, rect.y2 + 5); - - return RT_TRUE; -} - -/* ʾmenuؼͼ */ -rtgui_container_t *demo_view_menu(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_button_t *button; - - /* ȴһʾõͼ */ - container = demo_view("MENU View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һbuttonؼ */ - button = rtgui_button_create("Pop Menu"); - /* buttonλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - /* containerһcontainerؼadd_childbuttonؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, _onmenu); - - menu = rtgui_menu_create("Menu Test", RT_NULL, items, sizeof(items) / sizeof(items[0])); - - return container; -} diff --git a/examples/gui/demo_view_module.c b/examples/gui/demo_view_module.c deleted file mode 100644 index 9649ce7befd51606ef700f2611eda1811f0a09e7..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_module.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 嵥DCʾͼʾ - * - * ӻڴviewʾͼ - */ - -#include "demo_view.h" -#include -#include -#include - -#ifdef RT_USING_MODULE -#if defined(RTGUI_USING_DFS_FILERW) -static rtgui_container_t *_view = RT_NULL; - -/* 򿪰ťĻص */ -static void open_btn_onbutton(rtgui_widget_t *widget, struct rtgui_event *event) -{ - rtgui_filelist_view_t *view; - rtgui_workbench_t *workbench; - rtgui_rect_t rect; - - /* öworkbench */ - workbench = RTGUI_WORKBENCH(rtgui_widget_get_toplevel(widget)); - rtgui_widget_get_rect(RTGUI_WIDGET(workbench), &rect); - - /* WIN32ƽ̨Ϻʵ豸ϵijʼ· */ -#ifdef _WIN32 - view = rtgui_filelist_view_create(workbench, "d:\\", "*.*", &rect); -#else - view = rtgui_filelist_view_create(workbench, "/", "*.*", &rect); -#endif - /* ģ̬ʾһļбͼṩûѡͼļ */ - if (rtgui_container_show(RTGUI_CONTAINER(view), RT_TRUE) == RTGUI_MODAL_OK) - { - char path[32], name[8]; - - /* ļ·ıǩ */ - rtgui_filelist_view_get_fullpath(view, path, sizeof(path)); - - rt_memset(name, 0, sizeof(name)); - - /* Ӧģ */ - if (rt_strstr(path, ".mo") != RT_NULL || rt_strstr(path, ".so") != RT_NULL) - { - rt_module_open(path); - } - } - - /* ɾ ļб ͼ */ - rtgui_container_destroy(RTGUI_CONTAINER(view)); - rtgui_container_show(_view, RT_FALSE); -} - -/* ʾӦģʾͼ */ -rtgui_container_t *demo_view_module(rtgui_workbench_t *workbench) -{ - rtgui_rect_t rect; - rtgui_button_t *open_btn; - - /* ȴһʾͼ */ - _view = demo_view(workbench, "Ӧģʾ"); - - /* һť */ - demo_view_get_rect(_view, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 120; - rect.y2 = rect.y1 + 20; - open_btn = rtgui_button_create("Ӧģ"); - rtgui_container_add_child(RTGUI_CONTAINER(_view), RTGUI_WIDGET(open_btn)); - rtgui_widget_set_rect(RTGUI_WIDGET(open_btn), &rect); - rtgui_button_set_onbutton(open_btn, open_btn_onbutton); - - return _view; -} -#endif -#endif - diff --git a/examples/gui/demo_view_mywidget.c b/examples/gui/demo_view_mywidget.c deleted file mode 100644 index 622cc5a5bd2baa38807403587cfff56887be3e87..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_mywidget.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 嵥Զؼʾ - * - * ӻڴcontainerԶؼ - */ -#include "demo_view.h" -#include "mywidget.h" - -/* ʾԶؼͼ */ -rtgui_container_t *demo_view_mywidget(void) -{ - rtgui_container_t *container; - rtgui_rect_t rect; - rtgui_mywidget_t *mywidget; - - /* ȴһʾõͼ */ - container = demo_view("MyWidget View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.y1 + 80; - rect.y1 += 5; - rect.y2 = rect.y1 + 80; - /* һԶؼ */ - mywidget = rtgui_mywidget_create(&rect); - /* containerһcontainerؼadd_childԿؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(mywidget)); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 25; - rect.x2 = rect.y1 + 40; - rect.y1 += 5 + 100; - rect.y2 = rect.y1 + 40; - /* һԶؼ */ - mywidget = rtgui_mywidget_create(&rect); - /* containerһcontainerؼadd_childԿؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(mywidget)); - - return container; -} diff --git a/examples/gui/demo_view_notebook.c b/examples/gui/demo_view_notebook.c deleted file mode 100644 index 07bc84c96613ca7e6015681978db86d720508217..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_notebook.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 嵥notebookؼʾ - * - * ӻڴcontainerʾnotebookؼ - */ - -#include "demo_view.h" -#include -#include - -const static struct rtgui_listbox_item items[] = -{ - {"list #0", RT_NULL}, - {"list #1", RT_NULL}, - {"list #2", RT_NULL}, - {"list #3", RT_NULL}, -}; - -const static struct rtgui_listbox_item items2[] = -{ - {"list #0", RT_NULL}, - {"list #1", RT_NULL}, - {"list #2", RT_NULL}, - {"new list #1", RT_NULL}, - {"new list #2", RT_NULL}, -}; - -/* ʾnotebookؼͼ */ -rtgui_container_t *demo_view_notebook(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - struct rtgui_notebook *notebook; - rtgui_listbox_t *box; - - /* ȴһʾõͼ */ - container = demo_view("Notebook View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - - notebook = rtgui_notebook_create(&rect, RTGUI_NOTEBOOK_BOTTOM); - /* containerһcontainerؼadd_childnotebookؼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(notebook)); - - box = rtgui_listbox_create(items, sizeof(items) / sizeof(struct rtgui_listbox_item), &rect); - rtgui_notebook_add(notebook, "Tab 1", RTGUI_WIDGET(box)); - - box = rtgui_listbox_create(items2, sizeof(items2) / sizeof(struct rtgui_listbox_item), &rect); - rtgui_notebook_add(notebook, "Tab 2", RTGUI_WIDGET(box)); - - return container; -} diff --git a/examples/gui/demo_view_progressbar.c b/examples/gui/demo_view_progressbar.c deleted file mode 100644 index 91e30e4d90a3c7a172d7126838d92121996f1262..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_progressbar.c +++ /dev/null @@ -1,103 +0,0 @@ -#include "demo_view.h" -#include -#include -#include - -static rtgui_progressbar_t *hbar; -static rtgui_progressbar_t *vbar; -static rtgui_timer_t *bar_timer = RT_NULL; - -void progressbar_timeout(struct rtgui_timer *timer, void *parameter) -{ - static rt_uint32_t value = 0; - - value++; - if (value == 100) - value = 0; - - rtgui_progressbar_set_value(hbar, value); - rtgui_progressbar_set_value(vbar, value); -} - -static rt_bool_t start_timer(struct rtgui_object *object, struct rtgui_event *event) -{ - if (bar_timer != RT_NULL) - rtgui_timer_start(bar_timer); - return RT_TRUE; -} - -static rt_bool_t stop_timer(struct rtgui_object *object, struct rtgui_event *event) -{ - if (bar_timer != RT_NULL) - rtgui_timer_stop(bar_timer); - return RT_TRUE; -} - -static rt_bool_t progressbar_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - - if (event->type == RTGUI_EVENT_SHOW) - { - rtgui_container_event_handler(object, event); - start_timer(object, event); - } - else if (event->type == RTGUI_EVENT_HIDE) - { - rtgui_container_event_handler(object, event); - stop_timer(object, event); - } - else - { - /* Ĭϵ¼ */ - return rtgui_progressbar_event_handler(object, event); - } - - return RT_FALSE; -} - -rtgui_container_t *demo_view_progressbar(void) -{ - rtgui_container_t *container; - rtgui_rect_t rect; - rtgui_label_t *label; - - /* create a demo container */ - container = demo_view("ProgressBar View"); - - /* get demo container rect */ - demo_view_get_rect(container, &rect); - label = rtgui_label_create("ˮƽ:"); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 18; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rect.y1 += 20; - rect.y2 = rect.y1 + 18; - hbar = rtgui_progressbar_create(RTGUI_HORIZONTAL, 100, &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(hbar)); - - /* get demo container rect */ - demo_view_get_rect(container, &rect); - label = rtgui_label_create("ֱ:"); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 45; - rect.y2 = rect.y1 + 18; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rect.x1 += 110; - rect.x2 = rect.x1 + 20; - rect.y1 += 18 + 5; - rect.y2 = rect.y1 + 150; - vbar = rtgui_progressbar_create(RTGUI_VERTICAL, 100, &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(vbar)); - - bar_timer = rtgui_timer_create(50, RT_TIMER_FLAG_PERIODIC, - progressbar_timeout, RT_NULL); - - return container; -} - diff --git a/examples/gui/demo_view_radiobox.c b/examples/gui/demo_view_radiobox.c deleted file mode 100644 index 7d72d550a6f68ffbe73c662b00cb413cc486f1df..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_radiobox.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 嵥radioboxؼʾ - * - * ӻڴcontainerͬradioboxؼ - */ - -#include "demo_view.h" -#include - -/* ʾֱradioı */ -static char *radio_item_v[5] = -{ - "one", - "two", - "three", - "item 1", - "item 2" -}; - -/* ʾˮƽradioı */ -static char *radio_item_h[3] = -{ - "one", "two", "three" -}; - -/* ʾradioboxؼͼ */ -rtgui_container_t *demo_view_radiobox(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_radiobox_t *radiobox; - - /* ȴһʾõͼ */ - container = demo_view("RadioBox View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 5 * 25; - - /* һֱʾradioboxؼıradio_item_v飬5 */ - radiobox = rtgui_radiobox_create("Radio Box", RTGUI_VERTICAL, radio_item_v, 5); - /* õǰѡǵ0 */ - rtgui_radiobox_set_selection(radiobox, 0); - /* radioboxؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(radiobox)); - /* radioboxؼλϢ */ - rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5 + 5 * 25; - rect.y2 = rect.y1 + 60; - - /* һˮƽʾradioboxؼıradio_item_h飬3 */ - radiobox = rtgui_radiobox_create("Radio Box", RTGUI_HORIZONTAL, radio_item_h, 3); - /* õǰѡǵ0 */ - rtgui_radiobox_set_selection(radiobox, 0); - /* radioboxؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(radiobox)); - /* radioboxؼλϢ */ - rtgui_widget_set_rect(RTGUI_WIDGET(radiobox), &rect); - - return container; -} diff --git a/examples/gui/demo_view_scrollbar.c b/examples/gui/demo_view_scrollbar.c deleted file mode 100644 index 363748d5a3aa6bb50cfad92be6ab8595373aa0e8..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_scrollbar.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "demo_view.h" -#include -#include -#include - -rtgui_container_t *demo_view_scrollbar(void) -{ - rtgui_container_t *container; - rtgui_rect_t rect; - rtgui_label_t *label; - rtgui_scrollbar_t *hbar; - rtgui_scrollbar_t *vbar; - - /* create a demo container */ - container = demo_view("ScrollBar View"); - - /* get demo container rect */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - label = rtgui_label_create("horizontal bar:"); - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - hbar = rtgui_scrollbar_create(container, 5, 70, 20, 200, RTGUI_HORIZONTAL); - rtgui_scrollbar_set_line_step(hbar, 1); - rtgui_scrollbar_set_page_step(hbar, 3); - rtgui_scrollbar_set_range(hbar, 20); - - /* get demo container rect */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5+40; - rect.y2 = rect.y1 + 20; - label = rtgui_label_create("vertical bar:"); - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - vbar = rtgui_scrollbar_create(container, 10, 110, 20, 200, RTGUI_VERTICAL); - rtgui_scrollbar_set_line_step(vbar, 1); - rtgui_scrollbar_set_page_step(vbar, 5); - rtgui_scrollbar_set_range(vbar, 20); - - return container; -} diff --git a/examples/gui/demo_view_slider.c b/examples/gui/demo_view_slider.c deleted file mode 100644 index 32d98d9abc95b2886e89b1b9d15d61a798855c80..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_slider.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "demo_view.h" -#include -#include -#include - -rtgui_container_t *demo_view_slider(void) -{ - rtgui_container_t *container; - rtgui_rect_t rect; - rtgui_label_t *label; - rtgui_slider_t *slider; - - /* create a demo container */ - container = demo_view("Slider View"); - - /* get demo container rect */ - demo_view_get_rect(container, &rect); - label = rtgui_label_create("horizontal slider:"); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 18; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rect.y1 += 20; - rect.y2 = rect.y1 + 18; - slider = rtgui_slider_create(0, 100, RTGUI_HORIZONTAL); - rtgui_container_add_child(container, RTGUI_WIDGET(slider)); - rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect); - - /* get demo container rect */ - demo_view_get_rect(container, &rect); - label = rtgui_label_create("vertical slider:"); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 50; - rect.y2 = rect.y1 + 18; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rect.x1 += 110; - rect.x2 = rect.x1 + 20; - rect.y1 += 18 + 5; - rect.y2 = rect.y1 + 150; - slider = rtgui_slider_create(0, 100, RTGUI_VERTICAL); - rtgui_container_add_child(container, RTGUI_WIDGET(slider)); - rtgui_widget_set_rect(RTGUI_WIDGET(slider), &rect); - - return container; -} diff --git a/examples/gui/demo_view_textbox.c b/examples/gui/demo_view_textbox.c deleted file mode 100644 index 2a6047563c7f77c0c44ea12848c519be3d366f5e..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_textbox.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 嵥texboxؼʾ - * - * ӻڴcontainerӼͬ͵textboxؼ - */ -#include "demo_view.h" -#include -#include - -/* ʾtextboxؼͼ */ -rtgui_container_t *demo_view_textbox(void) -{ - rtgui_rect_t rect, textbox_rect; - rtgui_container_t *container; - rtgui_label_t *label; - rtgui_textbox_t *text; - - /* ȴһʾõͼ */ - container = demo_view("TextBox View"); - - /* ͼλϢ */ - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 30; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create(": "); - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - - /* textbox_rectֵrectԼtextboxؼλ */ - textbox_rect = rect; - textbox_rect.x1 = textbox_rect.x2 + 5; - textbox_rect.x2 = textbox_rect.x1 + 160; - /* һtextboxؼ */ - text = rtgui_textbox_create("bernard", RTGUI_TEXTBOX_SINGLE); - /* textboxؼλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect); - /* textboxؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(text)); - - /* һlabelؼλ */ - rect.y1 += 23; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("ʼ: "); - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* labelؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - textbox_rect = rect; - textbox_rect.x1 = textbox_rect.x2 + 5; - textbox_rect.x2 = textbox_rect.x1 + 160; - /* һtextboxؼ */ - text = rtgui_textbox_create("bernard.xiong@gmail.com", RTGUI_TEXTBOX_SINGLE); - /* textboxؼλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect); - /* textboxؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(text)); - - rect.y1 += 23; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create(": "); - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* labelؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - textbox_rect = rect; - textbox_rect.x1 = textbox_rect.x2 + 5; - textbox_rect.x2 = textbox_rect.x1 + 160; - /* һtextboxؼ */ - text = rtgui_textbox_create("rt-thread", RTGUI_TEXTBOX_SINGLE); - /* textboxʾıΪʽ(ʾΪ*ţʺʾ) */ - text->flag |= RTGUI_TEXTBOX_MASK; - /* textboxؼλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect); - /* textboxؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(text)); - - rect.y1 += 23; - rect.y2 = rect.y1 + 20; - /* һlabelؼ */ - label = rtgui_label_create("ҳ: "); - /* labelλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - /* labelؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(label)); - textbox_rect = rect; - textbox_rect.x1 = textbox_rect.x2 + 5; - textbox_rect.x2 = textbox_rect.x1 + 160; - /* һtextboxؼ */ - text = rtgui_textbox_create("http://www.rt-thread.org", RTGUI_TEXTBOX_SINGLE); - /* textboxؼλ */ - rtgui_widget_set_rect(RTGUI_WIDGET(text), &textbox_rect); - /* textboxؼͼ */ - rtgui_container_add_child(container, RTGUI_WIDGET(text)); - - return container; -} diff --git a/examples/gui/demo_view_ttf.c b/examples/gui/demo_view_ttf.c deleted file mode 100644 index 09820ef8897be5c2dc7f4922a31164951d2e622b..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_ttf.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 嵥TTFʾʾ - * - * ӻڴcontainerϽTTFʾʾ - */ - -#include "demo_view.h" -#include -#include -#include - -#ifdef RTGUI_USING_TTF -static rtgui_font_t *font_16, *font_24, *font_36, *font_48; - -/* - * container¼ - */ -rt_bool_t ttf_event_handler(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_widget *widget = RTGUI_WIDGET(object); - - /* PAINT¼д */ - if (event->type == RTGUI_EVENT_PAINT) - { - struct rtgui_dc *dc; - rtgui_rect_t rect; - rtgui_font_t *saved; - - /* - * Ϊõdemo container汾һֿؼڻͼʱҪdemo container - * Ȼͼ - */ - rtgui_container_event_handler(widget, event); - - /************************************************************************/ - /* DCIJ */ - /************************************************************************/ - - /* ÿؼDC */ - dc = rtgui_dc_begin_drawing(widget); - /* DCأؼ򸸿ؼ״̬DCǻȡɹģ */ - if (dc == RT_NULL) - return RT_FALSE; - - /* demo containerͼ */ - demo_view_get_rect(RTGUI_CONTAINER(widget), &rect); - - saved = RTGUI_WIDGET_FONT(widget); - - RTGUI_WIDGET_FONT(widget) = font_16; - rtgui_dc_draw_text(dc, "ABCD", &rect); - rect.y1 += 18; - - RTGUI_WIDGET_FONT(widget) = font_24; - rtgui_dc_draw_text(dc, "ABCD", &rect); - rect.y1 += 26; - - RTGUI_WIDGET_FONT(widget) = font_36; - rtgui_dc_draw_text(dc, "ABCD", &rect); - rect.y1 += 38; - - RTGUI_WIDGET_FONT(widget) = font_48; - rtgui_dc_draw_text(dc, "ABCD", &rect); - - RTGUI_WIDGET_FONT(widget) = saved; - /* ͼ */ - rtgui_dc_end_drawing(dc); - } - else - { - /* ¼Ĭϵ¼ */ - return rtgui_container_event_handler(widget, event); - } - - return RT_FALSE; -} - -/* TTFʾʾõͼ */ -rtgui_container_t *demo_view_ttf() -{ - rtgui_container_t *container; - - font_16 = rtgui_freetype_font_create("d:/simsun.ttf", 0, 0, 16); - font_24 = rtgui_freetype_font_create("d:/simsun.ttf", 0, 0, 24); - font_36 = rtgui_freetype_font_create("d:/simsun.ttf", 0, 0, 36); - font_48 = rtgui_freetype_font_create("d:/simsun.TTF", 0, 0, 72); - - container = demo_view("TTF ʾ"); - if (container != RT_NULL) - { - RTGUI_WIDGET_BACKGROUND(container) = white; - /* óԼ¼ */ - rtgui_object_set_event_handler(RTGUI_OBJECT(container), ttf_event_handler); - } - - return container; -} -#endif diff --git a/examples/gui/demo_view_window.c b/examples/gui/demo_view_window.c deleted file mode 100644 index 222dc7dde11cb338896a1c732e8b6a5a36559d99..0000000000000000000000000000000000000000 --- a/examples/gui/demo_view_window.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * 嵥ʾ - * - * ӻȴһʾõcontainerİťʱ᲻ͬģʽ - */ - -#include -#include -#include -#include -#include -#include "demo_view.h" -#include - -static struct rtgui_timer *timer; -static struct rtgui_label *label; -static struct rtgui_win *autowin = RT_NULL; -static char label_text[80]; -static rt_uint8_t cnt = 5; - -rtgui_win_t *normal_window; -rtgui_label_t *normal_window_label; -static char normal_window_label_text[16]; -static unsigned char normal_window_show_count = 1; -extern struct rtgui_win *main_win; - -static rt_bool_t normal_window_onclose(struct rtgui_object *win, - struct rtgui_event *event) -{ - normal_window_show_count++; - - return RT_TRUE; -} - -static void create_normal_win(void) -{ - rtgui_rect_t rect = {30, 40, 150, 80}; - - normal_window = rtgui_win_create(RT_NULL, "ͨ", - &rect, RTGUI_WIN_STYLE_DEFAULT); - - rect.x1 += 20; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - - /* һıǩ */ - rt_sprintf(normal_window_label_text, - " %d ʾ", normal_window_show_count); - normal_window_label = rtgui_label_create(normal_window_label_text); - rtgui_widget_set_rect(RTGUI_WIDGET(normal_window_label), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(normal_window), - RTGUI_WIDGET(normal_window_label)); - - rtgui_win_set_onclose(normal_window, - normal_window_onclose); -} - -/* ʾ */ -static void demo_normal_window_onbutton(struct rtgui_object *object, rtgui_event_t *event) -{ - rt_sprintf(normal_window_label_text, - " %d ʾ", normal_window_show_count); - rtgui_label_set_text(normal_window_label, - normal_window_label_text); - if (RTGUI_WIDGET_IS_HIDE(normal_window)) - rtgui_win_show(normal_window, RT_FALSE); - else - rtgui_win_activate(normal_window); -} - -/* ȡһĴڱ */ -static char *get_win_title() -{ - static rt_uint8_t win_no = 0; - static char win_title[16]; - - rt_sprintf(win_title, " %d", ++win_no); - return win_title; -} - -/* رնԻʱĻص */ -void diag_close(struct rtgui_timer *timer, void *parameter) -{ - cnt --; - rt_sprintf(label_text, "closed then %d second!", cnt); - - /* ñǩı¿ؼ */ - rtgui_label_set_text(label, label_text); - rtgui_widget_update(RTGUI_WIDGET(label)); - - if (cnt == 0) - { - /* ʱرնԻ */ - rtgui_win_destroy(autowin); - } -} - -/* AUTOڹرʱ¼ */ -rt_bool_t auto_window_close(struct rtgui_object *object, struct rtgui_event *event) -{ - if (timer != RT_NULL) - { - /* ֹͣɾʱ */ - rtgui_timer_stop(timer); - rtgui_timer_destory(timer); - - timer = RT_NULL; - } - autowin = RT_NULL; - - return RT_TRUE; -} - -static rt_uint16_t delta_x = 20; -static rt_uint16_t delta_y = 40; - -/* Զʾ */ -static void demo_autowin_onbutton(struct rtgui_object *object, rtgui_event_t *event) -{ - struct rtgui_rect rect = {50, 50, 200, 200}; - - /* don't create the window twice */ - if (autowin) - return; - - autowin = rtgui_win_create(main_win, "Information", - &rect, RTGUI_WIN_STYLE_DEFAULT | RTGUI_WIN_STYLE_DESTROY_ON_CLOSE); - if (autowin == RT_NULL) - return; - - cnt = 5; - rt_sprintf(label_text, "closed then %d second!", cnt); - label = rtgui_label_create(label_text); - rect.x1 += 5; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(autowin), - RTGUI_WIDGET(label)); - - /* ùرմʱĶ */ - rtgui_win_set_onclose(autowin, auto_window_close); - - rtgui_win_show(autowin, RT_FALSE); - /* һʱ */ - timer = rtgui_timer_create(100, RT_TIMER_FLAG_PERIODIC, diag_close, RT_NULL); - rtgui_timer_start(timer); -} - -/* ģ̬ʾ */ -static void demo_modalwin_onbutton(struct rtgui_object *object, rtgui_event_t *event) -{ - rtgui_win_t *win; - rtgui_label_t *label; - rtgui_rect_t rect = {0, 0, 150, 80}; - - rtgui_rect_moveto(&rect, delta_x, delta_y); - delta_x += 20; - delta_y += 20; - - /* һ */ - win = rtgui_win_create(main_win, - get_win_title(), &rect, RTGUI_WIN_STYLE_DEFAULT); - - rect.x1 += 20; - rect.x2 -= 5; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - - label = rtgui_label_create("һģʽ"); - rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label)); - - /* ģ̬ʾ */ - rtgui_win_show(win, RT_TRUE); - - /* ɾԶɾ */ - rtgui_win_destroy(win); -} - -static void demo_close_ntitle_window(struct rtgui_object *object, rtgui_event_t *event) -{ - rtgui_win_t *win; - - /* ؼ */ - win = RTGUI_WIN(rtgui_widget_get_toplevel(RTGUI_WIDGET(object))); - - /* ٴ */ - rtgui_win_destroy(win); -} - -/* ޱⴰʾ */ -static void demo_ntitlewin_onbutton(struct rtgui_object *object, rtgui_event_t *event) -{ - rtgui_win_t *win; - rtgui_label_t *label; - rtgui_button_t *button; - rtgui_rect_t widget_rect, rect = {0, 0, 150, 80}; - - rtgui_rect_moveto(&rect, delta_x, delta_y); - delta_x += 20; - delta_y += 20; - - /* һڣΪޱ⼰ޱ߿ */ - win = rtgui_win_create(main_win, - "no title", &rect, RTGUI_WIN_STYLE_NO_TITLE | - RTGUI_WIN_STYLE_NO_BORDER | - RTGUI_WIN_STYLE_DESTROY_ON_CLOSE); - RTGUI_WIDGET_BACKGROUND(win) = white; - - /* һıǩ */ - label = rtgui_label_create("ޱ߿򴰿"); - rtgui_font_get_metrics(RTGUI_WIDGET_FONT(label), "ޱ߿򴰿", &widget_rect); - rtgui_rect_moveto_align(&rect, &widget_rect, RTGUI_ALIGN_CENTER_HORIZONTAL); - widget_rect.y1 += 20; - widget_rect.y2 += 20; - rtgui_widget_set_rect(RTGUI_WIDGET(label), &widget_rect); - rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(label)); - RTGUI_WIDGET_BACKGROUND(label) = white; - - /* һرհť */ - widget_rect.x1 = 0; - widget_rect.y1 = 0; - widget_rect.x2 = 40; - widget_rect.y2 = 20; - rtgui_rect_moveto_align(&rect, &widget_rect, RTGUI_ALIGN_CENTER_HORIZONTAL); - widget_rect.y1 += 40; - widget_rect.y2 += 40; - button = rtgui_button_create("ر"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &widget_rect); - rtgui_container_add_child(RTGUI_CONTAINER(win), RTGUI_WIDGET(button)); - rtgui_button_set_onbutton(button, demo_close_ntitle_window); - - rtgui_win_show(win, RT_FALSE); -} - -rtgui_container_t *demo_view_window(void) -{ - rtgui_rect_t rect; - rtgui_container_t *container; - rtgui_button_t *button; - - /* һʾõͼ */ - container = demo_view("Window Demo"); - - create_normal_win(); - - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5; - rect.y2 = rect.y1 + 20; - /* ťʾ */ - button = rtgui_button_create("Normal Win"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(container), RTGUI_WIDGET(button)); - /* onbuttonΪdemo_win_onbutton */ - rtgui_button_set_onbutton(button, demo_normal_window_onbutton); - - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25; - rect.y2 = rect.y1 + 20; - /* ťʾһԶرյĴ */ - button = rtgui_button_create("Auto Win"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(container), RTGUI_WIDGET(button)); - /* onbuttonΪdemo_autowin_onbutton */ - rtgui_button_set_onbutton(button, demo_autowin_onbutton); - - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* ťڴһģʽ */ - button = rtgui_button_create("Modal Win"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(container), RTGUI_WIDGET(button)); - /* onbuttonΪdemo_modalwin_onbutton */ - rtgui_button_set_onbutton(button, demo_modalwin_onbutton); - - demo_view_get_rect(container, &rect); - rect.x1 += 5; - rect.x2 = rect.x1 + 100; - rect.y1 += 5 + 25 + 25 + 25; - rect.y2 = rect.y1 + 20; - /* ťڴһĴ */ - button = rtgui_button_create("NoTitle Win"); - rtgui_widget_set_rect(RTGUI_WIDGET(button), &rect); - rtgui_container_add_child(RTGUI_CONTAINER(container), RTGUI_WIDGET(button)); - /* onbuttonΪdemo_ntitlewin_onbutton */ - rtgui_button_set_onbutton(button, demo_ntitlewin_onbutton); - - return container; -} diff --git a/examples/gui/demo_xml.c b/examples/gui/demo_xml.c deleted file mode 100644 index fe4f5321a6c4352aa480b14757476c0b5afd5feb..0000000000000000000000000000000000000000 --- a/examples/gui/demo_xml.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include - -static int xml_event_handler(rt_uint8_t event, const char *text, rt_size_t len, void *user) -{ - rt_kprintf("%s: %s\n", rtgui_xml_event_str(event), text); - return 1; -} - -const char xml_str[] = "ToveJaniReminderDon't forget me this weekend!"; -void demo_xml() -{ - rtgui_xml_t *xml; - - xml = rtgui_xml_create(512, xml_event_handler, RT_NULL); - if (xml != RT_NULL) - { - rtgui_xml_parse(xml, xml_str, sizeof(xml_str)); - rtgui_xml_destroy(xml); - } -} -#ifdef RT_USING_FINSH -#include -FINSH_FUNCTION_EXPORT(demo_xml, show the demo of xml parser); -#endif diff --git a/examples/gui/mywidget.c b/examples/gui/mywidget.c deleted file mode 100644 index 514cd755dacf1d40a98c104d27c394dcfe7b36f4..0000000000000000000000000000000000000000 --- a/examples/gui/mywidget.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include "mywidget.h" - -static void rtgui_mywidget_ondraw(struct rtgui_mywidget *me) -{ - struct rtgui_dc *dc; - struct rtgui_rect rect; - rt_uint16_t x, y; - - dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(me)); - if (dc == RT_NULL) return; - - rtgui_widget_get_rect(RTGUI_WIDGET(me), &rect); - RTGUI_DC_BC(dc) = white; - rtgui_dc_fill_rect(dc, &rect); - - x = (rect.x2 + rect.x1) / 2; - y = (rect.y2 + rect.y1) / 2; - - RTGUI_DC_FC(dc) = black; - rtgui_dc_draw_hline(dc, rect.x1, rect.x2, y); - rtgui_dc_draw_vline(dc, x, rect.y1, rect.y2); - - if (me->status == MYWIDGET_STATUS_ON) - RTGUI_DC_FC(dc) = green; - else - RTGUI_DC_FC(dc) = red; - rtgui_dc_fill_circle(dc, x, y, 5); - - rtgui_dc_end_drawing(dc); - return; -} - -static void rtgui_mywidget_onmouse(struct rtgui_mywidget *me, struct rtgui_event_mouse *mouse) -{ - struct rtgui_rect rect; - rt_uint16_t x, y; - - if (!(mouse->button & RTGUI_MOUSE_BUTTON_UP)) return; - - rtgui_widget_get_rect(RTGUI_WIDGET(me), &rect); - rtgui_widget_rect_to_device(RTGUI_WIDGET(me), &rect); - - x = (rect.x2 + rect.x1) / 2; - y = (rect.y2 + rect.y1) / 2; - - if ((mouse->x < x + 5 && mouse->x > x - 5) && - (mouse->y < y + 5 && mouse->y > y - 5)) - { - if (me->status & MYWIDGET_STATUS_ON) me->status = MYWIDGET_STATUS_OFF; - else me->status = MYWIDGET_STATUS_ON; - - rtgui_mywidget_ondraw(me); - } -} - -rt_bool_t rtgui_mywidget_event_handler(struct rtgui_object *object, struct rtgui_event *event) -{ - struct rtgui_mywidget *me = RTGUI_MYWIDGET(object); - - switch (event->type) - { - case RTGUI_EVENT_PAINT: - rtgui_mywidget_ondraw(me); - break; - - case RTGUI_EVENT_MOUSE_BUTTON: - rtgui_mywidget_onmouse(RTGUI_MYWIDGET(me), (struct rtgui_event_mouse *) event); - break; - - default: - return rtgui_widget_event_handler(object, event); - } - - return RT_FALSE; -} - -static void _rtgui_mywidget_constructor(rtgui_mywidget_t *mywidget) -{ - RTGUI_WIDGET(mywidget)->flag |= RTGUI_WIDGET_FLAG_FOCUSABLE; - rtgui_object_set_event_handler(RTGUI_OBJECT(mywidget), rtgui_mywidget_event_handler); - - mywidget->status = MYWIDGET_STATUS_OFF; -} - -DEFINE_CLASS_TYPE(mywidget, "mywidget", - RTGUI_WIDGET_TYPE, - _rtgui_mywidget_constructor, - RT_NULL, - sizeof(struct rtgui_mywidget)); - -struct rtgui_mywidget *rtgui_mywidget_create(rtgui_rect_t *r) -{ - struct rtgui_mywidget *me; - - me = (struct rtgui_mywidget *) rtgui_widget_create(RTGUI_MYWIDGET_TYPE); - if (me != RT_NULL) - { - rtgui_widget_set_rect(RTGUI_WIDGET(me), r); - } - - return me; -} - -void rtgui_mywidget_destroy(struct rtgui_mywidget *me) -{ - rtgui_widget_destroy(RTGUI_WIDGET(me)); -} diff --git a/examples/gui/mywidget.h b/examples/gui/mywidget.h deleted file mode 100644 index 99f19c9416d6642ea63009b9016b412c08cacb03..0000000000000000000000000000000000000000 --- a/examples/gui/mywidget.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 程序清单:自定义控件 - * - * 这个例子是要实现一个自定义控件,外观大致如 - * | - * --o-- - * | - * 的形状,中间的o色彩表示了当前的状态,ON状态时是绿色,OFF状态时是红色? - * 并且,这个o位置接受鼠标点击,点击下切换下相应的状态? - */ -#ifndef __MY_WIDGET_H__ -#define __MY_WIDGET_H__ - -#include -#include - -/* 自定义控件的状态值定?*/ -#define MYWIDGET_STATUS_ON 1 -#define MYWIDGET_STATUS_OFF 0 - -DECLARE_CLASS_TYPE(mywidget); -/** 每个控件会有一个类型,通过如下的宏获得控件相应的类型信?*/ -#define RTGUI_MYWIDGET_TYPE (RTGUI_TYPE(mywidget)) -/** 对一个对象实例,可以通过下面的宏实现类型转换 */ -#define RTGUI_MYWIDGET(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MYWIDGET_TYPE, rtgui_mywidget_t)) -/** 可以通过下面的宏以决定一个具体实例是否是自定义控件类?*/ -#define RTGUI_IS_MYWIDGET(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_MYWIDGET_TYPE)) - -/* 个性化控件类定?*/ -struct rtgui_mywidget -{ - /* 这个控件是继承自rtgui_widget控件 */ - struct rtgui_widget parent; - - /* 状态:ON、OFF */ - rt_uint8_t status; -}; -typedef struct rtgui_mywidget rtgui_mywidget_t; - -/* 控件的创建和删除 */ -struct rtgui_mywidget *rtgui_mywidget_create(rtgui_rect_t *r); -void rtgui_mywidget_destroy(struct rtgui_mywidget *me); - -/* 控件的默认事件处理函数? - * 对一个控件而言,如果派生自它的子控件很可能会调用父控件的事件处理函数, - * 所以这里采用公开声明的方式? - */ -rt_bool_t rtgui_mywidget_event_handler(struct rtgui_object *object, struct rtgui_event *event); - -#endif diff --git a/examples/gui/play.hdh b/examples/gui/play.hdh deleted file mode 100644 index 0230cf09cc7f30013bec925ece48c8c1ed7c3f2c..0000000000000000000000000000000000000000 --- a/examples/gui/play.hdh +++ /dev/null @@ -1,107 +0,0 @@ -static const unsigned char play_hdh[] = { - 0x48, 0x44, 0x43, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0x9d, 0xae, 0xdf, 0xef, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0x9d, 0xae, - 0x9d, 0xae, 0xdf, 0xef, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0xdf, 0xef, 0x9d, 0xae, 0x7d, 0xae, 0xbf, 0xef, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0xbf, 0xef, 0x7d, 0xae, 0x7d, 0xae, 0xbf, 0xe7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0xbf, 0xe7, 0x7d, 0xae, - 0x7d, 0xa6, 0xbf, 0xe7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, - 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x7a, 0x6d, 0x1a, 0x4d, 0x1a, 0x4d, - 0x7a, 0x6d, 0x5f, 0xd7, 0x5f, 0xd7, 0x7a, 0x6d, 0x1a, 0x4d, 0x1a, 0x4d, - 0x7a, 0x6d, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, - 0x5f, 0xd7, 0x5f, 0xd7, 0xbf, 0xe7, 0x7d, 0xa6, 0x5d, 0xa6, 0x9f, 0xe7, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0xf9, 0x4c, 0x7c, 0x55, 0x7c, 0x55, 0xf9, 0x4c, 0x5f, 0xcf, - 0x5f, 0xcf, 0xf9, 0x4c, 0x7c, 0x55, 0x7c, 0x55, 0xf9, 0x4c, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x9f, 0xe7, 0x5d, 0xa6, 0x5d, 0xa6, 0x9f, 0xdf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0xf9, 0x4c, - 0x5b, 0x55, 0x5b, 0x55, 0xf9, 0x4c, 0x5f, 0xcf, 0x5f, 0xcf, 0xf9, 0x4c, - 0x5b, 0x55, 0x5b, 0x55, 0xf9, 0x4c, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x9f, 0xdf, 0x5d, 0xa6, - 0x5c, 0xa6, 0x9f, 0xdf, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, - 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0xd9, 0x4c, 0x3b, 0x4d, 0x3b, 0x4d, - 0xd9, 0x4c, 0x3f, 0xc7, 0x3f, 0xc7, 0xd9, 0x4c, 0x3b, 0x4d, 0x3b, 0x4d, - 0xd9, 0x4c, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, - 0x3f, 0xc7, 0x3f, 0xc7, 0x9f, 0xdf, 0x5c, 0xa6, 0x3c, 0xa6, 0x7f, 0xdf, - 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, - 0x3e, 0xc7, 0xb8, 0x44, 0x1a, 0x4d, 0x1a, 0x4d, 0xb8, 0x44, 0x3e, 0xc7, - 0x3e, 0xc7, 0xb8, 0x44, 0x1a, 0x4d, 0x1a, 0x4d, 0xb8, 0x44, 0x3e, 0xc7, - 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, - 0x7f, 0xdf, 0x3c, 0xa6, 0x3c, 0x9e, 0x7f, 0xd7, 0x1e, 0xbf, 0x1e, 0xbf, - 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x98, 0x3c, - 0xfa, 0x44, 0xfa, 0x44, 0x98, 0x3c, 0x1e, 0xbf, 0x1e, 0xbf, 0x98, 0x3c, - 0xfa, 0x44, 0xfa, 0x44, 0x98, 0x3c, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, - 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x7f, 0xd7, 0x3c, 0x9e, - 0x1c, 0x9e, 0x7f, 0xd7, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0x77, 0x3c, 0xd9, 0x3c, 0xd9, 0x3c, - 0x77, 0x3c, 0xfe, 0xbe, 0xfe, 0xbe, 0x77, 0x3c, 0xd9, 0x3c, 0xd9, 0x3c, - 0x77, 0x3c, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0x7f, 0xd7, 0x1c, 0x9e, 0x1c, 0x9e, 0x5e, 0xcf, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0x56, 0x34, 0x98, 0x3c, 0x98, 0x3c, 0x56, 0x34, 0xfe, 0xbe, - 0xfe, 0xbe, 0x56, 0x34, 0x98, 0x3c, 0x98, 0x3c, 0x56, 0x34, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0x5e, 0xcf, 0x1c, 0x9e, 0xfc, 0x95, 0x5e, 0xcf, 0xfe, 0xb6, 0xfe, 0xb6, - 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0x36, 0x34, - 0x78, 0x34, 0x78, 0x34, 0x36, 0x34, 0xfe, 0xb6, 0xfe, 0xb6, 0x36, 0x34, - 0x78, 0x34, 0x78, 0x34, 0x36, 0x34, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, - 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0x5e, 0xcf, 0xfc, 0x95, - 0xfb, 0x95, 0x3e, 0xcf, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, - 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xf5, 0x2b, 0x57, 0x34, 0x57, 0x34, - 0xf5, 0x2b, 0xde, 0xb6, 0xde, 0xb6, 0xf5, 0x2b, 0x57, 0x34, 0x57, 0x34, - 0xf5, 0x2b, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, - 0xde, 0xb6, 0xde, 0xb6, 0x3e, 0xcf, 0xfb, 0x95, 0xdb, 0x95, 0x3e, 0xc7, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xd5, 0x2b, 0x36, 0x2c, 0x36, 0x2c, 0xd5, 0x2b, 0xbe, 0xae, - 0xbe, 0xae, 0xd5, 0x2b, 0x36, 0x2c, 0x36, 0x2c, 0xd5, 0x2b, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0x3e, 0xc7, 0xdb, 0x95, 0xdb, 0x95, 0x3e, 0xc7, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0x56, 0x44, - 0xd4, 0x23, 0xd4, 0x23, 0x56, 0x44, 0xbe, 0xae, 0xbe, 0xae, 0x56, 0x44, - 0xd4, 0x23, 0xd4, 0x23, 0x56, 0x44, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0x3e, 0xc7, 0xdb, 0x95, - 0xdb, 0x8d, 0x1e, 0xc7, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x1e, 0xc7, 0xdb, 0x8d, 0xbb, 0x8d, 0x1e, 0xbf, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x1e, 0xbf, 0xbb, 0x8d, 0xbb, 0x8d, 0x1e, 0xbf, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x1e, 0xbf, 0xbb, 0x8d, - 0xbb, 0x8d, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xbb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, -}; diff --git a/examples/gui/stop.hdh b/examples/gui/stop.hdh deleted file mode 100644 index 83f9e60b7861adb33ba51bf672335cc5f6e33719..0000000000000000000000000000000000000000 --- a/examples/gui/stop.hdh +++ /dev/null @@ -1,107 +0,0 @@ -static const unsigned char stop_hdh[] = { - 0x48, 0x44, 0x43, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0x9d, 0xae, 0xdf, 0xef, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, - 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0xbf, 0xe7, 0x9d, 0xae, - 0x9d, 0xae, 0xdf, 0xef, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0xdf, 0xef, 0x9d, 0xae, 0x7d, 0xae, 0xbf, 0xef, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, 0x9f, 0xdf, - 0xbf, 0xef, 0x7d, 0xae, 0x7d, 0xae, 0xbf, 0xe7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, - 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0x7f, 0xd7, 0xbf, 0xe7, 0x7d, 0xae, - 0x7d, 0xa6, 0xbf, 0xe7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, - 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0xfb, 0x8d, 0x3c, 0x96, - 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, - 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, 0x5f, 0xd7, - 0x5f, 0xd7, 0x5f, 0xd7, 0xbf, 0xe7, 0x7d, 0xa6, 0x5d, 0xa6, 0x9f, 0xe7, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0xf9, 0x4c, 0x3a, 0x55, 0x5a, 0x65, 0x9d, 0xae, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x9f, 0xe7, 0x5d, 0xa6, 0x5d, 0xa6, 0x9f, 0xdf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0xf9, 0x4c, 0x5b, 0x55, 0x3b, 0x55, 0x1a, 0x4d, 0xba, 0x7d, 0x1e, 0xc7, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, - 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x5f, 0xcf, 0x9f, 0xdf, 0x5d, 0xa6, - 0x5c, 0xa6, 0x9f, 0xdf, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, - 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0xd9, 0x4c, 0x3b, 0x4d, - 0x3b, 0x4d, 0x3b, 0x4d, 0x1a, 0x4d, 0xf9, 0x4c, 0xfb, 0x8d, 0x3f, 0xc7, - 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, 0x3f, 0xc7, - 0x3f, 0xc7, 0x3f, 0xc7, 0x9f, 0xdf, 0x5c, 0xa6, 0x3c, 0xa6, 0x7f, 0xdf, - 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, - 0x3e, 0xc7, 0x3e, 0xc7, 0xb8, 0x44, 0x1a, 0x4d, 0x1a, 0x4d, 0x1a, 0x4d, - 0x1a, 0x4d, 0x1a, 0x4d, 0xd9, 0x44, 0x19, 0x5d, 0x7c, 0xa6, 0x3e, 0xc7, - 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, 0x3e, 0xc7, - 0x7f, 0xdf, 0x3c, 0xa6, 0x3c, 0x9e, 0x7f, 0xd7, 0x1e, 0xbf, 0x1e, 0xbf, - 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, - 0x98, 0x44, 0xfa, 0x44, 0xfa, 0x44, 0xfa, 0x44, 0xfa, 0x44, 0xfa, 0x44, - 0xf9, 0x44, 0xd9, 0x44, 0x98, 0x44, 0x39, 0x6d, 0x1e, 0xbf, 0x1e, 0xbf, - 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x1e, 0xbf, 0x7f, 0xd7, 0x3c, 0x9e, - 0x1c, 0x9e, 0x7f, 0xd7, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0x77, 0x3c, 0xd9, 0x44, - 0xd9, 0x44, 0xd9, 0x44, 0xd9, 0x44, 0xd9, 0x44, 0xb9, 0x44, 0xb8, 0x3c, - 0x77, 0x3c, 0x38, 0x6d, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0x7f, 0xd7, 0x1c, 0x9e, 0x1c, 0x9e, 0x5e, 0xcf, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0x56, 0x34, 0x98, 0x3c, 0x98, 0x3c, 0x98, 0x3c, - 0x98, 0x3c, 0x98, 0x3c, 0x77, 0x3c, 0xb7, 0x4c, 0x3c, 0x96, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0x5e, 0xcf, 0x1c, 0x9e, 0xfc, 0x95, 0x5e, 0xcf, 0xfe, 0xb6, 0xfe, 0xb6, - 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, - 0x36, 0x34, 0x78, 0x34, 0x78, 0x34, 0x78, 0x34, 0x57, 0x34, 0x56, 0x3c, - 0x9a, 0x7d, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, - 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0xfe, 0xb6, 0x5e, 0xcf, 0xfc, 0x95, - 0xfb, 0x95, 0x3e, 0xcf, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, - 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0x15, 0x2c, 0x57, 0x34, - 0x37, 0x34, 0x16, 0x2c, 0xf8, 0x5c, 0x9d, 0xae, 0xde, 0xb6, 0xde, 0xb6, - 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, 0xde, 0xb6, - 0xde, 0xb6, 0xde, 0xb6, 0x3e, 0xcf, 0xfb, 0x95, 0xdb, 0x95, 0x3e, 0xc7, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xd4, 0x2b, 0xf5, 0x2b, 0x56, 0x44, 0xfb, 0x8d, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0x3e, 0xc7, 0xdb, 0x95, 0xdb, 0x95, 0x3e, 0xc7, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xf8, 0x64, 0x39, 0x6d, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, - 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0xbe, 0xae, 0x3e, 0xc7, 0xdb, 0x95, - 0xdb, 0x8d, 0x1e, 0xc7, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x1e, 0xc7, 0xdb, 0x8d, 0xbb, 0x8d, 0x1e, 0xbf, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x1e, 0xbf, 0xbb, 0x8d, 0xbb, 0x8d, 0x1e, 0xbf, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, - 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x9d, 0xa6, 0x1e, 0xbf, 0xbb, 0x8d, - 0xbb, 0x8d, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, - 0xfe, 0xbe, 0xfe, 0xbe, 0xfe, 0xbe, 0xbb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, 0xdb, 0x8d, - 0xdb, 0x8d, 0xdb, 0x8d, -}; diff --git a/include/rtm.h b/include/rtm.h index 92ba6a381ab77635817432abe9cf69ce2a646d6d..4bf7951a90b9dfc5e48dbc2a76dec723eb9b4faa 100644 --- a/include/rtm.h +++ b/include/rtm.h @@ -21,6 +21,9 @@ struct rt_module_symtab const char *name; }; +#if defined(_MSC_VER) || defined(__MINGW32__) +#define RTM_EXPORT(symbol) +#else #define RTM_EXPORT(symbol) \ const char __rtmsym_##symbol##_name[] = #symbol; \ const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \ @@ -28,6 +31,8 @@ const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \ (void *)&symbol, \ __rtmsym_##symbol##_name \ }; +#endif + #else #define RTM_EXPORT(symbol) #endif diff --git a/libcpu/SConscript b/libcpu/SConscript index a1609d5fd3da5add215ded94e51240f5511a6d3f..0d009760920f192aab1f540ff4e27597a7da517f 100644 --- a/libcpu/SConscript +++ b/libcpu/SConscript @@ -18,6 +18,9 @@ if rtconfig.PLATFORM == 'iar': if rtconfig.PLATFORM == 'cl': src = Glob(path + '/*.c') +if rtconfig.PLATFORM == 'mingw': + src = Glob(path + '/*.c') + CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common'] group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH) diff --git a/libcpu/sim/win32/cpu_port.c b/libcpu/sim/win32/cpu_port.c index 38c387b196cf3f5eb54a2fbf245e52bcf9429a1e..6bf3c79cf7321597c0c97275ddb2f551671d798e 100644 --- a/libcpu/sim/win32/cpu_port.c +++ b/libcpu/sim/win32/cpu_port.c @@ -111,6 +111,7 @@ static DWORD WINAPI ThreadforKeyGet(LPVOID lpParam); static void SetThreadName(DWORD dwThreadID, char* threadName) { +#if defined(_MSC_VER) THREADNAME_INFO info; info.dwType = 0x1000; info.szName = threadName; @@ -124,6 +125,7 @@ static void SetThreadName(DWORD dwThreadID, char* threadName) __except(EXCEPTION_EXECUTE_HANDLER) { } +#endif } /* diff --git a/tools/building.py b/tools/building.py index a1e63f8fa97be7fd88e23381daa187bb6b486f5c..8237a0fd32d20ab7a6fb9237e5c02a9c23825959 100644 --- a/tools/building.py +++ b/tools/building.py @@ -48,6 +48,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ if not os.path.isfile(os.path.join(rtconfig.EXEC_PATH, 'armcc.exe')): if rtconfig.EXEC_PATH.find('bin40') > 0: rtconfig.EXEC_PATH = rtconfig.EXEC_PATH.replace('bin40', 'armcc/bin') + Env['LINKFLAGS']=Env['LINKFLAGS'].replace('RV31', 'armcc') # patch for win32 spawn if env['PLATFORM'] == 'win32' and rtconfig.PLATFORM == 'gcc': @@ -134,13 +135,13 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ objs = SConscript('SConscript', variant_dir='build', duplicate=0) Repository(Rtt_Root) # include kernel - objs.append(SConscript(Rtt_Root + '/src/SConscript', variant_dir='build/src', duplicate=0)) + objs.extend(SConscript(Rtt_Root + '/src/SConscript', variant_dir='build/src', duplicate=0)) # include libcpu if not has_libcpu: - objs.append(SConscript(Rtt_Root + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)) + objs.extend(SConscript(Rtt_Root + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)) # include components - objs.append(SConscript(Rtt_Root + '/components/SConscript', + objs.extend(SConscript(Rtt_Root + '/components/SConscript', variant_dir='build/components', duplicate=0, exports='remove_components'))