diff --git a/common/generic_type_info.hh b/common/generic_type_info.hh index c4515f3..cfe5b47 100644 --- a/common/generic_type_info.hh +++ b/common/generic_type_info.hh @@ -14,18 +14,13 @@ namespace nf7 { -template -concept GenericTypeInfo_UpdateTooltip_ = requires() { T::UpdateTypeTooltip(); }; - -template -concept GenericTypeInfo_Description_ = requires() { T::kTypeDescription; }; - - template class GenericTypeInfo : public nf7::File::TypeInfo { public: - GenericTypeInfo(const std::string& name, std::unordered_set&& v) noexcept : - TypeInfo(name, AddFlags(std::move(v))) { + GenericTypeInfo(const std::string& name, + std::unordered_set&& v, + const std::string& desc = "(no description)") noexcept : + TypeInfo(name, AddFlags(std::move(v))), desc_(desc) { } std::unique_ptr Deserialize(nf7::Deserializer& ar) const override @@ -47,16 +42,12 @@ class GenericTypeInfo : public nf7::File::TypeInfo { } void UpdateTooltip() const noexcept override { - if constexpr (nf7::GenericTypeInfo_UpdateTooltip_) { - T::UpdateTypeTooltip(); - } else if constexpr (nf7::GenericTypeInfo_Description_) { - ImGui::TextUnformatted(T::kTypeDescription); - } else { - ImGui::TextUnformatted("(no description)"); - } + ImGui::TextUnformatted(desc_.c_str()); } private: + std::string desc_; + static std::unordered_set AddFlags( std::unordered_set&& flags) noexcept { if (std::is_constructible::value) { diff --git a/file/audio_context.cc b/file/audio_context.cc index 562ee87..2296cf7 100644 --- a/file/audio_context.cc +++ b/file/audio_context.cc @@ -22,15 +22,7 @@ namespace { class AudioContext final : public nf7::File, public nf7::DirItem { public: static inline const nf7::GenericTypeInfo kType = { - "Audio/Context", {"nf7::DirItem",}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Drives miniaudio context."); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::audio::Queue"); - ImGui::Bullet(); ImGui::TextUnformatted( - "there's no merit to use multiple contexts"); - ImGui::Bullet(); ImGui::TextUnformatted( - "the context remains alive after file deletion until unused"); - } + "Audio/Context", {"nf7::DirItem",}, "drives miniaudio context"}; class Queue; diff --git a/file/audio_device.cc b/file/audio_device.cc index c162581..d966262 100644 --- a/file/audio_device.cc +++ b/file/audio_device.cc @@ -50,10 +50,8 @@ class Device final : public nf7::FileBase, public nf7::GenericConfig, public nf7::DirItem, public nf7::Node { public: static inline const nf7::GenericTypeInfo kType = { - "Audio/Device", {"nf7::DirItem",}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Provides a ring buffer to send/receive PCM samples."); - } + "Audio/Device", {"nf7::DirItem",}, + "provides a ring buffer to send/receive PCM samples"}; class Instance; class Lambda; diff --git a/file/font_context.cc b/file/font_context.cc index e2f9d20..6431542 100644 --- a/file/font_context.cc +++ b/file/font_context.cc @@ -22,15 +22,7 @@ namespace { class FontContext final : public nf7::File, public nf7::DirItem { public: static inline const nf7::GenericTypeInfo kType = { - "Font/Context", {"nf7::DirItem",}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Drives freetype context."); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::font::Queue"); - ImGui::Bullet(); ImGui::TextUnformatted( - "there's few merit to use multiple contexts"); - ImGui::Bullet(); ImGui::TextUnformatted( - "the context remains alive after file deletion until unused"); - } + "Font/Context", {"nf7::DirItem",}, "drives freetype context"}; class Queue; diff --git a/file/gl_obj.cc b/file/gl_obj.cc index 5a45239..6a1eb44 100644 --- a/file/gl_obj.cc +++ b/file/gl_obj.cc @@ -91,10 +91,6 @@ class ObjBase : public nf7::FileBase, struct TypeInfo; - static void UpdateTypeTooltip() noexcept { - T::UpdateTypeTooltip(); - } - ObjBase(nf7::Env& env, T&& data = {}) noexcept : nf7::FileBase(TypeInfo::kType, env), nf7::GenericConfig(mem_), @@ -288,10 +284,6 @@ class ObjBase : public nf7::FileBase, struct Buffer { public: - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("OpenGL buffer"); - } - static inline const std::vector kInputs = { "upload", }; @@ -392,16 +384,13 @@ struct Buffer { }; template <> struct ObjBase::TypeInfo final { - static inline const nf7::GenericTypeInfo> kType = {"GL/Buffer", {"nf7::DirItem"}}; + static inline const nf7::GenericTypeInfo> kType = { + "GL/Buffer", {"nf7::DirItem"}, "OpenGL buffer"}; }; struct Texture { public: - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("OpenGL texture"); - } - static inline const std::vector kInputs = { "upload", "download", }; @@ -676,16 +665,13 @@ struct Texture { }; template <> struct ObjBase::TypeInfo final { - static inline const nf7::GenericTypeInfo> kType = {"GL/Texture", {"nf7::DirItem"}}; + static inline const nf7::GenericTypeInfo> kType = { + "GL/Texture", {"nf7::DirItem"}, "OpenGL texture"}; }; struct Shader { public: - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("OpenGL shader"); - } - static inline const std::vector kInputs = {}; static inline const std::vector kOutputs = {}; @@ -768,16 +754,13 @@ struct Shader { }; template <> struct ObjBase::TypeInfo final { - static inline const nf7::GenericTypeInfo> kType = {"GL/Shader", {"nf7::DirItem"}}; + static inline const nf7::GenericTypeInfo> kType = { + "GL/Shader", {"nf7::DirItem"}, "OpenGL shader"}; }; struct Program { public: - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("OpenGL program"); - } - static inline const std::vector kInputs = { "draw", }; @@ -1056,16 +1039,13 @@ struct Program { }; template <> struct ObjBase::TypeInfo final { - static inline const nf7::GenericTypeInfo> kType = {"GL/Program", {"nf7::DirItem"}}; + static inline const nf7::GenericTypeInfo> kType = { + "GL/Program", {"nf7::DirItem"}, "OpenGL program"}; }; struct VertexArray { public: - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("OpenGL Vertex Array Object"); - } - static inline const std::vector kInputs = { }; static inline const std::vector kOutputs = { @@ -1250,21 +1230,17 @@ struct VertexArray { }; template <> struct ObjBase::TypeInfo final { - static inline const nf7::GenericTypeInfo> kType = {"GL/VertexArray", {"nf7::DirItem"}}; + static inline const nf7::GenericTypeInfo> kType = { + "GL/VertexArray", {"nf7::DirItem"}, "OpenGL vertex array"}; }; struct Framebuffer { public: - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("OpenGL Framebuffer Object"); - } - static inline const std::vector kInputs = { "clear", "blit", }; - static inline const std::vector kOutputs = { - }; + static inline const std::vector kOutputs = {}; using Product = nf7::gl::Framebuffer; @@ -1435,7 +1411,8 @@ struct Framebuffer { }; template <> struct ObjBase::TypeInfo final { - static inline const nf7::GenericTypeInfo> kType = {"GL/Framebuffer", {"nf7::DirItem"}}; + static inline const nf7::GenericTypeInfo> kType = { + "GL/Framebuffer", {"nf7::DirItem"}, "OpenGL framebuffer"}; }; } diff --git a/file/luajit_context.cc b/file/luajit_context.cc index 76b4710..64fb84f 100644 --- a/file/luajit_context.cc +++ b/file/luajit_context.cc @@ -21,16 +21,8 @@ namespace { class LuaContext final : public nf7::File, public nf7::DirItem { public: static inline const nf7::GenericTypeInfo kType = { - "LuaJIT/Context", {"nf7::DirItem",}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Drives LuaJIT thread and task queue."); - ImGui::Bullet(); ImGui::TextUnformatted( - "implements nf7::luajit::Queue"); - ImGui::Bullet(); ImGui::TextUnformatted( - "create multiple contexts to execute LuaJIT paralelly"); - ImGui::Bullet(); ImGui::TextUnformatted( - "the thread remains alive after file deletion until unused"); - } + "LuaJIT/Context", {"nf7::DirItem",}, + "drives LuaJIT thread and task queue"}; class Queue; diff --git a/file/luajit_node.cc b/file/luajit_node.cc index 062322a..7a484da 100644 --- a/file/luajit_node.cc +++ b/file/luajit_node.cc @@ -43,11 +43,10 @@ namespace { class Node final : public nf7::FileBase, public nf7::GenericConfig, public nf7::DirItem, public nf7::Node { public: - static inline const nf7::GenericTypeInfo kType = - {"LuaJIT/Node", {"nf7::DirItem", "nf7::Node"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Defines new pure Node without creating nfile."); - } + static inline const nf7::GenericTypeInfo kType = { + "LuaJIT/Node", {"nf7::DirItem", "nf7::Node"}, + "defines new pure Node without creating nfile" + }; class Lambda; diff --git a/file/node_imm.cc b/file/node_imm.cc index ee1cf59..a666599 100644 --- a/file/node_imm.cc +++ b/file/node_imm.cc @@ -34,15 +34,9 @@ namespace { class Imm final : public nf7::FileBase, public nf7::DirItem, public nf7::Node { public: - static inline const nf7::GenericTypeInfo kType = - {"Node/Imm", {"nf7::DirItem", "nf7::Node"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Emits an immediate value when get an input."); - ImGui::Bullet(); ImGui::TextUnformatted( - "implements nf7::Node"); - ImGui::Bullet(); ImGui::TextUnformatted( - "changes will be applied to active lambdas immediately"); - } + static inline const nf7::GenericTypeInfo kType = { + "Node/Imm", {"nf7::DirItem", "nf7::Node"}, + "emits an immediate value when get an input"}; class Lambda; diff --git a/file/node_network.cc b/file/node_network.cc index d83efe7..1bb62b0 100644 --- a/file/node_network.cc +++ b/file/node_network.cc @@ -54,13 +54,9 @@ class Network final : public nf7::FileBase, public nf7::GenericConfig, public nf7::DirItem, public nf7::Node { public: static inline const GenericTypeInfo kType = { - "Node/Network", {"nf7::DirItem"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("A Node composed of multiple child Nodes, whose sockets are linked to each other"); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - ImGui::Bullet(); ImGui::TextUnformatted( - "connection changes will be applied to active lambdas immediately"); - } + "Node/Network", {"nf7::DirItem"}, + "defines new Node by child Nodes and their links", + }; class InternalNode; @@ -683,12 +679,9 @@ class Network::Initiator final : public nf7::File, public Network::InternalNode { public: static inline const nf7::GenericTypeInfo kType = { - "Node/Network/Initiator", {}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted( - "Emits a pulse immediately when Node/Network gets the first input."); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - } + "Node/Network/Initiator", {}, + "emits a pulse immediately when Node/Network gets the first input", + }; Initiator(nf7::Env& env) noexcept : nf7::File(kType, env), nf7::Node(nf7::Node::kCustomNode) { diff --git a/file/node_ref.cc b/file/node_ref.cc index cc05067..92e60d4 100644 --- a/file/node_ref.cc +++ b/file/node_ref.cc @@ -36,16 +36,7 @@ namespace { class Ref final : public nf7::FileBase, public nf7::Node { public: static inline const nf7::GenericTypeInfo kType = { - "Node/Ref", {"nf7::Node"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Refers other Node."); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - ImGui::Bullet(); ImGui::TextUnformatted( - "the referencee's changes won't be applied to active lambdas " - "until their recreation"); - ImGui::Bullet(); ImGui::TextUnformatted( - "press 'sync' button on Node UI to resolve socket issues"); - } + "Node/Ref", {"nf7::Node"}, "refers other Node"}; class Lambda; diff --git a/file/node_singleton.cc b/file/node_singleton.cc index 2ec6c93..a1b070c 100644 --- a/file/node_singleton.cc +++ b/file/node_singleton.cc @@ -28,10 +28,9 @@ class Singleton final : public nf7::FileBase, public nf7::DirItem, public nf7::GenericConfig, public nf7::Node { public: static inline const nf7::GenericTypeInfo kType = { - "Node/Singleton", {"nf7::DirItem",}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Shares a single lambda between multiple callers."); - } + "Node/Singleton", {"nf7::DirItem",}, + "shares a single lambda between multiple callers", + }; class SharedLambda; class Lambda; diff --git a/file/sequencer_adaptor.cc b/file/sequencer_adaptor.cc index e5784c5..f78efc2 100644 --- a/file/sequencer_adaptor.cc +++ b/file/sequencer_adaptor.cc @@ -32,15 +32,10 @@ namespace { class Adaptor final : public nf7::FileBase, public nf7::Sequencer { public: - static inline const nf7::GenericTypeInfo kType = - {"Sequencer/Adaptor", {"nf7::Sequencer"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Wraps and Adapts other Sequencer."); - ImGui::Bullet(); ImGui::TextUnformatted( - "implements nf7::Sequencer"); - ImGui::Bullet(); ImGui::TextUnformatted( - "changes will be applied to active lambdas immediately"); - } + static inline const nf7::GenericTypeInfo kType = { + "Sequencer/Adaptor", {"nf7::Sequencer"}, + "wraps and adapts other Sequencer", + }; class Session; class Lambda; diff --git a/file/sequencer_call.cc b/file/sequencer_call.cc index 4831d1b..e6c9875 100644 --- a/file/sequencer_call.cc +++ b/file/sequencer_call.cc @@ -28,14 +28,9 @@ namespace { class Call final : public nf7::FileBase, public nf7::Sequencer { public: static inline const nf7::GenericTypeInfo kType = { - "Sequencer/Call", {"nf7::Sequencer"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Calls a Node."); - ImGui::Bullet(); ImGui::TextUnformatted( - "implements nf7::Sequencer"); - ImGui::Bullet(); ImGui::TextUnformatted( - "changes will be applied to active lambdas immediately"); - } + "Sequencer/Call", {"nf7::Sequencer"}, + "calls an external Node as a Sequencer", + }; class Lambda; class SessionLambda; diff --git a/file/sequencer_timeline.cc b/file/sequencer_timeline.cc index a343880..d1c6dce 100644 --- a/file/sequencer_timeline.cc +++ b/file/sequencer_timeline.cc @@ -47,11 +47,8 @@ namespace { class TL final : public nf7::FileBase, public nf7::DirItem, public nf7::Node { public: static inline const nf7::GenericTypeInfo kType = { - "Sequencer/Timeline", {"nf7::DirItem"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Timeline data"); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - } + "Sequencer/Timeline", {"nf7::DirItem"}, + }; struct Timing; diff --git a/file/system_dir.cc b/file/system_dir.cc index 56f3d74..456344f 100644 --- a/file/system_dir.cc +++ b/file/system_dir.cc @@ -34,8 +34,9 @@ namespace { class Dir final : public nf7::FileBase, public nf7::DirItem { public: - static inline const GenericTypeInfo kType = {"System/Dir", {"nf7::DirItem"}}; - static constexpr const char* kTypeDescription = "generic directory"; + static inline const nf7::GenericTypeInfo kType = { + "System/Dir", {"nf7::DirItem"}, "generic directory", + }; using ItemMap = std::map>; diff --git a/file/system_logger.cc b/file/system_logger.cc index 0c4a0f5..787f3d0 100644 --- a/file/system_logger.cc +++ b/file/system_logger.cc @@ -40,15 +40,8 @@ class Logger final : public nf7::FileBase, public nf7::GenericConfig, public nf7::DirItem { public: static inline const nf7::GenericTypeInfo kType = { - "System/Logger", {"nf7::DirItem"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Records log output from other files."); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Logger"); - ImGui::Bullet(); ImGui::TextUnformatted( - "logged are children and grandchildren of a dir that has this with name '_logger'"); - ImGui::Bullet(); ImGui::TextUnformatted( - "recorded logs won't be permanentized"); - } + "System/Logger", {"nf7::DirItem"}, "records log output from other files", + }; struct Row final { public: diff --git a/file/system_nfile.cc b/file/system_nfile.cc index 4a7b720..5848590 100644 --- a/file/system_nfile.cc +++ b/file/system_nfile.cc @@ -41,11 +41,9 @@ class NFile final : public nf7::FileBase, public nf7::GenericConfig, public nf7::DirItem, public nf7::Node { public: static inline const nf7::GenericTypeInfo kType = { - "System/NFile", {"nf7::DirItem"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("Read/Write a file placed on native filesystem."); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - } + "System/NFile", {"nf7::DirItem"}, + "read/write a file placed on native filesystem", + }; class Lambda; diff --git a/file/system_node.cc b/file/system_node.cc index 89c9580..6d461f6 100644 --- a/file/system_node.cc +++ b/file/system_node.cc @@ -17,7 +17,7 @@ class Save final : public nf7::Node::Lambda, public std::enable_shared_from_this { public: static inline nf7::GenericTypeInfo> kType = { - "System/Node/Save", {"nf7::DirItem"}, + "System/Node/Save", {}, }; static inline const nf7::Node::Meta kMeta = { {"exec"}, {}, }; @@ -32,7 +32,7 @@ class Save final : public nf7::Node::Lambda, class Exit final : public nf7::Node::Lambda { public: static inline nf7::GenericTypeInfo> kType = { - "System/Node/Exit", {"nf7::DirItem"}, + "System/Node/Exit", {}, }; static inline const nf7::Node::Meta kMeta = { {"exec"}, {}, }; @@ -45,7 +45,7 @@ class Exit final : public nf7::Node::Lambda { class Panic final : public nf7::Node::Lambda { public: static inline nf7::GenericTypeInfo> kType = { - "System/Node/Panic", {"nf7::DirItem"}, + "System/Node/Panic", {}, }; static inline const nf7::Node::Meta kMeta = { {"exec"}, {}, }; diff --git a/file/value_curve.cc b/file/value_curve.cc index e61dce8..751064b 100644 --- a/file/value_curve.cc +++ b/file/value_curve.cc @@ -35,15 +35,10 @@ class Curve final : public nf7::FileBase, public nf7::Node, public nf7::Sequencer { public: - static inline const nf7::GenericTypeInfo kType = - {"Value/Curve", {"nf7::DirItem", "nf7::Node", "nf7::Sequencer"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("bezier curve"); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Sequencer"); - ImGui::Bullet(); ImGui::TextUnformatted( - "changes will be applied to active lambdas immediately"); - } + static inline const nf7::GenericTypeInfo kType = { + "Value/Curve", {"nf7::DirItem", "nf7::Node", "nf7::Sequencer"}, + "bezier curve editor", + }; class NodeLambda; class SeqLambda; diff --git a/file/value_plot.cc b/file/value_plot.cc index 80c1a25..b4a2979 100644 --- a/file/value_plot.cc +++ b/file/value_plot.cc @@ -43,11 +43,7 @@ class Plot final : public nf7::FileBase, public nf7::Node { public: static inline const nf7::GenericTypeInfo kType = - {"Value/Plot", {"nf7::DirItem"}}; - static void UpdateTypeTooltip() noexcept { - ImGui::TextUnformatted("plotter"); - ImGui::Bullet(); ImGui::TextUnformatted("implements nf7::Node"); - } + {"Value/Plot", {"nf7::DirItem"}, "data plotter"}; class Lambda;