From cc51e1b4c8c5df87a324e282ef52fe64700fe46c Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 25 Dec 2021 22:52:34 +0000 Subject: [PATCH] New setting in the hex viewer for toggling the display of annotations --- .../HexViewerWidget/ByteItemGraphicsScene.cpp | 9 ++++++--- .../HexViewerWidget/HexViewerWidgetSettings.hpp | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp index 490c0b45..2058ef84 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp @@ -166,7 +166,10 @@ void ByteItemGraphicsScene::adjustSize(bool forced) { if (!this->byteItemsByAddress.empty()) { this->adjustByteItemPositions(); - this->adjustAnnotationItemPositions(); + + if (this->settings.displayAnnotations) { + this->adjustAnnotationItemPositions(); + } const auto* lastByteItem = (--this->byteItemsByAddress.end())->second; const auto sceneHeight = static_cast( @@ -293,7 +296,7 @@ void ByteItemGraphicsScene::adjustByteItemPositions() { ); // We only display annotations that span a single row. - if (firstByteRowIndex == lastByteRowIndex) { + if (this->settings.displayAnnotations && firstByteRowIndex == lastByteRowIndex) { annotationItem->show(); if (annotationItem->position == AnnotationItemPosition::TOP) { @@ -360,7 +363,7 @@ void ByteItemGraphicsScene::adjustByteItemPositions() { } void ByteItemGraphicsScene::adjustAnnotationItemPositions() { - if (this->byteItemsByAddress.empty()) { + if (this->byteItemsByAddress.empty() || !this->settings.displayAnnotations) { return; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp index bf9ec5f9..70ece87f 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp @@ -8,5 +8,6 @@ namespace Bloom::Widgets bool highlightFocusedMemory = true; bool highlightHoveredRowAndCol = true; bool displayAsciiValues = false; + bool displayAnnotations = true; }; }