From 33ea03c76c595277f440784c8904bec4778d7e2d Mon Sep 17 00:00:00 2001 From: Anthony Rabine Date: Wed, 13 Dec 2023 13:44:23 +0100 Subject: [PATCH] [EDITOR] new resource manager --- .gitmodules | 3 - .../CMakeLists.txt | 0 .../assets/build.png | Bin .../assets/build.svg | 0 .../assets/check-mark.png | Bin .../assets/close-outline.svg | 0 .../assets/file-document-plus-outline.png | Bin .../assets/file-document-plus-outline.svg | 0 .../assets/floppy.svg | 0 .../assets/folder-open-outline.svg | 0 .../assets/folder-open.svg | 0 .../assets/home.png | Bin .../assets/left.png | Bin .../assets/pause-button.png | Bin .../assets/play-circle-green.png | Bin .../assets/play-circle-green.svg | 0 .../assets/play-circle.png | Bin .../assets/play-circle.svg | 0 .../assets/right.png | Bin .../assets/volume-high.svg | 0 .../assets/volume-off.png | Bin .../assets/volume-off.svg | 0 .../assets/welcome.png | Bin .../example.asm | 0 {story-editor => story-editor-legacy}/icon.rc | 0 .../nodeeditor/CMakeLists.txt | 0 .../nodeeditor/LICENSE.rst | 0 .../nodeeditor/README.rst | 0 .../include/QtNodes/AbstractGraphModel | 0 .../include/QtNodes/AbstractNodePainter | 0 .../include/QtNodes/BasicGraphicsScene | 0 .../include/QtNodes/ConnectionIdUtils | 0 .../include/QtNodes/ConnectionStyle | 0 .../include/QtNodes/DataFlowGraphModel | 0 .../include/QtNodes/DataFlowGraphicsScene | 0 .../include/QtNodes/DefaultNodePainter | 0 .../nodeeditor/include/QtNodes/Definitions | 0 .../nodeeditor/include/QtNodes/GraphicsView | 0 .../include/QtNodes/GraphicsViewStyle | 0 .../nodeeditor/include/QtNodes/NodeData | 0 .../include/QtNodes/NodeDelegateModel | 0 .../include/QtNodes/NodeDelegateModelRegistry | 0 .../nodeeditor/include/QtNodes/NodeGeometry | 0 .../nodeeditor/include/QtNodes/NodeState | 0 .../nodeeditor/include/QtNodes/NodeStyle | 0 .../include/QtNodes/StyleCollection | 0 .../nodeeditor/include/QtNodes/UndoCommands | 0 .../QtNodes/internal/AbstractGraphModel.hpp | 0 .../QtNodes/internal/AbstractNodeGeometry.hpp | 0 .../QtNodes/internal/AbstractNodePainter.hpp | 0 .../QtNodes/internal/BasicGraphicsScene.hpp | 0 .../include/QtNodes/internal/Compiler.hpp | 0 .../internal/ConnectionGraphicsObject.hpp | 0 .../QtNodes/internal/ConnectionIdHash.hpp | 0 .../QtNodes/internal/ConnectionIdUtils.hpp | 0 .../QtNodes/internal/ConnectionPainter.hpp | 0 .../QtNodes/internal/ConnectionState.hpp | 0 .../QtNodes/internal/ConnectionStyle.hpp | 0 .../QtNodes/internal/DataFlowGraphModel.hpp | 0 .../internal/DataFlowGraphicsScene.hpp | 0 .../DefaultHorizontalNodeGeometry.hpp | 0 .../QtNodes/internal/DefaultNodePainter.hpp | 0 .../internal/DefaultVerticalNodeGeometry.hpp | 0 .../include/QtNodes/internal/Definitions.hpp | 0 .../include/QtNodes/internal/Export.hpp | 0 .../include/QtNodes/internal/GraphicsView.hpp | 0 .../QtNodes/internal/GraphicsViewStyle.hpp | 0 .../internal/NodeConnectionInteraction.hpp | 0 .../include/QtNodes/internal/NodeData.hpp | 0 .../QtNodes/internal/NodeDelegateModel.hpp | 0 .../internal/NodeDelegateModelRegistry.hpp | 0 .../QtNodes/internal/NodeGraphicsObject.hpp | 0 .../include/QtNodes/internal/NodeState.hpp | 0 .../include/QtNodes/internal/NodeStyle.hpp | 0 .../QtNodes/internal/OperatingSystem.hpp | 0 .../QtNodes/internal/QStringStdHash.hpp | 0 .../include/QtNodes/internal/QUuidStdHash.hpp | 0 .../include/QtNodes/internal/Serializable.hpp | 0 .../include/QtNodes/internal/Style.hpp | 0 .../QtNodes/internal/StyleCollection.hpp | 0 .../include/QtNodes/internal/UndoCommands.hpp | 0 .../include/QtNodes/internal/locateNode.hpp | 0 .../nodeeditor/resources/DefaultStyle.json | 0 .../nodeeditor/resources/resources.qrc | 0 .../nodeeditor/src/AbstractGraphModel.cpp | 0 .../nodeeditor/src/AbstractNodeGeometry.cpp | 0 .../nodeeditor/src/BasicGraphicsScene.cpp | 0 .../src/ConnectionGraphicsObject.cpp | 0 .../nodeeditor/src/ConnectionPainter.cpp | 0 .../nodeeditor/src/ConnectionState.cpp | 0 .../nodeeditor/src/ConnectionStyle.cpp | 0 .../nodeeditor/src/DataFlowGraphModel.cpp | 0 .../nodeeditor/src/DataFlowGraphicsScene.cpp | 0 .../src/DefaultHorizontalNodeGeometry.cpp | 0 .../nodeeditor/src/DefaultNodePainter.cpp | 0 .../src/DefaultVerticalNodeGeometry.cpp | 0 .../nodeeditor/src/Definitions.cpp | 0 .../nodeeditor/src/GraphicsView.cpp | 0 .../nodeeditor/src/GraphicsViewStyle.cpp | 0 .../src/NodeConnectionInteraction.cpp | 0 .../nodeeditor/src/NodeDelegateModel.cpp | 0 .../src/NodeDelegateModelRegistry.cpp | 0 .../nodeeditor/src/NodeGraphicsObject.cpp | 0 .../nodeeditor/src/NodeState.cpp | 0 .../nodeeditor/src/NodeStyle.cpp | 0 .../nodeeditor/src/StyleCollection.cpp | 0 .../nodeeditor/src/UndoCommands.cpp | 0 .../nodeeditor/src/locateNode.cpp | 0 .../nsis-installer.nsi | 0 .../ost_convert/CMakeLists.txt | 0 .../ost_convert/command_line.cpp | 0 .../ost_convert/command_line.h | 0 .../ost_convert/json.hpp | 0 .../ost_convert/main.cpp | 0 .../ost_convert/miniz.c | 0 .../ost_convert/miniz.h | 0 .../ost_convert/ni_parser.c | 0 .../ost_convert/ni_parser.h | 0 .../ost_convert/pack_archive.cpp | 0 .../ost_convert/pack_archive.h | 0 .../ost_convert/zip.cpp | 0 .../ost_convert/zip.h | 0 .../scripts/media.asm | 0 .../src/about.ui | 0 .../src/choose-file.ui | 0 .../src/code_editor.cpp | 0 .../src/code_editor.h | 0 .../src/dock_widget_base.cpp | 0 .../src/dock_widget_base.h | 0 .../src/dr_mp3.h | 0 .../src/event-node.ui | 0 .../src/event_node_model.cpp | 0 .../src/event_node_model.h | 0 .../src/graph.cpp | 0 .../src/graph.h | 0 .../src/highlighter.cpp | 0 .../src/highlighter.h | 0 .../src/json.hpp | 0 .../src/log_dock.cpp | 0 .../src/log_dock.h | 0 .../src/main.cpp | 0 .../src/main_window.cpp | 0 .../src/main_window.h | 0 .../src/media-node.ui | 0 .../src/media_converter.cpp | 0 .../src/media_converter.h | 0 .../src/media_node_model.cpp | 0 .../src/media_node_model.h | 0 .../src/memory_view_dock.cpp | 0 .../src/memory_view_dock.h | 0 .../src/new-project.ui | 0 .../src/new_project_dialog.cpp | 0 .../src/new_project_dialog.h | 0 .../src/ost-data.ui | 0 .../src/ost-editor.qrc | 0 .../src/ost-hmi.ui | 0 .../src/ost-log.ui | 0 .../src/ost-resources.ui | 0 .../src/ost-script.ui | 0 .../src/ost-vm.ui | 0 .../src/ost_wrapper.cpp | 0 .../src/ost_wrapper.h | 0 .../src/osthmi_dock.cpp | 0 .../src/osthmi_dock.h | 0 .../src/resource_model.cpp | 0 .../src/resource_model.h | 0 .../src/resources_dock.cpp | 0 .../src/resources_dock.h | 0 .../src/script_editor_dock.cpp | 0 .../src/script_editor_dock.h | 0 .../src/stb_image.h | 0 .../src/story_graph_model.cpp | 0 .../src/story_graph_model.h | 0 .../src/story_graph_scene.cpp | 0 .../src/story_graph_scene.h | 0 .../src/story_node_base.cpp | 0 .../src/story_node_base.h | 0 .../src/story_node_data.h | 0 .../src/story_project.cpp | 0 .../src/story_project.h | 0 .../src/toolbar.cpp | 0 .../src/toolbar.h | 0 .../src/vm_dock.cpp | 0 .../src/vm_dock.h | 0 .../story-editor-logo.ico | Bin .../story-editor-logo.png | Bin .../story-editor.desktop | 0 .../test.json | 0 .../tools/audio/.idea/.gitignore | 8 + story-editor-legacy/tools/audio/.idea/vcs.xml | 6 + .../tools/audio/AudioFile.cpp | 0 .../tools/audio/AudioFile.h | 0 .../tools/audio/CMakeLists.txt | 0 .../tools/audio/LICENSE | 0 .../tools/audio/main.cpp | 0 .../tools/audio/minimp3.h | 0 .../tools/audio/minimp3_ex.h | 0 story-editor-v2/CMakeLists.txt | 9 +- story-editor-v2/src/base_node.cpp | 6 +- story-editor-v2/src/base_node.h | 7 +- story-editor-v2/src/console_window.cpp | 23 +- story-editor-v2/src/console_window.h | 6 +- story-editor-v2/src/i_story_project.h | 29 + story-editor-v2/src/imgui_memory_editor.h | 742 ++++++++++++++++++ story-editor-v2/src/main_window.cpp | 53 +- story-editor-v2/src/main_window.h | 17 +- story-editor-v2/src/media_node.cpp | 63 +- story-editor-v2/src/media_node.h | 6 +- story-editor-v2/src/node_editor_window.cpp | 2 +- story-editor-v2/src/node_editor_window.h | 11 +- story-editor-v2/src/resource.h | 82 ++ story-editor-v2/src/resource_manager.h | 108 +++ story-editor-v2/src/resources_window.cpp | 38 +- story-editor-v2/src/resources_window.h | 6 +- story-editor-v2/src/story_project.cpp | 62 +- story-editor-v2/src/story_project.h | 30 +- story-editor/QHexView | 1 - 217 files changed, 1168 insertions(+), 150 deletions(-) delete mode 100644 .gitmodules rename {story-editor => story-editor-legacy}/CMakeLists.txt (100%) rename {story-editor => story-editor-legacy}/assets/build.png (100%) rename {story-editor => story-editor-legacy}/assets/build.svg (100%) rename {story-editor => story-editor-legacy}/assets/check-mark.png (100%) rename {story-editor => story-editor-legacy}/assets/close-outline.svg (100%) rename {story-editor => story-editor-legacy}/assets/file-document-plus-outline.png (100%) rename {story-editor => story-editor-legacy}/assets/file-document-plus-outline.svg (100%) rename {story-editor => story-editor-legacy}/assets/floppy.svg (100%) rename {story-editor => story-editor-legacy}/assets/folder-open-outline.svg (100%) rename {story-editor => story-editor-legacy}/assets/folder-open.svg (100%) rename {story-editor => story-editor-legacy}/assets/home.png (100%) rename {story-editor => story-editor-legacy}/assets/left.png (100%) rename {story-editor => story-editor-legacy}/assets/pause-button.png (100%) rename {story-editor => story-editor-legacy}/assets/play-circle-green.png (100%) rename {story-editor => story-editor-legacy}/assets/play-circle-green.svg (100%) rename {story-editor => story-editor-legacy}/assets/play-circle.png (100%) rename {story-editor => story-editor-legacy}/assets/play-circle.svg (100%) rename {story-editor => story-editor-legacy}/assets/right.png (100%) rename {story-editor => story-editor-legacy}/assets/volume-high.svg (100%) rename {story-editor => story-editor-legacy}/assets/volume-off.png (100%) rename {story-editor => story-editor-legacy}/assets/volume-off.svg (100%) rename {story-editor => story-editor-legacy}/assets/welcome.png (100%) rename {story-editor => story-editor-legacy}/example.asm (100%) rename {story-editor => story-editor-legacy}/icon.rc (100%) rename {story-editor => story-editor-legacy}/nodeeditor/CMakeLists.txt (100%) rename {story-editor => story-editor-legacy}/nodeeditor/LICENSE.rst (100%) rename {story-editor => story-editor-legacy}/nodeeditor/README.rst (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/AbstractGraphModel (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/AbstractNodePainter (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/BasicGraphicsScene (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/ConnectionIdUtils (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/ConnectionStyle (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/DataFlowGraphModel (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/DataFlowGraphicsScene (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/DefaultNodePainter (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/Definitions (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/GraphicsView (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/GraphicsViewStyle (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/NodeData (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/NodeDelegateModel (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/NodeDelegateModelRegistry (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/NodeGeometry (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/NodeState (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/NodeStyle (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/StyleCollection (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/UndoCommands (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/AbstractGraphModel.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/AbstractNodeGeometry.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/AbstractNodePainter.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/BasicGraphicsScene.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/Compiler.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/ConnectionGraphicsObject.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/ConnectionIdHash.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/ConnectionIdUtils.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/ConnectionPainter.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/ConnectionState.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/ConnectionStyle.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/DataFlowGraphModel.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/DataFlowGraphicsScene.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/DefaultHorizontalNodeGeometry.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/DefaultNodePainter.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/DefaultVerticalNodeGeometry.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/Definitions.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/Export.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/GraphicsView.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/GraphicsViewStyle.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeConnectionInteraction.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeData.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeDelegateModel.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeDelegateModelRegistry.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeGraphicsObject.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeState.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/NodeStyle.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/OperatingSystem.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/QStringStdHash.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/QUuidStdHash.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/Serializable.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/Style.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/StyleCollection.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/UndoCommands.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/include/QtNodes/internal/locateNode.hpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/resources/DefaultStyle.json (100%) rename {story-editor => story-editor-legacy}/nodeeditor/resources/resources.qrc (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/AbstractGraphModel.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/AbstractNodeGeometry.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/BasicGraphicsScene.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/ConnectionGraphicsObject.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/ConnectionPainter.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/ConnectionState.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/ConnectionStyle.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/DataFlowGraphModel.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/DataFlowGraphicsScene.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/DefaultHorizontalNodeGeometry.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/DefaultNodePainter.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/DefaultVerticalNodeGeometry.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/Definitions.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/GraphicsView.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/GraphicsViewStyle.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/NodeConnectionInteraction.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/NodeDelegateModel.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/NodeDelegateModelRegistry.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/NodeGraphicsObject.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/NodeState.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/NodeStyle.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/StyleCollection.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/UndoCommands.cpp (100%) rename {story-editor => story-editor-legacy}/nodeeditor/src/locateNode.cpp (100%) rename {story-editor => story-editor-legacy}/nsis-installer.nsi (100%) rename {story-editor => story-editor-legacy}/ost_convert/CMakeLists.txt (100%) rename {story-editor => story-editor-legacy}/ost_convert/command_line.cpp (100%) rename {story-editor => story-editor-legacy}/ost_convert/command_line.h (100%) rename {story-editor => story-editor-legacy}/ost_convert/json.hpp (100%) rename {story-editor => story-editor-legacy}/ost_convert/main.cpp (100%) rename {story-editor => story-editor-legacy}/ost_convert/miniz.c (100%) rename {story-editor => story-editor-legacy}/ost_convert/miniz.h (100%) rename {story-editor => story-editor-legacy}/ost_convert/ni_parser.c (100%) rename {story-editor => story-editor-legacy}/ost_convert/ni_parser.h (100%) rename {story-editor => story-editor-legacy}/ost_convert/pack_archive.cpp (100%) rename {story-editor => story-editor-legacy}/ost_convert/pack_archive.h (100%) rename {story-editor => story-editor-legacy}/ost_convert/zip.cpp (100%) rename {story-editor => story-editor-legacy}/ost_convert/zip.h (100%) rename {story-editor => story-editor-legacy}/scripts/media.asm (100%) rename {story-editor => story-editor-legacy}/src/about.ui (100%) rename {story-editor => story-editor-legacy}/src/choose-file.ui (100%) rename {story-editor => story-editor-legacy}/src/code_editor.cpp (100%) rename {story-editor => story-editor-legacy}/src/code_editor.h (100%) rename {story-editor => story-editor-legacy}/src/dock_widget_base.cpp (100%) rename {story-editor => story-editor-legacy}/src/dock_widget_base.h (100%) rename {story-editor => story-editor-legacy}/src/dr_mp3.h (100%) rename {story-editor => story-editor-legacy}/src/event-node.ui (100%) rename {story-editor => story-editor-legacy}/src/event_node_model.cpp (100%) rename {story-editor => story-editor-legacy}/src/event_node_model.h (100%) rename {story-editor => story-editor-legacy}/src/graph.cpp (100%) rename {story-editor => story-editor-legacy}/src/graph.h (100%) rename {story-editor => story-editor-legacy}/src/highlighter.cpp (100%) rename {story-editor => story-editor-legacy}/src/highlighter.h (100%) rename {story-editor => story-editor-legacy}/src/json.hpp (100%) rename {story-editor => story-editor-legacy}/src/log_dock.cpp (100%) rename {story-editor => story-editor-legacy}/src/log_dock.h (100%) rename {story-editor => story-editor-legacy}/src/main.cpp (100%) rename {story-editor => story-editor-legacy}/src/main_window.cpp (100%) rename {story-editor => story-editor-legacy}/src/main_window.h (100%) rename {story-editor => story-editor-legacy}/src/media-node.ui (100%) rename {story-editor => story-editor-legacy}/src/media_converter.cpp (100%) rename {story-editor => story-editor-legacy}/src/media_converter.h (100%) rename {story-editor => story-editor-legacy}/src/media_node_model.cpp (100%) rename {story-editor => story-editor-legacy}/src/media_node_model.h (100%) rename {story-editor => story-editor-legacy}/src/memory_view_dock.cpp (100%) rename {story-editor => story-editor-legacy}/src/memory_view_dock.h (100%) rename {story-editor => story-editor-legacy}/src/new-project.ui (100%) rename {story-editor => story-editor-legacy}/src/new_project_dialog.cpp (100%) rename {story-editor => story-editor-legacy}/src/new_project_dialog.h (100%) rename {story-editor => story-editor-legacy}/src/ost-data.ui (100%) rename {story-editor => story-editor-legacy}/src/ost-editor.qrc (100%) rename {story-editor => story-editor-legacy}/src/ost-hmi.ui (100%) rename {story-editor => story-editor-legacy}/src/ost-log.ui (100%) rename {story-editor => story-editor-legacy}/src/ost-resources.ui (100%) rename {story-editor => story-editor-legacy}/src/ost-script.ui (100%) rename {story-editor => story-editor-legacy}/src/ost-vm.ui (100%) rename {story-editor => story-editor-legacy}/src/ost_wrapper.cpp (100%) rename {story-editor => story-editor-legacy}/src/ost_wrapper.h (100%) rename {story-editor => story-editor-legacy}/src/osthmi_dock.cpp (100%) rename {story-editor => story-editor-legacy}/src/osthmi_dock.h (100%) rename {story-editor => story-editor-legacy}/src/resource_model.cpp (100%) rename {story-editor => story-editor-legacy}/src/resource_model.h (100%) rename {story-editor => story-editor-legacy}/src/resources_dock.cpp (100%) rename {story-editor => story-editor-legacy}/src/resources_dock.h (100%) rename {story-editor => story-editor-legacy}/src/script_editor_dock.cpp (100%) rename {story-editor => story-editor-legacy}/src/script_editor_dock.h (100%) rename {story-editor => story-editor-legacy}/src/stb_image.h (100%) rename {story-editor => story-editor-legacy}/src/story_graph_model.cpp (100%) rename {story-editor => story-editor-legacy}/src/story_graph_model.h (100%) rename {story-editor => story-editor-legacy}/src/story_graph_scene.cpp (100%) rename {story-editor => story-editor-legacy}/src/story_graph_scene.h (100%) rename {story-editor => story-editor-legacy}/src/story_node_base.cpp (100%) rename {story-editor => story-editor-legacy}/src/story_node_base.h (100%) rename {story-editor => story-editor-legacy}/src/story_node_data.h (100%) rename {story-editor => story-editor-legacy}/src/story_project.cpp (100%) rename {story-editor => story-editor-legacy}/src/story_project.h (100%) rename {story-editor => story-editor-legacy}/src/toolbar.cpp (100%) rename {story-editor => story-editor-legacy}/src/toolbar.h (100%) rename {story-editor => story-editor-legacy}/src/vm_dock.cpp (100%) rename {story-editor => story-editor-legacy}/src/vm_dock.h (100%) rename {story-editor => story-editor-legacy}/story-editor-logo.ico (100%) rename {story-editor => story-editor-legacy}/story-editor-logo.png (100%) rename {story-editor => story-editor-legacy}/story-editor.desktop (100%) rename {story-editor => story-editor-legacy}/test.json (100%) create mode 100644 story-editor-legacy/tools/audio/.idea/.gitignore create mode 100644 story-editor-legacy/tools/audio/.idea/vcs.xml rename {story-editor => story-editor-legacy}/tools/audio/AudioFile.cpp (100%) rename {story-editor => story-editor-legacy}/tools/audio/AudioFile.h (100%) rename {story-editor => story-editor-legacy}/tools/audio/CMakeLists.txt (100%) rename {story-editor => story-editor-legacy}/tools/audio/LICENSE (100%) rename {story-editor => story-editor-legacy}/tools/audio/main.cpp (100%) rename {story-editor => story-editor-legacy}/tools/audio/minimp3.h (100%) rename {story-editor => story-editor-legacy}/tools/audio/minimp3_ex.h (100%) create mode 100644 story-editor-v2/src/i_story_project.h create mode 100644 story-editor-v2/src/imgui_memory_editor.h create mode 100644 story-editor-v2/src/resource.h create mode 100644 story-editor-v2/src/resource_manager.h delete mode 160000 story-editor/QHexView diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 59ed8a5..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "story-editor/QHexView"] - path = story-editor/QHexView - url = https://github.com/arabine/QHexView \ No newline at end of file diff --git a/story-editor/CMakeLists.txt b/story-editor-legacy/CMakeLists.txt similarity index 100% rename from story-editor/CMakeLists.txt rename to story-editor-legacy/CMakeLists.txt diff --git a/story-editor/assets/build.png b/story-editor-legacy/assets/build.png similarity index 100% rename from story-editor/assets/build.png rename to story-editor-legacy/assets/build.png diff --git a/story-editor/assets/build.svg b/story-editor-legacy/assets/build.svg similarity index 100% rename from story-editor/assets/build.svg rename to story-editor-legacy/assets/build.svg diff --git a/story-editor/assets/check-mark.png b/story-editor-legacy/assets/check-mark.png similarity index 100% rename from story-editor/assets/check-mark.png rename to story-editor-legacy/assets/check-mark.png diff --git a/story-editor/assets/close-outline.svg b/story-editor-legacy/assets/close-outline.svg similarity index 100% rename from story-editor/assets/close-outline.svg rename to story-editor-legacy/assets/close-outline.svg diff --git a/story-editor/assets/file-document-plus-outline.png b/story-editor-legacy/assets/file-document-plus-outline.png similarity index 100% rename from story-editor/assets/file-document-plus-outline.png rename to story-editor-legacy/assets/file-document-plus-outline.png diff --git a/story-editor/assets/file-document-plus-outline.svg b/story-editor-legacy/assets/file-document-plus-outline.svg similarity index 100% rename from story-editor/assets/file-document-plus-outline.svg rename to story-editor-legacy/assets/file-document-plus-outline.svg diff --git a/story-editor/assets/floppy.svg b/story-editor-legacy/assets/floppy.svg similarity index 100% rename from story-editor/assets/floppy.svg rename to story-editor-legacy/assets/floppy.svg diff --git a/story-editor/assets/folder-open-outline.svg b/story-editor-legacy/assets/folder-open-outline.svg similarity index 100% rename from story-editor/assets/folder-open-outline.svg rename to story-editor-legacy/assets/folder-open-outline.svg diff --git a/story-editor/assets/folder-open.svg b/story-editor-legacy/assets/folder-open.svg similarity index 100% rename from story-editor/assets/folder-open.svg rename to story-editor-legacy/assets/folder-open.svg diff --git a/story-editor/assets/home.png b/story-editor-legacy/assets/home.png similarity index 100% rename from story-editor/assets/home.png rename to story-editor-legacy/assets/home.png diff --git a/story-editor/assets/left.png b/story-editor-legacy/assets/left.png similarity index 100% rename from story-editor/assets/left.png rename to story-editor-legacy/assets/left.png diff --git a/story-editor/assets/pause-button.png b/story-editor-legacy/assets/pause-button.png similarity index 100% rename from story-editor/assets/pause-button.png rename to story-editor-legacy/assets/pause-button.png diff --git a/story-editor/assets/play-circle-green.png b/story-editor-legacy/assets/play-circle-green.png similarity index 100% rename from story-editor/assets/play-circle-green.png rename to story-editor-legacy/assets/play-circle-green.png diff --git a/story-editor/assets/play-circle-green.svg b/story-editor-legacy/assets/play-circle-green.svg similarity index 100% rename from story-editor/assets/play-circle-green.svg rename to story-editor-legacy/assets/play-circle-green.svg diff --git a/story-editor/assets/play-circle.png b/story-editor-legacy/assets/play-circle.png similarity index 100% rename from story-editor/assets/play-circle.png rename to story-editor-legacy/assets/play-circle.png diff --git a/story-editor/assets/play-circle.svg b/story-editor-legacy/assets/play-circle.svg similarity index 100% rename from story-editor/assets/play-circle.svg rename to story-editor-legacy/assets/play-circle.svg diff --git a/story-editor/assets/right.png b/story-editor-legacy/assets/right.png similarity index 100% rename from story-editor/assets/right.png rename to story-editor-legacy/assets/right.png diff --git a/story-editor/assets/volume-high.svg b/story-editor-legacy/assets/volume-high.svg similarity index 100% rename from story-editor/assets/volume-high.svg rename to story-editor-legacy/assets/volume-high.svg diff --git a/story-editor/assets/volume-off.png b/story-editor-legacy/assets/volume-off.png similarity index 100% rename from story-editor/assets/volume-off.png rename to story-editor-legacy/assets/volume-off.png diff --git a/story-editor/assets/volume-off.svg b/story-editor-legacy/assets/volume-off.svg similarity index 100% rename from story-editor/assets/volume-off.svg rename to story-editor-legacy/assets/volume-off.svg diff --git a/story-editor/assets/welcome.png b/story-editor-legacy/assets/welcome.png similarity index 100% rename from story-editor/assets/welcome.png rename to story-editor-legacy/assets/welcome.png diff --git a/story-editor/example.asm b/story-editor-legacy/example.asm similarity index 100% rename from story-editor/example.asm rename to story-editor-legacy/example.asm diff --git a/story-editor/icon.rc b/story-editor-legacy/icon.rc similarity index 100% rename from story-editor/icon.rc rename to story-editor-legacy/icon.rc diff --git a/story-editor/nodeeditor/CMakeLists.txt b/story-editor-legacy/nodeeditor/CMakeLists.txt similarity index 100% rename from story-editor/nodeeditor/CMakeLists.txt rename to story-editor-legacy/nodeeditor/CMakeLists.txt diff --git a/story-editor/nodeeditor/LICENSE.rst b/story-editor-legacy/nodeeditor/LICENSE.rst similarity index 100% rename from story-editor/nodeeditor/LICENSE.rst rename to story-editor-legacy/nodeeditor/LICENSE.rst diff --git a/story-editor/nodeeditor/README.rst b/story-editor-legacy/nodeeditor/README.rst similarity index 100% rename from story-editor/nodeeditor/README.rst rename to story-editor-legacy/nodeeditor/README.rst diff --git a/story-editor/nodeeditor/include/QtNodes/AbstractGraphModel b/story-editor-legacy/nodeeditor/include/QtNodes/AbstractGraphModel similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/AbstractGraphModel rename to story-editor-legacy/nodeeditor/include/QtNodes/AbstractGraphModel diff --git a/story-editor/nodeeditor/include/QtNodes/AbstractNodePainter b/story-editor-legacy/nodeeditor/include/QtNodes/AbstractNodePainter similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/AbstractNodePainter rename to story-editor-legacy/nodeeditor/include/QtNodes/AbstractNodePainter diff --git a/story-editor/nodeeditor/include/QtNodes/BasicGraphicsScene b/story-editor-legacy/nodeeditor/include/QtNodes/BasicGraphicsScene similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/BasicGraphicsScene rename to story-editor-legacy/nodeeditor/include/QtNodes/BasicGraphicsScene diff --git a/story-editor/nodeeditor/include/QtNodes/ConnectionIdUtils b/story-editor-legacy/nodeeditor/include/QtNodes/ConnectionIdUtils similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/ConnectionIdUtils rename to story-editor-legacy/nodeeditor/include/QtNodes/ConnectionIdUtils diff --git a/story-editor/nodeeditor/include/QtNodes/ConnectionStyle b/story-editor-legacy/nodeeditor/include/QtNodes/ConnectionStyle similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/ConnectionStyle rename to story-editor-legacy/nodeeditor/include/QtNodes/ConnectionStyle diff --git a/story-editor/nodeeditor/include/QtNodes/DataFlowGraphModel b/story-editor-legacy/nodeeditor/include/QtNodes/DataFlowGraphModel similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/DataFlowGraphModel rename to story-editor-legacy/nodeeditor/include/QtNodes/DataFlowGraphModel diff --git a/story-editor/nodeeditor/include/QtNodes/DataFlowGraphicsScene b/story-editor-legacy/nodeeditor/include/QtNodes/DataFlowGraphicsScene similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/DataFlowGraphicsScene rename to story-editor-legacy/nodeeditor/include/QtNodes/DataFlowGraphicsScene diff --git a/story-editor/nodeeditor/include/QtNodes/DefaultNodePainter b/story-editor-legacy/nodeeditor/include/QtNodes/DefaultNodePainter similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/DefaultNodePainter rename to story-editor-legacy/nodeeditor/include/QtNodes/DefaultNodePainter diff --git a/story-editor/nodeeditor/include/QtNodes/Definitions b/story-editor-legacy/nodeeditor/include/QtNodes/Definitions similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/Definitions rename to story-editor-legacy/nodeeditor/include/QtNodes/Definitions diff --git a/story-editor/nodeeditor/include/QtNodes/GraphicsView b/story-editor-legacy/nodeeditor/include/QtNodes/GraphicsView similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/GraphicsView rename to story-editor-legacy/nodeeditor/include/QtNodes/GraphicsView diff --git a/story-editor/nodeeditor/include/QtNodes/GraphicsViewStyle b/story-editor-legacy/nodeeditor/include/QtNodes/GraphicsViewStyle similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/GraphicsViewStyle rename to story-editor-legacy/nodeeditor/include/QtNodes/GraphicsViewStyle diff --git a/story-editor/nodeeditor/include/QtNodes/NodeData b/story-editor-legacy/nodeeditor/include/QtNodes/NodeData similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/NodeData rename to story-editor-legacy/nodeeditor/include/QtNodes/NodeData diff --git a/story-editor/nodeeditor/include/QtNodes/NodeDelegateModel b/story-editor-legacy/nodeeditor/include/QtNodes/NodeDelegateModel similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/NodeDelegateModel rename to story-editor-legacy/nodeeditor/include/QtNodes/NodeDelegateModel diff --git a/story-editor/nodeeditor/include/QtNodes/NodeDelegateModelRegistry b/story-editor-legacy/nodeeditor/include/QtNodes/NodeDelegateModelRegistry similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/NodeDelegateModelRegistry rename to story-editor-legacy/nodeeditor/include/QtNodes/NodeDelegateModelRegistry diff --git a/story-editor/nodeeditor/include/QtNodes/NodeGeometry b/story-editor-legacy/nodeeditor/include/QtNodes/NodeGeometry similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/NodeGeometry rename to story-editor-legacy/nodeeditor/include/QtNodes/NodeGeometry diff --git a/story-editor/nodeeditor/include/QtNodes/NodeState b/story-editor-legacy/nodeeditor/include/QtNodes/NodeState similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/NodeState rename to story-editor-legacy/nodeeditor/include/QtNodes/NodeState diff --git a/story-editor/nodeeditor/include/QtNodes/NodeStyle b/story-editor-legacy/nodeeditor/include/QtNodes/NodeStyle similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/NodeStyle rename to story-editor-legacy/nodeeditor/include/QtNodes/NodeStyle diff --git a/story-editor/nodeeditor/include/QtNodes/StyleCollection b/story-editor-legacy/nodeeditor/include/QtNodes/StyleCollection similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/StyleCollection rename to story-editor-legacy/nodeeditor/include/QtNodes/StyleCollection diff --git a/story-editor/nodeeditor/include/QtNodes/UndoCommands b/story-editor-legacy/nodeeditor/include/QtNodes/UndoCommands similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/UndoCommands rename to story-editor-legacy/nodeeditor/include/QtNodes/UndoCommands diff --git a/story-editor/nodeeditor/include/QtNodes/internal/AbstractGraphModel.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/AbstractGraphModel.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/AbstractGraphModel.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/AbstractGraphModel.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/AbstractNodeGeometry.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/AbstractNodeGeometry.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/AbstractNodeGeometry.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/AbstractNodeGeometry.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/AbstractNodePainter.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/AbstractNodePainter.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/AbstractNodePainter.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/AbstractNodePainter.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/BasicGraphicsScene.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/BasicGraphicsScene.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/BasicGraphicsScene.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/BasicGraphicsScene.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/Compiler.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/Compiler.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/Compiler.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/Compiler.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/ConnectionGraphicsObject.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionGraphicsObject.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/ConnectionGraphicsObject.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionGraphicsObject.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/ConnectionIdHash.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionIdHash.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/ConnectionIdHash.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionIdHash.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/ConnectionIdUtils.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionIdUtils.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/ConnectionIdUtils.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionIdUtils.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/ConnectionPainter.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionPainter.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/ConnectionPainter.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionPainter.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/ConnectionState.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionState.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/ConnectionState.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionState.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/ConnectionStyle.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionStyle.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/ConnectionStyle.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/ConnectionStyle.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/DataFlowGraphModel.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/DataFlowGraphModel.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/DataFlowGraphModel.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/DataFlowGraphModel.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/DataFlowGraphicsScene.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/DataFlowGraphicsScene.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/DataFlowGraphicsScene.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/DataFlowGraphicsScene.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/DefaultHorizontalNodeGeometry.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/DefaultHorizontalNodeGeometry.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/DefaultHorizontalNodeGeometry.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/DefaultHorizontalNodeGeometry.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/DefaultNodePainter.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/DefaultNodePainter.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/DefaultNodePainter.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/DefaultNodePainter.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/DefaultVerticalNodeGeometry.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/DefaultVerticalNodeGeometry.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/DefaultVerticalNodeGeometry.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/DefaultVerticalNodeGeometry.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/Definitions.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/Definitions.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/Definitions.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/Definitions.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/Export.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/Export.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/Export.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/Export.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/GraphicsView.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/GraphicsView.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/GraphicsView.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/GraphicsView.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/GraphicsViewStyle.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/GraphicsViewStyle.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/GraphicsViewStyle.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/GraphicsViewStyle.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeConnectionInteraction.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeConnectionInteraction.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeConnectionInteraction.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeConnectionInteraction.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeData.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeData.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeData.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeData.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeDelegateModel.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeDelegateModel.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeDelegateModel.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeDelegateModel.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeDelegateModelRegistry.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeDelegateModelRegistry.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeDelegateModelRegistry.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeDelegateModelRegistry.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeGraphicsObject.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeGraphicsObject.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeGraphicsObject.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeGraphicsObject.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeState.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeState.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeState.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeState.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/NodeStyle.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeStyle.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/NodeStyle.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/NodeStyle.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/OperatingSystem.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/OperatingSystem.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/OperatingSystem.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/OperatingSystem.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/QStringStdHash.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/QStringStdHash.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/QStringStdHash.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/QStringStdHash.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/QUuidStdHash.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/QUuidStdHash.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/QUuidStdHash.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/QUuidStdHash.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/Serializable.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/Serializable.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/Serializable.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/Serializable.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/Style.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/Style.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/Style.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/Style.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/StyleCollection.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/StyleCollection.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/StyleCollection.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/StyleCollection.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/UndoCommands.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/UndoCommands.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/UndoCommands.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/UndoCommands.hpp diff --git a/story-editor/nodeeditor/include/QtNodes/internal/locateNode.hpp b/story-editor-legacy/nodeeditor/include/QtNodes/internal/locateNode.hpp similarity index 100% rename from story-editor/nodeeditor/include/QtNodes/internal/locateNode.hpp rename to story-editor-legacy/nodeeditor/include/QtNodes/internal/locateNode.hpp diff --git a/story-editor/nodeeditor/resources/DefaultStyle.json b/story-editor-legacy/nodeeditor/resources/DefaultStyle.json similarity index 100% rename from story-editor/nodeeditor/resources/DefaultStyle.json rename to story-editor-legacy/nodeeditor/resources/DefaultStyle.json diff --git a/story-editor/nodeeditor/resources/resources.qrc b/story-editor-legacy/nodeeditor/resources/resources.qrc similarity index 100% rename from story-editor/nodeeditor/resources/resources.qrc rename to story-editor-legacy/nodeeditor/resources/resources.qrc diff --git a/story-editor/nodeeditor/src/AbstractGraphModel.cpp b/story-editor-legacy/nodeeditor/src/AbstractGraphModel.cpp similarity index 100% rename from story-editor/nodeeditor/src/AbstractGraphModel.cpp rename to story-editor-legacy/nodeeditor/src/AbstractGraphModel.cpp diff --git a/story-editor/nodeeditor/src/AbstractNodeGeometry.cpp b/story-editor-legacy/nodeeditor/src/AbstractNodeGeometry.cpp similarity index 100% rename from story-editor/nodeeditor/src/AbstractNodeGeometry.cpp rename to story-editor-legacy/nodeeditor/src/AbstractNodeGeometry.cpp diff --git a/story-editor/nodeeditor/src/BasicGraphicsScene.cpp b/story-editor-legacy/nodeeditor/src/BasicGraphicsScene.cpp similarity index 100% rename from story-editor/nodeeditor/src/BasicGraphicsScene.cpp rename to story-editor-legacy/nodeeditor/src/BasicGraphicsScene.cpp diff --git a/story-editor/nodeeditor/src/ConnectionGraphicsObject.cpp b/story-editor-legacy/nodeeditor/src/ConnectionGraphicsObject.cpp similarity index 100% rename from story-editor/nodeeditor/src/ConnectionGraphicsObject.cpp rename to story-editor-legacy/nodeeditor/src/ConnectionGraphicsObject.cpp diff --git a/story-editor/nodeeditor/src/ConnectionPainter.cpp b/story-editor-legacy/nodeeditor/src/ConnectionPainter.cpp similarity index 100% rename from story-editor/nodeeditor/src/ConnectionPainter.cpp rename to story-editor-legacy/nodeeditor/src/ConnectionPainter.cpp diff --git a/story-editor/nodeeditor/src/ConnectionState.cpp b/story-editor-legacy/nodeeditor/src/ConnectionState.cpp similarity index 100% rename from story-editor/nodeeditor/src/ConnectionState.cpp rename to story-editor-legacy/nodeeditor/src/ConnectionState.cpp diff --git a/story-editor/nodeeditor/src/ConnectionStyle.cpp b/story-editor-legacy/nodeeditor/src/ConnectionStyle.cpp similarity index 100% rename from story-editor/nodeeditor/src/ConnectionStyle.cpp rename to story-editor-legacy/nodeeditor/src/ConnectionStyle.cpp diff --git a/story-editor/nodeeditor/src/DataFlowGraphModel.cpp b/story-editor-legacy/nodeeditor/src/DataFlowGraphModel.cpp similarity index 100% rename from story-editor/nodeeditor/src/DataFlowGraphModel.cpp rename to story-editor-legacy/nodeeditor/src/DataFlowGraphModel.cpp diff --git a/story-editor/nodeeditor/src/DataFlowGraphicsScene.cpp b/story-editor-legacy/nodeeditor/src/DataFlowGraphicsScene.cpp similarity index 100% rename from story-editor/nodeeditor/src/DataFlowGraphicsScene.cpp rename to story-editor-legacy/nodeeditor/src/DataFlowGraphicsScene.cpp diff --git a/story-editor/nodeeditor/src/DefaultHorizontalNodeGeometry.cpp b/story-editor-legacy/nodeeditor/src/DefaultHorizontalNodeGeometry.cpp similarity index 100% rename from story-editor/nodeeditor/src/DefaultHorizontalNodeGeometry.cpp rename to story-editor-legacy/nodeeditor/src/DefaultHorizontalNodeGeometry.cpp diff --git a/story-editor/nodeeditor/src/DefaultNodePainter.cpp b/story-editor-legacy/nodeeditor/src/DefaultNodePainter.cpp similarity index 100% rename from story-editor/nodeeditor/src/DefaultNodePainter.cpp rename to story-editor-legacy/nodeeditor/src/DefaultNodePainter.cpp diff --git a/story-editor/nodeeditor/src/DefaultVerticalNodeGeometry.cpp b/story-editor-legacy/nodeeditor/src/DefaultVerticalNodeGeometry.cpp similarity index 100% rename from story-editor/nodeeditor/src/DefaultVerticalNodeGeometry.cpp rename to story-editor-legacy/nodeeditor/src/DefaultVerticalNodeGeometry.cpp diff --git a/story-editor/nodeeditor/src/Definitions.cpp b/story-editor-legacy/nodeeditor/src/Definitions.cpp similarity index 100% rename from story-editor/nodeeditor/src/Definitions.cpp rename to story-editor-legacy/nodeeditor/src/Definitions.cpp diff --git a/story-editor/nodeeditor/src/GraphicsView.cpp b/story-editor-legacy/nodeeditor/src/GraphicsView.cpp similarity index 100% rename from story-editor/nodeeditor/src/GraphicsView.cpp rename to story-editor-legacy/nodeeditor/src/GraphicsView.cpp diff --git a/story-editor/nodeeditor/src/GraphicsViewStyle.cpp b/story-editor-legacy/nodeeditor/src/GraphicsViewStyle.cpp similarity index 100% rename from story-editor/nodeeditor/src/GraphicsViewStyle.cpp rename to story-editor-legacy/nodeeditor/src/GraphicsViewStyle.cpp diff --git a/story-editor/nodeeditor/src/NodeConnectionInteraction.cpp b/story-editor-legacy/nodeeditor/src/NodeConnectionInteraction.cpp similarity index 100% rename from story-editor/nodeeditor/src/NodeConnectionInteraction.cpp rename to story-editor-legacy/nodeeditor/src/NodeConnectionInteraction.cpp diff --git a/story-editor/nodeeditor/src/NodeDelegateModel.cpp b/story-editor-legacy/nodeeditor/src/NodeDelegateModel.cpp similarity index 100% rename from story-editor/nodeeditor/src/NodeDelegateModel.cpp rename to story-editor-legacy/nodeeditor/src/NodeDelegateModel.cpp diff --git a/story-editor/nodeeditor/src/NodeDelegateModelRegistry.cpp b/story-editor-legacy/nodeeditor/src/NodeDelegateModelRegistry.cpp similarity index 100% rename from story-editor/nodeeditor/src/NodeDelegateModelRegistry.cpp rename to story-editor-legacy/nodeeditor/src/NodeDelegateModelRegistry.cpp diff --git a/story-editor/nodeeditor/src/NodeGraphicsObject.cpp b/story-editor-legacy/nodeeditor/src/NodeGraphicsObject.cpp similarity index 100% rename from story-editor/nodeeditor/src/NodeGraphicsObject.cpp rename to story-editor-legacy/nodeeditor/src/NodeGraphicsObject.cpp diff --git a/story-editor/nodeeditor/src/NodeState.cpp b/story-editor-legacy/nodeeditor/src/NodeState.cpp similarity index 100% rename from story-editor/nodeeditor/src/NodeState.cpp rename to story-editor-legacy/nodeeditor/src/NodeState.cpp diff --git a/story-editor/nodeeditor/src/NodeStyle.cpp b/story-editor-legacy/nodeeditor/src/NodeStyle.cpp similarity index 100% rename from story-editor/nodeeditor/src/NodeStyle.cpp rename to story-editor-legacy/nodeeditor/src/NodeStyle.cpp diff --git a/story-editor/nodeeditor/src/StyleCollection.cpp b/story-editor-legacy/nodeeditor/src/StyleCollection.cpp similarity index 100% rename from story-editor/nodeeditor/src/StyleCollection.cpp rename to story-editor-legacy/nodeeditor/src/StyleCollection.cpp diff --git a/story-editor/nodeeditor/src/UndoCommands.cpp b/story-editor-legacy/nodeeditor/src/UndoCommands.cpp similarity index 100% rename from story-editor/nodeeditor/src/UndoCommands.cpp rename to story-editor-legacy/nodeeditor/src/UndoCommands.cpp diff --git a/story-editor/nodeeditor/src/locateNode.cpp b/story-editor-legacy/nodeeditor/src/locateNode.cpp similarity index 100% rename from story-editor/nodeeditor/src/locateNode.cpp rename to story-editor-legacy/nodeeditor/src/locateNode.cpp diff --git a/story-editor/nsis-installer.nsi b/story-editor-legacy/nsis-installer.nsi similarity index 100% rename from story-editor/nsis-installer.nsi rename to story-editor-legacy/nsis-installer.nsi diff --git a/story-editor/ost_convert/CMakeLists.txt b/story-editor-legacy/ost_convert/CMakeLists.txt similarity index 100% rename from story-editor/ost_convert/CMakeLists.txt rename to story-editor-legacy/ost_convert/CMakeLists.txt diff --git a/story-editor/ost_convert/command_line.cpp b/story-editor-legacy/ost_convert/command_line.cpp similarity index 100% rename from story-editor/ost_convert/command_line.cpp rename to story-editor-legacy/ost_convert/command_line.cpp diff --git a/story-editor/ost_convert/command_line.h b/story-editor-legacy/ost_convert/command_line.h similarity index 100% rename from story-editor/ost_convert/command_line.h rename to story-editor-legacy/ost_convert/command_line.h diff --git a/story-editor/ost_convert/json.hpp b/story-editor-legacy/ost_convert/json.hpp similarity index 100% rename from story-editor/ost_convert/json.hpp rename to story-editor-legacy/ost_convert/json.hpp diff --git a/story-editor/ost_convert/main.cpp b/story-editor-legacy/ost_convert/main.cpp similarity index 100% rename from story-editor/ost_convert/main.cpp rename to story-editor-legacy/ost_convert/main.cpp diff --git a/story-editor/ost_convert/miniz.c b/story-editor-legacy/ost_convert/miniz.c similarity index 100% rename from story-editor/ost_convert/miniz.c rename to story-editor-legacy/ost_convert/miniz.c diff --git a/story-editor/ost_convert/miniz.h b/story-editor-legacy/ost_convert/miniz.h similarity index 100% rename from story-editor/ost_convert/miniz.h rename to story-editor-legacy/ost_convert/miniz.h diff --git a/story-editor/ost_convert/ni_parser.c b/story-editor-legacy/ost_convert/ni_parser.c similarity index 100% rename from story-editor/ost_convert/ni_parser.c rename to story-editor-legacy/ost_convert/ni_parser.c diff --git a/story-editor/ost_convert/ni_parser.h b/story-editor-legacy/ost_convert/ni_parser.h similarity index 100% rename from story-editor/ost_convert/ni_parser.h rename to story-editor-legacy/ost_convert/ni_parser.h diff --git a/story-editor/ost_convert/pack_archive.cpp b/story-editor-legacy/ost_convert/pack_archive.cpp similarity index 100% rename from story-editor/ost_convert/pack_archive.cpp rename to story-editor-legacy/ost_convert/pack_archive.cpp diff --git a/story-editor/ost_convert/pack_archive.h b/story-editor-legacy/ost_convert/pack_archive.h similarity index 100% rename from story-editor/ost_convert/pack_archive.h rename to story-editor-legacy/ost_convert/pack_archive.h diff --git a/story-editor/ost_convert/zip.cpp b/story-editor-legacy/ost_convert/zip.cpp similarity index 100% rename from story-editor/ost_convert/zip.cpp rename to story-editor-legacy/ost_convert/zip.cpp diff --git a/story-editor/ost_convert/zip.h b/story-editor-legacy/ost_convert/zip.h similarity index 100% rename from story-editor/ost_convert/zip.h rename to story-editor-legacy/ost_convert/zip.h diff --git a/story-editor/scripts/media.asm b/story-editor-legacy/scripts/media.asm similarity index 100% rename from story-editor/scripts/media.asm rename to story-editor-legacy/scripts/media.asm diff --git a/story-editor/src/about.ui b/story-editor-legacy/src/about.ui similarity index 100% rename from story-editor/src/about.ui rename to story-editor-legacy/src/about.ui diff --git a/story-editor/src/choose-file.ui b/story-editor-legacy/src/choose-file.ui similarity index 100% rename from story-editor/src/choose-file.ui rename to story-editor-legacy/src/choose-file.ui diff --git a/story-editor/src/code_editor.cpp b/story-editor-legacy/src/code_editor.cpp similarity index 100% rename from story-editor/src/code_editor.cpp rename to story-editor-legacy/src/code_editor.cpp diff --git a/story-editor/src/code_editor.h b/story-editor-legacy/src/code_editor.h similarity index 100% rename from story-editor/src/code_editor.h rename to story-editor-legacy/src/code_editor.h diff --git a/story-editor/src/dock_widget_base.cpp b/story-editor-legacy/src/dock_widget_base.cpp similarity index 100% rename from story-editor/src/dock_widget_base.cpp rename to story-editor-legacy/src/dock_widget_base.cpp diff --git a/story-editor/src/dock_widget_base.h b/story-editor-legacy/src/dock_widget_base.h similarity index 100% rename from story-editor/src/dock_widget_base.h rename to story-editor-legacy/src/dock_widget_base.h diff --git a/story-editor/src/dr_mp3.h b/story-editor-legacy/src/dr_mp3.h similarity index 100% rename from story-editor/src/dr_mp3.h rename to story-editor-legacy/src/dr_mp3.h diff --git a/story-editor/src/event-node.ui b/story-editor-legacy/src/event-node.ui similarity index 100% rename from story-editor/src/event-node.ui rename to story-editor-legacy/src/event-node.ui diff --git a/story-editor/src/event_node_model.cpp b/story-editor-legacy/src/event_node_model.cpp similarity index 100% rename from story-editor/src/event_node_model.cpp rename to story-editor-legacy/src/event_node_model.cpp diff --git a/story-editor/src/event_node_model.h b/story-editor-legacy/src/event_node_model.h similarity index 100% rename from story-editor/src/event_node_model.h rename to story-editor-legacy/src/event_node_model.h diff --git a/story-editor/src/graph.cpp b/story-editor-legacy/src/graph.cpp similarity index 100% rename from story-editor/src/graph.cpp rename to story-editor-legacy/src/graph.cpp diff --git a/story-editor/src/graph.h b/story-editor-legacy/src/graph.h similarity index 100% rename from story-editor/src/graph.h rename to story-editor-legacy/src/graph.h diff --git a/story-editor/src/highlighter.cpp b/story-editor-legacy/src/highlighter.cpp similarity index 100% rename from story-editor/src/highlighter.cpp rename to story-editor-legacy/src/highlighter.cpp diff --git a/story-editor/src/highlighter.h b/story-editor-legacy/src/highlighter.h similarity index 100% rename from story-editor/src/highlighter.h rename to story-editor-legacy/src/highlighter.h diff --git a/story-editor/src/json.hpp b/story-editor-legacy/src/json.hpp similarity index 100% rename from story-editor/src/json.hpp rename to story-editor-legacy/src/json.hpp diff --git a/story-editor/src/log_dock.cpp b/story-editor-legacy/src/log_dock.cpp similarity index 100% rename from story-editor/src/log_dock.cpp rename to story-editor-legacy/src/log_dock.cpp diff --git a/story-editor/src/log_dock.h b/story-editor-legacy/src/log_dock.h similarity index 100% rename from story-editor/src/log_dock.h rename to story-editor-legacy/src/log_dock.h diff --git a/story-editor/src/main.cpp b/story-editor-legacy/src/main.cpp similarity index 100% rename from story-editor/src/main.cpp rename to story-editor-legacy/src/main.cpp diff --git a/story-editor/src/main_window.cpp b/story-editor-legacy/src/main_window.cpp similarity index 100% rename from story-editor/src/main_window.cpp rename to story-editor-legacy/src/main_window.cpp diff --git a/story-editor/src/main_window.h b/story-editor-legacy/src/main_window.h similarity index 100% rename from story-editor/src/main_window.h rename to story-editor-legacy/src/main_window.h diff --git a/story-editor/src/media-node.ui b/story-editor-legacy/src/media-node.ui similarity index 100% rename from story-editor/src/media-node.ui rename to story-editor-legacy/src/media-node.ui diff --git a/story-editor/src/media_converter.cpp b/story-editor-legacy/src/media_converter.cpp similarity index 100% rename from story-editor/src/media_converter.cpp rename to story-editor-legacy/src/media_converter.cpp diff --git a/story-editor/src/media_converter.h b/story-editor-legacy/src/media_converter.h similarity index 100% rename from story-editor/src/media_converter.h rename to story-editor-legacy/src/media_converter.h diff --git a/story-editor/src/media_node_model.cpp b/story-editor-legacy/src/media_node_model.cpp similarity index 100% rename from story-editor/src/media_node_model.cpp rename to story-editor-legacy/src/media_node_model.cpp diff --git a/story-editor/src/media_node_model.h b/story-editor-legacy/src/media_node_model.h similarity index 100% rename from story-editor/src/media_node_model.h rename to story-editor-legacy/src/media_node_model.h diff --git a/story-editor/src/memory_view_dock.cpp b/story-editor-legacy/src/memory_view_dock.cpp similarity index 100% rename from story-editor/src/memory_view_dock.cpp rename to story-editor-legacy/src/memory_view_dock.cpp diff --git a/story-editor/src/memory_view_dock.h b/story-editor-legacy/src/memory_view_dock.h similarity index 100% rename from story-editor/src/memory_view_dock.h rename to story-editor-legacy/src/memory_view_dock.h diff --git a/story-editor/src/new-project.ui b/story-editor-legacy/src/new-project.ui similarity index 100% rename from story-editor/src/new-project.ui rename to story-editor-legacy/src/new-project.ui diff --git a/story-editor/src/new_project_dialog.cpp b/story-editor-legacy/src/new_project_dialog.cpp similarity index 100% rename from story-editor/src/new_project_dialog.cpp rename to story-editor-legacy/src/new_project_dialog.cpp diff --git a/story-editor/src/new_project_dialog.h b/story-editor-legacy/src/new_project_dialog.h similarity index 100% rename from story-editor/src/new_project_dialog.h rename to story-editor-legacy/src/new_project_dialog.h diff --git a/story-editor/src/ost-data.ui b/story-editor-legacy/src/ost-data.ui similarity index 100% rename from story-editor/src/ost-data.ui rename to story-editor-legacy/src/ost-data.ui diff --git a/story-editor/src/ost-editor.qrc b/story-editor-legacy/src/ost-editor.qrc similarity index 100% rename from story-editor/src/ost-editor.qrc rename to story-editor-legacy/src/ost-editor.qrc diff --git a/story-editor/src/ost-hmi.ui b/story-editor-legacy/src/ost-hmi.ui similarity index 100% rename from story-editor/src/ost-hmi.ui rename to story-editor-legacy/src/ost-hmi.ui diff --git a/story-editor/src/ost-log.ui b/story-editor-legacy/src/ost-log.ui similarity index 100% rename from story-editor/src/ost-log.ui rename to story-editor-legacy/src/ost-log.ui diff --git a/story-editor/src/ost-resources.ui b/story-editor-legacy/src/ost-resources.ui similarity index 100% rename from story-editor/src/ost-resources.ui rename to story-editor-legacy/src/ost-resources.ui diff --git a/story-editor/src/ost-script.ui b/story-editor-legacy/src/ost-script.ui similarity index 100% rename from story-editor/src/ost-script.ui rename to story-editor-legacy/src/ost-script.ui diff --git a/story-editor/src/ost-vm.ui b/story-editor-legacy/src/ost-vm.ui similarity index 100% rename from story-editor/src/ost-vm.ui rename to story-editor-legacy/src/ost-vm.ui diff --git a/story-editor/src/ost_wrapper.cpp b/story-editor-legacy/src/ost_wrapper.cpp similarity index 100% rename from story-editor/src/ost_wrapper.cpp rename to story-editor-legacy/src/ost_wrapper.cpp diff --git a/story-editor/src/ost_wrapper.h b/story-editor-legacy/src/ost_wrapper.h similarity index 100% rename from story-editor/src/ost_wrapper.h rename to story-editor-legacy/src/ost_wrapper.h diff --git a/story-editor/src/osthmi_dock.cpp b/story-editor-legacy/src/osthmi_dock.cpp similarity index 100% rename from story-editor/src/osthmi_dock.cpp rename to story-editor-legacy/src/osthmi_dock.cpp diff --git a/story-editor/src/osthmi_dock.h b/story-editor-legacy/src/osthmi_dock.h similarity index 100% rename from story-editor/src/osthmi_dock.h rename to story-editor-legacy/src/osthmi_dock.h diff --git a/story-editor/src/resource_model.cpp b/story-editor-legacy/src/resource_model.cpp similarity index 100% rename from story-editor/src/resource_model.cpp rename to story-editor-legacy/src/resource_model.cpp diff --git a/story-editor/src/resource_model.h b/story-editor-legacy/src/resource_model.h similarity index 100% rename from story-editor/src/resource_model.h rename to story-editor-legacy/src/resource_model.h diff --git a/story-editor/src/resources_dock.cpp b/story-editor-legacy/src/resources_dock.cpp similarity index 100% rename from story-editor/src/resources_dock.cpp rename to story-editor-legacy/src/resources_dock.cpp diff --git a/story-editor/src/resources_dock.h b/story-editor-legacy/src/resources_dock.h similarity index 100% rename from story-editor/src/resources_dock.h rename to story-editor-legacy/src/resources_dock.h diff --git a/story-editor/src/script_editor_dock.cpp b/story-editor-legacy/src/script_editor_dock.cpp similarity index 100% rename from story-editor/src/script_editor_dock.cpp rename to story-editor-legacy/src/script_editor_dock.cpp diff --git a/story-editor/src/script_editor_dock.h b/story-editor-legacy/src/script_editor_dock.h similarity index 100% rename from story-editor/src/script_editor_dock.h rename to story-editor-legacy/src/script_editor_dock.h diff --git a/story-editor/src/stb_image.h b/story-editor-legacy/src/stb_image.h similarity index 100% rename from story-editor/src/stb_image.h rename to story-editor-legacy/src/stb_image.h diff --git a/story-editor/src/story_graph_model.cpp b/story-editor-legacy/src/story_graph_model.cpp similarity index 100% rename from story-editor/src/story_graph_model.cpp rename to story-editor-legacy/src/story_graph_model.cpp diff --git a/story-editor/src/story_graph_model.h b/story-editor-legacy/src/story_graph_model.h similarity index 100% rename from story-editor/src/story_graph_model.h rename to story-editor-legacy/src/story_graph_model.h diff --git a/story-editor/src/story_graph_scene.cpp b/story-editor-legacy/src/story_graph_scene.cpp similarity index 100% rename from story-editor/src/story_graph_scene.cpp rename to story-editor-legacy/src/story_graph_scene.cpp diff --git a/story-editor/src/story_graph_scene.h b/story-editor-legacy/src/story_graph_scene.h similarity index 100% rename from story-editor/src/story_graph_scene.h rename to story-editor-legacy/src/story_graph_scene.h diff --git a/story-editor/src/story_node_base.cpp b/story-editor-legacy/src/story_node_base.cpp similarity index 100% rename from story-editor/src/story_node_base.cpp rename to story-editor-legacy/src/story_node_base.cpp diff --git a/story-editor/src/story_node_base.h b/story-editor-legacy/src/story_node_base.h similarity index 100% rename from story-editor/src/story_node_base.h rename to story-editor-legacy/src/story_node_base.h diff --git a/story-editor/src/story_node_data.h b/story-editor-legacy/src/story_node_data.h similarity index 100% rename from story-editor/src/story_node_data.h rename to story-editor-legacy/src/story_node_data.h diff --git a/story-editor/src/story_project.cpp b/story-editor-legacy/src/story_project.cpp similarity index 100% rename from story-editor/src/story_project.cpp rename to story-editor-legacy/src/story_project.cpp diff --git a/story-editor/src/story_project.h b/story-editor-legacy/src/story_project.h similarity index 100% rename from story-editor/src/story_project.h rename to story-editor-legacy/src/story_project.h diff --git a/story-editor/src/toolbar.cpp b/story-editor-legacy/src/toolbar.cpp similarity index 100% rename from story-editor/src/toolbar.cpp rename to story-editor-legacy/src/toolbar.cpp diff --git a/story-editor/src/toolbar.h b/story-editor-legacy/src/toolbar.h similarity index 100% rename from story-editor/src/toolbar.h rename to story-editor-legacy/src/toolbar.h diff --git a/story-editor/src/vm_dock.cpp b/story-editor-legacy/src/vm_dock.cpp similarity index 100% rename from story-editor/src/vm_dock.cpp rename to story-editor-legacy/src/vm_dock.cpp diff --git a/story-editor/src/vm_dock.h b/story-editor-legacy/src/vm_dock.h similarity index 100% rename from story-editor/src/vm_dock.h rename to story-editor-legacy/src/vm_dock.h diff --git a/story-editor/story-editor-logo.ico b/story-editor-legacy/story-editor-logo.ico similarity index 100% rename from story-editor/story-editor-logo.ico rename to story-editor-legacy/story-editor-logo.ico diff --git a/story-editor/story-editor-logo.png b/story-editor-legacy/story-editor-logo.png similarity index 100% rename from story-editor/story-editor-logo.png rename to story-editor-legacy/story-editor-logo.png diff --git a/story-editor/story-editor.desktop b/story-editor-legacy/story-editor.desktop similarity index 100% rename from story-editor/story-editor.desktop rename to story-editor-legacy/story-editor.desktop diff --git a/story-editor/test.json b/story-editor-legacy/test.json similarity index 100% rename from story-editor/test.json rename to story-editor-legacy/test.json diff --git a/story-editor-legacy/tools/audio/.idea/.gitignore b/story-editor-legacy/tools/audio/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/story-editor-legacy/tools/audio/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/story-editor-legacy/tools/audio/.idea/vcs.xml b/story-editor-legacy/tools/audio/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/story-editor-legacy/tools/audio/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/story-editor/tools/audio/AudioFile.cpp b/story-editor-legacy/tools/audio/AudioFile.cpp similarity index 100% rename from story-editor/tools/audio/AudioFile.cpp rename to story-editor-legacy/tools/audio/AudioFile.cpp diff --git a/story-editor/tools/audio/AudioFile.h b/story-editor-legacy/tools/audio/AudioFile.h similarity index 100% rename from story-editor/tools/audio/AudioFile.h rename to story-editor-legacy/tools/audio/AudioFile.h diff --git a/story-editor/tools/audio/CMakeLists.txt b/story-editor-legacy/tools/audio/CMakeLists.txt similarity index 100% rename from story-editor/tools/audio/CMakeLists.txt rename to story-editor-legacy/tools/audio/CMakeLists.txt diff --git a/story-editor/tools/audio/LICENSE b/story-editor-legacy/tools/audio/LICENSE similarity index 100% rename from story-editor/tools/audio/LICENSE rename to story-editor-legacy/tools/audio/LICENSE diff --git a/story-editor/tools/audio/main.cpp b/story-editor-legacy/tools/audio/main.cpp similarity index 100% rename from story-editor/tools/audio/main.cpp rename to story-editor-legacy/tools/audio/main.cpp diff --git a/story-editor/tools/audio/minimp3.h b/story-editor-legacy/tools/audio/minimp3.h similarity index 100% rename from story-editor/tools/audio/minimp3.h rename to story-editor-legacy/tools/audio/minimp3.h diff --git a/story-editor/tools/audio/minimp3_ex.h b/story-editor-legacy/tools/audio/minimp3_ex.h similarity index 100% rename from story-editor/tools/audio/minimp3_ex.h rename to story-editor-legacy/tools/audio/minimp3_ex.h diff --git a/story-editor-v2/CMakeLists.txt b/story-editor-v2/CMakeLists.txt index 0e61e7e..3b1458d 100644 --- a/story-editor-v2/CMakeLists.txt +++ b/story-editor-v2/CMakeLists.txt @@ -6,7 +6,7 @@ project(${STORY_EDITOR_PROJECT} LANGUAGES C CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set (CMAKE_C_STANDARD 11) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) # set(CMAKE_VERBOSE_MAKEFILE on) @@ -125,6 +125,11 @@ set(SRCS src/code_editor.cpp src/code_editor.h + src/uuid.h + src/resource_manager.h + src/i_story_project.h + src/resource.h + libs/ImGuiColorTextEdit/TextEditor.cpp libs/ImGuiColorTextEdit/TextEditor.h libs/imgui-node-editor/imgui_node_editor.cpp @@ -162,8 +167,6 @@ endif() add_executable(${STORY_EDITOR_PROJECT} ${SRCS} - src/uuid.h - src/window_base.h src/window_base.cpp ) target_include_directories(${STORY_EDITOR_PROJECT} PUBLIC diff --git a/story-editor-v2/src/base_node.cpp b/story-editor-v2/src/base_node.cpp index 37ece3d..b1a02f5 100644 --- a/story-editor-v2/src/base_node.cpp +++ b/story-editor-v2/src/base_node.cpp @@ -5,13 +5,13 @@ int BaseNode::s_nextId = 1; -BaseNode::BaseNode(const std::string &title, StoryProject &proj) +BaseNode::BaseNode(const std::string &title, IStoryProject &proj) : m_project(proj) { // m_id = UUID().String(); - m_id = -1; - m_node = std::make_unique(GetNextId(), title.c_str()); + m_id = -1; // Story Project Node ID + m_node = std::make_unique(GetNextId(), title.c_str()); // ImGui internal ID } void BaseNode::AddInput() diff --git a/story-editor-v2/src/base_node.h b/story-editor-v2/src/base_node.h index b47f3e9..376c63b 100644 --- a/story-editor-v2/src/base_node.h +++ b/story-editor-v2/src/base_node.h @@ -7,7 +7,7 @@ #include #include "json.hpp" -#include "story_project.h" +#include "i_story_project.h" #include namespace ed = ax::NodeEditor; @@ -101,7 +101,7 @@ public: int y; }; - BaseNode(const std::string &title, StoryProject &proj); + BaseNode(const std::string &title, IStoryProject &proj); virtual void Draw() = 0; @@ -117,6 +117,7 @@ public: void SetId(const int id) { m_id = id; } int GetId() const { return m_id; } + int GetInternalId() const { return m_node->ID.Get(); } void seTitle(const std::string &title) { m_title = title; } std::string getTitle() const { return m_title; } @@ -173,7 +174,7 @@ public: void DeleteOutput(); private: - StoryProject &m_project; + IStoryProject &m_project; std::unique_ptr m_node; diff --git a/story-editor-v2/src/console_window.cpp b/story-editor-v2/src/console_window.cpp index 5bc6feb..7a6b893 100644 --- a/story-editor-v2/src/console_window.cpp +++ b/story-editor-v2/src/console_window.cpp @@ -4,6 +4,7 @@ ConsoleWindow::ConsoleWindow() + : WindowBase("Console") { ClearLog(); memset(InputBuf, 0, sizeof(InputBuf)); @@ -31,24 +32,12 @@ void ConsoleWindow::ClearLog() Items.clear(); } -void ConsoleWindow::Draw(const char *title, bool *p_open) +void ConsoleWindow::Draw() { - ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin(title, p_open)) - { - ImGui::End(); - return; - } + WindowBase::BeginDraw(); + + ImGui::SetWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - // As a specific feature guaranteed by the library, after calling Begin() the last Item represent the title bar. - // So e.g. IsItemHovered() will return true when hovering the title bar. - // Here we create a context menu only available from the title bar. - if (ImGui::BeginPopupContextItem()) - { - if (ImGui::MenuItem("Close Console")) - *p_open = false; - ImGui::EndPopup(); - } ImGui::TextWrapped("Console view"); // ImGui::TextWrapped("Enter 'HELP' for help."); @@ -176,7 +165,7 @@ void ConsoleWindow::Draw(const char *title, bool *p_open) if (reclaim_focus) ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget */ - ImGui::End(); + WindowBase::EndDraw(); } void ConsoleWindow::ExecCommand(const char *command_line) diff --git a/story-editor-v2/src/console_window.h b/story-editor-v2/src/console_window.h index 3ebda8c..57c0086 100644 --- a/story-editor-v2/src/console_window.h +++ b/story-editor-v2/src/console_window.h @@ -6,10 +6,12 @@ #include #include +#include "window_base.h" + // Demonstrate creating a simple console window, with scrolling, filtering, completion and history. // For the console example, we are using a more C++ like approach of declaring a class to hold both data and functions. -struct ConsoleWindow +struct ConsoleWindow : public WindowBase { public: ConsoleWindow(); @@ -25,7 +27,7 @@ public: void AddMessage(const std::string &message) { AddLog("%s", message.c_str()); } - void Draw(const char* title, bool* p_open); + virtual void Draw() override; void ExecCommand(const char* command_line); diff --git a/story-editor-v2/src/i_story_project.h b/story-editor-v2/src/i_story_project.h new file mode 100644 index 0000000..2679e94 --- /dev/null +++ b/story-editor-v2/src/i_story_project.h @@ -0,0 +1,29 @@ +#ifndef I_STORY_PROJECT_H +#define I_STORY_PROJECT_H + + +#include +#include +#include + +#include "resource.h" + +class IStoryProject +{ +public: + virtual ~IStoryProject() {} + + virtual void PlaySoundFile(const std::string &fileName) = 0; + virtual std::string BuildFullAssetsPath(const std::string &fileName) const = 0; + + // Resources management + virtual std::pair Images() = 0; + virtual std::pair Sounds() = 0; + virtual std::pair Resources() = 0; + virtual void AddResource(std::shared_ptr res) = 0; + virtual void ClearResources() = 0; + + +}; + +#endif // I_STORY_PROJECT_H diff --git a/story-editor-v2/src/imgui_memory_editor.h b/story-editor-v2/src/imgui_memory_editor.h new file mode 100644 index 0000000..ec2beef --- /dev/null +++ b/story-editor-v2/src/imgui_memory_editor.h @@ -0,0 +1,742 @@ +// Mini memory editor for Dear ImGui (to embed in your game/tools) +// Get latest version at http://www.github.com/ocornut/imgui_club +// +// Right-click anywhere to access the Options menu! +// You can adjust the keyboard repeat delay/rate in ImGuiIO. +// The code assume a mono-space font for simplicity! +// If you don't use the default font, use ImGui::PushFont()/PopFont() to switch to a mono-space font before calling this. +// +// Usage: +// // Create a window and draw memory editor inside it: +// static MemoryEditor mem_edit_1; +// static char data[0x10000]; +// size_t data_size = 0x10000; +// mem_edit_1.DrawWindow("Memory Editor", data, data_size); +// +// Usage: +// // If you already have a window, use DrawContents() instead: +// static MemoryEditor mem_edit_2; +// ImGui::Begin("MyWindow") +// mem_edit_2.DrawContents(this, sizeof(*this), (size_t)this); +// ImGui::End(); +// +// Changelog: +// - v0.10: initial version +// - v0.23 (2017/08/17): added to github. fixed right-arrow triggering a byte write. +// - v0.24 (2018/06/02): changed DragInt("Rows" to use a %d data format (which is desirable since imgui 1.61). +// - v0.25 (2018/07/11): fixed wording: all occurrences of "Rows" renamed to "Columns". +// - v0.26 (2018/08/02): fixed clicking on hex region +// - v0.30 (2018/08/02): added data preview for common data types +// - v0.31 (2018/10/10): added OptUpperCaseHex option to select lower/upper casing display [@samhocevar] +// - v0.32 (2018/10/10): changed signatures to use void* instead of unsigned char* +// - v0.33 (2018/10/10): added OptShowOptions option to hide all the interactive option setting. +// - v0.34 (2019/05/07): binary preview now applies endianness setting [@nicolasnoble] +// - v0.35 (2020/01/29): using ImGuiDataType available since Dear ImGui 1.69. +// - v0.36 (2020/05/05): minor tweaks, minor refactor. +// - v0.40 (2020/10/04): fix misuse of ImGuiListClipper API, broke with Dear ImGui 1.79. made cursor position appears on left-side of edit box. option popup appears on mouse release. fix MSVC warnings where _CRT_SECURE_NO_WARNINGS wasn't working in recent versions. +// - v0.41 (2020/10/05): fix when using with keyboard/gamepad navigation enabled. +// - v0.42 (2020/10/14): fix for . character in ASCII view always being greyed out. +// - v0.43 (2021/03/12): added OptFooterExtraHeight to allow for custom drawing at the bottom of the editor [@leiradel] +// - v0.44 (2021/03/12): use ImGuiInputTextFlags_AlwaysOverwrite in 1.82 + fix hardcoded width. +// - v0.50 (2021/11/12): various fixes for recent dear imgui versions (fixed misuse of clipper, relying on SetKeyboardFocusHere() handling scrolling from 1.85). added default size. +// +// Todo/Bugs: +// - This is generally old/crappy code, it should work but isn't very good.. to be rewritten some day. +// - PageUp/PageDown are supported because we use _NoNav. This is a good test scenario for working out idioms of how to mix natural nav and our own... +// - Arrows are being sent to the InputText() about to disappear which for LeftArrow makes the text cursor appear at position 1 for one frame. +// - Using InputText() is awkward and maybe overkill here, consider implementing something custom. + +#pragma once + +#include // sprintf, scanf +#include // uint8_t, etc. + +#ifdef _MSC_VER +#define _PRISizeT "I" +#define ImSnprintf _snprintf +#else +#define _PRISizeT "z" +#define ImSnprintf snprintf +#endif + +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4996) // warning C4996: 'sprintf': This function or variable may be unsafe. +#endif + +struct MemoryEditor +{ + enum DataFormat + { + DataFormat_Bin = 0, + DataFormat_Dec = 1, + DataFormat_Hex = 2, + DataFormat_COUNT + }; + + // Settings + bool Open; // = true // set to false when DrawWindow() was closed. ignore if not using DrawWindow(). + bool ReadOnly; // = false // disable any editing. + int Cols; // = 16 // number of columns to display. + bool OptShowOptions; // = true // display options button/context menu. when disabled, options will be locked unless you provide your own UI for them. + bool OptShowDataPreview; // = false // display a footer previewing the decimal/binary/hex/float representation of the currently selected bytes. + bool OptShowHexII; // = false // display values in HexII representation instead of regular hexadecimal: hide null/zero bytes, ascii values as ".X". + bool OptShowAscii; // = true // display ASCII representation on the right side. + bool OptGreyOutZeroes; // = true // display null/zero bytes using the TextDisabled color. + bool OptUpperCaseHex; // = true // display hexadecimal values as "FF" instead of "ff". + int OptMidColsCount; // = 8 // set to 0 to disable extra spacing between every mid-cols. + int OptAddrDigitsCount; // = 0 // number of addr digits to display (default calculated based on maximum displayed addr). + float OptFooterExtraHeight; // = 0 // space to reserve at the bottom of the widget to add custom widgets + ImU32 HighlightColor; // // background color of highlighted bytes. + ImU8 (*ReadFn)(const ImU8* data, size_t off); // = 0 // optional handler to read bytes. + void (*WriteFn)(ImU8* data, size_t off, ImU8 d); // = 0 // optional handler to write bytes. + bool (*HighlightFn)(const ImU8* data, size_t off);//= 0 // optional handler to return Highlight property (to support non-contiguous highlighting). + + // [Internal State] + bool ContentsWidthChanged; + size_t DataPreviewAddr; + size_t DataEditingAddr; + bool DataEditingTakeFocus; + char DataInputBuf[32]; + char AddrInputBuf[32]; + size_t GotoAddr; + size_t HighlightMin, HighlightMax; + int PreviewEndianess; + ImGuiDataType PreviewDataType; + + MemoryEditor() + { + // Settings + Open = true; + ReadOnly = false; + Cols = 16; + OptShowOptions = true; + OptShowDataPreview = false; + OptShowHexII = false; + OptShowAscii = true; + OptGreyOutZeroes = true; + OptUpperCaseHex = true; + OptMidColsCount = 8; + OptAddrDigitsCount = 0; + OptFooterExtraHeight = 0.0f; + HighlightColor = IM_COL32(255, 255, 255, 50); + ReadFn = NULL; + WriteFn = NULL; + HighlightFn = NULL; + + // State/Internals + ContentsWidthChanged = false; + DataPreviewAddr = DataEditingAddr = (size_t)-1; + DataEditingTakeFocus = false; + memset(DataInputBuf, 0, sizeof(DataInputBuf)); + memset(AddrInputBuf, 0, sizeof(AddrInputBuf)); + GotoAddr = (size_t)-1; + HighlightMin = HighlightMax = (size_t)-1; + PreviewEndianess = 0; + PreviewDataType = ImGuiDataType_S32; + } + + void GotoAddrAndHighlight(size_t addr_min, size_t addr_max) + { + GotoAddr = addr_min; + HighlightMin = addr_min; + HighlightMax = addr_max; + } + + struct Sizes + { + int AddrDigitsCount; + float LineHeight; + float GlyphWidth; + float HexCellWidth; + float SpacingBetweenMidCols; + float PosHexStart; + float PosHexEnd; + float PosAsciiStart; + float PosAsciiEnd; + float WindowWidth; + + Sizes() { memset(this, 0, sizeof(*this)); } + }; + + void CalcSizes(Sizes& s, size_t mem_size, size_t base_display_addr) + { + ImGuiStyle& style = ImGui::GetStyle(); + s.AddrDigitsCount = OptAddrDigitsCount; + if (s.AddrDigitsCount == 0) + for (size_t n = base_display_addr + mem_size - 1; n > 0; n >>= 4) + s.AddrDigitsCount++; + s.LineHeight = ImGui::GetTextLineHeight(); + s.GlyphWidth = ImGui::CalcTextSize("F").x + 1; // We assume the font is mono-space + s.HexCellWidth = (float)(int)(s.GlyphWidth * 2.5f); // "FF " we include trailing space in the width to easily catch clicks everywhere + s.SpacingBetweenMidCols = (float)(int)(s.HexCellWidth * 0.25f); // Every OptMidColsCount columns we add a bit of extra spacing + s.PosHexStart = (s.AddrDigitsCount + 2) * s.GlyphWidth; + s.PosHexEnd = s.PosHexStart + (s.HexCellWidth * Cols); + s.PosAsciiStart = s.PosAsciiEnd = s.PosHexEnd; + if (OptShowAscii) + { + s.PosAsciiStart = s.PosHexEnd + s.GlyphWidth * 1; + if (OptMidColsCount > 0) + s.PosAsciiStart += (float)((Cols + OptMidColsCount - 1) / OptMidColsCount) * s.SpacingBetweenMidCols; + s.PosAsciiEnd = s.PosAsciiStart + Cols * s.GlyphWidth; + } + s.WindowWidth = s.PosAsciiEnd + style.ScrollbarSize + style.WindowPadding.x * 2 + s.GlyphWidth; + } + + // Standalone Memory Editor window + void DrawWindow(const char* title, void* mem_data, size_t mem_size, size_t base_display_addr = 0x0000) + { + Sizes s; + CalcSizes(s, mem_size, base_display_addr); + ImGui::SetNextWindowSize(ImVec2(s.WindowWidth, s.WindowWidth * 0.60f), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(s.WindowWidth, FLT_MAX)); + + Open = true; + if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar)) + { + if (ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows) && ImGui::IsMouseReleased(ImGuiMouseButton_Right)) + ImGui::OpenPopup("context"); + DrawContents(mem_data, mem_size, base_display_addr); + if (ContentsWidthChanged) + { + CalcSizes(s, mem_size, base_display_addr); + ImGui::SetWindowSize(ImVec2(s.WindowWidth, ImGui::GetWindowSize().y)); + } + } + ImGui::End(); + } + + // Memory Editor contents only + void DrawContents(void* mem_data_void, size_t mem_size, size_t base_display_addr = 0x0000) + { + if (Cols < 1) + Cols = 1; + + ImU8* mem_data = (ImU8*)mem_data_void; + Sizes s; + CalcSizes(s, mem_size, base_display_addr); + ImGuiStyle& style = ImGui::GetStyle(); + + // We begin into our scrolling region with the 'ImGuiWindowFlags_NoMove' in order to prevent click from moving the window. + // This is used as a facility since our main click detection code doesn't assign an ActiveId so the click would normally be caught as a window-move. + const float height_separator = style.ItemSpacing.y; + float footer_height = OptFooterExtraHeight; + if (OptShowOptions) + footer_height += height_separator + ImGui::GetFrameHeightWithSpacing() * 1; + if (OptShowDataPreview) + footer_height += height_separator + ImGui::GetFrameHeightWithSpacing() * 1 + ImGui::GetTextLineHeightWithSpacing() * 3; + ImGui::BeginChild("##scrolling", ImVec2(0, -footer_height), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav); + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); + + // We are not really using the clipper API correctly here, because we rely on visible_start_addr/visible_end_addr for our scrolling function. + const int line_total_count = (int)((mem_size + Cols - 1) / Cols); + ImGuiListClipper clipper; + clipper.Begin(line_total_count, s.LineHeight); + + bool data_next = false; + + if (ReadOnly || DataEditingAddr >= mem_size) + DataEditingAddr = (size_t)-1; + if (DataPreviewAddr >= mem_size) + DataPreviewAddr = (size_t)-1; + + size_t preview_data_type_size = OptShowDataPreview ? DataTypeGetSize(PreviewDataType) : 0; + + size_t data_editing_addr_next = (size_t)-1; + if (DataEditingAddr != (size_t)-1) + { + // Move cursor but only apply on next frame so scrolling with be synchronized (because currently we can't change the scrolling while the window is being rendered) + if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)) && (ptrdiff_t)DataEditingAddr >= (ptrdiff_t)Cols) { data_editing_addr_next = DataEditingAddr - Cols; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && (ptrdiff_t)DataEditingAddr < (ptrdiff_t)mem_size - Cols) { data_editing_addr_next = DataEditingAddr + Cols; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && (ptrdiff_t)DataEditingAddr > (ptrdiff_t)0) { data_editing_addr_next = DataEditingAddr - 1; } + else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)) && (ptrdiff_t)DataEditingAddr < (ptrdiff_t)mem_size - 1) { data_editing_addr_next = DataEditingAddr + 1; } + } + + // Draw vertical separator + ImVec2 window_pos = ImGui::GetWindowPos(); + if (OptShowAscii) + draw_list->AddLine(ImVec2(window_pos.x + s.PosAsciiStart - s.GlyphWidth, window_pos.y), ImVec2(window_pos.x + s.PosAsciiStart - s.GlyphWidth, window_pos.y + 9999), ImGui::GetColorU32(ImGuiCol_Border)); + + const ImU32 color_text = ImGui::GetColorU32(ImGuiCol_Text); + const ImU32 color_disabled = OptGreyOutZeroes ? ImGui::GetColorU32(ImGuiCol_TextDisabled) : color_text; + + const char* format_address = OptUpperCaseHex ? "%0*" _PRISizeT "X: " : "%0*" _PRISizeT "x: "; + const char* format_data = OptUpperCaseHex ? "%0*" _PRISizeT "X" : "%0*" _PRISizeT "x"; + const char* format_byte = OptUpperCaseHex ? "%02X" : "%02x"; + const char* format_byte_space = OptUpperCaseHex ? "%02X " : "%02x "; + + while (clipper.Step()) + for (int line_i = clipper.DisplayStart; line_i < clipper.DisplayEnd; line_i++) // display only visible lines + { + size_t addr = (size_t)(line_i * Cols); + ImGui::Text(format_address, s.AddrDigitsCount, base_display_addr + addr); + + // Draw Hexadecimal + for (int n = 0; n < Cols && addr < mem_size; n++, addr++) + { + float byte_pos_x = s.PosHexStart + s.HexCellWidth * n; + if (OptMidColsCount > 0) + byte_pos_x += (float)(n / OptMidColsCount) * s.SpacingBetweenMidCols; + ImGui::SameLine(byte_pos_x); + + // Draw highlight + bool is_highlight_from_user_range = (addr >= HighlightMin && addr < HighlightMax); + bool is_highlight_from_user_func = (HighlightFn && HighlightFn(mem_data, addr)); + bool is_highlight_from_preview = (addr >= DataPreviewAddr && addr < DataPreviewAddr + preview_data_type_size); + if (is_highlight_from_user_range || is_highlight_from_user_func || is_highlight_from_preview) + { + ImVec2 pos = ImGui::GetCursorScreenPos(); + float highlight_width = s.GlyphWidth * 2; + bool is_next_byte_highlighted = (addr + 1 < mem_size) && ((HighlightMax != (size_t)-1 && addr + 1 < HighlightMax) || (HighlightFn && HighlightFn(mem_data, addr + 1))); + if (is_next_byte_highlighted || (n + 1 == Cols)) + { + highlight_width = s.HexCellWidth; + if (OptMidColsCount > 0 && n > 0 && (n + 1) < Cols && ((n + 1) % OptMidColsCount) == 0) + highlight_width += s.SpacingBetweenMidCols; + } + draw_list->AddRectFilled(pos, ImVec2(pos.x + highlight_width, pos.y + s.LineHeight), HighlightColor); + } + + if (DataEditingAddr == addr) + { + // Display text input on current byte + bool data_write = false; + ImGui::PushID((void*)addr); + if (DataEditingTakeFocus) + { + ImGui::SetKeyboardFocusHere(0); + sprintf(AddrInputBuf, format_data, s.AddrDigitsCount, base_display_addr + addr); + sprintf(DataInputBuf, format_byte, ReadFn ? ReadFn(mem_data, addr) : mem_data[addr]); + } + struct UserData + { + // FIXME: We should have a way to retrieve the text edit cursor position more easily in the API, this is rather tedious. This is such a ugly mess we may be better off not using InputText() at all here. + static int Callback(ImGuiInputTextCallbackData* data) + { + UserData* user_data = (UserData*)data->UserData; + if (!data->HasSelection()) + user_data->CursorPos = data->CursorPos; + if (data->SelectionStart == 0 && data->SelectionEnd == data->BufTextLen) + { + // When not editing a byte, always refresh its InputText content pulled from underlying memory data + // (this is a bit tricky, since InputText technically "owns" the master copy of the buffer we edit it in there) + data->DeleteChars(0, data->BufTextLen); + data->InsertChars(0, user_data->CurrentBufOverwrite); + data->SelectionStart = 0; + data->SelectionEnd = 2; + data->CursorPos = 0; + } + return 0; + } + char CurrentBufOverwrite[3]; // Input + int CursorPos; // Output + }; + UserData user_data; + user_data.CursorPos = -1; + sprintf(user_data.CurrentBufOverwrite, format_byte, ReadFn ? ReadFn(mem_data, addr) : mem_data[addr]); + ImGuiInputTextFlags flags = ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoHorizontalScroll | ImGuiInputTextFlags_CallbackAlways; +#if IMGUI_VERSION_NUM >= 18104 + flags |= ImGuiInputTextFlags_AlwaysOverwrite; +#else + flags |= ImGuiInputTextFlags_AlwaysInsertMode; +#endif + ImGui::SetNextItemWidth(s.GlyphWidth * 2); + if (ImGui::InputText("##data", DataInputBuf, IM_ARRAYSIZE(DataInputBuf), flags, UserData::Callback, &user_data)) + data_write = data_next = true; + else if (!DataEditingTakeFocus && !ImGui::IsItemActive()) + DataEditingAddr = data_editing_addr_next = (size_t)-1; + DataEditingTakeFocus = false; + if (user_data.CursorPos >= 2) + data_write = data_next = true; + if (data_editing_addr_next != (size_t)-1) + data_write = data_next = false; + unsigned int data_input_value = 0; + if (data_write && sscanf(DataInputBuf, "%X", &data_input_value) == 1) + { + if (WriteFn) + WriteFn(mem_data, addr, (ImU8)data_input_value); + else + mem_data[addr] = (ImU8)data_input_value; + } + ImGui::PopID(); + } + else + { + // NB: The trailing space is not visible but ensure there's no gap that the mouse cannot click on. + ImU8 b = ReadFn ? ReadFn(mem_data, addr) : mem_data[addr]; + + if (OptShowHexII) + { + if ((b >= 32 && b < 128)) + ImGui::Text(".%c ", b); + else if (b == 0xFF && OptGreyOutZeroes) + ImGui::TextDisabled("## "); + else if (b == 0x00) + ImGui::Text(" "); + else + ImGui::Text(format_byte_space, b); + } + else + { + if (b == 0 && OptGreyOutZeroes) + ImGui::TextDisabled("00 "); + else + ImGui::Text(format_byte_space, b); + } + if (!ReadOnly && ImGui::IsItemHovered() && ImGui::IsMouseClicked(0)) + { + DataEditingTakeFocus = true; + data_editing_addr_next = addr; + } + } + } + + if (OptShowAscii) + { + // Draw ASCII values + ImGui::SameLine(s.PosAsciiStart); + ImVec2 pos = ImGui::GetCursorScreenPos(); + addr = line_i * Cols; + ImGui::PushID(line_i); + if (ImGui::InvisibleButton("ascii", ImVec2(s.PosAsciiEnd - s.PosAsciiStart, s.LineHeight))) + { + DataEditingAddr = DataPreviewAddr = addr + (size_t)((ImGui::GetIO().MousePos.x - pos.x) / s.GlyphWidth); + DataEditingTakeFocus = true; + } + ImGui::PopID(); + for (int n = 0; n < Cols && addr < mem_size; n++, addr++) + { + if (addr == DataEditingAddr) + { + draw_list->AddRectFilled(pos, ImVec2(pos.x + s.GlyphWidth, pos.y + s.LineHeight), ImGui::GetColorU32(ImGuiCol_FrameBg)); + draw_list->AddRectFilled(pos, ImVec2(pos.x + s.GlyphWidth, pos.y + s.LineHeight), ImGui::GetColorU32(ImGuiCol_TextSelectedBg)); + } + unsigned char c = ReadFn ? ReadFn(mem_data, addr) : mem_data[addr]; + char display_c = (c < 32 || c >= 128) ? '.' : c; + draw_list->AddText(pos, (display_c == c) ? color_text : color_disabled, &display_c, &display_c + 1); + pos.x += s.GlyphWidth; + } + } + } + ImGui::PopStyleVar(2); + ImGui::EndChild(); + + // Notify the main window of our ideal child content size (FIXME: we are missing an API to get the contents size from the child) + ImGui::SetCursorPosX(s.WindowWidth); + + if (data_next && DataEditingAddr + 1 < mem_size) + { + DataEditingAddr = DataPreviewAddr = DataEditingAddr + 1; + DataEditingTakeFocus = true; + } + else if (data_editing_addr_next != (size_t)-1) + { + DataEditingAddr = DataPreviewAddr = data_editing_addr_next; + DataEditingTakeFocus = true; + } + + const bool lock_show_data_preview = OptShowDataPreview; + if (OptShowOptions) + { + ImGui::Separator(); + DrawOptionsLine(s, mem_data, mem_size, base_display_addr); + } + + if (lock_show_data_preview) + { + ImGui::Separator(); + DrawPreviewLine(s, mem_data, mem_size, base_display_addr); + } + } + + void DrawOptionsLine(const Sizes& s, void* mem_data, size_t mem_size, size_t base_display_addr) + { + IM_UNUSED(mem_data); + ImGuiStyle& style = ImGui::GetStyle(); + const char* format_range = OptUpperCaseHex ? "Range %0*" _PRISizeT "X..%0*" _PRISizeT "X" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x"; + + // Options menu + if (ImGui::Button("Options")) + ImGui::OpenPopup("context"); + if (ImGui::BeginPopup("context")) + { + ImGui::SetNextItemWidth(s.GlyphWidth * 7 + style.FramePadding.x * 2.0f); + if (ImGui::DragInt("##cols", &Cols, 0.2f, 4, 32, "%d cols")) { ContentsWidthChanged = true; if (Cols < 1) Cols = 1; } + ImGui::Checkbox("Show Data Preview", &OptShowDataPreview); + ImGui::Checkbox("Show HexII", &OptShowHexII); + if (ImGui::Checkbox("Show Ascii", &OptShowAscii)) { ContentsWidthChanged = true; } + ImGui::Checkbox("Grey out zeroes", &OptGreyOutZeroes); + ImGui::Checkbox("Uppercase Hex", &OptUpperCaseHex); + + ImGui::EndPopup(); + } + + ImGui::SameLine(); + ImGui::Text(format_range, s.AddrDigitsCount, base_display_addr, s.AddrDigitsCount, base_display_addr + mem_size - 1); + ImGui::SameLine(); + ImGui::SetNextItemWidth((s.AddrDigitsCount + 1) * s.GlyphWidth + style.FramePadding.x * 2.0f); + if (ImGui::InputText("##addr", AddrInputBuf, IM_ARRAYSIZE(AddrInputBuf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_EnterReturnsTrue)) + { + size_t goto_addr; + if (sscanf(AddrInputBuf, "%" _PRISizeT "X", &goto_addr) == 1) + { + GotoAddr = goto_addr - base_display_addr; + HighlightMin = HighlightMax = (size_t)-1; + } + } + + if (GotoAddr != (size_t)-1) + { + if (GotoAddr < mem_size) + { + ImGui::BeginChild("##scrolling"); + ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (GotoAddr / Cols) * ImGui::GetTextLineHeight()); + ImGui::EndChild(); + DataEditingAddr = DataPreviewAddr = GotoAddr; + DataEditingTakeFocus = true; + } + GotoAddr = (size_t)-1; + } + } + + void DrawPreviewLine(const Sizes& s, void* mem_data_void, size_t mem_size, size_t base_display_addr) + { + IM_UNUSED(base_display_addr); + ImU8* mem_data = (ImU8*)mem_data_void; + ImGuiStyle& style = ImGui::GetStyle(); + ImGui::AlignTextToFramePadding(); + ImGui::Text("Preview as:"); + ImGui::SameLine(); + ImGui::SetNextItemWidth((s.GlyphWidth * 10.0f) + style.FramePadding.x * 2.0f + style.ItemInnerSpacing.x); + if (ImGui::BeginCombo("##combo_type", DataTypeGetDesc(PreviewDataType), ImGuiComboFlags_HeightLargest)) + { + for (int n = 0; n < ImGuiDataType_COUNT; n++) + if (ImGui::Selectable(DataTypeGetDesc((ImGuiDataType)n), PreviewDataType == n)) + PreviewDataType = (ImGuiDataType)n; + ImGui::EndCombo(); + } + ImGui::SameLine(); + ImGui::SetNextItemWidth((s.GlyphWidth * 6.0f) + style.FramePadding.x * 2.0f + style.ItemInnerSpacing.x); + ImGui::Combo("##combo_endianess", &PreviewEndianess, "LE\0BE\0\0"); + + char buf[128] = ""; + float x = s.GlyphWidth * 6.0f; + bool has_value = DataPreviewAddr != (size_t)-1; + if (has_value) + DrawPreviewData(DataPreviewAddr, mem_data, mem_size, PreviewDataType, DataFormat_Dec, buf, (size_t)IM_ARRAYSIZE(buf)); + ImGui::Text("Dec"); ImGui::SameLine(x); ImGui::TextUnformatted(has_value ? buf : "N/A"); + if (has_value) + DrawPreviewData(DataPreviewAddr, mem_data, mem_size, PreviewDataType, DataFormat_Hex, buf, (size_t)IM_ARRAYSIZE(buf)); + ImGui::Text("Hex"); ImGui::SameLine(x); ImGui::TextUnformatted(has_value ? buf : "N/A"); + if (has_value) + DrawPreviewData(DataPreviewAddr, mem_data, mem_size, PreviewDataType, DataFormat_Bin, buf, (size_t)IM_ARRAYSIZE(buf)); + buf[IM_ARRAYSIZE(buf) - 1] = 0; + ImGui::Text("Bin"); ImGui::SameLine(x); ImGui::TextUnformatted(has_value ? buf : "N/A"); + } + + // Utilities for Data Preview + const char* DataTypeGetDesc(ImGuiDataType data_type) const + { + const char* descs[] = { "Int8", "Uint8", "Int16", "Uint16", "Int32", "Uint32", "Int64", "Uint64", "Float", "Double" }; + IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); + return descs[data_type]; + } + + size_t DataTypeGetSize(ImGuiDataType data_type) const + { + const size_t sizes[] = { 1, 1, 2, 2, 4, 4, 8, 8, sizeof(float), sizeof(double) }; + IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); + return sizes[data_type]; + } + + const char* DataFormatGetDesc(DataFormat data_format) const + { + const char* descs[] = { "Bin", "Dec", "Hex" }; + IM_ASSERT(data_format >= 0 && data_format < DataFormat_COUNT); + return descs[data_format]; + } + + bool IsBigEndian() const + { + uint16_t x = 1; + char c[2]; + memcpy(c, &x, 2); + return c[0] != 0; + } + + static void* EndianessCopyBigEndian(void* _dst, void* _src, size_t s, int is_little_endian) + { + if (is_little_endian) + { + uint8_t* dst = (uint8_t*)_dst; + uint8_t* src = (uint8_t*)_src + s - 1; + for (int i = 0, n = (int)s; i < n; ++i) + memcpy(dst++, src--, 1); + return _dst; + } + else + { + return memcpy(_dst, _src, s); + } + } + + static void* EndianessCopyLittleEndian(void* _dst, void* _src, size_t s, int is_little_endian) + { + if (is_little_endian) + { + return memcpy(_dst, _src, s); + } + else + { + uint8_t* dst = (uint8_t*)_dst; + uint8_t* src = (uint8_t*)_src + s - 1; + for (int i = 0, n = (int)s; i < n; ++i) + memcpy(dst++, src--, 1); + return _dst; + } + } + + void* EndianessCopy(void* dst, void* src, size_t size) const + { + static void* (*fp)(void*, void*, size_t, int) = NULL; + if (fp == NULL) + fp = IsBigEndian() ? EndianessCopyBigEndian : EndianessCopyLittleEndian; + return fp(dst, src, size, PreviewEndianess); + } + + const char* FormatBinary(const uint8_t* buf, int width) const + { + IM_ASSERT(width <= 64); + size_t out_n = 0; + static char out_buf[64 + 8 + 1]; + int n = width / 8; + for (int j = n - 1; j >= 0; --j) + { + for (int i = 0; i < 8; ++i) + out_buf[out_n++] = (buf[j] & (1 << (7 - i))) ? '1' : '0'; + out_buf[out_n++] = ' '; + } + IM_ASSERT(out_n < IM_ARRAYSIZE(out_buf)); + out_buf[out_n] = 0; + return out_buf; + } + + // [Internal] + void DrawPreviewData(size_t addr, const ImU8* mem_data, size_t mem_size, ImGuiDataType data_type, DataFormat data_format, char* out_buf, size_t out_buf_size) const + { + uint8_t buf[8]; + size_t elem_size = DataTypeGetSize(data_type); + size_t size = addr + elem_size > mem_size ? mem_size - addr : elem_size; + if (ReadFn) + for (int i = 0, n = (int)size; i < n; ++i) + buf[i] = ReadFn(mem_data, addr + i); + else + memcpy(buf, mem_data + addr, size); + + if (data_format == DataFormat_Bin) + { + uint8_t binbuf[8]; + EndianessCopy(binbuf, buf, size); + ImSnprintf(out_buf, out_buf_size, "%s", FormatBinary(binbuf, (int)size * 8)); + return; + } + + out_buf[0] = 0; + switch (data_type) + { + case ImGuiDataType_S8: + { + int8_t int8 = 0; + EndianessCopy(&int8, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hhd", int8); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%02x", int8 & 0xFF); return; } + break; + } + case ImGuiDataType_U8: + { + uint8_t uint8 = 0; + EndianessCopy(&uint8, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hhu", uint8); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%02x", uint8 & 0XFF); return; } + break; + } + case ImGuiDataType_S16: + { + int16_t int16 = 0; + EndianessCopy(&int16, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hd", int16); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%04x", int16 & 0xFFFF); return; } + break; + } + case ImGuiDataType_U16: + { + uint16_t uint16 = 0; + EndianessCopy(&uint16, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hu", uint16); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%04x", uint16 & 0xFFFF); return; } + break; + } + case ImGuiDataType_S32: + { + int32_t int32 = 0; + EndianessCopy(&int32, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%d", int32); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%08x", int32); return; } + break; + } + case ImGuiDataType_U32: + { + uint32_t uint32 = 0; + EndianessCopy(&uint32, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%u", uint32); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%08x", uint32); return; } + break; + } + case ImGuiDataType_S64: + { + int64_t int64 = 0; + EndianessCopy(&int64, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%lld", (long long)int64); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%016llx", (long long)int64); return; } + break; + } + case ImGuiDataType_U64: + { + uint64_t uint64 = 0; + EndianessCopy(&uint64, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%llu", (long long)uint64); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%016llx", (long long)uint64); return; } + break; + } + case ImGuiDataType_Float: + { + float float32 = 0.0f; + EndianessCopy(&float32, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%f", float32); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "%a", float32); return; } + break; + } + case ImGuiDataType_Double: + { + double float64 = 0.0; + EndianessCopy(&float64, buf, size); + if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%f", float64); return; } + if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "%a", float64); return; } + break; + } + case ImGuiDataType_COUNT: + break; + } // Switch + IM_ASSERT(0); // Shouldn't reach + } +}; + +#undef _PRISizeT +#undef ImSnprintf + +#ifdef _MSC_VER +#pragma warning (pop) +#endif diff --git a/story-editor-v2/src/main_window.cpp b/story-editor-v2/src/main_window.cpp index e7fbf93..259364e 100644 --- a/story-editor-v2/src/main_window.cpp +++ b/story-editor-v2/src/main_window.cpp @@ -19,8 +19,8 @@ #include "ImGuiFileDialog.h" MainWindow::MainWindow() - : m_resourcesWindow(m_project) - , m_nodeEditorWindow(m_project) + : m_resourcesWindow(*this) + , m_nodeEditorWindow(*this) { m_project.Clear(); } @@ -310,8 +310,9 @@ void MainWindow::OpenProjectDialog() nlohmann::json model; - if (m_project.Load(filePathName, model)) + if (m_project.Load(filePathName, model, m_resources)) { + m_consoleWindow.AddMessage("Open project success"); m_nodeEditorWindow.Load(model); EnableProject(); } @@ -321,7 +322,7 @@ void MainWindow::OpenProjectDialog() } - // RefreshProjectInformation(); + // RefreshProjectInformation(); // FIXME } // close @@ -341,7 +342,7 @@ void MainWindow::EnableProject() m_recentProjects.pop_back(); } } -/* +/* // FIXME m_ostHmiDock->Open(); m_resourcesDock->Open(); m_scriptEditorDock->Open(); @@ -549,7 +550,7 @@ void MainWindow::NewProjectPopup() void MainWindow::SaveProject() { nlohmann::json model; // = m_model.Save(); - m_project.Save(model); + m_project.Save(model, m_resources); } void MainWindow::CloseProject() @@ -589,15 +590,13 @@ void MainWindow::Loop() // DrawStatusBar(); // ------------ Draw all windows - m_consoleWindow.Draw("Console", nullptr); + m_consoleWindow.Draw(); m_emulatorWindow.Draw(); editor.Draw(); m_resourcesWindow.Draw(); m_nodeEditorWindow.Draw(); - - ShowOptionsWindow(); NewProjectPopup(); @@ -620,6 +619,42 @@ void MainWindow::Loop() gui.Destroy(); } +void MainWindow::PlaySoundFile(const std::string &fileName) +{ + m_consoleWindow.AddMessage("Play sound file: " + fileName); + m_project.PlaySoundFile(fileName); +} + +std::string MainWindow::BuildFullAssetsPath(const std::string &fileName) const +{ + return m_project.BuildFullAssetsPath(fileName); +} + +std::pair MainWindow::Images() +{ + return m_resources.Images(); +} + +std::pair MainWindow::Sounds() +{ + return m_resources.Sounds(); +} + +void MainWindow::AddResource(std::shared_ptr res) +{ + m_resources.Add(res); +} + +void MainWindow::ClearResources() +{ + m_resources.Clear(); +} + +std::pair MainWindow::Resources() +{ + return m_resources.Items(); +} + void MainWindow::SaveParams() { diff --git a/story-editor-v2/src/main_window.h b/story-editor-v2/src/main_window.h index dd2d1df..c889588 100644 --- a/story-editor-v2/src/main_window.h +++ b/story-editor-v2/src/main_window.h @@ -12,6 +12,7 @@ #include "chip32_assembler.h" #include "chip32_vm.h" #include "story_project.h" +#include "i_story_project.h" struct DebugContext { @@ -68,7 +69,7 @@ std::function Callback::func; -class MainWindow +class MainWindow : public IStoryProject { public: MainWindow(); @@ -94,6 +95,8 @@ private: std::vector m_recentProjects; + ResourceManager m_resources; + Gui gui; EmulatorWindow m_emulatorWindow; ConsoleWindow m_consoleWindow; @@ -115,6 +118,18 @@ private: std::string mServerSndUrl; int mServerPort; + + // From IStoryProject (proxy to StoryProject class) + virtual void PlaySoundFile(const std::string &fileName) override;; + virtual std::string BuildFullAssetsPath(const std::string &fileName) const override; + virtual std::pair Images() override; + virtual std::pair Sounds() override; + + virtual void AddResource(std::shared_ptr res) override; + virtual void ClearResources() override; + virtual std::pair Resources() override; + + void SaveParams(); void LoadParams(); diff --git a/story-editor-v2/src/media_node.cpp b/story-editor-v2/src/media_node.cpp index ff65696..92b5925 100644 --- a/story-editor-v2/src/media_node.cpp +++ b/story-editor-v2/src/media_node.cpp @@ -4,7 +4,7 @@ namespace ed = ax::NodeEditor; #include "IconsMaterialDesignIcons.h" -MediaNode::MediaNode(const std::string &title, StoryProject &proj) +MediaNode::MediaNode(const std::string &title, IStoryProject &proj) : BaseNode(title, proj) , m_project(proj) { @@ -14,6 +14,11 @@ MediaNode::MediaNode(const std::string &title, StoryProject &proj) AddInput(); AddOutputs(1); + + std::string widgetId = std::to_string(GetInternalId()); // Make widget unique by using the node ID + + m_buttonUniqueName = "Play " ICON_MDI_PLAY "##id" + widgetId; + } void MediaNode::Draw() @@ -50,6 +55,8 @@ void MediaNode::Draw() // Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements // (otherwise a Text+SameLine+Button sequence will have the text a little too high by default) + + ImGui::AlignTextToFramePadding(); ImGui::Text("Image"); ImGui::SameLine(); @@ -58,9 +65,11 @@ void MediaNode::Draw() ImGui::SameLine(); - bool do_select = false; + bool do_popup = false; + std::string type = "sound"; if (ImGui::Button("Select...")) { - do_select = true; // Instead of saying OpenPopup() here, we set this bool, which is used later in the Deferred Pop-up Section + do_popup = true; // Instead of saying OpenPopup() here, we set this bool, which is used later in the Deferred Pop-up Section + type = "image"; } // Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements @@ -74,18 +83,17 @@ void MediaNode::Draw() ImGui::SameLine(); - if (ImGui::Button("Play " ICON_MDI_PLAY)) + if (ImGui::Button(m_buttonUniqueName.c_str())) { m_project.PlaySoundFile(m_soundPath); } - bool do_select_sound = false; if (ImGui::Button("Select...")) { - do_select_sound = true; // Instead of saying OpenPopup() here, we set this bool, which is used later in the Deferred Pop-up Section + do_popup = true; // Instead of saying OpenPopup() here, we set this bool, which is used later in the Deferred Pop-up Section } ImGui::AlignTextToFramePadding(); - ImGui::Text("Hold to repeat:"); + ImGui::Text("Outputs:"); ImGui::SameLine(); // Arrow buttons with Repeater @@ -110,6 +118,47 @@ void MediaNode::Draw() DrawPins(); + + if (do_popup) { + ImGui::OpenPopup("popup_button"); // Cause openpopup to stick open. + do_popup = false; // disable bool so that if we click off the popup, it doesn't open the next frame. + } + + // This is the actual popup Gui drawing section. + if (ImGui::BeginPopup("popup_button")) { + // Note: if it weren't for the child window, we would have to PushItemWidth() here to avoid a crash! + ImGui::TextDisabled("Choose media file:"); + + + static int item_current_idx = 0; // Here we store our selection data as an index. + if (ImGui::BeginListBox("listbox media")) + { + auto [filtreDebut, filtreFin] = m_project.Sounds(); + int n = 0; + for (auto it = filtreDebut; it != filtreFin; ++it, n++) + { + const bool is_selected = (item_current_idx == n); + if (ImGui::Selectable((*it)->file.c_str(), is_selected)) + item_current_idx = n; + + // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) + if (is_selected) + ImGui::SetItemDefaultFocus(); + } + ImGui::EndListBox(); + } + + + if (ImGui::Button("Ok")) { + + ImGui::CloseCurrentPopup(); // These calls revoke the popup open state, which was set by OpenPopup above. + } + + ImGui::EndChild(); + ImGui::EndPopup(); // Note this does not do anything to the popup open/close state. It just terminates the content declaration. + } + + BaseNode::FrameEnd(); } diff --git a/story-editor-v2/src/media_node.h b/story-editor-v2/src/media_node.h index 9656694..e78cd94 100644 --- a/story-editor-v2/src/media_node.h +++ b/story-editor-v2/src/media_node.h @@ -6,6 +6,7 @@ #include #include "base_node.h" +#include "i_story_project.h" #include "gui.h" #include @@ -13,16 +14,17 @@ class MediaNode : public BaseNode { public: - MediaNode(const std::string &title, StoryProject &proj); + MediaNode(const std::string &title, IStoryProject &proj); void Draw() override; virtual void FromJson(nlohmann::json &j) override; private: - StoryProject &m_project; + IStoryProject &m_project; Gui::Image m_image; std::string m_soundName; std::string m_soundPath; + std::string m_buttonUniqueName; }; diff --git a/story-editor-v2/src/node_editor_window.cpp b/story-editor-v2/src/node_editor_window.cpp index 74f8d43..25b3a58 100644 --- a/story-editor-v2/src/node_editor_window.cpp +++ b/story-editor-v2/src/node_editor_window.cpp @@ -10,7 +10,7 @@ #include "gui.h" -NodeEditorWindow::NodeEditorWindow(StoryProject &proj) +NodeEditorWindow::NodeEditorWindow(IStoryProject &proj) : WindowBase("Node editor") , m_project(proj) { diff --git a/story-editor-v2/src/node_editor_window.h b/story-editor-v2/src/node_editor_window.h index d76059d..1e548f4 100644 --- a/story-editor-v2/src/node_editor_window.h +++ b/story-editor-v2/src/node_editor_window.h @@ -9,6 +9,7 @@ #include #include "base_node.h" #include "window_base.h" +#include "i_story_project.h" #include "story_project.h" #include "json.hpp" @@ -38,7 +39,7 @@ public: Connection model; }; - NodeEditorWindow(StoryProject &proj); + NodeEditorWindow(IStoryProject &proj); ~NodeEditorWindow(); virtual void Draw() override; @@ -47,7 +48,7 @@ public: void Load(const nlohmann::json &model); private: - StoryProject &m_project; + IStoryProject &m_project; ed::EditorContext* m_context = nullptr; @@ -74,12 +75,12 @@ private: template struct Factory { - static std::shared_ptr create_func(const std::string &title, StoryProject &proj) { + static std::shared_ptr create_func(const std::string &title, IStoryProject &proj) { return std::make_shared(title, proj); } }; - typedef std::shared_ptr (*GenericCreator)(const std::string &title, StoryProject &proj); + typedef std::shared_ptr (*GenericCreator)(const std::string &title, IStoryProject &proj); typedef std::map Registry; Registry m_registry; @@ -88,7 +89,7 @@ private: m_registry.insert(typename Registry::value_type(key, Factory::create_func)); } - std::shared_ptr createNode(const std::string& key, const std::string &title, StoryProject &proj) { + std::shared_ptr createNode(const std::string& key, const std::string &title, IStoryProject &proj) { typename Registry::const_iterator i = m_registry.find(key); if (i == m_registry.end()) { throw std::invalid_argument(std::string(__PRETTY_FUNCTION__) + diff --git a/story-editor-v2/src/resource.h b/story-editor-v2/src/resource.h new file mode 100644 index 0000000..7d132fb --- /dev/null +++ b/story-editor-v2/src/resource.h @@ -0,0 +1,82 @@ +#ifndef RESOURCE_H +#define RESOURCE_H + +#include +#include +#include +#include + +struct Resource +{ + std::string file; + std::string description; + std::string format; + std::string type; + + ~Resource() { + std::cout << "Res deleted" << std::endl; + } +}; + +// Itérateur pour parcourir les éléments filtrés +class FilterIterator { +private: + using Iterator = std::vector>::const_iterator; + Iterator current; + Iterator end; + std::string filterType; + +public: + FilterIterator(Iterator start, Iterator end, const std::string &type) + : current(start), end(end), filterType(type) { + searchNext(); + } + + // Surcharge de l'opérateur de déréférencement + const std::shared_ptr& operator*() const { + return *current; + } + + // Surcharge de l'opérateur d'incrémentation + FilterIterator& operator++() { + ++current; + searchNext(); + return *this; + } + + // Surcharge de l'opérateur d'égalité + bool operator==(const FilterIterator& other) const { + return current == other.current; + } + + // Surcharge de l'opérateur de différence + bool operator!=(const FilterIterator& other) const { + return !(*this == other); + } + +private: + // Fonction pour trouver le prochain élément qui correspond au filtre + void searchNext() { + + if (filterType == "") { + ++current; + } + else + { + while (current != end && (*current)->type != filterType) { + ++current; + } + } + } +}; + + +class IResource +{ +public: + virtual ~IResource(); + +}; + + +#endif // RESOURCE_H diff --git a/story-editor-v2/src/resource_manager.h b/story-editor-v2/src/resource_manager.h new file mode 100644 index 0000000..493ea17 --- /dev/null +++ b/story-editor-v2/src/resource_manager.h @@ -0,0 +1,108 @@ +#ifndef RESOURCE_MANAGER_H +#define RESOURCE_MANAGER_H + +#include +#include +#include +#include +#include + +#include "resource.h" + +class ResourceManager +{ +public: + + ResourceManager() + : m_images(filter("image")) + , m_sounds(filter("sound")) + { + + } + + ~ResourceManager() { + + } + + void Add(std::shared_ptr res) + { + m_items.push_back(res); + UpdateIterators(); + } + + void Clear() + { + m_items.clear(); + UpdateIterators(); + } + + + // Fonction pour créer un itérateur de début et de fin pour les éléments filtrés + std::pair filter(const std::string &type) const { + auto begin = std::begin(m_items); + auto end = std::end(m_items); + return std::make_pair(FilterIterator(begin, end, type), FilterIterator(end, end, type)); + } + + std::pair Items() + { + return filter(""); + } + + std::pair Images() + { + return m_images; + } + + std::pair Sounds() + { + return m_sounds; + } + + + /* + void StoryProject::AppendResource(const Resource &res) +{ + m_resources.push_back(res); +} + +bool StoryProject::GetResourceAt(int index, Resource &resOut) +{ + bool success = false; + if ((index >= 0) && (index < m_resources.size())) + { + resOut = m_resources[index]; + success = true; + } + return success; +} + +void StoryProject::ClearResources() +{ + m_resources.clear(); +} + +void StoryProject::DeleteResourceAt(int index) +{ + if ((index >= 0) && (index < m_resources.size())) + { + m_resources.erase(m_resources.begin() + index); + } +} +*/ + + +private: + std::vector> m_items; + std::pair m_images; + std::pair m_sounds; + + void UpdateIterators() + { + m_images = filter("image"); + m_sounds = filter("sound"); + } + +}; + +#endif // RESOURCE_MANAGER_H diff --git a/story-editor-v2/src/resources_window.cpp b/story-editor-v2/src/resources_window.cpp index af1ee59..e851a19 100644 --- a/story-editor-v2/src/resources_window.cpp +++ b/story-editor-v2/src/resources_window.cpp @@ -1,12 +1,14 @@ #include "resources_window.h" #include "imgui.h" #include - +#include +#include +#include "resource.h" #include "ImGuiFileDialog.h" //static thread_pool pool; -ResourcesWindow::ResourcesWindow(StoryProject &project) +ResourcesWindow::ResourcesWindow(IStoryProject &project) : WindowBase("Resources") , m_project(project) { @@ -42,19 +44,19 @@ void ResourcesWindow::ChooseFile() std::filesystem::path p(filePathName); - std::filesystem::path p2 = m_project.AssetsPath() / p.filename().generic_string(); + std::filesystem::path p2 = m_project.BuildFullAssetsPath( p.filename()); std::filesystem::copy(p, p2, std::filesystem::copy_options::overwrite_existing); - Resource res; + auto res = std::make_shared(); std::string ext = p.extension().string(); ext.erase(ext.begin()); // remove '.' dot sign std::transform(ext.begin(), ext.end(), ext.begin(), ::toupper); - res.format = ext; - res.type = m_soundFile ? "sound" : "image"; - res.file = p.filename().generic_string(); - m_project.AppendResource(res); + res->format = ext; + res->type = m_soundFile ? "sound" : "image"; + res->file = p.filename().generic_string(); + m_project.AddResource(res); } // close @@ -90,33 +92,29 @@ void ResourcesWindow::Draw() ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti; - if (ImGui::BeginTable("table1", 5, tableFlags)) + if (ImGui::BeginTable("table1", 4, tableFlags)) { ImGui::TableSetupColumn("File", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Format", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Description", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("Delete", ImGuiTableColumnFlags_WidthStretch); ImGui::TableHeadersRow(); - for (auto & r : m_project) + auto [b, e] = m_project.Resources(); + for (auto it = b; it != e; ++it) { + ImGui::TableNextColumn(); + ImGui::Text("%s", (*it)->file.c_str()); ImGui::TableNextColumn(); - ImGui::Text("%s", r.file.c_str()); + ImGui::Text("%s", (*it)->format.c_str()); ImGui::TableNextColumn(); - ImGui::Text("%s", ""); + ImGui::Text("%s", (*it)->description.c_str()); ImGui::TableNextColumn(); - ImGui::Text("%s", ""); - - ImGui::TableNextColumn(); - ImGui::Text("%s", ""); - - ImGui::TableNextColumn(); - ImGui::Text("%s", ""); + ImGui::Text("%s", (*it)->type.c_str()); } ImGui::EndTable(); diff --git a/story-editor-v2/src/resources_window.h b/story-editor-v2/src/resources_window.h index 3f85f7d..4248146 100644 --- a/story-editor-v2/src/resources_window.h +++ b/story-editor-v2/src/resources_window.h @@ -3,18 +3,18 @@ #include #include #include -#include "story_project.h" +#include "i_story_project.h" #include "window_base.h" class ResourcesWindow : public WindowBase { public: - ResourcesWindow(StoryProject &project); + ResourcesWindow(IStoryProject &project); ~ResourcesWindow(); virtual void Draw() override; private: - StoryProject &m_project; + IStoryProject &m_project; bool m_showImportDialog{false}; bool m_soundFile{false}; diff --git a/story-editor-v2/src/story_project.cpp b/story-editor-v2/src/story_project.cpp index 9b79a22..2b38acd 100644 --- a/story-editor-v2/src/story_project.cpp +++ b/story-editor-v2/src/story_project.cpp @@ -116,7 +116,7 @@ void StoryProject::Initialize(const std::string &file_path) m_initialized = true; } -bool StoryProject::Load(const std::string &file_path, nlohmann::json &model) +bool StoryProject::Load(const std::string &file_path, nlohmann::json &model, ResourceManager &manager) { std::ifstream f(file_path); @@ -132,7 +132,7 @@ bool StoryProject::Load(const std::string &file_path, nlohmann::json &model) nlohmann::json j = nlohmann::json::parse(f); m_nodes.clear(); - + manager.Clear(); if (j.contains("project")) { @@ -149,13 +149,13 @@ bool StoryProject::Load(const std::string &file_path, nlohmann::json &model) for (const auto &obj : resourcesData) { - Resource rData; + auto rData = std::make_shared(); - rData.type = obj["type"].get(); - rData.format = obj["format"].get(); - rData.description = obj["description"].get(); - rData.file = obj["file"].get(); - m_resources.push_back(rData); + rData->type = obj["type"].get(); + rData->format = obj["format"].get(); + rData->description = obj["description"].get(); + rData->file = obj["file"].get(); + manager.Add(rData); } if (j.contains("nodegraph")) @@ -235,7 +235,7 @@ bool StoryProject::Load(const std::string &file_path, nlohmann::json &model) return success; } -void StoryProject::Save(const nlohmann::json &model) +void StoryProject::Save(const nlohmann::json &model, ResourceManager &manager) { nlohmann::json j; j["project"] = { {"name", m_name}, {"uuid", m_uuid}, { "title_image", m_titleImage }, { "title_sound", m_titleSound } }; @@ -243,12 +243,13 @@ void StoryProject::Save(const nlohmann::json &model) { nlohmann::json resourcesData; - for (auto &r : m_resources) + auto [b, e] = manager.filter(""); + for (auto it = b; it != e; ++it) { - nlohmann::json obj = {{"type", r.type}, - {"format", r.format}, - {"description", r.description}, - {"file", r.file}}; + nlohmann::json obj = {{"type", (*it)->type}, + {"format", (*it)->format}, + {"description", (*it)->description}, + {"file", (*it)->file}}; resourcesData.push_back(obj); } @@ -274,9 +275,9 @@ void StoryProject::CreateTree() StoryNode *p = nlist.front(); std::cout << "Node: " << p->id << std::endl; - for (int i = 0; i < p->jumps.size(); i++) + for (size_t i = 0; i < p->jumps.size(); i++) { - int jump = p->jumps[i]; + size_t jump = p->jumps[i]; if (jump < m_nodes.size()) { @@ -356,35 +357,6 @@ void StoryProject::SetTitleSound(const std::string &titleSound) m_titleSound = titleSound; } -void StoryProject::AppendResource(const Resource &res) -{ - m_resources.push_back(res); -} - -bool StoryProject::GetResourceAt(int index, Resource &resOut) -{ - bool success = false; - if ((index >= 0) && (index < m_resources.size())) - { - resOut = m_resources[index]; - success = true; - } - return success; -} - -void StoryProject::ClearResources() -{ - m_resources.clear(); -} - -void StoryProject::DeleteResourceAt(int index) -{ - if ((index >= 0) && (index < m_resources.size())) - { - m_resources.erase(m_resources.begin() + index); - } -} - std::string StoryProject::GetFileExtension(const std::string &fileName) { if(fileName.find_last_of(".") != std::string::npos) diff --git a/story-editor-v2/src/story_project.h b/story-editor-v2/src/story_project.h index d86d4e7..fb0cb94 100644 --- a/story-editor-v2/src/story_project.h +++ b/story-editor-v2/src/story_project.h @@ -12,7 +12,7 @@ #include #include #include "json.hpp" - +#include "resource_manager.h" template class ThreadSafeQueue { @@ -109,14 +109,6 @@ struct StoryNode // "sound": 0 }; -struct Resource -{ - std::string file; - std::string description; - std::string format; - std::string type; -}; - struct StoryProject { enum ImageFormat { IMG_FORMAT_BMP_4BITS, IMG_FORMAT_QOIF, IMG_FORMAT_COUNT }; @@ -132,14 +124,14 @@ struct StoryProject StoryNode *m_tree; - bool Load(const std::string &file_path, nlohmann::json &model); - void Save(const nlohmann::json &model); + bool Load(const std::string &file_path, nlohmann::json &model, ResourceManager &manager); + void Save(const nlohmann::json &model, ResourceManager &manager); void CreateTree(); - void Clear() { + void Clear() + { m_uuid = ""; m_working_dir = ""; - m_resources.clear(); m_initialized = false; } @@ -170,17 +162,6 @@ struct StoryProject std::string GetTitleImage() const { return m_titleImage; } std::string GetTitleSound() const { return m_titleSound; } - // ------------- Resources Management - void AppendResource(const Resource &res); - bool GetResourceAt(int index, Resource &resOut); - void ClearResources(); - void DeleteResourceAt(int index); - int ResourcesSize() const { return m_resources.size(); } - - std::vector::const_iterator begin() const { return m_resources.begin(); } - std::vector::const_iterator end() const { return m_resources.end(); } - - public: // Initialize with an existing project void Initialize(const std::string &file_path); @@ -203,7 +184,6 @@ private: std::string m_titleImage; std::string m_titleSound; - std::vector m_resources; std::filesystem::path m_working_dir; /// Temporary folder based on the uuid, where the archive is unzipped std::string m_project_file_path; /// JSON project file diff --git a/story-editor/QHexView b/story-editor/QHexView deleted file mode 160000 index 8669e1c..0000000 --- a/story-editor/QHexView +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8669e1cff4ad8a47510d31ffc6dead959a4b8975