mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 10:19:47 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a769a6b9b3 | |||
| 6509ef98e4 | |||
| c928c271e8 | |||
| 02e702b285 | |||
| af3138c146 | |||
| 6e6adf3b85 | |||
| e84b33c5ca | |||
| ac6b409f3a | |||
| 1bbe95582a | |||
| 3ecf35963d | |||
| 276d2c5fe3 | |||
| a9339f9b9f | |||
| 7fac2aab35 | |||
| 7db190306c | |||
| 575fcca5c4 | |||
| 39d06e20e0 | |||
| f21d302565 | |||
| adbbe099b9 | |||
| 05d4536c42 |
@@ -0,0 +1,80 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(PathEditor VERSION 3.0 LANGUAGES C)
|
||||
|
||||
# 启用资源编译器以处理 .rc 文件
|
||||
enable_language(RC)
|
||||
|
||||
# 设置 C 标准
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF) # 禁用特定编译器的扩展(如 gnu17),强制使用标准 C17
|
||||
|
||||
# 定义源文件
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
src/utils/string_ext.c
|
||||
src/utils/os_env.c
|
||||
src/ui/ui_utils.c
|
||||
src/ui/dialogs.c
|
||||
src/ui/main_window.c
|
||||
src/core/registry_service.c
|
||||
src/core/path_manager.c
|
||||
src/core/app_context.c
|
||||
src/controller/callbacks.c
|
||||
ico/resources.rc
|
||||
)
|
||||
|
||||
# 创建 GUI 可执行文件(WIN32 属性会自动添加 -mwindows 参数)
|
||||
add_executable(${PROJECT_NAME} WIN32 ${SOURCES})
|
||||
|
||||
# 添加宏定义
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
_WIN32
|
||||
UNICODE
|
||||
_UNICODE
|
||||
)
|
||||
|
||||
# 添加编译选项
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-Wall
|
||||
-O2
|
||||
-fexec-charset=UTF-8
|
||||
)
|
||||
endif()
|
||||
|
||||
# 设置头文件搜索路径
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/include/core
|
||||
${CMAKE_SOURCE_DIR}/include/ui
|
||||
${CMAKE_SOURCE_DIR}/include/controller
|
||||
${CMAKE_SOURCE_DIR}/include/utils
|
||||
${CMAKE_SOURCE_DIR}/libs/IUP/include
|
||||
)
|
||||
|
||||
# 设置库文件搜索路径
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/libs/IUP
|
||||
)
|
||||
|
||||
# 链接所需库
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
iup
|
||||
iupcd
|
||||
gdi32
|
||||
comdlg32
|
||||
comctl32
|
||||
uuid
|
||||
ole32
|
||||
advapi32
|
||||
)
|
||||
|
||||
# 编译完成后,仅将程序实际需要的核心 DLL 文件复制到构建输出目录
|
||||
set(IUP_REQUIRED_DLLS "${CMAKE_CURRENT_SOURCE_DIR}/libs/IUP/iup.dll")
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${IUP_REQUIRED_DLLS}
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying required DLLs to build directory..."
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2026 LHY
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -18,8 +18,9 @@ CFLAGS = -Wall -O2 -I$(INCLUDE_DIR) -I$(LOCAL_INCLUDE_DIR) -D_WIN32 -DUNICODE -D
|
||||
LDFLAGS = -L$(LIB_DIR) -liup -liupcd -lgdi32 -lcomdlg32 -lcomctl32 -luuid -lole32 -ladvapi32 -mwindows
|
||||
|
||||
# Source
|
||||
SRC = src/main.c src/utils.c src/registry.c src/callbacks.c
|
||||
OBJ = $(OBJ_DIR)/main.o $(OBJ_DIR)/utils.o $(OBJ_DIR)/registry.o $(OBJ_DIR)/callbacks.o
|
||||
SRC = src/main.c src/utils.c src/registry.c src/callbacks.c src/ui.c src/globals.c
|
||||
RES = ico/resources.rc
|
||||
OBJ = $(OBJ_DIR)/main.o $(OBJ_DIR)/utils.o $(OBJ_DIR)/registry.o $(OBJ_DIR)/callbacks.o $(OBJ_DIR)/ui.o $(OBJ_DIR)/globals.o $(OBJ_DIR)/resources.o
|
||||
EXE = $(BIN_DIR)/PathEditor.exe
|
||||
|
||||
all: $(BIN_DIR) $(OBJ_DIR) $(EXE)
|
||||
@@ -45,6 +46,15 @@ $(OBJ_DIR)/registry.o: src/registry.c
|
||||
$(OBJ_DIR)/callbacks.o: src/callbacks.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJ_DIR)/ui.o: src/ui.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJ_DIR)/globals.o: src/globals.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJ_DIR)/resources.o: ico/resources.rc
|
||||
$(WINDRES) -i $< -o $@
|
||||
|
||||
clean:
|
||||
if exist $(OBJ_DIR)\*.o del /Q $(OBJ_DIR)\*.o
|
||||
if exist $(BIN_DIR)\*.exe del /Q $(BIN_DIR)\*.exe
|
||||
@@ -1,18 +1,49 @@
|
||||
# Path Editor (系统环境变量编辑器)
|
||||
|
||||
一个简单、轻量级的 Windows 系统环境变量(PATH)编辑器,基于 C 语言和 IUP 图形库开发。
|
||||
* Path Editor 是一个专为 Windows 用户设计的系统环境变量(PATH)管理工具。它基于原生 C 语言和 IUP 图形库开发,旨在替代 Windows 自带的简陋编辑界面。
|
||||
* 相比系统自带的编辑器,Path Editor 提供了更加直观的双视图(系统/用户变量)界面、智能的路径有效性检测、自动备份机制以及便捷的拖拽操作,让环境变量的管理变得安全、高效且轻松。无论您是开发者还是系统管理员,它都是您配置开发环境的得力助手。
|
||||
|
||||
## ✨ 功能特点
|
||||
|
||||
* **可视化编辑**:直观地查看和管理系统 PATH 环境变量。
|
||||
* **安全操作**:必须以管理员身份运行才能保存更改,防止误操作。
|
||||
* **🛡️ 安全第一**:
|
||||
* **自动备份**:每次保存前自动备份注册表,防止意外。
|
||||
* **只读模式**:非管理员运行时自动切换到只读模式,防止误操作。
|
||||
* **权限检测**:智能检测当前运行权限。
|
||||
|
||||
* **📑 双视图管理**:
|
||||
* 完美支持 **System (系统变量)** 和 **User (用户变量)** 的分离查看与编辑。
|
||||
* 清晰的 Tab 标签页切换。
|
||||
|
||||
* **🔴 智能诊断与维护**:
|
||||
* **无效路径高亮**:自动检测路径是否存在,不存在的显示为红色。
|
||||
* **重复路径高亮**:自动检测重复项,重复的显示为橙色。
|
||||
* **一键清理**:智能移除所有无效和重复的路径,保持环境整洁。
|
||||
|
||||
* **📂 高效交互**:
|
||||
* **拖拽支持**:直接将文件夹拖入窗口即可添加(支持管理员模式下的 UIPI 穿透)。
|
||||
* **实时搜索**:顶部搜索框支持不区分大小写的实时过滤查找。
|
||||
* **快捷键**:支持 Delete 键快速删除选中项。
|
||||
|
||||
* **便捷管理**:
|
||||
* ➕ **新建**:添加新路径到列表。
|
||||
* 📂 **浏览**:直接从文件资源管理器选择目录添加。
|
||||
* ✏️ **编辑**:修改现有路径。
|
||||
* ✏️ **编辑**:双击或点击按钮修改现有路径。
|
||||
* 🗑️ **删除**:移除不需要的路径。
|
||||
* ⬆️⬇️ **排序**:上移/下移调整路径优先级。
|
||||
* **轻量级**:原生 C 语言编写,运行速度快,占用资源少。
|
||||
|
||||
* **轻量级**:原生 C 语言编写,无臃肿依赖,运行速度极快。
|
||||
|
||||
## 🏗️ 架构与二次开发
|
||||
|
||||
本项目注重代码的模块化和可维护性,采用了经典的 **MVC 分层架构**,非常适合作为 C 语言桌面程序开发的参考:
|
||||
|
||||
* **分层设计**:
|
||||
* `src/core/` (Model): 核心数据与业务逻辑,完全脱离 UI 框架(无任何 `<iup.h>` 依赖)。
|
||||
* `src/ui/` (View): 负责界面布局与组件的纯视觉展示。
|
||||
* `src/controller/` (Controller): 负责连接用户交互与底层数据。
|
||||
* `src/utils/` (Utils): 纯粹的底层工具类封装(系统级调用、字符串处理)。
|
||||
* **统一配置中心**:所有的 UI 尺寸、间距、颜色等常量配置均提取在 `include/config.h` 中,只需修改宏定义即可轻松定制属于你的专属界面风格。
|
||||
* **清晰的应用状态**:摒弃了脆弱的全局变量模式,采用 `AppContext` 统一管理应用运行时的上下文状态,通过指针传递,安全可靠。
|
||||
|
||||
## 📦 下载与安装
|
||||
|
||||
@@ -28,10 +59,13 @@
|
||||
|
||||
* Windows 操作系统
|
||||
* GCC 编译器 (推荐 MinGW-w64)
|
||||
* Make 工具
|
||||
* CMake 工具 (推荐使用 CMake 构建)
|
||||
* IUP 库 (已包含在 `libs` 目录下)
|
||||
* Inno Setup 6 (仅打包需要)
|
||||
|
||||
### 编译步骤
|
||||
### 编译步骤 (推荐使用 CMake)
|
||||
|
||||
本项目已迁移至 CMake 构建系统,支持生成更标准的构建文件并集成到各大 IDE。
|
||||
|
||||
1. 克隆仓库:
|
||||
|
||||
@@ -40,30 +74,40 @@
|
||||
cd PathEditor
|
||||
```
|
||||
|
||||
2. 编译项目:
|
||||
2. 使用 CMake 配置和编译:
|
||||
|
||||
```bash
|
||||
mingw32-make
|
||||
# 生成构建系统 (以 MinGW 为例)
|
||||
cmake -B build -G "MinGW Makefiles"
|
||||
|
||||
# 编译项目
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
3. 运行:
|
||||
编译成功后,可执行文件位于 `bin/PathEditor.exe`。
|
||||
编译成功后,可执行文件位于 `build/PathEditor.exe`。
|
||||
|
||||
### 打包 (可选)
|
||||
|
||||
本项目使用 Inno Setup 生成安装包。
|
||||
|
||||
1. 确保已安装 [Inno Setup 6](https://jrsoftware.org/isdl.php)。
|
||||
2. 编译项目生成 exe 文件。
|
||||
3. 使用 Inno Setup 编译 `dist/installer.iss` 脚本。
|
||||
2. 运行根目录下的 `build_installer.bat` 脚本。
|
||||
3. 生成的安装包将位于 `dist/dist/PathEditorSetup.exe`。
|
||||
|
||||
## 📝 使用说明
|
||||
|
||||
1. **启动**:右键点击程序图标,选择“以管理员身份运行”。
|
||||
2. **查看**:程序启动后会自动加载当前的系统 PATH 变量。
|
||||
3. **修改**:使用右侧按钮栏进行添加、删除、移动等操作。
|
||||
4. **保存**:操作完成后,务必点击底部的【确定】按钮保存更改。
|
||||
5. **生效**:保存后,某些正在运行的程序可能需要重启才能识别新的环境变量。CMD 或 PowerShell 窗口需要重新打开。
|
||||
* **红色**条目表示路径不存在。
|
||||
* **橙色**条目表示路径重复。
|
||||
3. **搜索**:在顶部输入关键词可快速筛选。
|
||||
4. **修改**:
|
||||
* 拖拽文件夹到列表可直接添加。
|
||||
* 使用右侧按钮栏进行常规操作。
|
||||
* 点击“一键清理”可自动删除无效和重复项。
|
||||
5. **保存**:操作完成后,务必点击底部的【确定】按钮保存更改。
|
||||
6. **生效**:保存后,某些正在运行的程序可能需要重启才能识别新的环境变量。CMD 或 PowerShell 窗口需要重新打开。
|
||||
|
||||
## 👤 作者信息
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
|
||||
echo Building Installer...
|
||||
"D:\Program Files (x86)\Inno Setup 6\ISCC.exe" "dist\installer.iss"
|
||||
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo Installer build failed!
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
|
||||
echo Done! Installer is in dist\dist\
|
||||
pause
|
||||
Vendored
+3
-2
@@ -27,6 +27,7 @@ OutputBaseFilename=PathEditorSetup
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
SetupIconFile=d:\Code\doing_exercises\programs\PathEditor\ico\PathEditor.ico
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
@@ -36,8 +37,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "d:\Code\doing_exercises\programs\PathEditor\bin\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "d:\Code\doing_exercises\programs\PathEditor\bin\*.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "d:\Code\doing_exercises\programs\PathEditor\build\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "d:\Code\doing_exercises\programs\PathEditor\build\*.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 138 KiB |
@@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON "PathEditor.ico"
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef CALLBACKS_H
|
||||
#define CALLBACKS_H
|
||||
|
||||
#include <iup.h>
|
||||
|
||||
// 按钮回调
|
||||
int btn_new_cb(Ihandle* self);
|
||||
int btn_edit_cb(Ihandle* self);
|
||||
int btn_browse_cb(Ihandle* self);
|
||||
int btn_del_cb(Ihandle* self);
|
||||
int btn_up_cb(Ihandle* self);
|
||||
int btn_down_cb(Ihandle* self);
|
||||
int btn_ok_cb(Ihandle* self);
|
||||
int btn_cancel_cb(Ihandle* self);
|
||||
int btn_help_cb(Ihandle* self);
|
||||
|
||||
// 双击回调
|
||||
int list_dblclick_cb(Ihandle* self, int item, char* text);
|
||||
|
||||
#endif // CALLBACKS_H
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
// ============================================================================
|
||||
// UI的配置常量
|
||||
// ============================================================================
|
||||
|
||||
// 应用程序名称
|
||||
#define APP_NAME "PathEditor" // 编辑环境变量应用程序名称
|
||||
#define APP_NAME_READONLY "PathEditor (只读模式)" // 编辑环境变量只读模式标题
|
||||
|
||||
// 对话框设置
|
||||
#define UI_DLG_SIZE "800x800" // 对话框默认大小 (像素)
|
||||
#define UI_DLG_MINSIZE "800x800" // 对话框最小大小 (像素)
|
||||
|
||||
// 列表控件设置
|
||||
#define UI_LIST_ITEM_PADDING "5x5" // 列表项内边距
|
||||
#define UI_LIST_BACKCOLOR "255 255 255" // 列表背景颜色
|
||||
|
||||
// 按钮设置
|
||||
#define UI_BTN_RASTERSIZE "100x32" // 按钮默认大小
|
||||
|
||||
// 布局间隙和边距
|
||||
#define UI_VBOX_GAP "5" // 垂直布局项间隙
|
||||
#define UI_VBOX_MARGIN "0x0" // 垂直布局外边距
|
||||
#define UI_VBOX_ALL_MARGIN "10x10" // 垂直布局总外边距
|
||||
#define UI_VBOX_ALL_GAP "5" // 垂直布局总间隙
|
||||
|
||||
#define UI_HBOX_GAP "10" // 水平布局项间隙
|
||||
#define UI_HBOX_MARGIN "10x10" // 水平布局外边距
|
||||
#define UI_HBOX_ALIGNMENT "ACENTER" // 水平布局对齐方式
|
||||
|
||||
#endif // CONFIG_H
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef CALLBACKS_H
|
||||
#define CALLBACKS_H
|
||||
|
||||
#include <iup.h>
|
||||
|
||||
// 按钮回调
|
||||
int btn_new_cb(Ihandle *self);
|
||||
int btn_edit_cb(Ihandle *self);
|
||||
int btn_browse_cb(Ihandle *self);
|
||||
int btn_del_cb(Ihandle *self);
|
||||
int btn_up_cb(Ihandle *self);
|
||||
int btn_down_cb(Ihandle *self);
|
||||
int btn_clean_cb(Ihandle *self);
|
||||
int btn_ok_cb(Ihandle *self);
|
||||
int btn_cancel_cb(Ihandle *self);
|
||||
int btn_help_cb(Ihandle *self);
|
||||
|
||||
// 搜索回调
|
||||
int txt_search_cb(Ihandle *self);
|
||||
|
||||
// 双击回调
|
||||
int list_dblclick_cb(Ihandle *self, int item, char *text);
|
||||
|
||||
// 拖拽回调
|
||||
int list_dropfiles_cb(Ihandle *self, const char *filename, int num, int x, int y);
|
||||
|
||||
// 键盘按键回调
|
||||
int list_k_any_cb(Ihandle *self, int c);
|
||||
|
||||
// 载入数据与更新UI
|
||||
void load_all_paths(void);
|
||||
|
||||
#endif // CALLBACKS_H
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef APP_CONTEXT_H
|
||||
#define APP_CONTEXT_H
|
||||
|
||||
#include "utils/string_ext.h"
|
||||
#include <iup.h>
|
||||
|
||||
// 应用上下文结构体,用于存储应用运行时的状态
|
||||
typedef struct {
|
||||
StringList sys_paths;
|
||||
StringList user_paths;
|
||||
} AppContext;
|
||||
|
||||
// 创建应用上下文
|
||||
AppContext* create_app_context(void);
|
||||
|
||||
// 销毁应用上下文
|
||||
void destroy_app_context(AppContext* ctx);
|
||||
|
||||
// 获取应用上下文
|
||||
AppContext* get_app_context(Ihandle *ih);
|
||||
|
||||
#endif // APP_CONTEXT_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef PATH_MANAGER_H
|
||||
#define PATH_MANAGER_H
|
||||
|
||||
#include "utils/string_ext.h"
|
||||
|
||||
// 移除列表中指定索引的项
|
||||
void path_manager_remove_at(StringList *list, int index);
|
||||
|
||||
// 上移指定索引的项
|
||||
void path_manager_move_up(StringList *list, int index);
|
||||
|
||||
// 下移指定索引的项
|
||||
void path_manager_move_down(StringList *list, int index);
|
||||
|
||||
// 清理无效和重复的路径
|
||||
// 返回被清理的项数
|
||||
int path_manager_clean(StringList *list);
|
||||
|
||||
#endif // PATH_MANAGER_H
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef REGISTRY_SERVICE_H
|
||||
#define REGISTRY_SERVICE_H
|
||||
|
||||
#include "utils/string_ext.h"
|
||||
|
||||
// 加载系统变量和用户变量到字符串列表
|
||||
int load_system_paths(StringList *list);
|
||||
int load_user_paths(StringList *list);
|
||||
|
||||
// 从字符串列表保存系统变量和用户变量
|
||||
int save_system_paths(const StringList *list);
|
||||
int save_user_paths(const StringList *list);
|
||||
|
||||
#endif // REGISTRY_SERVICE_H
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
#include <iup.h>
|
||||
|
||||
// 注册表路径常量
|
||||
#define REG_PATH L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
|
||||
#define REG_VALUE L"Path"
|
||||
|
||||
// 全局控件句柄声明
|
||||
extern Ihandle *dlg; // 主对话框句柄
|
||||
extern Ihandle *list_path; // 路径列表控件句柄
|
||||
extern Ihandle *lbl_status; // 状态标签句柄
|
||||
extern Ihandle *btn_new; // 新增按钮句柄
|
||||
extern Ihandle *btn_edit; // 编辑按钮句柄
|
||||
extern Ihandle *btn_browse; // 浏览按钮句柄
|
||||
extern Ihandle *btn_del; // 删除按钮句柄
|
||||
extern Ihandle *btn_up; // 上移按钮句柄
|
||||
extern Ihandle *btn_down; // 下移按钮句柄
|
||||
extern Ihandle *btn_ok; // 确认按钮句柄
|
||||
extern Ihandle *btn_cancel; // 取消按钮句柄
|
||||
extern Ihandle *btn_help; // 帮助按钮句柄
|
||||
|
||||
#endif // GLOBALS_H
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef REGISTRY_H
|
||||
#define REGISTRY_H
|
||||
|
||||
// 从注册表加载PATH到列表控件
|
||||
void load_path();
|
||||
|
||||
// 将列表控件中的PATH保存回注册表
|
||||
void save_path();
|
||||
|
||||
#endif // REGISTRY_H
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef DIALOGS_H
|
||||
#define DIALOGS_H
|
||||
|
||||
// 自定义输入对话框
|
||||
// 返回值:0-取消,1-确认
|
||||
int custom_input_dialog(const char *title, const char *label_text, char *buffer, int buffer_size);
|
||||
|
||||
#endif // DIALOGS_H
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef MAIN_WINDOW_H
|
||||
#define MAIN_WINDOW_H
|
||||
|
||||
#include <iup.h>
|
||||
|
||||
// 创建主窗口
|
||||
Ihandle* create_main_window(void);
|
||||
|
||||
#endif // MAIN_WINDOW_H
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef UI_UTILS_H
|
||||
#define UI_UTILS_H
|
||||
|
||||
#include <iup.h>
|
||||
#include "utils/string_ext.h"
|
||||
|
||||
// 刷新单个列表框样式
|
||||
void refresh_single_list_style(Ihandle *list);
|
||||
|
||||
// 同步字符串列表到 UI 列表框
|
||||
void sync_string_list_to_ui(Ihandle *list_ui, const StringList *str_list);
|
||||
|
||||
#endif // UI_UTILS_H
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
|
||||
// 宽字符转UTF-8
|
||||
char* wide_to_utf8(const wchar_t* wstr);
|
||||
|
||||
// UTF-8转宽字符
|
||||
wchar_t* utf8_to_wide(const char* str);
|
||||
|
||||
// 检查管理员权限
|
||||
int check_admin();
|
||||
|
||||
// 刷新列表样式(斑马纹)
|
||||
void refresh_list_style();
|
||||
|
||||
#endif // UTILS_H
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef OS_ENV_H
|
||||
#define OS_ENV_H
|
||||
|
||||
// 检查是否以管理员权限运行
|
||||
int check_admin(void);
|
||||
|
||||
// 检查路径是否有效
|
||||
int is_path_valid(const char *path);
|
||||
|
||||
// 备份注册表
|
||||
void backup_registry(void);
|
||||
|
||||
#endif // OS_ENV_H
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef STRING_EXT_H
|
||||
#define STRING_EXT_H
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
// 简单字符串列表结构
|
||||
typedef struct
|
||||
{
|
||||
char **items;
|
||||
int count;
|
||||
int capacity;
|
||||
} StringList;
|
||||
|
||||
// 字符串列表
|
||||
void init_string_list(StringList *list);
|
||||
void add_string_list(StringList *list, const char *str);
|
||||
void clear_string_list(StringList *list);
|
||||
|
||||
// 字符串转换函数
|
||||
char *wide_to_utf8(const wchar_t *wstr);
|
||||
wchar_t *utf8_to_wide(const char *str);
|
||||
char *stristr(const char *haystack, const char *needle);
|
||||
|
||||
#endif // STRING_EXT_H
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user