aboutsummaryrefslogtreecommitdiff
path: root/core/src/UI/UI_Workflows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/UI/UI_Workflows.cpp')
-rw-r--r--core/src/UI/UI_Workflows.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/core/src/UI/UI_Workflows.cpp b/core/src/UI/UI_Workflows.cpp
index fe504e2..108410c 100644
--- a/core/src/UI/UI_Workflows.cpp
+++ b/core/src/UI/UI_Workflows.cpp
@@ -17,11 +17,13 @@
namespace ImNodes = ax::NodeEditor;
namespace {
-class WorkflowCreationMenu {
+class WorkflowCreationMenu
+{
private:
using WorkflowNodeConstructor = std::unique_ptr<WorkflowNode> (*)();
- enum Category {
+ enum Category
+ {
NumericCategory,
TextCategory,
DocumentsCategory,
@@ -30,7 +32,8 @@ private:
OutputCategory,
};
- struct Candidate {
+ struct Candidate
+ {
WorkflowNodeConstructor Constructor;
std::string Name;
Category Category;
@@ -39,7 +42,10 @@ private:
std::vector<Candidate> mCandidates;
#define SUB_RANGE_ACCESS(Type, AccessorName, storage, begin, nextBegin) \
- std::span<Type> AccessorName() { return { &storage[begin], (size_t)(nextBegin - begin) }; }
+ std::span<Type> AccessorName() \
+ { \
+ return { &storage[begin], (size_t)(nextBegin - begin) }; \
+ }
int mTextOffset;
int mDocumentOffset;
@@ -57,12 +63,14 @@ private:
#undef SUB_RANGE_ACCESS
public:
- WorkflowCreationMenu() {
+ WorkflowCreationMenu()
+ {
SetupCandidates();
}
private:
- void SetupCandidates() {
+ void SetupCandidates()
+ {
// Numeric nodes offset start at 0
mCandidates.push_back(Candidate{
.Constructor = []() -> std::unique_ptr<WorkflowNode> { return std::make_unique<NumericOperationNode>(NumericOperationNode::Addition); },
@@ -127,21 +135,25 @@ private:
}
};
-class WorkflowUI {
+class WorkflowUI
+{
private:
Workflow* mWorkflow;
ImNodes::EditorContext* mContext;
public:
- WorkflowUI() {
+ WorkflowUI()
+ {
mContext = ImNodes::CreateEditor();
}
- ~WorkflowUI() {
+ ~WorkflowUI()
+ {
ImNodes::DestroyEditor(mContext);
}
- void Draw() {
+ void Draw()
+ {
ImNodes::SetCurrentEditor(mContext);
ImNodes::Begin("");
@@ -164,7 +176,8 @@ public:
};
} // namespace
-void UI::WorkflowsTab() {
+void UI::WorkflowsTab()
+{
static std::unique_ptr<WorkflowUI> openWorkflow;
// TODO
}