Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void Editor::Init(const std::string& initial_file)
_factory->RegisterInputType<std::chrono::days>(std::chrono::days::zero());
_factory->RegisterInputType<std::chrono::months>(std::chrono::months::zero());
_factory->RegisterInputType<std::chrono::years>(std::chrono::years::zero());
_factory->RegisterInputType<std::filesystem::path>(std::filesystem::path(""));

auto node_explorer = std::make_shared<NodeExplorerWindow>(_env);
OnActiveGraphChanged.Bind("NodeExplorer", [window = node_explorer](const auto& g) { window->SetActiveGraph(g); });
Expand Down
14 changes: 14 additions & 0 deletions src/utilities/Widgets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include "Core.hpp"
#include "FileExplorer.hpp"
#include "Style.hpp"

#include <flow/core/Concepts.hpp>
Expand All @@ -16,6 +17,7 @@
#include <imgui_stdlib.h>

#include <chrono>
#include <filesystem>
#include <stdexcept>

FLOW_UI_SUBNAMESPACE_START(widgets)
Expand Down Expand Up @@ -210,4 +212,16 @@ inline bool InputField<std::chrono::years>(std::string_view name, std::chrono::y
return InputChrono(name, value, flags);
}

template<>
inline bool InputField<std::filesystem::path>(std::string_view, std::filesystem::path& value, ImGuiInputTextFlags)
{
if (ImGui::Button("Select File"))
{
value = FileExplorer::Load(FileExplorer::GetDocumentsPath(), "", "*");
return true;
}

return false;
}

FLOW_UI_SUBNAMESPACE_END
2 changes: 1 addition & 1 deletion src/views/PortView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void PortView::DrawLabel()
if (!_show_label) return;

ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted(std::string{Name()}.c_str());
ImGui::TextUnformatted(std::string{Name().substr(0, Name().find("##"))}.c_str());
}

void PortView::DrawIcon(float alpha) { ::flow::ui::DrawPinIcon(*this, IsConnected(), static_cast<int>(alpha * 255)); }
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/InputField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <imgui.h>

#include <filesystem>

FLOW_UI_SUBNAMESPACE_START(widgets)

template<typename T>
Expand Down Expand Up @@ -44,5 +46,6 @@ template class Input<std::chrono::days>;
template class Input<std::chrono::weeks>;
template class Input<std::chrono::months>;
template class Input<std::chrono::years>;
template class Input<std::filesystem::path>;

FLOW_UI_SUBNAMESPACE_END