diff --git a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss index 8754465e..f36962bf 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss +++ b/src/Insight/UserInterfaces/InsightWindow/Stylesheets/InsightWindow.qss @@ -398,7 +398,8 @@ QScrollBar::sub-line:vertical { } #hex-viewer-container #tool-bar #highlight-stack-memory-btn, -#hex-viewer-container #tool-bar #highlight-focused-memory-btn { +#hex-viewer-container #tool-bar #highlight-focused-memory-btn, +#hex-viewer-container #tool-bar #highlight-hovered-rows-columns-btn { qproperty-buttonWidth: 25; qproperty-buttonHeight: 21; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp index dfb69244..a7738695 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp @@ -54,8 +54,11 @@ void ByteItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, const auto hoveredByteItem = this->hoveredByteItem.value_or(nullptr); if (hoveredByteItem != nullptr && ( - hoveredByteItem->currentColumnIndex == this->currentColumnIndex - || hoveredByteItem->currentRowIndex == this->currentRowIndex + hoveredByteItem == this || (this->settings.highlightHoveredRowAndCol && ( + hoveredByteItem->currentColumnIndex == this->currentColumnIndex + || hoveredByteItem->currentRowIndex == this->currentRowIndex + ) + ) ) ) { painter->setBrush(QColor(0x8E, 0x8B, 0x83, hoveredByteItem == this ? 70 : 30)); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp index 71ed5f8f..f8889ae0 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp @@ -22,6 +22,7 @@ ByteItemGraphicsScene::ByteItemGraphicsScene( ): QGraphicsScene(parent), targetMemoryDescriptor(targetMemoryDescriptor), insightWorker(insightWorker), +settings(settings), hoveredAddressLabel(hoveredAddressLabel), parent(parent) { this->setObjectName("byte-widget-container"); @@ -158,7 +159,7 @@ void ByteItemGraphicsScene::onByteWidgetEnter(ByteItem* widget) { "Relative Address (Absolute Address): " + widget->relativeAddressHex + " (" + widget->addressHex + ")" ); - if (!this->byteItemsByRowIndex.empty()) { + if (this->settings.highlightHoveredRowAndCol && !this->byteItemsByRowIndex.empty()) { for (auto& byteWidget : this->byteItemsByColumnIndex.at(widget->currentColumnIndex)) { byteWidget->update(); } @@ -166,6 +167,9 @@ void ByteItemGraphicsScene::onByteWidgetEnter(ByteItem* widget) { for (auto& byteWidget : this->byteItemsByRowIndex.at(widget->currentRowIndex)) { byteWidget->update(); } + + } else { + widget->update(); } } @@ -175,7 +179,7 @@ void ByteItemGraphicsScene::onByteWidgetLeave() { this->hoveredAddressLabel->setText("Relative Address (Absolute Address):"); - if (!this->byteItemsByRowIndex.empty()) { + if (this->settings.highlightHoveredRowAndCol && !this->byteItemsByRowIndex.empty()) { for (auto& byteWidget : this->byteItemsByColumnIndex.at(byteItem->currentColumnIndex)) { byteWidget->update(); } @@ -183,6 +187,9 @@ void ByteItemGraphicsScene::onByteWidgetLeave() { for (auto& byteWidget : this->byteItemsByRowIndex.at(byteItem->currentRowIndex)) { byteWidget->update(); } + + } else { + byteItem->update(); } } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp index 67d0c8fa..44d01004 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp @@ -60,6 +60,8 @@ namespace Bloom::Widgets Targets::TargetState targetState = Targets::TargetState::UNKNOWN; InsightWorker& insightWorker; + const HexViewerWidgetSettings& settings; + QWidget* parent = nullptr; QLabel* hoveredAddressLabel = nullptr; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp index a03b04d0..db361b57 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.cpp @@ -44,9 +44,14 @@ HexViewerWidget::HexViewerWidget( this->toolBar = this->container->findChild("tool-bar"); this->bottomBar = this->container->findChild("bottom-bar"); - this->refreshButton = this->container->findChild("refresh-memory-btn"); - this->highlightStackMemoryButton = this->container->findChild("highlight-stack-memory-btn"); - this->highlightFocusedMemoryButton = this->container->findChild("highlight-focused-memory-btn"); + this->refreshButton = this->toolBar->findChild("refresh-memory-btn"); + this->highlightStackMemoryButton = this->toolBar->findChild("highlight-stack-memory-btn"); + this->highlightHoveredRowAndColumnButton = this->toolBar->findChild( + "highlight-hovered-rows-columns-btn" + ); + this->highlightFocusedMemoryButton = this->container->findChild( + "highlight-focused-memory-btn" + ); this->toolBar->setContentsMargins(0, 0, 0, 0); this->toolBar->layout()->setContentsMargins(5, 0, 5, 1); @@ -70,18 +75,35 @@ HexViewerWidget::HexViewerWidget( this->byteItemGraphicsScene = this->byteItemGraphicsView->getScene(); byteItemGraphicsViewLayout->insertWidget(0, this->byteItemGraphicsView); + this->setStackMemoryHighlightingEnabled(true); + this->setHoveredRowAndColumnHighlightingEnabled(true); + this->setFocusedMemoryHighlightingEnabled(true); + QObject::connect( this->highlightStackMemoryButton, &QToolButton::clicked, this, - &HexViewerWidget::toggleStackMemoryHighlighting + [this] { + this->setStackMemoryHighlightingEnabled(!this->settings.highlightStackMemory); + } + ); + + QObject::connect( + this->highlightHoveredRowAndColumnButton, + &QToolButton::clicked, + this, + [this] { + this->setHoveredRowAndColumnHighlightingEnabled(!this->settings.highlightHoveredRowAndCol); + } ); QObject::connect( this->highlightFocusedMemoryButton, &QToolButton::clicked, this, - &HexViewerWidget::toggleFocusedMemoryHighlighting + [this] { + this->setFocusedMemoryHighlightingEnabled(!this->settings.highlightFocusedMemory); + } ); QObject::connect( @@ -150,20 +172,23 @@ void HexViewerWidget::onByteWidgetsAdjusted() { // } } -void HexViewerWidget::toggleStackMemoryHighlighting() { - auto enable = !this->settings.highlightStackMemory; - - this->highlightStackMemoryButton->setChecked(enable); - this->settings.highlightStackMemory = enable; +void HexViewerWidget::setStackMemoryHighlightingEnabled(bool enabled) { + this->highlightStackMemoryButton->setChecked(enabled); + this->settings.highlightStackMemory = enabled; this->byteItemGraphicsScene->update(); } -void HexViewerWidget::toggleFocusedMemoryHighlighting() { - auto enable = !this->settings.highlightFocusedMemory; - - this->highlightFocusedMemoryButton->setChecked(enable); - this->settings.highlightFocusedMemory = enable; +void HexViewerWidget::setHoveredRowAndColumnHighlightingEnabled(bool enabled) { + this->highlightHoveredRowAndColumnButton->setChecked(enabled); + this->settings.highlightHoveredRowAndCol = enabled; + + this->byteItemGraphicsScene->update(); +} + +void HexViewerWidget::setFocusedMemoryHighlightingEnabled(bool enabled) { + this->highlightFocusedMemoryButton->setChecked(enabled); + this->settings.highlightFocusedMemory = enabled; this->byteItemGraphicsScene->update(); } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp index 92a5d9c1..d211c96b 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidget.hpp @@ -59,13 +59,15 @@ namespace Bloom::Widgets SvgToolButton* highlightStackMemoryButton = nullptr; SvgToolButton* highlightFocusedMemoryButton = nullptr; + SvgToolButton* highlightHoveredRowAndColumnButton = nullptr; Targets::TargetState targetState = Targets::TargetState::UNKNOWN; private slots: void onTargetStateChanged(Targets::TargetState newState); void onByteWidgetsAdjusted(); - void toggleStackMemoryHighlighting(); - void toggleFocusedMemoryHighlighting(); + void setStackMemoryHighlightingEnabled(bool enabled); + void setHoveredRowAndColumnHighlightingEnabled(bool enabled); + void setFocusedMemoryHighlightingEnabled(bool enabled); }; } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp index 844720f2..f7d919e0 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerWidgetSettings.hpp @@ -10,6 +10,7 @@ namespace Bloom::Widgets bool highlightStackMemory = false; std::optional stackPointerAddress; + bool highlightHoveredRowAndCol = false; bool highlightFocusedMemory = false; bool displayAsciiValues = false; }; diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui index 8d39bb08..7e5d5fe5 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/UiFiles/HexViewerWidget.ui @@ -89,6 +89,22 @@ + + + + true + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns.svg + + + :/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns-disabled.svg + + + Highlight Row And Column On Hover + + + diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns-disabled.svg b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns-disabled.svg new file mode 100644 index 00000000..a5088fee --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns-disabled.svg @@ -0,0 +1,146 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns.svg b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns.svg new file mode 100644 index 00000000..6ea374d8 --- /dev/null +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns.svg @@ -0,0 +1,146 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/src/resources.qrc b/src/resources.qrc index b0e2eacd..b27663c3 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -55,5 +55,7 @@ ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-stack-memory-disabled.svg ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-focused-memory.svg ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-focused-memory-disabled.svg + ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns.svg + ./Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns-disabled.svg