Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenyhraz committed May 31, 2024
1 parent 18f0f57 commit 14aa005
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 68 deletions.
4 changes: 2 additions & 2 deletions src/Gui/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Windows/AstroWindow.hpp"
#include "Windows/RandomWindow.hpp"
#include "Windows/ObjdetectWindow.hpp"
#include "Windows/NodeEditorWindow.hpp"
#include "Windows/MicroserviceEditorWindow.hpp"

void Application::Initialize()
{
Expand All @@ -13,7 +13,7 @@ void Application::Initialize()
mWindows.push_back(std::make_unique<AstroWindow>());
mWindows.push_back(std::make_unique<RandomWindow>());
mWindows.push_back(std::make_unique<ObjdetectWindow>());
mWindows.push_back(std::make_unique<NodeEditorWindow>());
mWindows.push_back(std::make_unique<MicroserviceEditorWindow>());

for (const auto& window : mWindows)
window->Initialize();
Expand Down
27 changes: 27 additions & 0 deletions src/Gui/Windows/MicroserviceEditorWindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "MicroserviceEditorWindow.hpp"

void MicroserviceEditorWindow::Initialize()
{
editor.OnStart();
}

void MicroserviceEditorWindow::Render()
{
PROFILE_FUNCTION;
if (ImGui::BeginTabItem("MicroserviceEditor"))
{
ImGui::Separator();
if (ImGui::Button("Test"))
LaunchAsync([&]() { Test(); });

editor.OnFrame();

ImGui::EndTabItem();
}
}

void MicroserviceEditorWindow::Test()
{
editor.workflow.Run();
LOG_SUCCESS("Workflow test completed");
}
14 changes: 14 additions & 0 deletions src/Gui/Windows/MicroserviceEditorWindow.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once
#include "Window.hpp"
#include "Microservice/MicroserviceEditor.hpp"

class MicroserviceEditorWindow : public Window
{
void Test();

MicroserviceEditor editor;

public:
void Initialize() override;
void Render() override;
};
43 changes: 0 additions & 43 deletions src/Gui/Windows/NodeEditorWindow.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions src/Gui/Windows/NodeEditorWindow.hpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <imgui_node_editor.h>
#include "Microservice/Workflow.hpp"
#include "Workflow.hpp"
#include "libs/imgui-nodes/examples/blueprints-example/utilities/drawing.h"
#include "libs/imgui-nodes/examples/blueprints-example/utilities/widgets.h"

Expand All @@ -19,7 +19,7 @@ enum class PinType
Delegate,
};

struct NodeEditor
struct MicroserviceEditor
{
ed::EditorContext* context = nullptr;
bool firstFrame = true;
Expand All @@ -45,16 +45,16 @@ struct NodeEditor

void OnStop() { ed::DestroyEditor(context); }

void ImGuiEx_BeginColumn() { ImGui::BeginGroup(); }
void BeginColumn() { ImGui::BeginGroup(); }

void ImGuiEx_NextColumn()
void NextColumn()
{
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
}

void ImGuiEx_EndColumn() { ImGui::EndGroup(); }
void EndColumn() { ImGui::EndGroup(); }

ImColor GetIconColor(PinType type)
{
Expand Down Expand Up @@ -197,21 +197,21 @@ struct NodeEditor
const auto nodeSize = inputColumnTextSize + outputColumnTextSize + pinIconSize * 2 + ImGui::GetStyle().FramePadding.x * 3;
RenderNodeName(microservice.GetName(), nodeSize);

ImGuiEx_BeginColumn();
BeginColumn();

if (workflowType != WorkflowType::Simple)
RenderInputFlowPin(microservice);
for (const auto& [name, param] : microservice.GetInputParameters())
RenderInputPin(name, param);

ImGuiEx_NextColumn();
NextColumn();

if (workflowType != WorkflowType::Simple)
RenderOutputFlowPin(microservice, outputColumnTextSize);
for (const auto& [name, param] : microservice.GetOutputParameters())
RenderOutputPin(name, param, outputColumnTextSize);

ImGuiEx_EndColumn();
EndColumn();

ed::EndNode();
}
Expand Down

0 comments on commit 14aa005

Please sign in to comment.