取消代码中utf8的编码转换

This commit is contained in:
2025-07-05 19:05:35 +08:00
parent 12afd677b6
commit 8c12c1ffc3
8 changed files with 215 additions and 239 deletions

View File

@@ -14,6 +14,7 @@
#include "nrf.h"
#include "mywin_user_debug.h"
#include "string.h"
#include "char_encode.h"
// 文件管理器

View File

@@ -1,22 +1,17 @@
#ifndef MYWIN_USER_FILDER_H__
#define MYWIN_USER_FILDER_H__
// 定义列表中最大显示文件数
#define FILDER_FILE_MAXNUM 1000
// 定义最大路径深度
#define FILDER_DIR_DEPTH 10
// 定义文件类型
#define FILDER_FILE_TYPE 1
#define FILDER_DIR_TYPE 0
//定义列表中最大显示文件数
#define FILDER_FILE_MAXNUM 1000
//定义最大路径深度
#define FILDER_DIR_DEPTH 10
//定义文件类型
#define FILDER_FILE_TYPE 1
#define FILDER_DIR_TYPE 0
//路径栈
// 路径栈
typedef struct
{
int index[FILDER_DIR_DEPTH];
@@ -24,18 +19,12 @@ typedef struct
int fileNum;
} Filder_Path;
typedef struct
{
char name[256];
int type; //1,文件0文件夹
int type; // 1,文件0文件夹
uint64_t size;
}Filder_FildInfo;
} Filder_FildInfo;
typedef struct
{
@@ -44,79 +33,69 @@ typedef struct
char *imgFile;
char *imgDir;
char dirName[256];
char fileName[256];//文件路径
char fileName[256]; // 文件路径
Filder_Path path;
int index;
int fileNum; //条目数
int dirNum; //文件夹数目
int fileNum; // 条目数
int dirNum; // 文件夹数目
int titleHight;
int itemHight;
int itemIndent;
int scrollbar_xsize;//滚动条宽度
int itemNumOnePage; //每页显示条目数
int firstItemOnPage;//显示在页首的条目编号
int scroll_x; //滚动显示的x坐标
int scroll_xsize; //混动显示的x长度
int scroll_timer; //滚动显示使用的定时器
int y_off; //支持触屏
}WIN_FilderStruct;
int scrollbar_xsize; // 滚动条宽度
int itemNumOnePage; // 每页显示条目数
int firstItemOnPage; // 显示在页首的条目编号
int scroll_x; // 滚动显示的x坐标
int scroll_xsize; // 混动显示的x长度
int scroll_timer; // 滚动显示使用的定时器
int y_off; // 支持触屏
} WIN_FilderStruct;
WIN_FilderStruct *WIN_CreatFilder (WIN_WindowStruct *base,
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
int x,int y,int x_size,int y_size);
WIN_FilderStruct *WIN_CreatFilder(WIN_WindowStruct *base,
void (*msgLoop)(struct _WIN_WindowStruct *win, WIN_MsgStruct *msg),
int x, int y, int x_size, int y_size);
// 设置文件路径,同时扫描路径下的文件
void FILDER_SetFileDir(WIN_FilderStruct *filder, char *dir);
// 入栈
int FILDER_PathPush(WIN_FilderStruct *filder);
//设置文件路径,同时扫描路径下的文件
void FILDER_SetFileDir (WIN_FilderStruct *filder,char *dir);
// 出栈
int FILDER_PathPull(WIN_FilderStruct *filder);
//入栈
int FILDER_PathPush (WIN_FilderStruct *filder);
//出栈
int FILDER_PathPull (WIN_FilderStruct *filder);
//把文件名追加到目录,同时扫描路径下的文件
int FILDER_DirAppend (WIN_FilderStruct *filder,Filder_FildInfo *file);
//剪短一层目录,同时扫描目录下的文件
int FILDER_DirCut (WIN_FilderStruct *filder);
//生成文件路径
void FILDER_GetFileRoute (WIN_FilderStruct *filder);
//清空条目
void FILDER_ClearItem (WIN_FilderStruct *filder);
//添加一个文件条目
void FILDER_AddItem (WIN_FilderStruct *filder,Filder_FildInfo *file);
// 把文件名追加到目录,同时扫描路径下的文件
int FILDER_DirAppend(WIN_FilderStruct *filder, Filder_FildInfo *file);
//在指定位置插入一个条目
void FILDER_InsertItem (WIN_FilderStruct *filder,Filder_FildInfo *file,int index);
//扫描文件
void FILDER_ScanFile (WIN_FilderStruct *filder);
// 剪短一层目录,同时扫描目录下的文件
int FILDER_DirCut(WIN_FilderStruct *filder);
//打开文件
void FILDER_OpenFile (WIN_FilderStruct *filder);
// 生成文件路径
void FILDER_GetFileRoute(WIN_FilderStruct *filder);
//消息框的绘制函数
void FILDER_DefaultPaint (WIN_FilderStruct *filder);
// 清空条目
void FILDER_ClearItem(WIN_FilderStruct *filder);
//消息框的消息处理函数
void FILDER_defaultMsgLoop (WIN_FilderStruct *filder,WIN_MsgStruct *msg);
// 添加一个文件条目
void FILDER_AddItem(WIN_FilderStruct *filder, Filder_FildInfo *file);
//选则文件
int FILDER_ChooseFile (WIN_WindowStruct *win,char *dir);
// 在指定位置插入一个条目
void FILDER_InsertItem(WIN_FilderStruct *filder, Filder_FildInfo *file, int index);
// 扫描文件
void FILDER_ScanFile(WIN_FilderStruct *filder);
// 打开文件
void FILDER_OpenFile(WIN_FilderStruct *filder);
// 消息框的绘制函数
void FILDER_DefaultPaint(WIN_FilderStruct *filder);
// 消息框的消息处理函数
void FILDER_defaultMsgLoop(WIN_FilderStruct *filder, WIN_MsgStruct *msg);
// 选则文件
int FILDER_ChooseFile(WIN_WindowStruct *win, char *dir);
#endif

View File

@@ -35,21 +35,21 @@ const static MENU_ItemStruct ptr[]={
//进入设置页面
WIN_MenuStruct *MENU_Setting (WIN_WindowStruct *base,WIN_PicStruct *pic)
WIN_MenuStruct *MENU_Setting (WIN_WindowStruct *base,WIN_PicStruct *pic)
{
WIN_MenuStruct *menu=WIN_CreatMenu (base,(void (*)(WIN_WindowStruct *,WIN_MsgStruct *))MENU_SettingMsgLoop,
WIN_MenuStruct *menu=WIN_CreatMenu (base,(void (*)(WIN_WindowStruct *,WIN_MsgStruct *))MENU_SettingMsgLoop,
0,0,base->x_size,base->y_size);
((WIN_WindowStruct *)menu)->intercept=1;//不发送按键消息到父窗口
WIN_SetBackPicPath ((WIN_WindowStruct *)menu,base->pic_path);
MENU_SetTitle (menu,0,"设置");
MENU_SetMaxItem(menu,9);
for (int i=0;i<9;i++)
{
MENU_AddItem (menu,ptr[i].img,(char *)ptr[i].txt);
}
WIN_ShowWindow((WIN_WindowStruct*)menu);
return menu;
}
@@ -70,10 +70,10 @@ static void MENU_DoEnter (WIN_MenuStruct *menu)
{
//选择了一个设置项
if (MENU_GetIndex(menu)==0) MENU_ThemeSet((WIN_WindowStruct *)menu);
else if (MENU_GetIndex(menu)==1) TIMEBOX_TimeSet ((WIN_WindowStruct *)menu);
else if (MENU_GetIndex(menu)==2) MENU_LightSet((WIN_WindowStruct *)menu);//BACKLIGHTSETBOX_BackLightSet ();
else if (MENU_GetIndex(menu)==1) TIMEBOX_TimeSet ((WIN_WindowStruct *)menu);
else if (MENU_GetIndex(menu)==2) MENU_LightSet((WIN_WindowStruct *)menu);//BACKLIGHTSETBOX_BackLightSet ();
else if (MENU_GetIndex(menu)==3) {MSGBOX_Inquiry ((WIN_WindowStruct *)menu,"重置","再按一次确定键重置","确定","返回");}
else if (MENU_GetIndex(menu)==4)
else if (MENU_GetIndex(menu)==4)
{
char *txt=mymalloc (512);
if (APP_SOURCE)
@@ -90,7 +90,7 @@ static void MENU_DoEnter (WIN_MenuStruct *menu)
MSGBOX_TipsTime ((WIN_WindowStruct*)menu,"关于", txt,"确定",5000);
myfree(txt);
}
else if (MENU_GetIndex(menu)==5) SYSFILE_ChooseFile((WIN_WindowStruct *)menu);
else if (MENU_GetIndex(menu)==5) SYSFILE_ChooseFile((WIN_WindowStruct *)menu);
else if (MENU_GetIndex(menu)==6) FILDER_ChooseFile ((WIN_WindowStruct *)menu,"0:");
else if(MENU_GetIndex(menu)==7) enter_sound((WIN_WindowStruct *)menu);
else if(MENU_GetIndex(menu)==8) DEBUG_EnterPrint();
@@ -109,7 +109,7 @@ void MENU_SettingMsgLoop (WIN_MenuStruct *menu,WIN_MsgStruct *msg)
WIN_TouchStruct *t=0;
WIN_KeyStruct *k=0;
switch (msg->msg)
{
{
case WIN_MSG_KEY:
k=msg->data.p;
if (k->shortPress&KEY_VALUE_ENTER)
@@ -191,7 +191,7 @@ static int cb_sound_fun(void *ptr)
{
DAC_FifolInit();
nrf_init();
nrf_set_no_respond(1);
nrf_set_no_respond(1);
g_work=1;
uint16_t value=0;
DAC_SetSetValuwFun(recv_value);

View File

@@ -53,12 +53,9 @@ static void MENU_ToolEnter(WIN_MenuStruct *menu)
{
// 选择了一个
char *path = mymalloc(256);
char *tmp = mymalloc(256);
utf82gbk_str(MENU_GetSelectItem(menu), tmp);
sprintf(path, "%s/%s", TOOL_APP_PATH, tmp);
sprintf(path, "%s/%s", TOOL_APP_PATH, MENU_GetSelectItem(menu));
app_run_path(path);
myfree(path);
myfree(tmp);
}
static void MENU_ToolDeleteFun(WIN_MenuStruct *menu)