工具界面转换字符编码
This commit is contained in:
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -7,7 +7,11 @@
|
|||||||
"stm32f4xx.h": "c",
|
"stm32f4xx.h": "c",
|
||||||
"libc.h": "c",
|
"libc.h": "c",
|
||||||
"*.txt": "c",
|
"*.txt": "c",
|
||||||
"*.tmp": "c"
|
"*.tmp": "c",
|
||||||
|
"mywin_inc.h": "c",
|
||||||
|
"mywin_user_status_bar.h": "c",
|
||||||
|
"elf.h": "c",
|
||||||
|
"string.h": "c"
|
||||||
},
|
},
|
||||||
"cortex-debug.variableUseNaturalFormat": false
|
"cortex-debug.variableUseNaturalFormat": false
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@@ -4,137 +4,127 @@
|
|||||||
#include "mywin_user_tool.h"
|
#include "mywin_user_tool.h"
|
||||||
#include "ff.h"
|
#include "ff.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
#include "char_encode.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
void MENU_ToolScanFile(WIN_MenuStruct *menu);
|
||||||
|
|
||||||
|
// 进入设置页面
|
||||||
|
WIN_MenuStruct *MENU_Tool(WIN_WindowStruct *base, WIN_PicStruct *pic)
|
||||||
|
|
||||||
void MENU_ToolScanFile (WIN_MenuStruct *menu);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//进入设置页面
|
|
||||||
WIN_MenuStruct *MENU_Tool (WIN_WindowStruct *base,WIN_PicStruct *pic)
|
|
||||||
{
|
{
|
||||||
WIN_MenuStruct *menu=WIN_CreatMenu (base,(void (*)(WIN_WindowStruct *,WIN_MsgStruct *))MENU_ToolMsgLoop,
|
WIN_MenuStruct *menu = WIN_CreatMenu(base, (void (*)(WIN_WindowStruct *, WIN_MsgStruct *))MENU_ToolMsgLoop,
|
||||||
0,0,base->x_size,base->y_size);
|
0, 0, base->x_size, base->y_size);
|
||||||
((WIN_WindowStruct *)menu)->intercept=1;//不发送按键消息到父窗口
|
((WIN_WindowStruct *)menu)->intercept = 1; // 不发送按键消息到父窗口
|
||||||
|
|
||||||
WIN_SetBackPicPath ((WIN_WindowStruct *)menu,base->pic_path);
|
WIN_SetBackPicPath((WIN_WindowStruct *)menu, base->pic_path);
|
||||||
MENU_SetTitle (menu,0,"工具");
|
MENU_SetTitle(menu, 0, "工具");
|
||||||
|
|
||||||
MENU_SetMaxItem(menu,TOOL_APP_MAXNUM);
|
MENU_SetMaxItem(menu, TOOL_APP_MAXNUM);
|
||||||
MENU_ToolScanFile(menu);
|
MENU_ToolScanFile(menu);
|
||||||
|
|
||||||
WIN_ShowWindow((WIN_WindowStruct*)menu);
|
WIN_ShowWindow((WIN_WindowStruct *)menu);
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MENU_ToolScanFile(WIN_MenuStruct *menu)
|
||||||
|
|
||||||
|
|
||||||
void MENU_ToolScanFile (WIN_MenuStruct *menu)
|
|
||||||
{
|
{
|
||||||
FRESULT ret=FR_OK;
|
FRESULT ret = FR_OK;
|
||||||
DIR dir={0};
|
DIR dir = {0};
|
||||||
FILINFO *file_info=0;
|
FILINFO *file_info = 0;
|
||||||
file_info=mymalloc (sizeof(FILINFO));
|
char *tmp = mymalloc(256);
|
||||||
ret=f_findfirst(&dir,file_info,TOOL_APP_PATH,"*.axf");
|
file_info = mymalloc(sizeof(FILINFO));
|
||||||
while ((ret==FR_OK)&&(file_info->fname[0]!=0))
|
ret = f_findfirst(&dir, file_info, TOOL_APP_PATH, "*.axf");
|
||||||
|
while ((ret == FR_OK) && (file_info->fname[0] != 0))
|
||||||
{
|
{
|
||||||
if (AM_DIR&file_info->fattrib) continue;
|
if (AM_DIR & file_info->fattrib)
|
||||||
if(MENU_GetAllItemNum(menu)<TOOL_APP_MAXNUM)
|
continue;
|
||||||
MENU_AddItem (menu,0,file_info->fname);
|
gbk2utf8_str(file_info->fname, tmp);
|
||||||
else break;
|
if (MENU_GetAllItemNum(menu) < TOOL_APP_MAXNUM)
|
||||||
ret=f_findnext(&dir,file_info);
|
MENU_AddItem(menu, 0, tmp);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
ret = f_findnext(&dir, file_info);
|
||||||
}
|
}
|
||||||
myfree(file_info);
|
myfree(file_info);
|
||||||
|
myfree(tmp);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void MENU_ToolEnter(WIN_MenuStruct *menu)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void MENU_ToolEnter (WIN_MenuStruct *menu)
|
|
||||||
{
|
{
|
||||||
//选择了一个
|
// 选择了一个
|
||||||
char *path=mymalloc(256);
|
char *path = mymalloc(256);
|
||||||
sprintf(path,"%s/%s",TOOL_APP_PATH,MENU_GetSelectItem(menu));
|
char *tmp = mymalloc(256);
|
||||||
|
utf82gbk_str(MENU_GetSelectItem(menu), tmp);
|
||||||
|
sprintf(path, "%s/%s", TOOL_APP_PATH, tmp);
|
||||||
app_run_path(path);
|
app_run_path(path);
|
||||||
myfree(path);
|
myfree(path);
|
||||||
|
myfree(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void MENU_ToolDeleteFun(WIN_MenuStruct *menu)
|
static void MENU_ToolDeleteFun(WIN_MenuStruct *menu)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 消息处理函数
|
||||||
|
void MENU_ToolMsgLoop(WIN_MenuStruct *menu, WIN_MsgStruct *msg)
|
||||||
//消息处理函数
|
|
||||||
void MENU_ToolMsgLoop (WIN_MenuStruct *menu,WIN_MsgStruct *msg)
|
|
||||||
{
|
{
|
||||||
WIN_MoveStruct *m=0;
|
WIN_MoveStruct *m = 0;
|
||||||
WIN_TouchStruct *t=0;
|
WIN_TouchStruct *t = 0;
|
||||||
WIN_KeyStruct *k=0;
|
WIN_KeyStruct *k = 0;
|
||||||
switch (msg->msg)
|
switch (msg->msg)
|
||||||
{
|
{
|
||||||
case WIN_MSG_KEY:
|
case WIN_MSG_KEY:
|
||||||
k=msg->data.p;
|
k = msg->data.p;
|
||||||
if (k->shortPress&KEY_VALUE_ENTER)
|
if (k->shortPress & KEY_VALUE_ENTER)
|
||||||
|
{
|
||||||
|
MENU_ToolEnter(menu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MENU_DefaultMsgLoop(menu, msg);
|
||||||
|
}
|
||||||
|
break; // case WIN_MSG_KEY:
|
||||||
|
case WIN_MSG_MOVE:
|
||||||
|
m = msg->data.p;
|
||||||
|
switch (m->moveType)
|
||||||
|
{
|
||||||
|
case MOVE_DATA_SHORT:
|
||||||
|
// if (m->y_move>((WIN_WindowStruct *)menu)->y_size/2-20&&m->y_move<((WIN_WindowStruct *)menu)->y_size/2+20)
|
||||||
|
// {
|
||||||
|
// MENU_ToolEnter(menu);
|
||||||
|
// }
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MENU_DefaultMsgLoop(menu, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WIN_MSG_CHID:
|
||||||
|
switch (msg->data.v)
|
||||||
|
{
|
||||||
|
case CHID_DELETE:
|
||||||
|
break;
|
||||||
|
case CHID_USER:
|
||||||
|
{
|
||||||
|
if (msg->srcWin == menu->bar)
|
||||||
{
|
{
|
||||||
MENU_ToolEnter(menu);
|
if (msg->data2.v == SCROLLBAR_PRESSED)
|
||||||
|
{
|
||||||
|
MENU_ToolEnter(menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MENU_DefaultMsgLoop (menu,msg);
|
MENU_DefaultMsgLoop(menu, msg);
|
||||||
}
|
}
|
||||||
break;//case WIN_MSG_KEY:
|
}
|
||||||
case WIN_MSG_MOVE:
|
break;
|
||||||
m=msg->data.p;
|
|
||||||
switch (m->moveType)
|
|
||||||
{
|
|
||||||
case MOVE_DATA_SHORT:
|
|
||||||
// if (m->y_move>((WIN_WindowStruct *)menu)->y_size/2-20&&m->y_move<((WIN_WindowStruct *)menu)->y_size/2+20)
|
|
||||||
// {
|
|
||||||
// MENU_ToolEnter(menu);
|
|
||||||
// }
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
MENU_DefaultMsgLoop (menu,msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WIN_MSG_CHID:
|
|
||||||
switch (msg->data.v)
|
|
||||||
{
|
|
||||||
case CHID_DELETE:
|
|
||||||
break;
|
|
||||||
case CHID_USER:
|
|
||||||
{
|
|
||||||
if (msg->srcWin==menu->bar)
|
|
||||||
{
|
|
||||||
if (msg->data2.v==SCROLLBAR_PRESSED)
|
|
||||||
{
|
|
||||||
MENU_ToolEnter(menu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MENU_DefaultMsgLoop (menu,msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
MENU_DefaultMsgLoop (menu,msg);
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MENU_DefaultMsgLoop(menu, msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user