diff --git a/plugins/builtin/include/content/views/view_bookmarks.hpp b/plugins/builtin/include/content/views/view_bookmarks.hpp
index c323d5acf..9626eb252 100644
--- a/plugins/builtin/include/content/views/view_bookmarks.hpp
+++ b/plugins/builtin/include/content/views/view_bookmarks.hpp
@@ -19,6 +19,7 @@ namespace hex::plugin::builtin {
struct Bookmark {
ImHexApi::Bookmarks::Entry entry;
TextEditor editor;
+ bool highlightVisible;
};
private:
diff --git a/plugins/builtin/source/content/views/view_bookmarks.cpp b/plugins/builtin/source/content/views/view_bookmarks.cpp
index 4a65625ed..b00ec5114 100644
--- a/plugins/builtin/source/content/views/view_bookmarks.cpp
+++ b/plugins/builtin/source/content/views/view_bookmarks.cpp
@@ -44,7 +44,7 @@ namespace hex::plugin::builtin {
bookmarkId
};
- m_bookmarks->emplace_back(std::move(bookmark), TextEditor());
+ m_bookmarks->emplace_back(std::move(bookmark), TextEditor(), true);
ImHexApi::Provider::markDirty();
@@ -81,7 +81,10 @@ namespace hex::plugin::builtin {
std::ignore = data;
// Loop over all bookmarks
- for (const auto &[bookmark, editor] : *m_bookmarks) {
+ for (const auto &[bookmark, editor, highlightVisible] : *m_bookmarks) {
+ if (!highlightVisible)
+ continue;
+
// Make sure the bookmark overlaps the currently hovered address
if (!Region { address, size }.isWithin(bookmark.region))
continue;
@@ -176,7 +179,7 @@ namespace hex::plugin::builtin {
result += "## Bookmarks\n\n";
- for (const auto &[bookmark, editor] : bookmarks) {
+ for (const auto &[bookmark, editor, highlightVisible] : bookmarks) {
result += hex::format("### {} [0x{:04X} - 0x{:04X}]\n\n", hex::changeEndianness(bookmark.color, std::endian::big) >> 8, bookmark.name, bookmark.region.getStartAddress(), bookmark.region.getEndAddress());
for (const auto &line : hex::splitString(bookmark.comment, "\n"))
@@ -306,7 +309,7 @@ namespace hex::plugin::builtin {
// Draw all bookmarks
for (auto it = m_bookmarks->begin(); it != m_bookmarks->end(); ++it) {
- auto &[bookmark, editor] = *it;
+ auto &[bookmark, editor, highlightVisible] = *it;
auto &[region, name, comment, color, locked, bookmarkId] = bookmark;
// Apply filter
@@ -362,7 +365,7 @@ namespace hex::plugin::builtin {
auto nextPos = ImGui::GetCursorPos();
ImGui::SameLine();
- ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 70_scaled);
+ ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 100_scaled);
{
// Draw jump to region button
@@ -389,6 +392,14 @@ namespace hex::plugin::builtin {
});
}
ImGui::SetItemTooltip("%s", "hex.builtin.view.bookmarks.tooltip.open_in_view"_lang.get());
+
+ ImGui::SameLine(0, 4_scaled);
+
+ // Draw highlight visible toggle
+ if (ImGuiExt::DimmedIconButton(highlightVisible ? ICON_VS_EYE : ICON_VS_EYE_CLOSED, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
+ highlightVisible = !highlightVisible;
+ EventHighlightingChanged::post();
+ }
}
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2());
@@ -548,9 +559,10 @@ namespace hex::plugin::builtin {
.comment = bookmark["comment"],
.color = bookmark["color"],
.locked = bookmark["locked"],
- .id = bookmark.contains("id") ? bookmark["id"].get() : m_currBookmarkId.get(provider)
+ .id = bookmark.contains("id") ? bookmark["id"].get() : m_currBookmarkId.get(provider),
},
- editor
+ editor,
+ bookmark.contains("highlightVisible") ? bookmark["highlightVisible"].get() : true,
});
if (bookmark.contains("id"))
m_currBookmarkId.get(provider) = std::max(m_currBookmarkId.get(provider), bookmark["id"].get() + 1);
@@ -564,7 +576,7 @@ namespace hex::plugin::builtin {
bool ViewBookmarks::exportBookmarks(prv::Provider *provider, nlohmann::json &json) {
json["bookmarks"] = nlohmann::json::array();
size_t index = 0;
- for (const auto &[bookmark, editor] : m_bookmarks.get(provider)) {
+ for (const auto &[bookmark, editor, highlightVisible] : m_bookmarks.get(provider)) {
json["bookmarks"][index] = {
{ "name", bookmark.name },
{ "comment", editor.GetText() },
@@ -575,7 +587,8 @@ namespace hex::plugin::builtin {
}
},
{ "locked", bookmark.locked },
- { "id", bookmark.id }
+ { "id", bookmark.id },
+ { "highlightVisible", highlightVisible }
};
index++;