mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 10:19:47 +08:00
feat: 引入 Lua 配置系统实现 UI 参数热更新
- 添加 Lua 5.5 库支持,包含头文件和动态链接库 - 新增 lua_config 模块,提供配置初始化、获取字符串/整型值等功能 - 创建 config.lua 配置文件,集中管理所有 UI 文本、尺寸和布局参数 - 移除原有的硬编码 config.h,将 UI 常量迁移至 Lua 配置 - 修改主窗口、对话框和回调函数,动态读取 Lua 配置值 - 更新 CMakeLists.txt,添加 Lua 库依赖和 DLL 复制步骤 - 删除过时的 Makefile,统一使用 CMake 构建
This commit is contained in:
+8
-2
@@ -4,11 +4,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "core/app_context.h"
|
||||
#include "core/lua_config.h"
|
||||
#include "utils/string_ext.h"
|
||||
#include "utils/os_env.h"
|
||||
#include "controller/callbacks.h"
|
||||
#include "ui/main_window.h"
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
!编译命令:
|
||||
@@ -39,6 +39,11 @@ int main(int argc, char **argv)
|
||||
IupOpen(&argc, &argv);
|
||||
IupSetGlobal("UTF8MODE", "YES");
|
||||
|
||||
if (lua_config_init() != 0)
|
||||
{
|
||||
IupMessage("警告", "Lua 配置系统初始化失败,将使用默认值");
|
||||
}
|
||||
|
||||
// 在管理员模式下,解决无法拖拽文件到列表框的问题 (UIPI)
|
||||
// 需要加载 User32.dll 获取 ChangeWindowMessageFilter 函数
|
||||
HMODULE hUser32 = LoadLibraryW(L"user32.dll");
|
||||
@@ -81,7 +86,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
Ihandle *lbl_status = IupGetDialogChild(dlg, "LBL_STATUS");
|
||||
if (lbl_status)
|
||||
IupSetAttribute(lbl_status, "TITLE", "状态: ⚠️ 只读模式 (无管理员权限)");
|
||||
IupSetAttribute(lbl_status, "TITLE", lua_config_get_string("status", "readonly"));
|
||||
|
||||
Ihandle *btn_new = IupGetDialogChild(dlg, "BTN_NEW");
|
||||
Ihandle *btn_edit = IupGetDialogChild(dlg, "BTN_EDIT");
|
||||
@@ -119,6 +124,7 @@ int main(int argc, char **argv)
|
||||
IupMainLoop();
|
||||
|
||||
destroy_app_context(ctx);
|
||||
lua_config_destroy();
|
||||
IupClose();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user