From 6a815d5ebb143024f5e35d37262a4baee4c6eff3 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 19 Nov 2020 22:34:56 +0100 Subject: [PATCH] Allow mouse highlighting of bytes highlighted by pattern --- libs/ImGui/include/imgui_memory_editor.h | 9 ++++++++- source/views/view_hexeditor.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/ImGui/include/imgui_memory_editor.h b/libs/ImGui/include/imgui_memory_editor.h index a1b37583a..9c3ff946f 100644 --- a/libs/ImGui/include/imgui_memory_editor.h +++ b/libs/ImGui/include/imgui_memory_editor.h @@ -60,6 +60,8 @@ #pragma warning (disable: 4996) // warning C4996: 'sprintf': This function or variable may be unsafe. #endif +ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b); + struct MemoryEditor { enum DataFormat @@ -315,7 +317,12 @@ struct MemoryEditor if (OptMidColsCount > 0 && n > 0 && (n + 1) < Cols && ((n + 1) % OptMidColsCount) == 0) highlight_width += s.SpacingBetweenMidCols; } - draw_list->AddRectFilled(pos, ImVec2(pos.x + highlight_width, pos.y + s.LineHeight), HighlightColor); + + ImU32 color = HighlightColor; + if ((is_highlight_from_user_range + is_highlight_from_user_func + is_highlight_from_preview) > 1) + color = (ImAlphaBlendColors(HighlightColor, 0x60C08080) & 0x00FFFFFF) | 0x90000000; + + draw_list->AddRectFilled(pos, ImVec2(pos.x + highlight_width, pos.y + s.LineHeight), color); } if (DataEditingAddr == addr) diff --git a/source/views/view_hexeditor.cpp b/source/views/view_hexeditor.cpp index 4c60c17fc..a4af614f2 100644 --- a/source/views/view_hexeditor.cpp +++ b/source/views/view_hexeditor.cpp @@ -46,7 +46,7 @@ namespace hex { } } - _this->m_memoryEditor.HighlightColor = 0x50C08080; + _this->m_memoryEditor.HighlightColor = 0x60C08080; return false; };