feat: Added setting to disable hex editor highlights entirely
This commit is contained in:
parent
0ae823716a
commit
89111059f9
@ -494,6 +494,7 @@
|
||||
"hex.builtin.setting.hex_editor.pattern_parent_highlighting": "Highlight pattern parents on hover",
|
||||
"hex.builtin.setting.hex_editor.paste_behaviour": "Single-Byte Paste behaviour",
|
||||
"hex.builtin.setting.hex_editor.sync_scrolling": "Synchronize editor scroll position",
|
||||
"hex.builtin.setting.hex_editor.show_highlights": "Show colorful highlightings",
|
||||
"hex.builtin.setting.hex_editor.show_selection": "Move selection display to hex editor footer",
|
||||
"hex.builtin.setting.imhex": "ImHex",
|
||||
"hex.builtin.setting.imhex.recent_files": "Recent Files",
|
||||
|
@ -835,6 +835,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Settings::add<Widgets::ColorPicker>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.highlight_color", ImColor(0x80, 0x80, 0xC0, 0x60));
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.sync_scrolling", false);
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.show_selection", false);
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.show_highlights", true);
|
||||
ContentRegistry::Settings::add<Widgets::SliderInteger>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.byte_padding", 0, 0, 50);
|
||||
ContentRegistry::Settings::add<Widgets::SliderInteger>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.char_padding", 0, 0, 50);
|
||||
|
||||
|
@ -154,9 +154,9 @@ namespace hex::plugin::builtin {
|
||||
u64 inputA = m_region.getStartAddress();
|
||||
u64 inputB = m_region.getEndAddress();
|
||||
|
||||
if (justOpened) {
|
||||
if (m_justOpened) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
justOpened = false;
|
||||
m_justOpened = false;
|
||||
}
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.begin"_lang, &inputA, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.end"_lang, &inputB, ImGuiInputTextFlags_AutoSelectAll);
|
||||
@ -173,9 +173,9 @@ namespace hex::plugin::builtin {
|
||||
u64 inputA = m_region.getStartAddress();
|
||||
u64 inputB = m_region.getSize();
|
||||
|
||||
if (justOpened) {
|
||||
if (m_justOpened) {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
justOpened = false;
|
||||
m_justOpened = false;
|
||||
}
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.begin"_lang, &inputA, ImGuiInputTextFlags_AutoSelectAll);
|
||||
ImGuiExt::InputHexadecimal("hex.builtin.view.hex_editor.select.offset.size"_lang, &inputB, ImGuiInputTextFlags_AutoSelectAll);
|
||||
@ -217,7 +217,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
private:
|
||||
Region m_region = { 0, 1 };
|
||||
bool justOpened = true;
|
||||
bool m_justOpened = true;
|
||||
};
|
||||
|
||||
class PopupBaseAddress : public ViewHexEditor::Popup {
|
||||
@ -550,7 +550,15 @@ namespace hex::plugin::builtin {
|
||||
return result;
|
||||
});
|
||||
|
||||
static bool showHighlights = true;
|
||||
ContentRegistry::Settings::onChange("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.show_highlights", [](const ContentRegistry::Settings::SettingsValue &value) {
|
||||
showHighlights = value.get<bool>(true);
|
||||
});
|
||||
|
||||
m_hexEditor.setBackgroundHighlightCallback([this](u64 address, const u8 *data, size_t size) -> std::optional<color_t> {
|
||||
if (!showHighlights)
|
||||
return std::nullopt;
|
||||
|
||||
if (auto highlight = m_backgroundHighlights->find(address); highlight != m_backgroundHighlights->end()) {
|
||||
if (std::ranges::any_of(*m_hoverHighlights, [region = Region(address, size)](const Region &highlight) { return highlight.overlaps(region); }))
|
||||
return ImAlphaBlendColors(highlight->second, 0xA0FFFFFF);
|
||||
|
Loading…
x
Reference in New Issue
Block a user