Refactor message, display, resource, readme

This commit is contained in:
idea4good 2018-12-11 14:30:09 +08:00
parent 0f9faa1abe
commit 78f42abe7b
24 changed files with 73 additions and 304 deletions

View File

@ -1,6 +1,12 @@
if [ "$#" -ne 1 ]; then
echo "Invalid arguments"
exit -1
fi
url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%2FzSee4vCUBcyjR65I9zZ6nb%2B%2F7bbzex%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%2Fxbxj%2FrSBkX7eQ%3D%3D" url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%2FzSee4vCUBcyjR65I9zZ6nb%2B%2F7bbzex%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%2Fxbxj%2FrSBkX7eQ%3D%3D"
build_time=`date +%Y-%m-%dT%H:%M:%S.000+0800` build_time=`date +%Y-%m-%dT%H:%M:%S.000+0800`
device_info=`uname -s -n -m` device_info=`uname -s -n -m`
curl --include --request POST --header "Content-Type: application/json" --data-binary "[{ curl --include --request POST --header "Content-Type: application/json" --data-binary "[{
\"device_info\" :\"$device_info\", \"device_info\" :\"$device_info\",
\"project_info\" :\"$1\", \"project_info\" :\"$1\",

View File

@ -5,10 +5,10 @@
相比QT、MFCGuiLite不预设开发者的使用场景不在具体功能上大包大揽用框架的简洁换取开发的自由GuiLite在图形绘制上面力图一步到位运行效率感人。 相比QT、MFCGuiLite不预设开发者的使用场景不在具体功能上大包大揽用框架的简洁换取开发的自由GuiLite在图形绘制上面力图一步到位运行效率感人。
## 新功能:入门demo -- HelloGuiLite ## 新功能:多语言demo -- HelloFont
![HelloGuiLite](doc/HelloGuiLite.gif) ![HelloFont](doc/HelloFont.gif)
**信不信由你代码只有100+行!**[查阅代码](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloGuiLite/UIcode/helloGL.cpp) **信不信由你代码只有100+行!**[查阅代码](https://gitee.com/idea4good/GuiLiteSamples/blob/master/HelloFont/UIcode/UIcode.cpp)
## 卓越的跨平台能力 ## 卓越的跨平台能力
在Mac, iOS下的运行效果: 在Mac, iOS下的运行效果:

View File

@ -46,5 +46,5 @@ void register_timer(int milli_second, void func(void* ptmr, void* parg));
unsigned int get_cur_thread_id(); unsigned int get_cur_thread_id();
void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg); void create_thread(unsigned long* thread_id, void* attr, void *(*start_routine) (void *), void* arg);
void thread_sleep(unsigned int milli_seconds); void thread_sleep(unsigned int milli_seconds);
int build_bmp(char *filename, unsigned int width, unsigned int height, unsigned char *data); int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data);
#endif #endif

View File

@ -1,7 +1,6 @@
#ifndef _DISPLAY_H_ #ifndef _DISPLAY_H_
#define _DISPLAY_H_ #define _DISPLAY_H_
#define MAX_DISPLAY 9
#define SURFACE_CNT_MAX 6//root + pages #define SURFACE_CNT_MAX 6//root + pages
class c_hid_pipe; class c_hid_pipe;
@ -14,21 +13,17 @@ public:
unsigned int color_bytes, unsigned int surface_cnt); unsigned int color_bytes, unsigned int surface_cnt);
c_surface* alloc_surface(void* usr, Z_ORDER_LEVEL max_zorder); c_surface* alloc_surface(void* usr, Z_ORDER_LEVEL max_zorder);
int merge_surface(c_surface* s1, c_surface* s2, int x0, int x1, int y0, int y2, int offset); int merge_surface(c_surface* s1, c_surface* s2, int x0, int x1, int y0, int y2, int offset);
c_hid_pipe* get_hid_pipe() { return m_hid_pipe; }
unsigned int get_width() { return m_width; } unsigned int get_width() { return m_width; }
unsigned int get_height() { return m_height; } unsigned int get_height() { return m_height; }
static void* get_frame_buffer(unsigned int display_id, int* width, int* height); void* get_frame_buffer(int* width, int* height);
static int snap_shot(unsigned int display_id); int snap_shot(const char* file_name);
private: private:
unsigned int m_width; //in pixels unsigned int m_width; //in pixels
unsigned int m_height; //in pixels unsigned int m_height; //in pixels
unsigned int m_color_bytes; //16 bits, 32 bits only unsigned int m_color_bytes; //16 bits, 32 bits only
void* m_phy_fb; void* m_phy_fb;
c_hid_pipe* m_hid_pipe;
c_surface* m_surface_group[SURFACE_CNT_MAX]; c_surface* m_surface_group[SURFACE_CNT_MAX];
unsigned int m_surface_cnt; unsigned int m_surface_cnt;
static c_display* ms_displays[MAX_DISPLAY];
}; };
#endif #endif

View File

@ -8,39 +8,20 @@ typedef struct
unsigned int dwParam2; unsigned int dwParam2;
}MSG_INFO; }MSG_INFO;
int read_usr_msg(MSG_INFO* msg);
int write_usr_msg(MSG_INFO* msg);
#define FIFO_BUFFER_LEN 1024 #define FIFO_BUFFER_LEN 1024
#define FIFO_NAME_LEN 16
class c_fifo class c_fifo
{ {
public: public:
c_fifo(const char* name); c_fifo();
int read(void* buf, int len); int read(void* buf, int len);
int write(void* buf, int len); int write(void* buf, int len);
private: private:
unsigned char m_buf[FIFO_BUFFER_LEN]; unsigned char m_buf[FIFO_BUFFER_LEN];
char m_name[FIFO_NAME_LEN];
int m_head; int m_head;
int m_tail; int m_tail;
void* m_read_sem; void* m_read_sem;
void* m_write_mutex; void* m_write_mutex;
}; };
#define MAX_HID_PIPES 9
class c_hid_pipe
{
public:
c_hid_pipe(void* id);
static int read_hid_msg();
static int write_hid_msg(MSG_INFO* msg, unsigned int display_id = 0);
MSG_INFO m_msg;
int m_fd;
private:
static c_hid_pipe* ms_pipes[MAX_HID_PIPES];
static int ms_max_fd;
};
#endif #endif

View File

@ -137,7 +137,7 @@ static int set_a_timer(int interval, void (* timer_proc) (void* ptmr, void* parg
typedef void (*EXPIRE_ROUTINE)(void* arg); typedef void (*EXPIRE_ROUTINE)(void* arg);
EXPIRE_ROUTINE s_expire_function; EXPIRE_ROUTINE s_expire_function;
static c_fifo s_real_timer_fifo("real timer fifo"); static c_fifo s_real_timer_fifo;
static void* real_timer_routine(void*) static void* real_timer_routine(void*)
{ {
@ -269,7 +269,7 @@ typedef struct{
unsigned int biBlueMask; unsigned int biBlueMask;
}__attribute__((packed))Infohead; }__attribute__((packed))Infohead;
int build_bmp(char *filename, unsigned int width, unsigned int height, unsigned char *data) int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data)
{ {
FileHead bmp_head; FileHead bmp_head;
Infohead bmp_info; Infohead bmp_info;

View File

@ -136,7 +136,7 @@ static int set_a_timer(int interval, void (* timer_proc) (void* ptmr, void* parg
typedef void (*EXPIRE_ROUTINE)(void* arg); typedef void (*EXPIRE_ROUTINE)(void* arg);
EXPIRE_ROUTINE s_expire_function; EXPIRE_ROUTINE s_expire_function;
static c_fifo s_real_timer_fifo("real timer fifo"); static c_fifo s_real_timer_fifo;
static DWORD WINAPI fire_real_timer(LPVOID lpParam) static DWORD WINAPI fire_real_timer(LPVOID lpParam)
{ {
@ -276,7 +276,7 @@ typedef struct {
}Infohead; }Infohead;
#pragma pack(pop) #pragma pack(pop)
int build_bmp(char *filename, unsigned int width, unsigned int height, unsigned char *data) int build_bmp(const char *filename, unsigned int width, unsigned int height, unsigned char *data)
{ {
FileHead bmp_head; FileHead bmp_head;
Infohead bmp_info; Infohead bmp_info;

View File

@ -15,7 +15,7 @@ typedef struct
AUDIO_TYPE type; AUDIO_TYPE type;
}AUDIO_REQUEST; }AUDIO_REQUEST;
static c_fifo s_request_fifo("aduio fifo"); static c_fifo s_request_fifo;
static void* render_thread(void* param) static void* render_thread(void* param)
{ {

View File

@ -30,7 +30,7 @@ typedef struct
}WAV_RESOURCE; }WAV_RESOURCE;
static WAV_RESOURCE s_wav_resource[AUDIO_MAX]; static WAV_RESOURCE s_wav_resource[AUDIO_MAX];
static c_fifo s_request_fifo("aduio fifo"); static c_fifo s_request_fifo;
static IAudioClient* s_audio_client; static IAudioClient* s_audio_client;
static IAudioRenderClient* s_audio_render_client; static IAudioRenderClient* s_audio_render_client;
static HANDLE s_audio_event; static HANDLE s_audio_event;

View File

@ -9,31 +9,8 @@
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
c_hid_pipe* c_hid_pipe::ms_pipes[MAX_HID_PIPES]; c_fifo::c_fifo()
int c_hid_pipe::ms_max_fd;
static c_fifo s_usr_fifo("usr fifo");
int read_usr_msg(MSG_INFO* msg)
{ {
return s_usr_fifo.read(msg, sizeof(MSG_INFO));
}
int write_usr_msg(MSG_INFO* msg)
{
if(msg->dwMsgId & 0xf000000)ASSERT(FALSE);
return s_usr_fifo.write(msg, sizeof(MSG_INFO));
}
c_fifo::c_fifo(const char* name)
{
if (strlen(name) >= FIFO_NAME_LEN)
{
ASSERT(FALSE);
}
memset(m_name, 0, sizeof(m_name));
strcpy(m_name, name);
m_head = m_tail = 0; m_head = m_tail = 0;
m_read_sem = malloc(sizeof(sem_t)); m_read_sem = malloc(sizeof(sem_t));
m_write_mutex = malloc(sizeof(pthread_mutex_t)); m_write_mutex = malloc(sizeof(pthread_mutex_t));
@ -76,9 +53,7 @@ int c_fifo::write(void* buf, int len)
if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head) if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head)
{//full, clear data has been written; {//full, clear data has been written;
m_tail = tail; m_tail = tail;
log_out("Warning: "); log_out("Warning: fifo full\n");
log_out(m_name);
log_out(" full\n");
pthread_mutex_unlock((pthread_mutex_t*)m_write_mutex); pthread_mutex_unlock((pthread_mutex_t*)m_write_mutex);
return 0; return 0;
} }
@ -98,57 +73,3 @@ int c_fifo::write(void* buf, int len)
} }
return i; return i;
} }
////////////////////////////////////
// HID //
////////////////////////////////////
static c_fifo s_hid_fifo("hid fifo");
c_hid_pipe::c_hid_pipe(void* id)
{
for(int i = 0; i < MAX_HID_PIPES; i++)
{
if(!ms_pipes[i])
{
ms_pipes[i] = this;
break;
}
}
}
int c_hid_pipe::read_hid_msg()
{
int ret = -1;
for(int i = 0; i < MAX_HID_PIPES; i++)
{
if(ms_pipes[i])
{
ms_pipes[i]->m_msg.dwMsgId = XXX;
}
}
MSG_INFO msg;
ret = s_hid_fifo.read(&msg, sizeof(MSG_INFO));
if(0 >= ret)
{
return ret;
}
int display_id = ((msg.dwMsgId & 0xff00000) >> 24);
msg.dwMsgId &= 0x00ffffff;//recover message.
if (!ms_pipes[display_id])
{
return -2;
}
ms_pipes[display_id]->m_msg = msg;
return ret;
}
int c_hid_pipe::write_hid_msg(MSG_INFO* msg, unsigned int display_id)
{
if(MAX_DISPLAY <= display_id)
{
ASSERT(FALSE);
return -1;
}
msg->dwMsgId |= ((display_id) << 24);//merge display ID in message.
return s_hid_fifo.write(msg, sizeof(MSG_INFO));
}

View File

@ -5,32 +5,8 @@
#include "../../core_include/msg.h" #include "../../core_include/msg.h"
#include <windows.h> #include <windows.h>
c_hid_pipe* c_hid_pipe::ms_pipes[MAX_HID_PIPES]; c_fifo::c_fifo()
int c_hid_pipe::ms_max_fd;
static c_fifo s_usr_fifo("usr fifo");
static c_fifo s_hid_fifo("hid fifo");
int read_usr_msg(MSG_INFO* msg)
{ {
return s_usr_fifo.read(msg, sizeof(MSG_INFO));
}
int write_usr_msg(MSG_INFO* msg)
{
if(msg->dwMsgId & 0xf000000)ASSERT(FALSE);
return s_usr_fifo.write(msg, sizeof(MSG_INFO));
}
c_fifo::c_fifo(const char* name)
{
if (strlen(name) >= FIFO_NAME_LEN)
{
ASSERT(FALSE);
}
memset(m_name, 0, sizeof(m_name));
strcpy(m_name, name);
m_head = m_tail = 0; m_head = m_tail = 0;
m_read_sem = CreateSemaphore(NULL, // default security attributes m_read_sem = CreateSemaphore(NULL, // default security attributes
0, // initial count 0, // initial count
@ -73,9 +49,7 @@ int c_fifo::write(void* buf, int len)
if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head) if ((m_tail + 1) % FIFO_BUFFER_LEN == m_head)
{//full, clear data has been written; {//full, clear data has been written;
m_tail = tail; m_tail = tail;
log_out("Warning: "); log_out("Warning: fifo full\n");
log_out(m_name);
log_out(" full\n");
ReleaseMutex(m_write_mutex); ReleaseMutex(m_write_mutex);
return 0; return 0;
} }
@ -95,58 +69,3 @@ int c_fifo::write(void* buf, int len)
} }
return i; return i;
} }
////////////////////////////////////
// HID //
////////////////////////////////////
c_hid_pipe::c_hid_pipe(void* id)
{
for(int i = 0; i < MAX_HID_PIPES; i++)
{
if(!ms_pipes[i])
{
ms_pipes[i] = this;
break;
}
}
}
int c_hid_pipe::read_hid_msg()
{
int ret = -1;
for(int i = 0; i < MAX_HID_PIPES; i++)
{
if(ms_pipes[i])
{
ms_pipes[i]->m_msg.dwMsgId = XXX;
}
}
MSG_INFO msg;
ret = s_hid_fifo.read(&msg, sizeof(MSG_INFO));
if(0 >= ret)
{
return ret;
}
int display_id = ((msg.dwMsgId & 0xff00000) >> 24);
msg.dwMsgId &= 0x00ffffff;//recover message.
if (!ms_pipes[display_id])
{
return -2;
}
ms_pipes[display_id]->m_msg = msg;
return ret;
}
int c_hid_pipe::write_hid_msg(MSG_INFO* msg, unsigned int display_id)
{
if(MAX_DISPLAY <= display_id)
{
ASSERT(FALSE);
return -1;
}
msg->dwMsgId |= ((display_id) << 24);//merge display ID in message.
return s_hid_fifo.write(msg, sizeof(MSG_INFO));
}

View File

@ -8,8 +8,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
c_display* c_display::ms_displays[MAX_DISPLAY];
c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int display_height, c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int display_height,
unsigned int surface_width, unsigned int surface_height, unsigned int surface_width, unsigned int surface_height,
unsigned int color_bytes, unsigned int surface_cnt) unsigned int color_bytes, unsigned int surface_cnt)
@ -24,15 +22,6 @@ c_display::c_display(void* phy_fb, unsigned int display_width, unsigned int disp
m_height = display_height; m_height = display_height;
m_color_bytes = color_bytes; m_color_bytes = color_bytes;
m_phy_fb = phy_fb; m_phy_fb = phy_fb;
m_hid_pipe = new c_hid_pipe(NULL);
for (int i = 0; i < MAX_DISPLAY; i++)
{
if (!ms_displays[i])
{
ms_displays[i] = this;
break;
}
}
m_surface_cnt = surface_cnt; m_surface_cnt = surface_cnt;
if (m_surface_cnt > SURFACE_CNT_MAX) if (m_surface_cnt > SURFACE_CNT_MAX)
@ -118,54 +107,35 @@ int c_display::merge_surface(c_surface* s0, c_surface* s1, int x0, int x1, int y
return 0; return 0;
} }
void* c_display::get_frame_buffer(unsigned int display_id, int* width, int* height) void* c_display::get_frame_buffer(int* width, int* height)
{ {
if (MAX_DISPLAY <= display_id) if (width && height)
{ {
ASSERT(FALSE); *width = get_width();
return NULL; *height = get_height();
} }
if (ms_displays[display_id]) return m_phy_fb;
{
if (width && height)
{
*width = ms_displays[display_id]->get_width();
*height = ms_displays[display_id]->get_height();
}
return ms_displays[display_id]->m_phy_fb;
}
return NULL;
} }
int c_display::snap_shot(unsigned int display_id) int c_display::snap_shot(const char* file_name)
{ {
if (MAX_DISPLAY <= display_id) if (!m_phy_fb)
{ {
ASSERT(FALSE);
return -1; return -1;
} }
if (!ms_displays[display_id] || !ms_displays[display_id]->m_phy_fb) unsigned int width = get_width();
{ unsigned int height = get_height();
return -2;
}
char path[32];
memset(path, 0, sizeof(path));
sprintf(path, "snapshot_%d.bmp", display_id);
unsigned int width = ms_displays[display_id]->get_width();
unsigned int height = ms_displays[display_id]->get_height();
//16 bits framebuffer //16 bits framebuffer
if (ms_displays[display_id]->m_color_bytes == 2) if (m_color_bytes == 2)
{ {
return build_bmp(path, width, height, (unsigned char*)ms_displays[display_id]->m_phy_fb); return build_bmp(file_name, width, height, (unsigned char*)m_phy_fb);
} }
//32 bits framebuffer //32 bits framebuffer
unsigned short* p_bmp565_data = new unsigned short[width * height]; unsigned short* p_bmp565_data = new unsigned short[width * height];
unsigned int* p_raw_data = (unsigned int*)ms_displays[display_id]->m_phy_fb; unsigned int* p_raw_data = (unsigned int*)m_phy_fb;
for (int i = 0; i < width * height; i++) for (int i = 0; i < width * height; i++)
{ {
@ -173,7 +143,7 @@ int c_display::snap_shot(unsigned int display_id)
p_bmp565_data[i] = GL_RGB_32_to_16(rgb); p_bmp565_data[i] = GL_RGB_32_to_16(rgb);
} }
int ret = build_bmp(path, width, height, (unsigned char*)p_bmp565_data); int ret = build_bmp(file_name, width, height, (unsigned char*)p_bmp565_data);
delete []p_bmp565_data; delete []p_bmp565_data;
return ret; return ret;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 21 KiB

BIN
doc/HelloFont.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 KiB

View File

@ -6,11 +6,10 @@ typedef enum{
TOUCH_IDLE TOUCH_IDLE
}ACTION; }ACTION;
class c_hid_pipe;
class c_slide_group; class c_slide_group;
class c_gesture{ class c_gesture{
public: public:
c_gesture(c_wnd* root, c_slide_group* group, c_hid_pipe* hid_pipe); c_gesture(c_wnd* root, c_slide_group* group, c_fifo* hid_fifo);
void set_page_group(c_slide_group* group){m_slide_group = group;} void set_page_group(c_slide_group* group){m_slide_group = group;}
protected: protected:
bool handle_flip(MSG_INFO &msg); bool handle_flip(MSG_INFO &msg);
@ -31,10 +30,9 @@ private:
c_slide_group* m_slide_group; c_slide_group* m_slide_group;
c_wnd* m_root; c_wnd* m_root;
c_hid_pipe* m_hid_pipe; c_fifo* m_hid_fifo;
static c_gesture* ms_gesture[MAX_DISPLAY]; static void* task_handle_msg(void* param);
static void* task(void* param);
}; };
#endif #endif

View File

@ -14,14 +14,13 @@ typedef struct struct_bitmap_info BITMAP_INFO;
enum FONT_TYPE enum FONT_TYPE
{ {
FONT_NULL, FONT_NULL,
FONT_ENG_S, FONT_DEFAULT,
FONT_ENG_SB, FONT_CUSTOM1,
FONT_ENG_SBM, FONT_CUSTOM2,
FONT_ENG_SMB, FONT_CUSTOM3,
FONT_ENG_MB, FONT_CUSTOM4,
FONT_ENG_LLB, FONT_CUSTOM5,
FONT_ENG_LLLB, FONT_CUSTOM6,
FONT_MAX FONT_MAX
}; };
@ -52,6 +51,9 @@ enum SHAPE_TYPE
KEY_BUTTON_NORMAL, KEY_BUTTON_NORMAL,
KEY_BUTTON_PUSH, KEY_BUTTON_PUSH,
SHAPE_CUSTOM1,
SHAPE_CUSTOM2,
SHAPE_CUSTOM3,
SHAPE_MAX SHAPE_MAX
}; };

View File

@ -12,7 +12,7 @@
void c_button::pre_create_wnd() void c_button::pre_create_wnd()
{ {
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER; m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_type = c_my_resource::get_font(FONT_DEFAULT);
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);
} }

View File

@ -43,7 +43,7 @@ void c_dialog::on_paint()
if (m_str) if (m_str)
{ {
c_word::draw_string(m_surface, m_z_order, m_str, rect.m_left+35, rect.m_top, c_my_resource::get_font(FONT_ENG_MB), GL_RGB(255, 255, 255), GL_ARGB(0, 0, 0, 0), ALIGN_LEFT); c_word::draw_string(m_surface, m_z_order, m_str, rect.m_left+35, rect.m_top, c_my_resource::get_font(FONT_DEFAULT), GL_RGB(255, 255, 255), GL_ARGB(0, 0, 0, 0), ALIGN_LEFT);
} }
} }

View File

@ -25,7 +25,7 @@ static c_keyboard s_keyboard;
void c_edit::pre_create_wnd() void c_edit::pre_create_wnd()
{ {
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER | KEY_BOARD_STYLE; m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER | KEY_BOARD_STYLE;
m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_type = c_my_resource::get_font(FONT_DEFAULT);
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);

View File

@ -5,7 +5,6 @@
#include "core_include/display.h" #include "core_include/display.h"
#include "core_include/cmd_target.h" #include "core_include/cmd_target.h"
#include "core_include/wnd.h" #include "core_include/wnd.h"
#include "../gui_include/dialog.h"
#include "../gui_include/gesture.h" #include "../gui_include/gesture.h"
#include "../gui_include/slide_group.h" #include "../gui_include/slide_group.h"
#include <stdlib.h> #include <stdlib.h>
@ -14,61 +13,31 @@
#define FLIP_STEP 10//for PC & ANDROID #define FLIP_STEP 10//for PC & ANDROID
#define MOVE_THRESHOLD 10 #define MOVE_THRESHOLD 10
c_gesture* c_gesture::ms_gesture[MAX_DISPLAY]; void* c_gesture::task_handle_msg(void* param)
void* c_gesture::task(void* param)
{ {
c_gesture* This = (c_gesture*)param;
MSG_INFO msg; MSG_INFO msg;
while(1) while(1)
{ {
if(c_hid_pipe::read_hid_msg() < 0) This->m_hid_fifo->read(&msg, sizeof(msg));
if(This->handle_flip(msg))
{ {
continue; This->handle_hid_msg(msg);
}
for(int i = 0; i < MAX_DISPLAY; i++)
{
if(!ms_gesture[i])
{
continue;
}
msg = ms_gesture[i]->m_hid_pipe->m_msg;
if(XXX == msg.dwMsgId)
{
continue;
}
if(ms_gesture[i]->handle_flip(msg))
{
ms_gesture[i]->handle_hid_msg(msg);
}
} }
} }
return 0; return 0;
} }
static unsigned long s_pid; c_gesture::c_gesture(c_wnd* root, c_slide_group* group, c_fifo* hid_fifo)
c_gesture::c_gesture(c_wnd* root, c_slide_group* group, c_hid_pipe* hid_pipe)
{ {
m_root = root; m_root = root;
m_slide_group = group; m_slide_group = group;
m_hid_pipe = hid_pipe; m_hid_fifo = hid_fifo;
m_action = TOUCH_IDLE; m_action = TOUCH_IDLE;
m_down_x = m_down_y = m_move_x = m_move_y = 0; m_down_x = m_down_y = m_move_x = m_move_y = 0;
for(int i = 0; i < MAX_DISPLAY; i++) unsigned long pid;
{ create_thread(&pid, NULL, task_handle_msg, this);
if(!ms_gesture[i])
{
ms_gesture[i] = this;
break;
}
}
if(!s_pid)
{
create_thread(&s_pid, NULL, task, NULL);
}
} }
bool c_gesture::handle_flip(MSG_INFO &msg) bool c_gesture::handle_flip(MSG_INFO &msg)

View File

@ -14,7 +14,7 @@ void c_label::pre_create_wnd()
m_style = GL_ATTR_VISIBLE | ALIGN_LEFT | ALIGN_VCENTER; m_style = GL_ATTR_VISIBLE | ALIGN_LEFT | ALIGN_VCENTER;
m_font_color = GL_RGB(255,255,255); m_font_color = GL_RGB(255,255,255);
m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_type = c_my_resource::get_font(FONT_DEFAULT);
m_bg_color = get_parent()->get_bg_color(); m_bg_color = get_parent()->get_bg_color();
} }

View File

@ -26,7 +26,7 @@ void c_list_box::on_init_children()
{ {
m_item_total = 0; m_item_total = 0;
m_selected_item = 0; m_selected_item = 0;
m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_type = c_my_resource::get_font(FONT_DEFAULT);
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);
} }

View File

@ -21,7 +21,7 @@ GL_END_MESSAGE_MAP()
void c_spin_box::pre_create_wnd() void c_spin_box::pre_create_wnd()
{ {
m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER; m_style = GL_ATTR_VISIBLE | GL_ATTR_FOCUS | ALIGN_HCENTER | ALIGN_VCENTER;
m_font_type = c_my_resource::get_font(FONT_ENG_SMB); m_font_type = c_my_resource::get_font(FONT_DEFAULT);
m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND); m_bg_color = c_my_resource::get_color(CTRL_BACK_GROUND);
m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND); m_font_color = c_my_resource::get_color(CTRL_FORE_GROUND);

View File

@ -1,11 +1,19 @@
echo off echo off
set argC=0
for %%x in (%*) do Set /A argC+=1
if NOT "1" == "%argC%" (
echo "Invalidate arguments"
goto :eof
)
set url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%%2FzSee4vCUBcyjR65I9zZ6nb%%2B%%2F7bbzex%%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%%2Fxbxj%%2FrSBkX7eQ%%3D%%3D" set url="https://api.powerbi.com/beta/72f988bf-86f1-41af-91ab-2d7cd011db47/datasets/2ff1e8a8-2f6f-4d73-a75d-86829e3f4574/rows?key=8f5xLp1gP8%%2FzSee4vCUBcyjR65I9zZ6nb%%2B%%2F7bbzex%%2FSctLX3ntIlAR0sxWpDdguuYyDtLdHK%%2Fxbxj%%2FrSBkX7eQ%%3D%%3D"
for /f "tokens=2-4 delims=/ " %%a in ("%date%") do (set MM=%%a& set DD=%%b& set YYYY=%%c) for /f "tokens=2-4 delims=/ " %%a in ("%date%") do (set MM=%%a& set DD=%%b& set YYYY=%%c)
set YY=%YYYY:~0,2% set YY=%YYYY:~0,2%
if not "%YY%" == "20" (rem For Chinese date format if not "%YY%" == "20" (rem For Chinese date format
for /f "tokens=1-3 delims=/ " %%a in ("%date%") do (set YYYY=%%a& set MM=%%b& set DD=%%c)) for /f "tokens=1-3 delims=/ " %%a in ("%date%") do (set YYYY=%%a& set MM=%%b& set DD=%%c))
set datetime=%YYYY%-%MM%-%DD%T%time: =0%0+0800
set datetime=%YYYY%-%MM%-%DD%T%time: =0%0+0800
set devie_info=Win-%USERNAME% set devie_info=Win-%USERNAME%
set raw_data=[{^ set raw_data=[{^
\"device_info\" :\"%devie_info%\",^ \"device_info\" :\"%devie_info%\",^