diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp index 2471ccf4..68bd04da 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.cpp @@ -48,6 +48,14 @@ namespace Bloom::Widgets return; } + if (this->changed) { + painter->drawPixmap( + boundingRect, + ByteItem::changedMemoryAsciiPixmapsByValue[value] + ); + return; + } + if (this->stackMemory && hexViewerState->settings.groupStackMemory) { painter->drawPixmap( boundingRect, @@ -84,6 +92,14 @@ namespace Bloom::Widgets return; } + if (this->changed) { + painter->drawPixmap( + boundingRect, + ByteItem::changedMemoryPixmapsByValue[value] + ); + return; + } + if (this->stackMemory && hexViewerState->settings.groupStackMemory) { painter->drawPixmap( boundingRect, @@ -127,6 +143,8 @@ namespace Bloom::Widgets static constexpr auto groupedBackgroundColor = QColor(0x44, 0x44, 0x41, 255); static constexpr auto stackMemoryBackgroundColor = QColor(0x44, 0x44, 0x41, 200); static constexpr auto stackMemoryBarColor = QColor(0x67, 0x57, 0x20, 255); + static constexpr auto changedMemoryBackgroundColor = QColor(0x5C, 0x49, 0x5D, 200); + static constexpr auto changedMemoryFadedBackgroundColor = QColor(0x5C, 0x49, 0x5D, 125); static const auto hoveredStackMemoryBackgroundColor = QColor( stackMemoryBackgroundColor.red(), @@ -140,6 +158,7 @@ namespace Bloom::Widgets static constexpr auto standardFontColor = QColor(0xAF, 0xB1, 0xB3); static constexpr auto fadedFontColor = QColor(0xAF, 0xB1, 0xB3, 100); static constexpr auto asciiFontColor = QColor(0xA7, 0x77, 0x26); + static constexpr auto changedMemoryAsciiFontColor = QColor(0xB7, 0x7F, 0x21); const auto byteItemRect = QRect(0, 0, ByteItem::WIDTH, ByteItem::HEIGHT); const auto byteItemSize = byteItemRect.size(); @@ -166,6 +185,12 @@ namespace Bloom::Widgets painter.drawRect(0, byteItemSize.height() - 3, byteItemSize.width(), 3); } + auto changedMemoryTemplatePixmap = QPixmap(byteItemSize); + changedMemoryTemplatePixmap.fill(changedMemoryBackgroundColor); + + auto changedMemoryFadedTemplatePixmap = QPixmap(byteItemSize); + changedMemoryFadedTemplatePixmap.fill(changedMemoryFadedBackgroundColor); + auto hoveredStackMemoryTemplatePixmap = QPixmap(byteItemSize); hoveredStackMemoryTemplatePixmap.fill(hoveredStackMemoryBackgroundColor); @@ -220,6 +245,16 @@ namespace Bloom::Widgets ByteItem::stackMemoryPixmapsByValue.emplace_back(std::move(stackMemoryPixmap)); } + { + auto changedMemoryPixmap = changedMemoryTemplatePixmap; + auto painter = QPainter(&changedMemoryPixmap); + painter.setFont(font); + painter.setPen(standardFontColor); + painter.drawText(byteItemRect, Qt::AlignCenter, hexValue); + + ByteItem::changedMemoryPixmapsByValue.emplace_back(std::move(changedMemoryPixmap)); + } + { auto hoveredPrimaryPixmap = hoveredPrimaryTemplatePixmap; auto painter = QPainter(&hoveredPrimaryPixmap); @@ -270,6 +305,19 @@ namespace Bloom::Widgets ByteItem::stackMemoryAsciiPixmapsByValue.emplace_back(std::move(stackMemoryAsciiPixmap)); } + { + auto changedMemoryAsciiPixmap = asciiValue.has_value() + ? changedMemoryTemplatePixmap + : changedMemoryFadedTemplatePixmap; + + auto painter = QPainter(&changedMemoryAsciiPixmap); + painter.setFont(font); + painter.setPen(asciiValue.has_value() ? changedMemoryAsciiFontColor : fadedFontColor); + painter.drawText(byteItemRect, Qt::AlignCenter, asciiValue.value_or(hexValue)); + + ByteItem::changedMemoryAsciiPixmapsByValue.emplace_back(std::move(changedMemoryAsciiPixmap)); + } + { auto hoveredPrimaryAsciiPixmap = hoveredPrimaryTemplatePixmap; auto painter = QPainter(&hoveredPrimaryAsciiPixmap); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.hpp index f88fe0fb..1e497e56 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItem.hpp @@ -24,6 +24,7 @@ namespace Bloom::Widgets bool excluded = false; bool grouped = false; bool stackMemory = false; + bool changed = false; explicit ByteItem(Targets::TargetMemoryAddress address); @@ -45,10 +46,12 @@ namespace Bloom::Widgets static inline std::vector selectedPixmapsByValue = {}; static inline std::vector groupedPixmapsByValue = {}; static inline std::vector stackMemoryPixmapsByValue = {}; + static inline std::vector changedMemoryPixmapsByValue = {}; static inline std::vector standardAsciiPixmapsByValue = {}; static inline std::vector selectedAsciiPixmapsByValue = {}; static inline std::vector groupedAsciiPixmapsByValue = {}; static inline std::vector stackMemoryAsciiPixmapsByValue = {}; + static inline std::vector changedMemoryAsciiPixmapsByValue = {}; static inline std::vector hoveredPrimaryPixmapsByValue = {}; static inline std::vector hoveredPrimaryAsciiPixmapsByValue = {}; static inline std::optional missingDataPixmap = {};