From 73604e90c86dddcf5d5e1db4b75128cfc99930f9 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 5 Dec 2021 22:09:07 +0100 Subject: [PATCH] projects: Save bookmark colors Fixes #362 --- source/helpers/project_file_handler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/helpers/project_file_handler.cpp b/source/helpers/project_file_handler.cpp index 38cba00c9..1149eabfa 100644 --- a/source/helpers/project_file_handler.cpp +++ b/source/helpers/project_file_handler.cpp @@ -10,7 +10,7 @@ using json = nlohmann::json; namespace hex { void to_json(json& j, const ImHexApi::Bookmarks::Entry& b) { - j = json{ { "address", b.region.address }, { "size", b.region.size }, { "name", b.name.data() }, { "comment", b.comment.data() }, { "locked", b.locked } }; + j = json{ { "address", b.region.address }, { "size", b.region.size }, { "name", b.name.data() }, { "comment", b.comment.data() }, { "locked", b.locked }, { "color", b.color } }; } void from_json(const json& j, ImHexApi::Bookmarks::Entry& b) { @@ -21,6 +21,7 @@ namespace hex { j.at("name").get_to(name); j.at("comment").get_to(comment); j.at("locked").get_to(b.locked); + j.at("color").get_to(b.color); std::copy(name.begin(), name.end(), std::back_inserter(b.name)); b.name.push_back('\0'); @@ -43,6 +44,7 @@ namespace hex { ProjectFile::s_patches = projectFileData["patches"].get(); ProjectFile::s_dataProcessorContent = projectFileData["dataProcessor"]; + ProjectFile::s_bookmarks.clear(); for (auto &element : projectFileData["bookmarks"].items()) { ImHexApi::Bookmarks::Entry entry; from_json(element.value(), entry);