Implemented the copy, paste, and cut functions in the workspace, with corresponding shortcut key responses. The clipboard functionality is implemented internally and does not interact with the operating system for now.

This commit is contained in:
2026-04-24 17:07:07 +08:00
parent e0afc4963f
commit fa4e79dc86
2 changed files with 228 additions and 128 deletions
+10
View File
@@ -7,6 +7,7 @@
#include "imnodes.h"
#include "ID_Generator.hpp"
#include "Nodes_And_Connectors.hpp"
#include "Json_Utilities.hpp"
// 节点编辑器类
class Workflow_Editor
@@ -29,6 +30,9 @@ protected:
std::vector<std::shared_ptr<Abs_Node>> Node_Pool; // 节点池
std::vector<Edge> Edge_Pool; // 边池
// 配置剪切板
Json_Object Config_Clipboard;
/**
* 顶层索引为起始工作流节点(N个元素即N个处理流程)
* 次级索引为工作序列,表示完成一个处理流程的非冲突序列
@@ -41,6 +45,12 @@ protected:
// 删除边 返回迭代器指定位置的下一个位置的迭代器,仅限内部使用
std::vector<Edge>::iterator Del_Link(std::vector<Edge>::iterator iterator);
// 从节点和边列表构建配置对象
Json_Object Generate_Config(std::vector<std::shared_ptr<Abs_Node>> Node_List, std::vector<Edge> Edge_List);
// 从配置对象应用 true -> success / false -> failed
bool Apply_Config(Json_Object Config_Object, ImVec2 initial_position = ImVec2(0, 0));
public:
// 绘制节点编辑器
void Show(void);