1
0
mirror of synced 2025-02-18 03:09:18 +01:00

feat: Added unique selection and scrolling position to each provider

This commit is contained in:
WerWolv 2022-09-18 16:22:08 +02:00
parent 59a04e6dbf
commit b2932773b9
18 changed files with 161 additions and 83 deletions

@ -1 +1 @@
Subproject commit 0798f36a0442bfd59618210c1b9f71c9ef1096e8 Subproject commit 955f88b8e9673dbc98c9873965a65d7691eea1dc

View File

@ -30,6 +30,11 @@ namespace hex::plugin::builtin {
std::vector<hex::prv::Overlay *> dataOverlays; std::vector<hex::prv::Overlay *> dataOverlays;
std::optional<dp::Node::NodeError> currNodeError; std::optional<dp::Node::NodeError> currNodeError;
} dataProcessor; } dataProcessor;
struct {
std::optional<u64> selectionStart, selectionEnd;
float scrollPosition = 0.0F;
} editor;
}; };
static Data& getCurrent() { static Data& getCurrent() {

View File

@ -6,6 +6,8 @@
#include <hex/helpers/concepts.hpp> #include <hex/helpers/concepts.hpp>
#include <hex/helpers/encoding_file.hpp> #include <hex/helpers/encoding_file.hpp>
#include <content/helpers/provider_extra_data.hpp>
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
@ -18,8 +20,6 @@ namespace hex::plugin::builtin {
void drawContent() override; void drawContent() override;
private: private:
constexpr static auto InvalidSelection = std::numeric_limits<u64>::max();
void registerShortcuts(); void registerShortcuts();
void registerEvents(); void registerEvents();
void registerMenuItems(); void registerMenuItems();
@ -33,22 +33,16 @@ namespace hex::plugin::builtin {
void setSelection(u128 start, u128 end) { void setSelection(u128 start, u128 end) {
if (!ImHexApi::Provider::isValid()) if (!ImHexApi::Provider::isValid())
return; return;
if (start == InvalidSelection && end == InvalidSelection)
return;
if (start == InvalidSelection)
start = end;
if (end == InvalidSelection)
end = start;
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
auto &data = ProviderExtraData::get(provider).editor;
const size_t maxAddress = provider->getActualSize() + provider->getBaseAddress() - 1; const size_t maxAddress = provider->getActualSize() + provider->getBaseAddress() - 1;
this->m_selectionChanged = this->m_selectionStart != start || this->m_selectionEnd != end; this->m_selectionChanged = data.selectionStart != start || data.selectionEnd != end;
this->m_selectionStart = std::clamp<u128>(start, 0, maxAddress); data.selectionStart = std::clamp<u128>(start, 0, maxAddress);
this->m_selectionEnd = std::clamp<u128>(end, 0, maxAddress); data.selectionEnd = std::clamp<u128>(end, 0, maxAddress);
if (this->m_selectionChanged) { if (this->m_selectionChanged) {
EventManager::post<EventRegionSelected>(this->getSelection()); EventManager::post<EventRegionSelected>(this->getSelection());
@ -56,15 +50,22 @@ namespace hex::plugin::builtin {
} }
[[nodiscard]] Region getSelection() const { [[nodiscard]] Region getSelection() const {
const auto start = std::min(this->m_selectionStart, this->m_selectionEnd); auto &data = ProviderExtraData::getCurrent().editor;
const auto end = std::max(this->m_selectionStart, this->m_selectionEnd);
if (!isSelectionValid())
return Region::Invalid();
const auto start = std::min(*data.selectionStart, *data.selectionEnd);
const auto end = std::max(*data.selectionStart, *data.selectionEnd);
const size_t size = end - start + 1; const size_t size = end - start + 1;
return { start, size }; return { start, size };
} }
[[nodiscard]] bool isSelectionValid() const { [[nodiscard]] bool isSelectionValid() const {
return this->m_selectionStart != InvalidSelection && this->m_selectionEnd != InvalidSelection; auto &data = ProviderExtraData::getCurrent().editor;
return data.selectionStart.has_value() && data.selectionEnd.has_value();
} }
void jumpToSelection() { void jumpToSelection() {
@ -119,10 +120,9 @@ namespace hex::plugin::builtin {
bool m_shouldJumpToSelection = false; bool m_shouldJumpToSelection = false;
bool m_shouldScrollToSelection = false; bool m_shouldScrollToSelection = false;
bool m_shouldJumpWhenOffScreen = false; bool m_shouldJumpWhenOffScreen = false;
bool m_shouldUpdateScrollPosition = false;
bool m_selectionChanged = false; bool m_selectionChanged = false;
u64 m_selectionStart = InvalidSelection;
u64 m_selectionEnd = InvalidSelection;
u16 m_visibleRowCount = 0; u16 m_visibleRowCount = 0;
@ -136,6 +136,7 @@ namespace hex::plugin::builtin {
bool m_upperCaseHex = true; bool m_upperCaseHex = true;
bool m_grayOutZero = true; bool m_grayOutZero = true;
bool m_showAscii = true; bool m_showAscii = true;
bool m_syncScrolling = false;
bool m_shouldOpenPopup = false; bool m_shouldOpenPopup = false;
std::unique_ptr<Popup> m_currPopup; std::unique_ptr<Popup> m_currPopup;

View File

@ -11,9 +11,9 @@
#include <imgui.h> #include <imgui.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "provider_extra_data.hpp" #include <content/helpers/provider_extra_data.hpp>
#include "content/providers/file_provider.hpp" #include <content/providers/file_provider.hpp>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {

View File

@ -283,6 +283,17 @@ namespace hex::plugin::builtin {
return result; return result;
}); });
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.sync_scrolling", 0, [](auto name, nlohmann::json &setting) {
static bool syncScrolling = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &syncScrolling)) {
setting = static_cast<int>(syncScrolling);
return true;
}
return false;
});
/* Fonts */ /* Fonts */

View File

@ -9,7 +9,7 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <cstring> #include <cstring>
#include <provider_extra_data.hpp> #include <content/helpers/provider_extra_data.hpp>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {

View File

@ -10,7 +10,7 @@
#include <imnodes.h> #include <imnodes.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "provider_extra_data.hpp" #include <content/helpers/provider_extra_data.hpp>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {

View File

@ -721,10 +721,6 @@ namespace hex::plugin::builtin {
const u16 columnCount = this->m_bytesPerRow / bytesPerCell; const u16 columnCount = this->m_bytesPerRow / bytesPerCell;
const auto byteColumnCount = columnCount + getByteColumnSeparatorCount(columnCount); const auto byteColumnCount = columnCount + getByteColumnSeparatorCount(columnCount);
const auto selection = this->getSelection();
const auto selectionMin = selection.getStartAddress();
const auto selectionMax = selection.getEndAddress();
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0.5, 0)); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0.5, 0));
if (ImGui::BeginTable("##hex", 2 + byteColumnCount + 2 + 2 , ImGuiTableFlags_ScrollY | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoKeepColumnsVisible, size)) { if (ImGui::BeginTable("##hex", 2 + byteColumnCount + 2 + 2 , ImGuiTableFlags_ScrollY | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoKeepColumnsVisible, size)) {
View::discardNavigationRequests(); View::discardNavigationRequests();
@ -762,6 +758,7 @@ namespace hex::plugin::builtin {
if (ImHexApi::Provider::isValid()) { if (ImHexApi::Provider::isValid()) {
auto provider = ImHexApi::Provider::get(); auto provider = ImHexApi::Provider::get();
auto &providerData = ProviderExtraData::get(provider).editor;
std::pair<Region, bool> validRegion = { Region::Invalid(), false }; std::pair<Region, bool> validRegion = { Region::Invalid(), false };
const auto isCurrRegionValid = [&validRegion, &provider](u64 address){ const auto isCurrRegionValid = [&validRegion, &provider](u64 address){
@ -806,11 +803,15 @@ namespace hex::plugin::builtin {
const auto backgroundColor = [&]{ const auto backgroundColor = [&]{
auto color = queryBackgroundColor(byteAddress, &bytes[x * cellBytes], cellBytes); auto color = queryBackgroundColor(byteAddress, &bytes[x * cellBytes], cellBytes);
if ((byteAddress >= selectionMin && byteAddress <= selectionMax)) { if (this->isSelectionValid()) {
if (color.has_value()) auto selection = this->getSelection();
color = (ImAlphaBlendColors(color.value(), this->m_selectionColor)) & 0x00FFFFFF;
else if (byteAddress >= selection.getStartAddress() && byteAddress <= selection.getEndAddress()) {
color = this->m_selectionColor; if (color.has_value())
color = (ImAlphaBlendColors(color.value(), this->m_selectionColor)) & 0x00FFFFFF;
else
color = this->m_selectionColor;
}
} }
if (color.has_value()) if (color.has_value())
@ -849,9 +850,11 @@ namespace hex::plugin::builtin {
auto [foregroundColor, backgroundColor] = cellColors[x]; auto [foregroundColor, backgroundColor] = cellColors[x];
if (isColumnSeparatorColumn(x + 1, columnCount) && selectionMax != x + y * columnCount) { if (isColumnSeparatorColumn(x + 1, columnCount)) {
if (this->isSelectionValid() && this->getSelection().getEndAddress() != x + y * columnCount)
cellSize.x += SeparatorColumWidth + 1; cellSize.x += SeparatorColumWidth + 1;
} }
if (y == u64(clipper.DisplayStart)) if (y == u64(clipper.DisplayStart))
cellSize.y -= (ImGui::GetStyle().CellPadding.y + 1); cellSize.y -= (ImGui::GetStyle().CellPadding.y + 1);
@ -997,19 +1000,19 @@ namespace hex::plugin::builtin {
} }
// Scroll to the cursor if it's either at the top or bottom edge of the screen // Scroll to the cursor if it's either at the top or bottom edge of the screen
if (this->m_shouldScrollToSelection && (this->m_selectionEnd != InvalidSelection) && (this->m_selectionStart != InvalidSelection)) { if (this->m_shouldScrollToSelection && this->isSelectionValid()) {
// Make sure simply clicking on a byte at the edge of the screen won't cause scrolling // Make sure simply clicking on a byte at the edge of the screen won't cause scrolling
if ((ImGui::IsMouseDown(ImGuiMouseButton_Left) && this->m_selectionStart != this->m_selectionEnd)) { if ((ImGui::IsMouseDown(ImGuiMouseButton_Left) && providerData.selectionStart != providerData.selectionEnd)) {
auto fractionPerLine = 1.0 / (this->m_visibleRowCount + 1); auto fractionPerLine = 1.0 / (this->m_visibleRowCount + 1);
if (y == u64(clipper.DisplayStart + 3)) { if (y == u64(clipper.DisplayStart + 3)) {
if (i128(this->m_selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) <= (i64(clipper.DisplayStart + 3) * this->m_bytesPerRow)) { if (i128(*providerData.selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) <= (i64(clipper.DisplayStart + 3) * this->m_bytesPerRow)) {
this->m_shouldScrollToSelection = false; this->m_shouldScrollToSelection = false;
ImGui::SetScrollHereY(fractionPerLine * 5); ImGui::SetScrollHereY(fractionPerLine * 5);
} }
} else if (y == u64(clipper.DisplayEnd - 3)) { } else if (y == u64(clipper.DisplayEnd - 3)) {
if (i128(this->m_selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) >= (i64(clipper.DisplayEnd - 3) * this->m_bytesPerRow)) { if (i128(*providerData.selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) >= (i64(clipper.DisplayEnd - 3) * this->m_bytesPerRow)) {
this->m_shouldScrollToSelection = false; this->m_shouldScrollToSelection = false;
ImGui::SetScrollHereY(fractionPerLine * (this->m_visibleRowCount - 1)); ImGui::SetScrollHereY(fractionPerLine * (this->m_visibleRowCount - 1));
} }
@ -1045,6 +1048,16 @@ namespace hex::plugin::builtin {
ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (static_cast<long double>(newSelection.getStartAddress() - pageAddress) / this->m_bytesPerRow) * CharacterSize.y, 0.5); ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (static_cast<long double>(newSelection.getStartAddress() - pageAddress) / this->m_bytesPerRow) * CharacterSize.y, 0.5);
} }
if (!this->m_syncScrolling) {
if (this->m_shouldUpdateScrollPosition) {
this->m_shouldUpdateScrollPosition = false;
ImGui::SetScrollY(providerData.scrollPosition);
} else {
providerData.scrollPosition = ImGui::GetScrollY();
}
}
} else { } else {
ImGui::TextFormattedCentered("hex.builtin.view.hex_editor.no_bytes"_lang); ImGui::TextFormattedCentered("hex.builtin.view.hex_editor.no_bytes"_lang);
} }
@ -1133,14 +1146,15 @@ namespace hex::plugin::builtin {
drawTooltip(address, data, bytesPerCell); drawTooltip(address, data, bytesPerCell);
auto endAddress = address + bytesPerCell - 1; auto endAddress = address + bytesPerCell - 1;
auto &selectionStart = ProviderExtraData::getCurrent().editor.selectionStart;
if (ImGui::IsMouseDragging(ImGuiMouseButton_Left)) { if (ImGui::IsMouseDragging(ImGuiMouseButton_Left)) {
this->setSelection(this->m_selectionStart, endAddress); this->setSelection(*selectionStart, endAddress);
this->scrollToSelection(); this->scrollToSelection();
} }
else if (ImGui::IsMouseDown(ImGuiMouseButton_Left)) { else if (ImGui::IsMouseDown(ImGuiMouseButton_Left)) {
if (ImGui::GetIO().KeyShift) if (ImGui::GetIO().KeyShift)
this->setSelection(this->m_selectionStart, endAddress); this->setSelection(*selectionStart, endAddress);
else else
this->setSelection(address, endAddress); this->setSelection(address, endAddress);
@ -1252,52 +1266,66 @@ namespace hex::plugin::builtin {
// Remove selection // Remove selection
ShortcutManager::addShortcut(this, Keys::Escape, [this] { ShortcutManager::addShortcut(this, Keys::Escape, [this] {
this->m_selectionStart = InvalidSelection; auto &data = ProviderExtraData::getCurrent().editor;
this->m_selectionEnd = InvalidSelection;
data.selectionStart.reset();
data.selectionEnd.reset();
EventManager::post<EventRegionSelected>(this->getSelection()); EventManager::post<EventRegionSelected>(this->getSelection());
}); });
// Move cursor around // Move cursor around
ShortcutManager::addShortcut(this, Keys::Up, [this] { ShortcutManager::addShortcut(this, Keys::Up, [this] {
if (this->m_selectionEnd >= this->m_bytesPerRow) { auto selection = this->getSelection();
auto pos = this->m_selectionEnd - this->m_bytesPerRow;
if (selection.getEndAddress() >= this->m_bytesPerRow) {
auto pos = selection.getEndAddress() - this->m_bytesPerRow;
this->setSelection(pos, pos); this->setSelection(pos, pos);
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
} }
}); });
ShortcutManager::addShortcut(this, Keys::Down, [this] { ShortcutManager::addShortcut(this, Keys::Down, [this] {
auto pos = this->m_selectionEnd + this->m_bytesPerRow; auto selection = this->getSelection();
auto pos = selection.getEndAddress() + this->m_bytesPerRow;
this->setSelection(pos, pos); this->setSelection(pos, pos);
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
ShortcutManager::addShortcut(this, Keys::Left, [this] { ShortcutManager::addShortcut(this, Keys::Left, [this] {
if (this->m_selectionEnd > 0) { auto selection = this->getSelection();
auto pos = this->m_selectionEnd - 1;
if (selection.getEndAddress() > 0) {
auto pos = selection.getEndAddress() - 1;
this->setSelection(pos, pos); this->setSelection(pos, pos);
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
} }
}); });
ShortcutManager::addShortcut(this, Keys::Right, [this] { ShortcutManager::addShortcut(this, Keys::Right, [this] {
auto pos = this->m_selectionEnd + 1; auto selection = this->getSelection();
auto pos = selection.getEndAddress() + 1;
this->setSelection(pos, pos); this->setSelection(pos, pos);
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
ShortcutManager::addShortcut(this, Keys::PageUp, [this] { ShortcutManager::addShortcut(this, Keys::PageUp, [this] {
auto selection = this->getSelection();
u64 visibleByteCount = this->m_bytesPerRow * this->m_visibleRowCount; u64 visibleByteCount = this->m_bytesPerRow * this->m_visibleRowCount;
if (this->m_selectionEnd >= visibleByteCount) { if (selection.getEndAddress() >= visibleByteCount) {
auto pos = this->m_selectionEnd - visibleByteCount; auto pos = selection.getEndAddress() - visibleByteCount;
this->setSelection(pos, pos); this->setSelection(pos, pos);
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
} }
}); });
ShortcutManager::addShortcut(this, Keys::PageDown, [this] { ShortcutManager::addShortcut(this, Keys::PageDown, [this] {
auto pos = this->m_selectionEnd + (this->m_bytesPerRow * this->m_visibleRowCount); auto selection = this->getSelection();
auto pos = selection.getEndAddress() + (this->m_bytesPerRow * this->m_visibleRowCount);
this->setSelection(pos, pos); this->setSelection(pos, pos);
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
@ -1305,42 +1333,50 @@ namespace hex::plugin::builtin {
// Move selection around // Move selection around
ShortcutManager::addShortcut(this, SHIFT + Keys::Up, [this] { ShortcutManager::addShortcut(this, SHIFT + Keys::Up, [this] {
this->m_selectionStart = std::max<u64>(this->m_selectionStart, this->m_bytesPerRow); auto selection = this->getSelection();
this->setSelection(this->m_selectionStart - this->m_bytesPerRow, this->m_selectionEnd); this->setSelection(std::max<u64>(selection.getStartAddress(), this->m_bytesPerRow) - this->m_bytesPerRow, selection.getEndAddress());
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
ShortcutManager::addShortcut(this, SHIFT + Keys::Down, [this] { ShortcutManager::addShortcut(this, SHIFT + Keys::Down, [this] {
this->setSelection(this->m_selectionStart + this->m_bytesPerRow, this->m_selectionEnd); auto selection = this->getSelection();
this->setSelection(selection.getStartAddress() + this->m_bytesPerRow, selection.getEndAddress());
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
ShortcutManager::addShortcut(this, SHIFT + Keys::Left, [this] { ShortcutManager::addShortcut(this, SHIFT + Keys::Left, [this] {
this->m_selectionStart = std::max<u64>(this->m_selectionStart, 1); auto selection = this->getSelection();
this->setSelection(this->m_selectionStart - 1, this->m_selectionEnd); this->setSelection(std::max<u64>(selection.getStartAddress(), 1) - 1, selection.getEndAddress());
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
ShortcutManager::addShortcut(this, SHIFT + Keys::Right, [this] { ShortcutManager::addShortcut(this, SHIFT + Keys::Right, [this] {
this->setSelection(this->m_selectionStart + 1, this->m_selectionEnd); auto selection = this->getSelection();
this->setSelection(selection.getStartAddress() + 1, selection.getEndAddress());
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
ShortcutManager::addShortcut(this, Keys::PageUp, [this] { ShortcutManager::addShortcut(this, Keys::PageUp, [this] {
auto selection = this->getSelection();
u64 visibleByteCount = this->m_bytesPerRow * this->m_visibleRowCount; u64 visibleByteCount = this->m_bytesPerRow * this->m_visibleRowCount;
if (this->m_selectionEnd >= visibleByteCount) {
auto pos = this->m_selectionEnd - visibleByteCount; if (selection.getEndAddress() >= visibleByteCount) {
this->setSelection(pos, this->m_selectionEnd); auto pos = selection.getEndAddress() - visibleByteCount;
this->setSelection(pos, selection.getEndAddress());
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
} }
}); });
ShortcutManager::addShortcut(this, Keys::PageDown, [this] { ShortcutManager::addShortcut(this, Keys::PageDown, [this] {
auto pos = this->m_selectionEnd + (this->m_bytesPerRow * this->m_visibleRowCount); auto selection = this->getSelection();
this->setSelection(pos, this->m_selectionEnd); auto pos = selection.getEndAddress() + (this->m_bytesPerRow * this->m_visibleRowCount);
this->setSelection(pos, selection.getEndAddress());
this->scrollToSelection(); this->scrollToSelection();
this->jumpIfOffScreen(); this->jumpIfOffScreen();
}); });
@ -1389,15 +1425,18 @@ namespace hex::plugin::builtin {
}); });
EventManager::subscribe<RequestSelectionChange>(this, [this](Region region) { EventManager::subscribe<RequestSelectionChange>(this, [this](Region region) {
auto provider = ImHexApi::Provider::get();
if (region == Region::Invalid()) { if (region == Region::Invalid()) {
this->m_selectionStart = InvalidSelection; auto &providerData = ProviderExtraData::get(provider).editor;
this->m_selectionEnd = InvalidSelection;
providerData.selectionStart.reset();
providerData.selectionEnd.reset();
return; return;
} }
auto provider = ImHexApi::Provider::get(); auto page = provider->getPageOfAddress(region.getStartAddress());
auto page = provider->getPageOfAddress(region.getStartAddress());
if (!page.has_value()) if (!page.has_value())
return; return;
@ -1413,6 +1452,13 @@ namespace hex::plugin::builtin {
region = this->getSelection(); region = this->getSelection();
}); });
EventManager::subscribe<EventProviderChanged>(this, [this](auto, auto) {
this->m_shouldUpdateScrollPosition = true;
if (this->isSelectionValid())
EventManager::post<EventRegionSelected>(this->getSelection());
});
EventManager::subscribe<EventSettingsChanged>(this, [this] { EventManager::subscribe<EventSettingsChanged>(this, [this] {
{ {
auto bytesPerRow = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row"); auto bytesPerRow = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row");
@ -1459,6 +1505,13 @@ namespace hex::plugin::builtin {
this->m_currDataVisualizer = visualizers["hex.builtin.visualizer.hexadecimal.8bit"]; this->m_currDataVisualizer = visualizers["hex.builtin.visualizer.hexadecimal.8bit"];
} }
{
auto syncScrolling = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.sync_scrolling");
if (syncScrolling.is_number())
this->m_syncScrolling = static_cast<int>(syncScrolling);
}
}); });
} }

View File

@ -4,7 +4,7 @@
#include <pl/patterns/pattern.hpp> #include <pl/patterns/pattern.hpp>
#include <provider_extra_data.hpp> #include <content/helpers/provider_extra_data.hpp>
namespace hex::plugin::builtin { namespace hex::plugin::builtin {

View File

@ -14,7 +14,7 @@
#include <hex/api/project_file_manager.hpp> #include <hex/api/project_file_manager.hpp>
#include <hex/helpers/magic.hpp> #include <hex/helpers/magic.hpp>
#include <provider_extra_data.hpp> #include <content/helpers/provider_extra_data.hpp>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>

View File

@ -739,6 +739,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.hex_editor.grey_zeros", "Nullen ausgrauen" }, { "hex.builtin.setting.hex_editor.grey_zeros", "Nullen ausgrauen" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Hex Zeichen als Grossbuchstaben" }, { "hex.builtin.setting.hex_editor.uppercase_hex", "Hex Zeichen als Grossbuchstaben" },
{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" }, { "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
{ "hex.builtin.setting.hex_editor.sync_scrolling", "Editorposition synchronisieren" },
{ "hex.builtin.setting.folders", "Ordner" }, { "hex.builtin.setting.folders", "Ordner" },
{ "hex.builtin.setting.folders.description", "Gib zusätzliche Orderpfade an in welchen Pattern, Scripts, Yara Rules und anderes gesucht wird" }, { "hex.builtin.setting.folders.description", "Gib zusätzliche Orderpfade an in welchen Pattern, Scripts, Yara Rules und anderes gesucht wird" },
{ "hex.builtin.setting.folders.add_folder", "Neuer Ordner hinzufügen" }, { "hex.builtin.setting.folders.add_folder", "Neuer Ordner hinzufügen" },

View File

@ -745,6 +745,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.hex_editor.grey_zeros", "Grey out zeros" }, { "hex.builtin.setting.hex_editor.grey_zeros", "Grey out zeros" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" }, { "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" },
{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" }, { "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
{ "hex.builtin.setting.folders", "Folders" }, { "hex.builtin.setting.folders", "Folders" },
{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, Yara rules and more" }, { "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, Yara rules and more" },
{ "hex.builtin.setting.folders.add_folder", "Add new folder" }, { "hex.builtin.setting.folders.add_folder", "Add new folder" },

View File

@ -749,6 +749,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.hex_editor.grey_zeros", "Taglia fuori gli zeri" }, { "hex.builtin.setting.hex_editor.grey_zeros", "Taglia fuori gli zeri" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Caratteri esadecimali maiuscoli" }, { "hex.builtin.setting.hex_editor.uppercase_hex", "Caratteri esadecimali maiuscoli" },
//{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" }, //{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
//{ "hex.builtin.setting.folders", "Folders" }, //{ "hex.builtin.setting.folders", "Folders" },
//{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, rules and more" }, //{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, rules and more" },
// { "hex.builtin.setting.folders.add_folder", "Add new folder" }, // { "hex.builtin.setting.folders.add_folder", "Add new folder" },

View File

@ -745,6 +745,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.hex_editor.grey_zeros", "ゼロをグレーアウト" }, { "hex.builtin.setting.hex_editor.grey_zeros", "ゼロをグレーアウト" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "16進数を大文字表記" }, { "hex.builtin.setting.hex_editor.uppercase_hex", "16進数を大文字表記" },
{ "hex.builtin.setting.hex_editor.visualizer", "データ表示方式" }, { "hex.builtin.setting.hex_editor.visualizer", "データ表示方式" },
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
{ "hex.builtin.setting.folders", "フォルダ" }, { "hex.builtin.setting.folders", "フォルダ" },
{ "hex.builtin.setting.folders.description", "パターン、スクリプト、ルールなどのための検索パスを指定して追加できます。" }, { "hex.builtin.setting.folders.description", "パターン、スクリプト、ルールなどのための検索パスを指定して追加できます。" },
{ "hex.builtin.setting.folders.add_folder", "フォルダを追加…" }, { "hex.builtin.setting.folders.add_folder", "フォルダを追加…" },

View File

@ -744,6 +744,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.hex_editor.grey_zeros", "00을 회색으로 표시" }, { "hex.builtin.setting.hex_editor.grey_zeros", "00을 회색으로 표시" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "16진수 값을 대문자로 표시" }, { "hex.builtin.setting.hex_editor.uppercase_hex", "16진수 값을 대문자로 표시" },
{ "hex.builtin.setting.hex_editor.visualizer", "데이터 표시" }, { "hex.builtin.setting.hex_editor.visualizer", "데이터 표시" },
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
{ "hex.builtin.setting.folders", "폴더" }, { "hex.builtin.setting.folders", "폴더" },
{ "hex.builtin.setting.folders.description", "패턴, 스크립트, YARA 규칙 등을 찾아볼 추가적인 폴더 경로를 지정하세요" }, { "hex.builtin.setting.folders.description", "패턴, 스크립트, YARA 규칙 등을 찾아볼 추가적인 폴더 경로를 지정하세요" },
{ "hex.builtin.setting.folders.add_folder", "새 폴더 추가" }, { "hex.builtin.setting.folders.add_folder", "새 폴더 추가" },

View File

@ -734,13 +734,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.fps", "FPS Limit" }, { "hex.builtin.setting.interface.fps", "FPS Limit" },
{ "hex.builtin.setting.interface.fps.unlocked", "Destravado" }, { "hex.builtin.setting.interface.fps.unlocked", "Destravado" },
{ "hex.builtin.setting.hex_editor", "Hex Editor" }, { "hex.builtin.setting.hex_editor", "Hex Editor" },
{ "hex.builtin.setting.hex_editor.highlight_color", "Selection highlight color" }, //{ "hex.builtin.setting.hex_editor.highlight_color", "Selection highlight color" },
{ "hex.builtin.setting.hex_editor.bytes_per_row", "Bytes por linha" }, { "hex.builtin.setting.hex_editor.bytes_per_row", "Bytes por linha" },
{ "hex.builtin.setting.hex_editor.ascii", "Exibir coluna ASCII" }, { "hex.builtin.setting.hex_editor.ascii", "Exibir coluna ASCII" },
{ "hex.builtin.setting.hex_editor.advanced_decoding", "Display advanced decoding column" }, //{ "hex.builtin.setting.hex_editor.advanced_decoding", "Display advanced decoding column" },
{ "hex.builtin.setting.hex_editor.grey_zeros", "Grey out zeros" }, //{ "hex.builtin.setting.hex_editor.grey_zeros", "Grey out zeros" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" }, //{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" },
{ "hex.builtin.setting.hex_editor.visualizer", "Visualizador de Dados" }, { "hex.builtin.setting.hex_editor.visualizer", "Visualizador de Dados" },
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
{ "hex.builtin.setting.folders", "Pastas" }, { "hex.builtin.setting.folders", "Pastas" },
{ "hex.builtin.setting.folders.description", "Especifique caminhos de pesquisa adicionais para padrões, scripts, regras Yara e muito mais" }, { "hex.builtin.setting.folders.description", "Especifique caminhos de pesquisa adicionais para padrões, scripts, regras Yara e muito mais" },
{ "hex.builtin.setting.folders.add_folder", "Adicionar nova pasta" }, { "hex.builtin.setting.folders.add_folder", "Adicionar nova pasta" },

View File

@ -745,6 +745,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.hex_editor.grey_zeros", "显示零字节为灰色" }, { "hex.builtin.setting.hex_editor.grey_zeros", "显示零字节为灰色" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "大写十六进制" }, { "hex.builtin.setting.hex_editor.uppercase_hex", "大写十六进制" },
{ "hex.builtin.setting.hex_editor.visualizer", "数据处理器的数据可视化格式" }, { "hex.builtin.setting.hex_editor.visualizer", "数据处理器的数据可视化格式" },
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
{ "hex.builtin.setting.folders", "扩展搜索路径" }, { "hex.builtin.setting.folders", "扩展搜索路径" },
{ "hex.builtin.setting.folders.description", "为模式、脚本和规则等指定额外的搜索路径" }, { "hex.builtin.setting.folders.description", "为模式、脚本和规则等指定额外的搜索路径" },
{ "hex.builtin.setting.folders.add_folder", "添加新的目录" }, { "hex.builtin.setting.folders.add_folder", "添加新的目录" },

View File

@ -735,17 +735,18 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.fps", "FPS 限制" }, { "hex.builtin.setting.interface.fps", "FPS 限制" },
{ "hex.builtin.setting.interface.fps.unlocked", "解鎖" }, { "hex.builtin.setting.interface.fps.unlocked", "解鎖" },
{ "hex.builtin.setting.hex_editor", "十六進位編輯器" }, { "hex.builtin.setting.hex_editor", "十六進位編輯器" },
{ "hex.builtin.setting.hex_editor.highlight_color", "Selection highlight color" }, //{ "hex.builtin.setting.hex_editor.highlight_color", "Selection highlight color" },
{ "hex.builtin.setting.hex_editor.bytes_per_row", "Bytes per row" }, //{ "hex.builtin.setting.hex_editor.bytes_per_row", "Bytes per row" },
{ "hex.builtin.setting.hex_editor.ascii", "顯示 ASCII 欄" }, { "hex.builtin.setting.hex_editor.ascii", "顯示 ASCII 欄" },
{ "hex.builtin.setting.hex_editor.advanced_decoding", "Display advanced decoding column" }, { "hex.builtin.setting.hex_editor.advanced_decoding", "Display advanced decoding column" },
{ "hex.builtin.setting.hex_editor.grey_zeros", "Grey out zeros" }, //{ "hex.builtin.setting.hex_editor.grey_zeros", "Grey out zeros" },
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" }, //{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" },
{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" }, //{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
{ "hex.builtin.setting.folders", "資料夾" }, { "hex.builtin.setting.folders", "資料夾" },
{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, Yara rules and more" }, //{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, Yara rules and more" },
{ "hex.builtin.setting.folders.add_folder", "新增資料夾" }, { "hex.builtin.setting.folders.add_folder", "新增資料夾" },
{ "hex.builtin.setting.folders.remove_folder", "Remove currently selected folder from list" }, //{ "hex.builtin.setting.folders.remove_folder", "Remove currently selected folder from list" },
{ "hex.builtin.setting.font", "字體" }, { "hex.builtin.setting.font", "字體" },
{ "hex.builtin.setting.font.font_path", "自訂字型路徑" }, { "hex.builtin.setting.font.font_path", "自訂字型路徑" },
{ "hex.builtin.setting.font.font_size", "字體大小" }, { "hex.builtin.setting.font.font_size", "字體大小" },
@ -766,11 +767,11 @@ namespace hex::plugin::builtin {
{ "hex.builtin.provider.gdb.server", "伺服器" }, { "hex.builtin.provider.gdb.server", "伺服器" },
{ "hex.builtin.provider.gdb.ip", "IP 位址" }, { "hex.builtin.provider.gdb.ip", "IP 位址" },
{ "hex.builtin.provider.gdb.port", "連接埠" }, { "hex.builtin.provider.gdb.port", "連接埠" },
{ "hex.builtin.provider.disk", "Raw Disk Provider" }, //{ "hex.builtin.provider.disk", "Raw Disk Provider" },
{ "hex.builtin.provider.disk.selected_disk", "Disk" }, //{ "hex.builtin.provider.disk.selected_disk", "Disk" },
{ "hex.builtin.provider.disk.disk_size", "Disk Size" }, //{ "hex.builtin.provider.disk.disk_size", "Disk Size" },
{ "hex.builtin.provider.disk.sector_size", "Sector Size" }, //{ "hex.builtin.provider.disk.sector_size", "Sector Size" },
{ "hex.builtin.provider.disk.reload", "Reload" }, //{ "hex.builtin.provider.disk.reload", "Reload" },
//{ "hex.builtin.provider.intel_hex", "Intel Hex Provider" }, //{ "hex.builtin.provider.intel_hex", "Intel Hex Provider" },
// { "hex.builtin.provider.intel_hex.name", "Intel Hex {0}" }, // { "hex.builtin.provider.intel_hex.name", "Intel Hex {0}" },
//{ "hex.builtin.provider.motorola_srec", "Motorola SREC Provider" }, //{ "hex.builtin.provider.motorola_srec", "Motorola SREC Provider" },