From 94d39c5a7e0b12c16afa5c21febe08ff0a92c666 Mon Sep 17 00:00:00 2001 From: Tobias Hienzsch Date: Mon, 23 Oct 2023 19:58:30 +0200 Subject: [PATCH] [designer] Add jml_tools module --- tools/jml-designer/CMakeLists.txt | 9 +++++---- tools/jml-designer/Component/ColorPropertyComponent.cpp | 3 +-- tools/jml-designer/Core/Justification.cpp | 2 +- tools/jml-designer/Document/Document.cpp | 3 ++- tools/jml-designer/Layer/Export/ExportPanel.cpp | 3 ++- tools/jml-designer/Layer/Export/ExportPanel.hpp | 2 +- tools/jml-designer/Layer/Layer.cpp | 4 ++-- tools/jml-designer/Layers/TextLayer.cpp | 4 ++-- tools/jml-designer/Tool/ShapeTool.cpp | 4 ++-- .../{jml-designer/Core => jml_tools/graphics}/Color.cpp | 2 -- .../{jml-designer/Core => jml_tools/graphics}/Color.hpp | 2 -- tools/jml_tools/jml_tools.cpp | 2 ++ tools/jml_tools/jml_tools.hpp | 2 ++ .../{jml-designer/Core => jml_tools/value}/ValueTree.cpp | 6 ++---- .../{jml-designer/Core => jml_tools/value}/ValueTree.hpp | 6 ++---- 15 files changed, 26 insertions(+), 28 deletions(-) rename tools/{jml-designer/Core => jml_tools/graphics}/Color.cpp (92%) rename tools/{jml-designer/Core => jml_tools/graphics}/Color.hpp (84%) rename tools/{jml-designer/Core => jml_tools/value}/ValueTree.cpp (92%) rename tools/{jml-designer/Core => jml_tools/value}/ValueTree.hpp (83%) diff --git a/tools/jml-designer/CMakeLists.txt b/tools/jml-designer/CMakeLists.txt index 6d56a47..2622e84 100644 --- a/tools/jml-designer/CMakeLists.txt +++ b/tools/jml-designer/CMakeLists.txt @@ -46,12 +46,8 @@ set(sources "Component/ValuePropertyComponent.cpp" "Component/ValuePropertyComponent.hpp" - "Core/Color.cpp" - "Core/Color.hpp" "Core/Justification.cpp" "Core/Justification.hpp" - "Core/ValueTree.cpp" - "Core/ValueTree.hpp" "Core/ValueTreeObject.hpp" "Core/ValueTreeObjectList.hpp" @@ -139,7 +135,12 @@ target_include_directories(jml-designer target_link_libraries(jml-designer PRIVATE juce::juce_gui_extra + jml::jml_tools + PUBLIC + lua::lua + sol2::sol2 + JMLDesigner_BinaryData juce::juce_recommended_warning_flags ) diff --git a/tools/jml-designer/Component/ColorPropertyComponent.cpp b/tools/jml-designer/Component/ColorPropertyComponent.cpp index f73d7ff..c43a037 100644 --- a/tools/jml-designer/Component/ColorPropertyComponent.cpp +++ b/tools/jml-designer/Component/ColorPropertyComponent.cpp @@ -1,7 +1,6 @@ #include "ColorPropertyComponent.hpp" -#include "Core/Color.hpp" -#include "Core/ValueTree.hpp" +#include namespace jml::designer { diff --git a/tools/jml-designer/Core/Justification.cpp b/tools/jml-designer/Core/Justification.cpp index 14b5420..430af36 100644 --- a/tools/jml-designer/Core/Justification.cpp +++ b/tools/jml-designer/Core/Justification.cpp @@ -1,6 +1,6 @@ #include "Justification.hpp" -#include "Core/ValueTree.hpp" +#include namespace jml::designer { diff --git a/tools/jml-designer/Document/Document.cpp b/tools/jml-designer/Document/Document.cpp index 7851349..7bb772d 100644 --- a/tools/jml-designer/Document/Document.cpp +++ b/tools/jml-designer/Document/Document.cpp @@ -1,10 +1,11 @@ #include "Document.hpp" -#include "Core/ValueTree.hpp" #include "Layers/GroupLayer.hpp" #include "Layers/ShapeLayer.hpp" #include "Layers/TextLayer.hpp" +#include + namespace jml::designer { Document::Document(juce::ValueTree valueTree, juce::UndoManager* um) diff --git a/tools/jml-designer/Layer/Export/ExportPanel.cpp b/tools/jml-designer/Layer/Export/ExportPanel.cpp index a72aea2..130c5b9 100644 --- a/tools/jml-designer/Layer/Export/ExportPanel.cpp +++ b/tools/jml-designer/Layer/Export/ExportPanel.cpp @@ -1,7 +1,8 @@ #include "ExportPanel.hpp" #include "Component/PropertyPanel.hpp" -#include "Core/ValueTree.hpp" + +#include namespace jml::designer { diff --git a/tools/jml-designer/Layer/Export/ExportPanel.hpp b/tools/jml-designer/Layer/Export/ExportPanel.hpp index 8271ff0..3ea634a 100644 --- a/tools/jml-designer/Layer/Export/ExportPanel.hpp +++ b/tools/jml-designer/Layer/Export/ExportPanel.hpp @@ -1,9 +1,9 @@ #pragma once -#include "Core/ValueTree.hpp" #include "Layer/Export/ImageExporter.hpp" #include "Layer/LayerSelection.hpp" +#include #include namespace jml::designer { diff --git a/tools/jml-designer/Layer/Layer.cpp b/tools/jml-designer/Layer/Layer.cpp index 50dc3b0..8f16b24 100644 --- a/tools/jml-designer/Layer/Layer.cpp +++ b/tools/jml-designer/Layer/Layer.cpp @@ -1,8 +1,8 @@ #include "Layer.hpp" #include "Component/PropertyPanel.hpp" -#include "Core/Color.hpp" -#include "Core/ValueTree.hpp" + +#include namespace jml::designer { diff --git a/tools/jml-designer/Layers/TextLayer.cpp b/tools/jml-designer/Layers/TextLayer.cpp index a852689..e8eab2d 100644 --- a/tools/jml-designer/Layers/TextLayer.cpp +++ b/tools/jml-designer/Layers/TextLayer.cpp @@ -1,9 +1,9 @@ #include "TextLayer.hpp" #include "Component/PropertyPanel.hpp" -#include "Core/Color.hpp" #include "Core/Justification.hpp" -#include "Core/ValueTree.hpp" + +#include namespace jml::designer { diff --git a/tools/jml-designer/Tool/ShapeTool.cpp b/tools/jml-designer/Tool/ShapeTool.cpp index 8b0f78a..f6a7a01 100644 --- a/tools/jml-designer/Tool/ShapeTool.cpp +++ b/tools/jml-designer/Tool/ShapeTool.cpp @@ -1,10 +1,10 @@ #include "ShapeTool.hpp" -#include "Core/Color.hpp" -#include "Core/ValueTree.hpp" #include "Document/DocumentCanvas.hpp" #include "Layers/ShapeLayer.hpp" +#include + namespace jml::designer { ShapeTool::ShapeTool(DocumentCanvas& c, Shape shape) noexcept : Tool{c}, _shape{shape} diff --git a/tools/jml-designer/Core/Color.cpp b/tools/jml_tools/graphics/Color.cpp similarity index 92% rename from tools/jml-designer/Core/Color.cpp rename to tools/jml_tools/graphics/Color.cpp index d47189d..1990901 100644 --- a/tools/jml-designer/Core/Color.cpp +++ b/tools/jml_tools/graphics/Color.cpp @@ -1,5 +1,3 @@ -#include "Color.hpp" - auto juce::VariantConverter::fromVar(juce::var const& v) -> juce::Colour { return juce::Colour::fromString(v.toString()); diff --git a/tools/jml-designer/Core/Color.hpp b/tools/jml_tools/graphics/Color.hpp similarity index 84% rename from tools/jml-designer/Core/Color.hpp rename to tools/jml_tools/graphics/Color.hpp index d44e753..c8e4001 100644 --- a/tools/jml-designer/Core/Color.hpp +++ b/tools/jml_tools/graphics/Color.hpp @@ -1,7 +1,5 @@ #pragma once -#include - template<> struct juce::VariantConverter { diff --git a/tools/jml_tools/jml_tools.cpp b/tools/jml_tools/jml_tools.cpp index 2c78baa..2ba3a8c 100644 --- a/tools/jml_tools/jml_tools.cpp +++ b/tools/jml_tools/jml_tools.cpp @@ -2,4 +2,6 @@ #include "BinaryData.hpp" +#include "graphics/Color.cpp" // NOLINT #include "graphics/Drawable.cpp" // NOLINT +#include "value/ValueTree.cpp" // NOLINT diff --git a/tools/jml_tools/jml_tools.hpp b/tools/jml_tools/jml_tools.hpp index 8df1464..3a02152 100644 --- a/tools/jml_tools/jml_tools.hpp +++ b/tools/jml_tools/jml_tools.hpp @@ -22,4 +22,6 @@ END_JUCE_MODULE_DECLARATION #include +#include "graphics/Color.hpp" #include "graphics/Drawable.hpp" +#include "value/ValueTree.hpp" diff --git a/tools/jml-designer/Core/ValueTree.cpp b/tools/jml_tools/value/ValueTree.cpp similarity index 92% rename from tools/jml-designer/Core/ValueTree.cpp rename to tools/jml_tools/value/ValueTree.cpp index 7c1bceb..0d0a51d 100644 --- a/tools/jml-designer/Core/ValueTree.cpp +++ b/tools/jml_tools/value/ValueTree.cpp @@ -1,6 +1,4 @@ -#include "ValueTree.hpp" - -namespace jml::designer { +namespace jml { auto loadValueTree(juce::File const& file, bool asXml) -> juce::ValueTree { @@ -42,4 +40,4 @@ auto saveValueTree(juce::ValueTree const& v, juce::File const& file, bool asXml) return false; } -} // namespace jml::designer +} // namespace jml diff --git a/tools/jml-designer/Core/ValueTree.hpp b/tools/jml_tools/value/ValueTree.hpp similarity index 83% rename from tools/jml-designer/Core/ValueTree.hpp rename to tools/jml_tools/value/ValueTree.hpp index cfdc9eb..89f4536 100644 --- a/tools/jml-designer/Core/ValueTree.hpp +++ b/tools/jml_tools/value/ValueTree.hpp @@ -1,8 +1,6 @@ #pragma once -#include - -namespace jml::designer { +namespace jml { template [[nodiscard]] auto toVar(T const& v) -> juce::var @@ -25,4 +23,4 @@ template [[nodiscard]] auto loadValueTree(juce::File const& file, bool asXml) -> juce::ValueTree; auto saveValueTree(juce::ValueTree const& v, juce::File const& file, bool asXml) -> bool; -} // namespace jml::designer +} // namespace jml