mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 18:52:46 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ec22eaae0 | |||
| c92d20b4b3 | |||
| 6a22202ce5 | |||
| db01c1ad53 | |||
| 1681473357 | |||
| 50f9f95ad5 | |||
| 6ccdc696d2 | |||
| 1219a53391 | |||
| 3302132644 | |||
| 59db3dc33b |
@@ -0,0 +1,75 @@
|
|||||||
|
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.c
|
||||||
|
src/registry.c
|
||||||
|
src/ui.c
|
||||||
|
src/globals.c
|
||||||
|
src/ui_utils.c
|
||||||
|
src/cb_edit.c
|
||||||
|
src/cb_file.c
|
||||||
|
src/cb_main.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}/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..."
|
||||||
|
)
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
CC = gcc
|
|
||||||
WINDRES = windres
|
|
||||||
|
|
||||||
# Paths - specific to user environment
|
|
||||||
IUP_DIR = libs/iup-3.31_Win64_dllw6_lib
|
|
||||||
INCLUDE_DIR = $(IUP_DIR)/include
|
|
||||||
LIB_DIR = $(IUP_DIR)
|
|
||||||
LOCAL_INCLUDE_DIR = include
|
|
||||||
|
|
||||||
# Output Directories
|
|
||||||
OBJ_DIR = obj
|
|
||||||
BIN_DIR = bin
|
|
||||||
|
|
||||||
# Flags
|
|
||||||
# -mwindows: Create GUI app (no console)
|
|
||||||
# -DUNICODE -D_UNICODE: Use Wide Character API
|
|
||||||
CFLAGS = -Wall -O2 -I$(INCLUDE_DIR) -I$(LOCAL_INCLUDE_DIR) -D_WIN32 -DUNICODE -D_UNICODE -fexec-charset=UTF-8
|
|
||||||
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/ui.c src/ui_utils.c src/cb_edit.c src/cb_file.c src/cb_main.c
|
|
||||||
RES = ico/resources.rc
|
|
||||||
OBJ = $(OBJ_DIR)/main.o $(OBJ_DIR)/utils.o $(OBJ_DIR)/registry.o $(OBJ_DIR)/ui.o $(OBJ_DIR)/ui_utils.o $(OBJ_DIR)/cb_edit.o $(OBJ_DIR)/cb_file.o $(OBJ_DIR)/cb_main.o $(OBJ_DIR)/resources.o
|
|
||||||
EXE = $(BIN_DIR)/PathEditor.exe
|
|
||||||
|
|
||||||
all: $(BIN_DIR) $(OBJ_DIR) $(EXE)
|
|
||||||
|
|
||||||
$(BIN_DIR):
|
|
||||||
if not exist $(BIN_DIR) mkdir $(BIN_DIR)
|
|
||||||
|
|
||||||
$(OBJ_DIR):
|
|
||||||
if not exist $(OBJ_DIR) mkdir $(OBJ_DIR)
|
|
||||||
|
|
||||||
$(EXE): $(OBJ)
|
|
||||||
$(CC) -o $@ $^ $(LDFLAGS)
|
|
||||||
|
|
||||||
$(OBJ_DIR)/main.o: src/main.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/utils.o: src/utils.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/registry.o: src/registry.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/ui.o: src/ui.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/ui_utils.o: src/ui_utils.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/cb_edit.o: src/cb_edit.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/cb_file.o: src/cb_file.c
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(OBJ_DIR)/cb_main.o: src/cb_main.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
|
|
||||||
@@ -40,6 +40,13 @@
|
|||||||
|
|
||||||
* **轻量级**:原生 C 语言编写,无臃肿依赖,运行速度极快。
|
* **轻量级**:原生 C 语言编写,无臃肿依赖,运行速度极快。
|
||||||
|
|
||||||
|
## 🏗️ 架构与二次开发
|
||||||
|
|
||||||
|
本项目注重代码的模块化和可维护性,非常适合作为 C 语言桌面程序开发的参考:
|
||||||
|
|
||||||
|
* **统一配置中心**:所有的 UI 尺寸、间距、颜色等常量配置均提取在 `include/config.h` 中,只需修改宏定义即可轻松定制属于你的专属界面风格。
|
||||||
|
* **清晰的全局状态**:全局变量和常量被独立分离在 `src/globals.c` / `include/globals.h` 中管理,使得核心业务逻辑更加整洁。
|
||||||
|
|
||||||
## 📦 下载与安装
|
## 📦 下载与安装
|
||||||
|
|
||||||
您可以从 [Releases](https://github.com/LHY0125/PathEditor/releases) 页面下载最新的安装包 (`PathEditorSetup.exe`)。
|
您可以从 [Releases](https://github.com/LHY0125/PathEditor/releases) 页面下载最新的安装包 (`PathEditorSetup.exe`)。
|
||||||
@@ -54,12 +61,14 @@
|
|||||||
|
|
||||||
* Windows 操作系统
|
* Windows 操作系统
|
||||||
* GCC 编译器 (推荐 MinGW-w64)
|
* GCC 编译器 (推荐 MinGW-w64)
|
||||||
* Make 工具
|
* CMake 工具
|
||||||
* IUP 库 (已包含在 `libs` 目录下)
|
* IUP 库 (已包含在 `libs` 目录下)
|
||||||
* Inno Setup 6 (仅打包需要)
|
* Inno Setup 6 (仅打包需要)
|
||||||
|
|
||||||
### 编译步骤
|
### 编译步骤
|
||||||
|
|
||||||
|
本项目使用 CMake 构建系统,支持生成更标准的构建文件并集成到各大 IDE。
|
||||||
|
|
||||||
1. 克隆仓库:
|
1. 克隆仓库:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -67,14 +76,18 @@
|
|||||||
cd PathEditor
|
cd PathEditor
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 编译项目:
|
2. 使用 CMake 配置和编译:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mingw32-make
|
# 生成构建系统 (以 MinGW 为例)
|
||||||
|
cmake -B build -G "MinGW Makefiles"
|
||||||
|
|
||||||
|
# 编译项目
|
||||||
|
cmake --build build
|
||||||
```
|
```
|
||||||
|
|
||||||
3. 运行:
|
3. 运行:
|
||||||
编译成功后,可执行文件位于 `bin/PathEditor.exe`。
|
编译成功后,可执行文件位于 `build/PathEditor.exe`。
|
||||||
|
|
||||||
### 打包 (可选)
|
### 打包 (可选)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,4 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo Copying DLLs...
|
|
||||||
if not exist bin mkdir bin
|
|
||||||
copy /Y "libs\iup-3.31_Win64_dllw6_lib\*.dll" bin\
|
|
||||||
|
|
||||||
echo Building Installer...
|
echo Building Installer...
|
||||||
"D:\Program Files (x86)\Inno Setup 6\ISCC.exe" "dist\installer.iss"
|
"D:\Program Files (x86)\Inno Setup 6\ISCC.exe" "dist\installer.iss"
|
||||||
|
|||||||
Vendored
+2
-2
@@ -37,8 +37,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
|
|||||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "d:\Code\doing_exercises\programs\PathEditor\bin\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "d:\Code\doing_exercises\programs\PathEditor\build\{#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\*.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// UI 常量定义
|
||||||
|
#define UI_WINDOW_TITLE "Path Editor" // 窗口标题
|
||||||
|
#define UI_WINDOW_SIZE "800x800" // 窗口默认大小 (像素)
|
||||||
|
|
||||||
|
// 按钮尺寸
|
||||||
|
#define UI_BUTTON_SIZE "100x32" // 按钮默认大小 (像素)
|
||||||
|
#define UI_BUTTON_SMALL_SIZE "80x32" // 小按钮大小 (像素)
|
||||||
|
|
||||||
|
// 布局间距
|
||||||
|
#define UI_MARGIN_MAIN "10x10" // 主布局外边距 (像素)
|
||||||
|
#define UI_GAP_MAIN "10" // 主布局间距 (像素)
|
||||||
|
#define UI_GAP_BUTTONS "5" // 按钮间距 (像素)
|
||||||
|
#define UI_GAP_BOTTOM "10" // 底部间距 (像素)
|
||||||
|
|
||||||
|
// 列表属性
|
||||||
|
#define UI_LIST_ITEM_PADDING "5x5" // 列表项内边距 (像素)
|
||||||
|
#define UI_LIST_BGCOLOR "255 255 255" // 列表背景颜色 (RGB)
|
||||||
|
#define UI_LIST_MERGED_BGCOLOR "240 240 240"// 合并列表背景颜色 (RGB)
|
||||||
|
|
||||||
|
#endif // CONFIG_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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
|
// 全局控件定义
|
||||||
|
Ihandle *dlg = NULL; // 主对话框
|
||||||
|
Ihandle *tabs_main = NULL; // 主选项卡
|
||||||
|
Ihandle *list_sys = NULL, *list_user = NULL, *list_merged = NULL; // 列表控件
|
||||||
|
Ihandle *lbl_status = NULL; // 状态栏
|
||||||
|
Ihandle *btn_new = NULL, *btn_edit = NULL, *btn_browse = NULL, *btn_del = NULL, *btn_up = NULL, *btn_down = NULL; // 右侧按钮
|
||||||
|
Ihandle *btn_undo = NULL, *btn_redo = NULL; // 撤销重做按钮
|
||||||
|
Ihandle *btn_import = NULL, *btn_export = NULL; // 导入导出按钮
|
||||||
|
Ihandle *btn_ok = NULL, *btn_cancel = NULL, *btn_help = NULL; // 确认取消帮助按钮
|
||||||
|
Ihandle *btn_clean = NULL; // 一键清理按钮
|
||||||
|
Ihandle *btn_theme = NULL; // 主题切换按钮
|
||||||
|
Ihandle *txt_search = NULL; // 搜索框
|
||||||
|
|
||||||
|
// 历史记录栈
|
||||||
|
HistoryStack undo_stack = {0};
|
||||||
|
HistoryStack redo_stack = {0};
|
||||||
|
|
||||||
|
// 全局变量定义
|
||||||
|
StringList raw_sys_paths = {0};
|
||||||
|
StringList raw_user_paths = {0};
|
||||||
|
int is_dark_mode = 0; // 默认浅色模式
|
||||||
+7
-20
@@ -7,27 +7,14 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "cb_main.h"
|
#include "cb_main.h"
|
||||||
|
|
||||||
// 全局控件定义
|
/*
|
||||||
Ihandle *dlg; // 主对话框
|
!编译命令:
|
||||||
Ihandle *tabs_main; // 主选项卡
|
cmake -B build -G "MinGW Makefiles"
|
||||||
Ihandle *list_sys, *list_user, *list_merged; // 列表控件
|
cmake --build build
|
||||||
Ihandle *lbl_status; // 状态栏
|
|
||||||
Ihandle *btn_new, *btn_edit, *btn_browse, *btn_del, *btn_up, *btn_down; // 右侧按钮
|
|
||||||
Ihandle *btn_undo, *btn_redo; // 撤销重做按钮
|
|
||||||
Ihandle *btn_import, *btn_export; // 导入导出按钮
|
|
||||||
Ihandle *btn_ok, *btn_cancel, *btn_help; // 确认取消帮助按钮
|
|
||||||
Ihandle *btn_clean; // 一键清理按钮
|
|
||||||
Ihandle *btn_theme; // 主题切换按钮
|
|
||||||
Ihandle *txt_search; // 搜索框
|
|
||||||
|
|
||||||
// 历史记录栈
|
!打包命令:
|
||||||
HistoryStack undo_stack = {0};
|
build_installer.bat
|
||||||
HistoryStack redo_stack = {0};
|
*/
|
||||||
|
|
||||||
// 全局变量定义
|
|
||||||
StringList raw_sys_paths = {0};
|
|
||||||
StringList raw_user_paths = {0};
|
|
||||||
int is_dark_mode = 0; // 默认浅色模式
|
|
||||||
|
|
||||||
// 主函数
|
// 主函数
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
#include "config.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "ui_utils.h"
|
#include "ui_utils.h"
|
||||||
#include "cb_edit.h"
|
#include "cb_edit.h"
|
||||||
@@ -12,8 +13,8 @@ Ihandle *create_path_list()
|
|||||||
Ihandle *list = IupFlatList();
|
Ihandle *list = IupFlatList();
|
||||||
IupSetAttribute(list, "EXPAND", "YES");
|
IupSetAttribute(list, "EXPAND", "YES");
|
||||||
IupSetAttribute(list, "MULTIPLE", "YES");
|
IupSetAttribute(list, "MULTIPLE", "YES");
|
||||||
IupSetAttribute(list, "ITEMPADDING", "5x5");
|
IupSetAttribute(list, "ITEMPADDING", UI_LIST_ITEM_PADDING);
|
||||||
IupSetAttribute(list, "BACKCOLOR", "255 255 255");
|
IupSetAttribute(list, "BACKCOLOR", UI_LIST_BGCOLOR);
|
||||||
IupSetAttribute(list, "BORDER", "YES");
|
IupSetAttribute(list, "BORDER", "YES");
|
||||||
IupSetAttribute(list, "CANFOCUS", "YES");
|
IupSetAttribute(list, "CANFOCUS", "YES");
|
||||||
IupSetAttribute(list, "HLINE", "NO");
|
IupSetAttribute(list, "HLINE", "NO");
|
||||||
@@ -49,16 +50,16 @@ Ihandle *create_main_buttons()
|
|||||||
IupSetCallback(btn_down, "ACTION", (Icallback)btn_down_cb);
|
IupSetCallback(btn_down, "ACTION", (Icallback)btn_down_cb);
|
||||||
IupSetCallback(btn_clean, "ACTION", (Icallback)btn_clean_cb);
|
IupSetCallback(btn_clean, "ACTION", (Icallback)btn_clean_cb);
|
||||||
|
|
||||||
// 设置按钮大小 (宽度和高度都增加约1/4)
|
// 设置按钮大小
|
||||||
IupSetAttribute(btn_new, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_new, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_edit, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_edit, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_browse, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_browse, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_del, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_del, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_undo, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_undo, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_redo, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_redo, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_up, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_up, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_down, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_down, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
IupSetAttribute(btn_clean, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_clean, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
|
|
||||||
Ihandle *vbox_btns = IupVbox(
|
Ihandle *vbox_btns = IupVbox(
|
||||||
btn_new, btn_edit, btn_browse, btn_del,
|
btn_new, btn_edit, btn_browse, btn_del,
|
||||||
@@ -69,7 +70,7 @@ Ihandle *create_main_buttons()
|
|||||||
IupFill(),
|
IupFill(),
|
||||||
btn_up, btn_down,
|
btn_up, btn_down,
|
||||||
NULL);
|
NULL);
|
||||||
IupSetAttribute(vbox_btns, "GAP", "5");
|
IupSetAttribute(vbox_btns, "GAP", UI_GAP_BUTTONS);
|
||||||
IupSetAttribute(vbox_btns, "MARGIN", "0x0");
|
IupSetAttribute(vbox_btns, "MARGIN", "0x0");
|
||||||
|
|
||||||
return vbox_btns;
|
return vbox_btns;
|
||||||
@@ -81,30 +82,30 @@ Ihandle *create_bottom_buttons()
|
|||||||
// 创建底部按钮
|
// 创建底部按钮
|
||||||
btn_help = IupButton("帮助(H)", NULL);
|
btn_help = IupButton("帮助(H)", NULL);
|
||||||
IupSetCallback(btn_help, "ACTION", (Icallback)btn_help_cb);
|
IupSetCallback(btn_help, "ACTION", (Icallback)btn_help_cb);
|
||||||
IupSetAttribute(btn_help, "RASTERSIZE", "80x32");
|
IupSetAttribute(btn_help, "RASTERSIZE", UI_BUTTON_SMALL_SIZE);
|
||||||
|
|
||||||
btn_theme = IupButton("深色模式", NULL);
|
btn_theme = IupButton("深色模式", NULL);
|
||||||
IupSetCallback(btn_theme, "ACTION", (Icallback)btn_theme_cb);
|
IupSetCallback(btn_theme, "ACTION", (Icallback)btn_theme_cb);
|
||||||
IupSetAttribute(btn_theme, "RASTERSIZE", "80x32");
|
IupSetAttribute(btn_theme, "RASTERSIZE", UI_BUTTON_SMALL_SIZE);
|
||||||
|
|
||||||
lbl_status = IupLabel("就绪");
|
lbl_status = IupLabel("就绪");
|
||||||
IupSetAttribute(lbl_status, "EXPAND", "HORIZONTAL");
|
IupSetAttribute(lbl_status, "EXPAND", "HORIZONTAL");
|
||||||
|
|
||||||
btn_import = IupButton("导入配置", NULL);
|
btn_import = IupButton("导入配置", NULL);
|
||||||
IupSetCallback(btn_import, "ACTION", (Icallback)btn_import_cb);
|
IupSetCallback(btn_import, "ACTION", (Icallback)btn_import_cb);
|
||||||
IupSetAttribute(btn_import, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_import, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
|
|
||||||
btn_export = IupButton("导出配置", NULL);
|
btn_export = IupButton("导出配置", NULL);
|
||||||
IupSetCallback(btn_export, "ACTION", (Icallback)btn_export_cb);
|
IupSetCallback(btn_export, "ACTION", (Icallback)btn_export_cb);
|
||||||
IupSetAttribute(btn_export, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_export, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
|
|
||||||
btn_ok = IupButton("确定(O)", NULL);
|
btn_ok = IupButton("确定(O)", NULL);
|
||||||
IupSetCallback(btn_ok, "ACTION", (Icallback)btn_ok_cb);
|
IupSetCallback(btn_ok, "ACTION", (Icallback)btn_ok_cb);
|
||||||
IupSetAttribute(btn_ok, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_ok, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
|
|
||||||
btn_cancel = IupButton("取消(C)", NULL);
|
btn_cancel = IupButton("取消(C)", NULL);
|
||||||
IupSetCallback(btn_cancel, "ACTION", (Icallback)btn_cancel_cb);
|
IupSetCallback(btn_cancel, "ACTION", (Icallback)btn_cancel_cb);
|
||||||
IupSetAttribute(btn_cancel, "RASTERSIZE", "100x32");
|
IupSetAttribute(btn_cancel, "RASTERSIZE", UI_BUTTON_SIZE);
|
||||||
|
|
||||||
Ihandle *hbox_bottom = IupHbox(
|
Ihandle *hbox_bottom = IupHbox(
|
||||||
btn_help,
|
btn_help,
|
||||||
@@ -116,7 +117,7 @@ Ihandle *create_bottom_buttons()
|
|||||||
btn_ok,
|
btn_ok,
|
||||||
btn_cancel,
|
btn_cancel,
|
||||||
NULL);
|
NULL);
|
||||||
IupSetAttribute(hbox_bottom, "GAP", "10");
|
IupSetAttribute(hbox_bottom, "GAP", UI_GAP_BOTTOM);
|
||||||
IupSetAttribute(hbox_bottom, "ALIGNMENT", "ACENTER");
|
IupSetAttribute(hbox_bottom, "ALIGNMENT", "ACENTER");
|
||||||
IupSetAttribute(hbox_bottom, "MARGIN", "0x0");
|
IupSetAttribute(hbox_bottom, "MARGIN", "0x0");
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ Ihandle *create_main_dialog()
|
|||||||
|
|
||||||
IupSetAttribute(list_merged, "READONLY", "YES");
|
IupSetAttribute(list_merged, "READONLY", "YES");
|
||||||
IupSetAttribute(list_merged, "MULTIPLE", "NO");
|
IupSetAttribute(list_merged, "MULTIPLE", "NO");
|
||||||
IupSetAttribute(list_merged, "BGCOLOR", "240 240 240"); // 灰色背景
|
IupSetAttribute(list_merged, "BGCOLOR", UI_LIST_MERGED_BGCOLOR); // 灰色背景
|
||||||
|
|
||||||
// 创建标签页
|
// 创建标签页
|
||||||
tabs_main = IupTabs(list_sys, list_user, list_merged, NULL);
|
tabs_main = IupTabs(list_sys, list_user, list_merged, NULL);
|
||||||
@@ -154,18 +155,19 @@ Ihandle *create_main_dialog()
|
|||||||
// 布局
|
// 布局
|
||||||
Ihandle *btns = create_main_buttons();
|
Ihandle *btns = create_main_buttons();
|
||||||
Ihandle *hbox_mid = IupHbox(tabs_main, btns, NULL);
|
Ihandle *hbox_mid = IupHbox(tabs_main, btns, NULL);
|
||||||
IupSetAttribute(hbox_mid, "GAP", "10");
|
IupSetAttribute(hbox_mid, "GAP", UI_GAP_MAIN);
|
||||||
IupSetAttribute(hbox_mid, "MARGIN", "0x0");
|
IupSetAttribute(hbox_mid, "MARGIN", "0x0");
|
||||||
|
|
||||||
Ihandle *bottom = create_bottom_buttons();
|
Ihandle *bottom = create_bottom_buttons();
|
||||||
|
|
||||||
Ihandle *vbox_main = IupVbox(txt_search, hbox_mid, bottom, NULL);
|
Ihandle *vbox_main = IupVbox(txt_search, hbox_mid, bottom, NULL);
|
||||||
IupSetAttribute(vbox_main, "GAP", "10");
|
IupSetAttribute(vbox_main, "GAP", UI_GAP_MAIN);
|
||||||
IupSetAttribute(vbox_main, "MARGIN", "10x10");
|
IupSetAttribute(vbox_main, "MARGIN", UI_MARGIN_MAIN);
|
||||||
|
|
||||||
Ihandle *dlg = IupDialog(vbox_main);
|
Ihandle *dlg = IupDialog(vbox_main);
|
||||||
IupSetAttribute(dlg, "TITLE", "Path Editor");
|
IupSetAttribute(dlg, "TITLE", UI_WINDOW_TITLE);
|
||||||
IupSetAttribute(dlg, "SIZE", "480x400");
|
IupSetAttribute(dlg, "RASTERSIZE", UI_WINDOW_SIZE);
|
||||||
|
IupSetAttribute(dlg, "MINSIZE", UI_WINDOW_SIZE);
|
||||||
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user