整理代码
1.解决一些编译警告 2.整理一些文件格式
This commit is contained in:
@@ -1,249 +1,193 @@
|
||||
#include "mywin_inc.h"
|
||||
#include "mywin_user_debug.h"
|
||||
#include "date.h"
|
||||
#include "math.h"
|
||||
#include "tools.h"
|
||||
#include "system_file.h"
|
||||
#include "mywin_user_filder.h"
|
||||
#include "mywin_user_animation.h"
|
||||
#include "tools.h"
|
||||
#include "mylua.h"
|
||||
|
||||
#include "mywin_inc.h"
|
||||
#include "mywin_user_animation.h"
|
||||
#include "mywin_user_filder.h"
|
||||
#include "system_file.h"
|
||||
#include "tools.h"
|
||||
|
||||
#define MODULE(s) DEBUG_##s
|
||||
|
||||
|
||||
|
||||
void MODULE(Delete)(WIN_DebugStruct *lock);
|
||||
WIN_DebugStruct *WIN_CreatDebug (WIN_WindowStruct *base,
|
||||
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
|
||||
int x,int y,int x_size,int y_size)
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣѭ<CFA2><D1AD>
|
||||
if (msgLoop==0)
|
||||
{
|
||||
msgLoop=(void (*)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg))MODULE(DefaultMsgLoop);
|
||||
}
|
||||
|
||||
WIN_DebugStruct *ret=mymalloc (sizeof ( WIN_DebugStruct));
|
||||
//<2F><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>캯<EFBFBD><ECBAAF>
|
||||
if (ret)
|
||||
{
|
||||
mymemset (ret,0,sizeof ( WIN_DebugStruct));
|
||||
if (0==WIN_CreatTouchEx((WIN_TouchWinStruct *)ret,base,msgLoop,x,y,x_size,y_size))
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
myfree (ret);
|
||||
ret=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
((WIN_WindowStruct *)ret)->winType="WIN_DebugStruct";
|
||||
((WIN_WindowStruct *)ret)->deleteWindow=(void (*)(struct _WIN_WindowStruct *win))MODULE(Delete);
|
||||
WIN_DebugStruct *WIN_CreatDebug(WIN_WindowStruct *base,
|
||||
void (*msgLoop)(struct _WIN_WindowStruct *win,
|
||||
WIN_MsgStruct *msg),
|
||||
int x, int y, int x_size, int y_size) {
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣѭ<EFBFBD><EFBFBD>
|
||||
if (msgLoop == 0) {
|
||||
msgLoop = (void (*)(struct _WIN_WindowStruct *win,
|
||||
WIN_MsgStruct *msg))MODULE(DefaultMsgLoop);
|
||||
}
|
||||
|
||||
WIN_DebugStruct *ret = mymalloc(sizeof(WIN_DebugStruct));
|
||||
// <EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
||||
if (ret) {
|
||||
mymemset(ret, 0, sizeof(WIN_DebugStruct));
|
||||
if (0 == WIN_CreatTouchEx((WIN_TouchWinStruct *)ret, base, msgLoop, x, y,
|
||||
x_size, y_size)) {
|
||||
// <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
myfree(ret);
|
||||
ret = 0;
|
||||
} else {
|
||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
((WIN_WindowStruct *)ret)->winType = "WIN_DebugStruct";
|
||||
((WIN_WindowStruct *)ret)->deleteWindow =
|
||||
(void (*)(struct _WIN_WindowStruct *win))MODULE(Delete);
|
||||
//((WIN_WindowStruct *)ret)->intercept=1;//<2F><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
((WIN_WindowStruct *)ret)->bkcolor=0x008080;
|
||||
((WIN_WindowStruct *)ret)->color=0xd7c1ac;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ret->time_id1=WIN_CreatTimer ((WIN_WindowStruct *)ret,50);
|
||||
freopen("lcd","r+",stdout);
|
||||
return ret;
|
||||
((WIN_WindowStruct *)ret)->bkcolor = 0x008080;
|
||||
((WIN_WindowStruct *)ret)->color = 0xd7c1ac;
|
||||
}
|
||||
}
|
||||
|
||||
ret->time_id1 = WIN_CreatTimer((WIN_WindowStruct *)ret, 50);
|
||||
freopen("lcd", "r+", stdout);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MODULE(Delete)(WIN_DebugStruct *lock) {
|
||||
|
||||
freopen("usart", "r+", stdout);
|
||||
|
||||
void MODULE(Delete)(WIN_DebugStruct *lock)
|
||||
{
|
||||
|
||||
freopen("usart","r+",stdout);
|
||||
|
||||
//<2F><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٺ<EFBFBD><D9BA><EFBFBD>
|
||||
WIN_DeleteWindow ( (WIN_WindowStruct *)lock);
|
||||
// <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٺ<EFBFBD><D9BA><EFBFBD>
|
||||
WIN_DeleteWindow((WIN_WindowStruct *)lock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int draw_char_at(int c,int x,int y)
|
||||
{
|
||||
char ch[3]={0};
|
||||
if(c>0x80)
|
||||
{ch[0]=c>>8;ch[1]=c;}
|
||||
else ch[0]=c;
|
||||
WIN_DrawTxtAt(ch,x,y);
|
||||
static int draw_char_at(int c, int x, int y) {
|
||||
char ch[3] = {0};
|
||||
if (c > 0x80) {
|
||||
ch[0] = c >> 8;
|
||||
ch[1] = c;
|
||||
} else
|
||||
ch[0] = c;
|
||||
WIN_DrawTxtAt(ch, x, y);
|
||||
return 8;
|
||||
}
|
||||
|
||||
// Ĭ<>ϻ<EFBFBD><CFBB>ƺ<EFBFBD><C6BA><EFBFBD>
|
||||
void MODULE(DefaultPaint)(WIN_DebugStruct *home) {
|
||||
|
||||
//Ĭ<>ϻ<EFBFBD><CFBB>ƺ<EFBFBD><C6BA><EFBFBD>
|
||||
void MODULE(DefaultPaint) (WIN_DebugStruct *home)
|
||||
{
|
||||
|
||||
int x=0;
|
||||
int y=0;
|
||||
int x_size=((WIN_WindowStruct *)home)->x_size;
|
||||
int y_size=((WIN_WindowStruct *)home)->y_size;
|
||||
|
||||
WIN_PaintBackGround ((WIN_WindowStruct *)home);
|
||||
u32 font_type=WIN_SetFontSize(16);
|
||||
u32 color_bk=((WIN_WindowStruct *)home)->bkcolor;
|
||||
u32 color=((WIN_WindowStruct *)home)->color;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int x_size = ((WIN_WindowStruct *)home)->x_size;
|
||||
int y_size = ((WIN_WindowStruct *)home)->y_size;
|
||||
|
||||
WIN_PaintBackGround((WIN_WindowStruct *)home);
|
||||
u32 font_type = WIN_SetFontSize(16);
|
||||
u32 color_bk = ((WIN_WindowStruct *)home)->bkcolor;
|
||||
u32 color = ((WIN_WindowStruct *)home)->color;
|
||||
WIN_SetLcdColor(color);
|
||||
|
||||
|
||||
tools_dbg_print(draw_char_at);
|
||||
|
||||
WIN_SetFontSize(font_type);
|
||||
|
||||
|
||||
WIN_SetFontSize(font_type);
|
||||
}
|
||||
|
||||
|
||||
void MODULE(Exit)(WIN_DebugStruct *op)
|
||||
{
|
||||
if(op->work==0)
|
||||
void MODULE(Exit)(WIN_DebugStruct *op) {
|
||||
if (op->work == 0)
|
||||
((WIN_WindowStruct *)op)->deleteWindow((WIN_WindowStruct *)op);
|
||||
else
|
||||
{
|
||||
MSGBOX_TipsTime((WIN_WindowStruct *)op,"<EFBFBD><EFBFBD>ʾ","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>","ȷ<EFBFBD><EFBFBD>",5000);
|
||||
else {
|
||||
MSGBOX_TipsTime((WIN_WindowStruct *)op, "<EFBFBD><EFBFBD>ʾ", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>",
|
||||
"ȷ<EFBFBD><EFBFBD>", 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Ĭ<><C4AC><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void MODULE(DefaultMsgLoop) (WIN_DebugStruct *home,WIN_MsgStruct *msg)
|
||||
{
|
||||
WIN_KeyStruct *k=0;
|
||||
WIN_MoveStruct *m;
|
||||
switch (msg->msg)
|
||||
{
|
||||
case WIN_MSG_PAINT:
|
||||
MODULE(DefaultPaint)(home);
|
||||
break;
|
||||
case WIN_MSG_INIT:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case WIN_MSG_TIMER:
|
||||
//<2F><>ʱ<EFBFBD><CAB1>ʱ<EFBFBD>䵽
|
||||
if (msg->data.v==home->time_id1)
|
||||
{
|
||||
if (WIN_GetExWorkFunStat(home->work))
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
||||
WIN_ExWorkFunClear (home->work);
|
||||
home->work=0;
|
||||
}
|
||||
WIN_SetInvalidWhenTop((WIN_WindowStruct *)home);
|
||||
}
|
||||
break;
|
||||
case WIN_MSG_CHID:
|
||||
break;
|
||||
case WIN_MSG_KEY:
|
||||
k=msg->data.p;
|
||||
if(k->shortPress&KEY_VALUE_DOWN)
|
||||
{
|
||||
}
|
||||
else if(k->shortPress&KEY_VALUE_UP)
|
||||
{
|
||||
}
|
||||
else if(k->shortPress&KEY_VALUE_ENTER)
|
||||
{
|
||||
}
|
||||
else if(k->shortPress&KEY_VALUE_HOME)
|
||||
{
|
||||
MODULE(Exit)(home);
|
||||
// Ĭ<><C4AC><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void MODULE(DefaultMsgLoop)(WIN_DebugStruct *home, WIN_MsgStruct *msg) {
|
||||
WIN_KeyStruct *k = 0;
|
||||
WIN_MoveStruct *m;
|
||||
switch (msg->msg) {
|
||||
case WIN_MSG_PAINT:
|
||||
MODULE(DefaultPaint)(home);
|
||||
break;
|
||||
case WIN_MSG_INIT: {
|
||||
} break;
|
||||
case WIN_MSG_TIMER:
|
||||
// <20><>ʱ<EFBFBD><CAB1>ʱ<EFBFBD>䵽
|
||||
if (msg->data.v == home->time_id1) {
|
||||
if (WIN_GetExWorkFunStat(home->work)) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
||||
WIN_ExWorkFunClear(home->work);
|
||||
home->work = 0;
|
||||
}
|
||||
WIN_SetInvalidWhenTop((WIN_WindowStruct *)home);
|
||||
}
|
||||
break;
|
||||
case WIN_MSG_CHID:
|
||||
break;
|
||||
case WIN_MSG_KEY:
|
||||
k = msg->data.p;
|
||||
if (k->shortPress & KEY_VALUE_DOWN) {
|
||||
} else if (k->shortPress & KEY_VALUE_UP) {
|
||||
} else if (k->shortPress & KEY_VALUE_ENTER) {
|
||||
} else if (k->shortPress & KEY_VALUE_HOME) {
|
||||
MODULE(Exit)(home);
|
||||
}
|
||||
WIN_SetInvalid((WIN_WindowStruct *)home);
|
||||
break; // case WIN_MSG_KEY:
|
||||
case WIN_MSG_MOVE:
|
||||
m = msg->data.p;
|
||||
switch (m->moveType) {
|
||||
case MOVE_DATA_SHORT:
|
||||
WIN_SetInvalid((WIN_WindowStruct *)home);
|
||||
break;//case WIN_MSG_KEY:
|
||||
case WIN_MSG_MOVE:
|
||||
m=msg->data.p;
|
||||
switch(m->moveType)
|
||||
{
|
||||
case MOVE_DATA_SHORT:
|
||||
WIN_SetInvalid((WIN_WindowStruct *)home);
|
||||
break;
|
||||
case MOVE_DATA_LONG:
|
||||
{
|
||||
MODULE(Exit)(home);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WIN_DefaultMsgLoop((WIN_WindowStruct *)home,msg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MOVE_DATA_LONG: {
|
||||
MODULE(Exit)(home);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WIN_DefaultMsgLoop((WIN_WindowStruct *)home, msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void DEBUG_EnterPrint(void)
|
||||
{
|
||||
WIN_DebugStruct *home=0;
|
||||
WIN_WindowStruct *win=0;
|
||||
if(win=WIN_GetWinByTitle(0,"debug"),win==0)
|
||||
{
|
||||
WIN_WindowStruct *base=0;
|
||||
if(base==0) base=WIN_GetBaseWindow();
|
||||
home=WIN_CreatDebug (base,0,0,0,base->x_size,base->y_size);
|
||||
WIN_SetWinTitle((WIN_WindowStruct*)home,"debug");
|
||||
|
||||
WIN_ShowWindow((WIN_WindowStruct*)home);
|
||||
}
|
||||
else
|
||||
{
|
||||
WIN_SetChidWinTop(win->baseWin,win);
|
||||
void DEBUG_EnterPrint(void) {
|
||||
WIN_DebugStruct *home = 0;
|
||||
WIN_WindowStruct *win = 0;
|
||||
if (win = WIN_GetWinByTitle(0, "debug"), win == 0) {
|
||||
WIN_WindowStruct *base = 0;
|
||||
if (base == 0)
|
||||
base = WIN_GetBaseWindow();
|
||||
home = WIN_CreatDebug(base, 0, 0, 0, base->x_size, base->y_size);
|
||||
WIN_SetWinTitle((WIN_WindowStruct *)home, "debug");
|
||||
|
||||
WIN_ShowWindow((WIN_WindowStruct *)home);
|
||||
} else {
|
||||
WIN_SetChidWinTop(win->baseWin, win);
|
||||
WIN_ShowWindow(win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int cb_run_lua(void *ptr)
|
||||
{
|
||||
char *argv[]={
|
||||
"lua",
|
||||
(char *)ptr,
|
||||
static int cb_run_lua(void *ptr) {
|
||||
char *argv[] = {
|
||||
"lua",
|
||||
(char *)ptr,
|
||||
};
|
||||
|
||||
|
||||
// lua_main(2,argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void DEBUG_EnterPrintCmd(char *cmd)
|
||||
{
|
||||
WIN_DebugStruct *w=0;
|
||||
|
||||
WIN_WindowStruct *base=0;
|
||||
if(base==0) base=WIN_GetBaseWindow();
|
||||
w=WIN_CreatDebug (base,0,0,0,base->x_size,base->y_size);
|
||||
|
||||
mymemcpy(w->cmd,cmd,strlen(cmd)+1);
|
||||
void DEBUG_EnterPrintCmd(char *cmd) {
|
||||
WIN_DebugStruct *w = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
w->work=WIN_CreatThreadPro (cb_run_lua,w->cmd,&w->ret,18);
|
||||
WIN_WindowStruct *base = 0;
|
||||
if (base == 0)
|
||||
base = WIN_GetBaseWindow();
|
||||
w = WIN_CreatDebug(base, 0, 0, 0, base->x_size, base->y_size);
|
||||
|
||||
WIN_ShowWindow((WIN_WindowStruct*)w);
|
||||
mymemcpy(w->cmd, cmd, strlen(cmd) + 1);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
w->work = WIN_CreatThreadPro(cb_run_lua, w->cmd, &w->ret, 18);
|
||||
|
||||
WIN_ShowWindow((WIN_WindowStruct *)w);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#undef MODULE
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user