parent
5694eaba8c
commit
11f63f9b02
@ -137,6 +137,7 @@ namespace hex::plugin::builtin {
|
||||
bool m_grayOutZero = true;
|
||||
bool m_showAscii = true;
|
||||
bool m_syncScrolling = false;
|
||||
u32 m_byteCellPadding = 0, m_characterCellPadding = 0;
|
||||
|
||||
bool m_shouldOpenPopup = false;
|
||||
std::unique_ptr<Popup> m_currPopup;
|
||||
|
@ -17,8 +17,8 @@ namespace hex::plugin::builtin {
|
||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||
|
||||
[[nodiscard]] ImVec2 getMinSize() const override { return { 500, 300 }; }
|
||||
[[nodiscard]] ImVec2 getMaxSize() const override { return { 500, 300 }; }
|
||||
[[nodiscard]] ImVec2 getMinSize() const override { return { 700, 400 }; }
|
||||
[[nodiscard]] ImVec2 getMaxSize() const override { return { 700, 400 }; }
|
||||
|
||||
private:
|
||||
bool m_restartRequested = false;
|
||||
|
@ -308,6 +308,28 @@ namespace hex::plugin::builtin {
|
||||
return false;
|
||||
});
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.byte_padding", 0, [](auto name, nlohmann::json &setting) {
|
||||
static int padding = static_cast<int>(setting);
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &padding, 0, 50)) {
|
||||
setting = padding;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.char_padding", 0, [](auto name, nlohmann::json &setting) {
|
||||
static int padding = static_cast<int>(setting);
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &padding, 0, 50)) {
|
||||
setting = padding;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
/* Fonts */
|
||||
|
||||
|
@ -746,12 +746,12 @@ namespace hex::plugin::builtin {
|
||||
if (isColumnSeparatorColumn(i, columnCount))
|
||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, SeparatorColumWidth);
|
||||
|
||||
ImGui::TableSetupColumn(hex::format(this->m_upperCaseHex ? "{:0{}X}" : "{:0{}x}", i * bytesPerCell, this->m_currDataVisualizer->getMaxCharsPerCell()).c_str(), ImGuiTableColumnFlags_WidthFixed, CharacterSize.x * this->m_currDataVisualizer->getMaxCharsPerCell() + 6);
|
||||
ImGui::TableSetupColumn(hex::format(this->m_upperCaseHex ? "{:0{}X}" : "{:0{}x}", i * bytesPerCell, this->m_currDataVisualizer->getMaxCharsPerCell()).c_str(), ImGuiTableColumnFlags_WidthFixed, CharacterSize.x * this->m_currDataVisualizer->getMaxCharsPerCell() + 6 + this->m_byteCellPadding);
|
||||
}
|
||||
|
||||
// ASCII column
|
||||
ImGui::TableSetupColumn("");
|
||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, CharacterSize.x * this->m_bytesPerRow);
|
||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, (CharacterSize.x + this->m_characterCellPadding) * this->m_bytesPerRow);
|
||||
|
||||
// Custom encoding column
|
||||
ImGui::TableSetupColumn("");
|
||||
@ -856,7 +856,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (x < std::ceil(float(validBytes) / bytesPerCell)) {
|
||||
auto cellStartPos = getCellPosition();
|
||||
auto cellSize = (CharacterSize * ImVec2(this->m_currDataVisualizer->getMaxCharsPerCell(), 1) + (ImVec2(3, 2) * ImGui::GetStyle().CellPadding) - ImVec2(1, 0) * ImGui::GetStyle().CellPadding) + ImVec2(1, 0);
|
||||
auto cellSize = (CharacterSize * ImVec2(this->m_currDataVisualizer->getMaxCharsPerCell(), 1) + (ImVec2(3, 2) * ImGui::GetStyle().CellPadding) - ImVec2(1, 0) * ImGui::GetStyle().CellPadding) + ImVec2(1 + this->m_byteCellPadding, 0);
|
||||
auto maxCharsPerCell = this->m_currDataVisualizer->getMaxCharsPerCell();
|
||||
|
||||
auto [foregroundColor, backgroundColor] = cellColors[x];
|
||||
@ -910,7 +910,10 @@ namespace hex::plugin::builtin {
|
||||
// Draw ASCII column
|
||||
if (this->m_showAscii) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0, 0));
|
||||
if (ImGui::BeginTable("##ascii_cell", this->m_bytesPerRow)) {
|
||||
if (ImGui::BeginTable("##ascii_column", this->m_bytesPerRow)) {
|
||||
for (u64 x = 0; x < this->m_bytesPerRow; x++)
|
||||
ImGui::TableSetupColumn(hex::format("##ascii_cell{}", x).c_str(), ImGuiTableColumnFlags_WidthFixed, CharacterSize.x + this->m_characterCellPadding);
|
||||
|
||||
ImGui::TableNextRow();
|
||||
|
||||
for (u64 x = 0; x < this->m_bytesPerRow; x++) {
|
||||
@ -919,7 +922,7 @@ namespace hex::plugin::builtin {
|
||||
const u64 byteAddress = y * this->m_bytesPerRow + x + provider->getBaseAddress() + provider->getCurrentPageAddress();
|
||||
|
||||
const auto cellStartPos = getCellPosition();
|
||||
const auto cellSize = CharacterSize;
|
||||
const auto cellSize = CharacterSize + ImVec2(this->m_characterCellPadding, 0);
|
||||
|
||||
const bool cellHovered = ImGui::IsMouseHoveringRect(cellStartPos, cellStartPos + cellSize, true);
|
||||
|
||||
@ -1525,6 +1528,20 @@ namespace hex::plugin::builtin {
|
||||
this->m_syncScrolling = static_cast<int>(syncScrolling);
|
||||
}
|
||||
|
||||
{
|
||||
auto padding = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.byte_padding");
|
||||
|
||||
if (padding.is_number())
|
||||
this->m_byteCellPadding = static_cast<int>(padding);
|
||||
}
|
||||
|
||||
{
|
||||
auto padding = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.char_padding");
|
||||
|
||||
if (padding.is_number())
|
||||
this->m_characterCellPadding = static_cast<int>(padding);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -780,6 +780,8 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Hex Zeichen als Grossbuchstaben" },
|
||||
{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
|
||||
{ "hex.builtin.setting.hex_editor.sync_scrolling", "Editorposition synchronisieren" },
|
||||
{ "hex.builtin.setting.hex_editor.byte_padding", "Extra Byte-Zellenabstand" },
|
||||
{ "hex.builtin.setting.hex_editor.char_padding", "Extra Character-Zellenabstand" },
|
||||
{ "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.add_folder", "Neuer Ordner hinzufügen" },
|
||||
|
@ -784,6 +784,8 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" },
|
||||
{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
|
||||
{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
|
||||
{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
{ "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.add_folder", "Add new folder" },
|
||||
|
@ -790,6 +790,8 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.hex_editor.uppercase_hex", "Caratteri esadecimali maiuscoli" },
|
||||
//{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
|
||||
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
|
||||
//{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
//{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
//{ "hex.builtin.setting.folders", "Folders" },
|
||||
//{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, rules and more" },
|
||||
// { "hex.builtin.setting.folders.add_folder", "Add new folder" },
|
||||
|
@ -786,6 +786,8 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.hex_editor.uppercase_hex", "16進数を大文字表記" },
|
||||
{ "hex.builtin.setting.hex_editor.visualizer", "データ表示方式" },
|
||||
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
|
||||
//{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
//{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
{ "hex.builtin.setting.folders", "フォルダ" },
|
||||
{ "hex.builtin.setting.folders.description", "パターン、スクリプト、ルールなどのための検索パスを指定して追加できます。" },
|
||||
{ "hex.builtin.setting.folders.add_folder", "フォルダを追加…" },
|
||||
|
@ -783,6 +783,8 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.hex_editor.uppercase_hex", "16진수 값을 대문자로 표시" },
|
||||
{ "hex.builtin.setting.hex_editor.visualizer", "데이터 표시" },
|
||||
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
|
||||
//{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
//{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
{ "hex.builtin.setting.folders", "폴더" },
|
||||
{ "hex.builtin.setting.folders.description", "패턴, 스크립트, YARA 규칙 등을 찾아볼 추가적인 폴더 경로를 지정하세요" },
|
||||
{ "hex.builtin.setting.folders.add_folder", "새 폴더 추가" },
|
||||
|
@ -782,6 +782,8 @@ namespace hex::plugin::builtin {
|
||||
//{ "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.sync_scrolling", "Synchronize editor position" },
|
||||
//{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
//{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
{ "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.add_folder", "Adicionar nova pasta" },
|
||||
|
@ -785,6 +785,8 @@ namespace hex::plugin::builtin {
|
||||
{ "hex.builtin.setting.hex_editor.uppercase_hex", "大写十六进制" },
|
||||
{ "hex.builtin.setting.hex_editor.visualizer", "数据处理器的数据可视化格式" },
|
||||
{ "hex.builtin.setting.hex_editor.sync_scrolling", "同步编辑器位置" },
|
||||
//{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
//{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
{ "hex.builtin.setting.folders", "扩展搜索路径" },
|
||||
{ "hex.builtin.setting.folders.description", "为模式、脚本和规则等指定额外的搜索路径" },
|
||||
{ "hex.builtin.setting.folders.add_folder", "添加新的目录" },
|
||||
|
@ -782,6 +782,8 @@ namespace hex::plugin::builtin {
|
||||
//{ "hex.builtin.setting.hex_editor.uppercase_hex", "Upper case Hex characters" },
|
||||
//{ "hex.builtin.setting.hex_editor.visualizer", "Data visualizer" },
|
||||
//{ "hex.builtin.setting.hex_editor.sync_scrolling", "Synchronize editor position" },
|
||||
//{ "hex.builtin.setting.hex_editor.byte_padding", "Extra byte cell padding" },
|
||||
//{ "hex.builtin.setting.hex_editor.char_padding", "Extra character cell padding" },
|
||||
{ "hex.builtin.setting.folders", "資料夾" },
|
||||
//{ "hex.builtin.setting.folders.description", "Specify additional search paths for patterns, scripts, Yara rules and more" },
|
||||
{ "hex.builtin.setting.folders.add_folder", "新增資料夾" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user