1
0
mirror of synced 2024-11-12 02:00:52 +01:00

ui: Moved hex editor settings to settings menu

This commit is contained in:
WerWolv 2021-09-20 23:40:36 +02:00
parent 46f196cb3f
commit fef072f721
14 changed files with 240 additions and 75 deletions

View File

@ -92,6 +92,7 @@ struct MemoryEditor
bool OptShowAdvancedDecoding; // = true // display advanced decoding data on the right side.
bool OptGreyOutZeroes; // = true // display null/zero bytes using the TextDisabled color.
bool OptUpperCaseHex; // = true // display hexadecimal values as "FF" instead of "ff".
bool OptShowExtraInfo; // = true // display extra information about size of data and current selection
int OptMidColsCount; // = 8 // set to 0 to disable extra spacing between every mid-cols.
int OptAddrDigitsCount; // = 0 // number of addr digits to display (default calculated based on maximum displayed addr).
ImU32 HighlightColor; // // background color of highlighted bytes.
@ -311,9 +312,8 @@ struct MemoryEditor
size_t data_preview_addr_next = (size_t)-1;
if (ImGui::IsWindowFocused()) {
if (DataEditingAddr != (size_t)-1)
{
// Move cursor but only apply on next frame so scrolling with be synchronized (because currently we can't change the scrolling while the window is being rendered)
// Move cursor but only apply on next frame so scrolling with be synchronized (because currently we can't change the scrolling while the window is being rendered)
if (DataEditingAddr != (size_t)-1) {
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)) && DataEditingAddr >= (size_t)Cols) { data_editing_addr_next = DataEditingAddr - Cols; DataEditingTakeFocus = true; }
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && DataEditingAddr < mem_size - Cols) { data_editing_addr_next = DataEditingAddr + Cols; DataEditingTakeFocus = true; }
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && DataEditingAddr > 0) { data_editing_addr_next = DataEditingAddr - 1; DataEditingTakeFocus = true; }
@ -323,7 +323,6 @@ struct MemoryEditor
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)) && DataEditingAddr > 0) { data_editing_addr_next = 0; DataEditingTakeFocus = true; }
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)) && DataEditingAddr < mem_size - 1) { data_editing_addr_next = mem_size - 1; DataEditingTakeFocus = true; }
} else if (DataPreviewAddr != -1) {
// Move cursor but only apply on next frame so scrolling with be synchronized (because currently we can't change the scrolling while the window is being rendered)
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)) && DataPreviewAddr >= (size_t)Cols) { DataPreviewAddr = data_preview_addr_next = DataPreviewAddr - Cols; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; }
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && DataPreviewAddr < mem_size - Cols) { DataPreviewAddr = data_preview_addr_next = DataPreviewAddr + Cols; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; }
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && DataPreviewAddr > 0) { DataPreviewAddr = data_preview_addr_next = DataPreviewAddr - 1; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; }
@ -333,6 +332,11 @@ struct MemoryEditor
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)) && DataPreviewAddr > 0) { DataPreviewAddr = data_preview_addr_next = 0; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; }
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)) && DataPreviewAddr < mem_size - 1) { DataPreviewAddr = data_preview_addr_next = mem_size - 1; if (!ImGui::GetIO().KeyShift) DataPreviewAddrEnd = DataPreviewAddr; }
}
} else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
DataPreviewAddr = data_preview_addr_next = DataPreviewAddrEnd = (size_t)-1;
HighlightMin = HighlightMax = (size_t)-1;
hex::EventManager::post<hex::EventRegionSelected>(hex::Region{ (size_t)-1, 0 });
}
if (data_preview_addr_next != (size_t)-1 && (data_preview_addr_next / Cols) != (data_preview_addr_backup / Cols))
@ -688,35 +692,19 @@ struct MemoryEditor
const char* format_range = OptUpperCaseHex ? "Range %0*" _PRISizeT "X..%0*" _PRISizeT "X" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x";
const char* format_selection = OptUpperCaseHex ? "Selection %0*" _PRISizeT "X..%0*" _PRISizeT "X (%ld %s)" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x (%ld %s)";
// Options menu
if (ImGui::Button("Options"))
ImGui::OpenPopup("options");
if (this->OptShowExtraInfo) {
ImGui::Text(format_range, s.AddrDigitsCount, base_display_addr, s.AddrDigitsCount, base_display_addr + mem_size - 1);
if (DataPreviewAddr != (size_t)-1 && DataPreviewAddrEnd != (size_t)-1) {
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
if (ImGui::BeginPopup("options")) {
ImGui::PushItemWidth(ImGui::CalcTextSize("00 cols").x * 1.1f);
if (ImGui::DragInt("##cols", &Cols, 0.2f, 4, 32, "%d cols")) { ContentsWidthChanged = true; if (Cols < 1) Cols = 1; }
ImGui::PopItemWidth();
ImGui::Checkbox("Show HexII", &OptShowHexII);
if (ImGui::Checkbox("Show Ascii", &OptShowAscii)) { ContentsWidthChanged = true; }
if (ImGui::Checkbox("Show Advanced Decoding", &OptShowAdvancedDecoding)) { ContentsWidthChanged = true; }
ImGui::Checkbox("Grey out zeroes", &OptGreyOutZeroes);
ImGui::Checkbox("Uppercase Hex", &OptUpperCaseHex);
auto selectionStart = std::min(DataPreviewAddr, DataPreviewAddrEnd);
auto selectionEnd = std::max(DataPreviewAddr, DataPreviewAddrEnd);
ImGui::EndPopup();
}
ImGui::SameLine();
ImGui::Text(format_range, s.AddrDigitsCount, base_display_addr, s.AddrDigitsCount, base_display_addr + mem_size - 1);
if (DataPreviewAddr != (size_t)-1 && DataPreviewAddrEnd != (size_t)-1) {
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
auto selectionStart = std::min(DataPreviewAddr, DataPreviewAddrEnd);
auto selectionEnd = std::max(DataPreviewAddr, DataPreviewAddrEnd);
size_t regionSize = (selectionEnd - selectionStart) + 1;
ImGui::Text(format_selection, s.AddrDigitsCount, base_display_addr + selectionStart, s.AddrDigitsCount, base_display_addr + selectionEnd, regionSize, regionSize == 1 ? "byte" : "bytes");
size_t regionSize = (selectionEnd - selectionStart) + 1;
ImGui::Text(format_selection, s.AddrDigitsCount, base_display_addr + selectionStart, s.AddrDigitsCount, base_display_addr + selectionEnd, regionSize, regionSize == 1 ? "byte" : "bytes");
}
}
if (GotoAddr != (size_t)-1)

View File

@ -131,7 +131,7 @@ namespace hex::plugin::builtin {
return [value] { ImGui::TextUnformatted(value.c_str()); return value; };
});
ContentRegistry::DataInspector::add("hex.builtin.inspector.string", 0, [](auto buffer, auto endian, auto style) {
ContentRegistry::DataInspector::add("hex.builtin.inspector.string", 1, [](auto buffer, auto endian, auto style) {
Region currSelection = { 0 };
EventManager::post<QuerySelection>(currSelection);
@ -143,7 +143,7 @@ namespace hex::plugin::builtin {
stringBuffer += "...";
for (auto &c : stringBuffer)
if (c < 0x20 || c == '\n' || c == '\r')
if (c < 0x20)
c = ' ';

View File

@ -131,6 +131,83 @@ namespace hex::plugin::builtin {
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.column_count", 16, [](auto name, nlohmann::json &setting) {
static int columns = static_cast<int>(setting);
if (ImGui::SliderInt(name.data(), &columns, 1, 32)) {
setting = columns;
return true;
}
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.hexii", 0, [](auto name, nlohmann::json &setting) {
static bool hexii = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &hexii)) {
setting = static_cast<int>(hexii);
return true;
}
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.ascii", 1, [](auto name, nlohmann::json &setting) {
static bool ascii = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &ascii)) {
setting = static_cast<int>(ascii);
return true;
}
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.advanced_decoding", 0, [](auto name, nlohmann::json &setting) {
static bool advancedDecoding = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &advancedDecoding)) {
setting = static_cast<int>(advancedDecoding);
return true;
}
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.grey_zeros", 1, [](auto name, nlohmann::json &setting) {
static bool greyZeros = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &greyZeros)) {
setting = static_cast<int>(greyZeros);
return true;
}
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.uppercase_hex", 1, [](auto name, nlohmann::json &setting) {
static bool upperCaseHex = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &upperCaseHex)) {
setting = static_cast<int>(upperCaseHex);
return true;
}
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.extra_info", 1, [](auto name, nlohmann::json &setting) {
static bool extraInfos = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &extraInfos)) {
setting = static_cast<int>(extraInfos);
return true;
}
return false;
});
}
}

View File

@ -96,6 +96,7 @@ namespace hex::plugin::builtin {
{ "hex.view.data_inspector.name", "Dateninspektor" },
{ "hex.view.data_inspector.table.name", "Name" },
{ "hex.view.data_inspector.table.value", "Wert" },
{ "hex.view.data_inspector.no_data", "Keine bytes angewählt"},
{ "hex.view.data_processor.name", "Datenprozessor" },
{ "hex.view.data_processor.menu.remove_selection", "Auswahl entfernen" },
@ -596,6 +597,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.language", "Sprache" },
{ "hex.builtin.setting.interface.fps", "FPS Limite" },
{ "hex.builtin.setting.interface.highlight_alpha", "Markierungssichtbarkeit" },
{ "hex.builtin.setting.hex_editor", "Hex Editor" },
{ "hex.builtin.setting.hex_editor.column_count", "Anzahl Byte Spalten" },
{ "hex.builtin.setting.hex_editor.hexii", "HexII anstatt Bytes anzeigen" },
{ "hex.builtin.setting.hex_editor.ascii", "ASCII Spalte anzeigen" },
{ "hex.builtin.setting.hex_editor.advanced_decoding", "Erweiterte Dekodierungsspalte anzeigen" },
{ "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.extra_info", "Extra informationen anzeigen" },
{ "hex.builtin.provider.file.path", "Dateipfad" },
{ "hex.builtin.provider.file.size", "Größe" },

View File

@ -96,6 +96,7 @@ namespace hex::plugin::builtin {
{ "hex.view.data_inspector.name", "Data Inspector" },
{ "hex.view.data_inspector.table.name", "Name" },
{ "hex.view.data_inspector.table.value", "Value" },
{ "hex.view.data_inspector.no_data", "No bytes selected"},
{ "hex.view.data_processor.name", "Data Processor" },
{ "hex.view.data_processor.menu.remove_selection", "Remove Selected" },
@ -597,6 +598,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.language", "Language" },
{ "hex.builtin.setting.interface.fps", "FPS Limit" },
{ "hex.builtin.setting.interface.highlight_alpha", "Highlighting opacity" },
{ "hex.builtin.setting.hex_editor", "Hex Editor" },
{ "hex.builtin.setting.hex_editor.column_count", "Byte column count" },
{ "hex.builtin.setting.hex_editor.hexii", "Display HexII instead of Bytes" },
{ "hex.builtin.setting.hex_editor.ascii", "Display ASCII 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.uppercase_hex", "Upper case Hex characters" },
{ "hex.builtin.setting.hex_editor.extra_info", "Display extra information" },
{ "hex.builtin.provider.file.path", "File path" },
{ "hex.builtin.provider.file.size", "Size" },

View File

@ -95,6 +95,8 @@ namespace hex::plugin::builtin {
{ "hex.view.data_inspector.name", "Ispezione Dati" },
{ "hex.view.data_inspector.table.name", "Nome" },
{ "hex.view.data_inspector.table.value", "Valore" },
//{ "hex.view.data_inspector.no_data", "No bytes selected"},
{ "hex.view.data_processor.name", "Processa Dati" },
{ "hex.view.data_processor.menu.remove_selection", "Rimuovi i selezionati" },
@ -593,8 +595,16 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.scaling.x1_0", "x1.0" },
{ "hex.builtin.setting.interface.scaling.x1_5", "x1.5" },
{ "hex.builtin.setting.interface.scaling.x2_0", "x2.0" },
{ "hex.builtin.setting.interface.fps", "Limite FPS" },
{ "hex.builtin.setting.interface.highlight_alpha", "Evidenziazione dell'opacità" },
{ "hex.builtin.setting.interface.fps", "Limite FPS" },
{ "hex.builtin.setting.interface.highlight_alpha", "Evidenziazione dell'opacità" },
//{ "hex.builtin.setting.hex_editor", "Hex Editor" },
//{ "hex.builtin.setting.hex_editor.column_count", "Byte column count" },
//{ "hex.builtin.setting.hex_editor.hexii", "Display HexII instead of Bytes" },
//{ "hex.builtin.setting.hex_editor.ascii", "Display ASCII 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.uppercase_hex", "Upper case Hex characters" },
//{ "hex.builtin.setting.hex_editor.extra_info", "Display extra information" },
{ "hex.builtin.provider.file.path", "Percorso del File" },
{ "hex.builtin.provider.file.size", "Dimensione" },

View File

@ -96,6 +96,7 @@ namespace hex::plugin::builtin {
{ "hex.view.data_inspector.name", "数据分析器" },
{ "hex.view.data_inspector.table.name", "名称" },
{ "hex.view.data_inspector.table.value", "" },
//{ "hex.view.data_inspector.no_data", "No bytes selected"},
{ "hex.view.data_processor.name", "数据处理器" },
{ "hex.view.data_processor.menu.remove_selection", "移除已选" },
@ -598,6 +599,14 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.interface.language", "语言" },
{ "hex.builtin.setting.interface.fps", "FPS限制" },
{ "hex.builtin.setting.interface.highlight_alpha", "高亮不透明度" },
//{ "hex.builtin.setting.hex_editor", "Hex Editor" },
//{ "hex.builtin.setting.hex_editor.column_count", "Byte column count" },
//{ "hex.builtin.setting.hex_editor.hexii", "Display HexII instead of Bytes" },
//{ "hex.builtin.setting.hex_editor.ascii", "Display ASCII 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.uppercase_hex", "Upper case Hex characters" },
//{ "hex.builtin.setting.hex_editor.extra_info", "Display extra information" },
{ "hex.builtin.provider.file.path", "路径" },
{ "hex.builtin.provider.file.size", "大小" },

View File

@ -3,6 +3,8 @@
#include <hex.hpp>
#include <imgui.h>
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui_internal.h>
#include <imgui_imhex_extensions.h>
#include <fontawesome_font.h>

View File

@ -45,7 +45,7 @@ namespace hex::prv {
void FileProvider::read(u64 offset, void *buffer, size_t size, bool overlays) {
if (((offset - this->getBaseAddress()) + size) > this->getSize() || buffer == nullptr || size == 0)
if ((offset - this->getBaseAddress()) > (this->getSize() - size) || buffer == nullptr || size == 0)
return;
std::memcpy(buffer, reinterpret_cast<u8*>(this->m_mappedFile) + PageSize * this->m_currPage + offset - this->getBaseAddress(), size);

View File

@ -14,19 +14,13 @@ namespace hex {
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
auto provider = SharedData::currentProvider;
if (provider == nullptr) {
if (provider == nullptr || region.address == (size_t)-1) {
this->m_validBytes = 0;
return;
} else {
this->m_validBytes = u64(provider->getSize() - region.address);
this->m_startAddress = region.address;
}
if (region.address == (size_t)-1) {
this->m_validBytes = 0;
return;
}
this->m_validBytes = u64(provider->getSize() - region.address);
this->m_startAddress = region.address;
this->m_shouldInvalidate = true;
});
}
@ -56,7 +50,7 @@ namespace hex {
if (ImGui::Begin(View::toWindowName("hex.view.data_inspector.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
auto provider = SharedData::currentProvider;
if (provider != nullptr && provider->isReadable()) {
if (provider != nullptr && provider->isReadable() && this->m_validBytes > 0) {
if (ImGui::BeginTable("##datainspector", 2,
ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg,
ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * (this->m_cachedData.size() + 1)))) {
@ -112,6 +106,13 @@ namespace hex {
this->m_numberDisplayStyle = NumberDisplayStyle::Octal;
this->m_shouldInvalidate = true;
}
} else {
std::string text = "hex.view.data_inspector.no_data"_lang;
auto textSize = ImGui::CalcTextSize(text.c_str());
auto availableSpace = ImGui::GetContentRegionAvail();
ImGui::SetCursorPos((availableSpace - textSize) / 2.0F);
ImGui::TextUnformatted(text.c_str());
}
}
ImGui::End();

View File

@ -19,8 +19,12 @@ namespace hex {
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
if (this->m_shouldMatchSelection) {
this->m_codeRegion[0] = region.address;
this->m_codeRegion[1] = region.address + region.size;
if (region.address == size_t(-1)) {
this->m_codeRegion[0] = this->m_codeRegion[1] = 0;
} else {
this->m_codeRegion[0] = region.address;
this->m_codeRegion[1] = region.address + region.size;
}
}
});
}

View File

@ -15,8 +15,12 @@ namespace hex {
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
if (this->m_shouldMatchSelection) {
this->m_hashRegion[0] = region.address;
this->m_hashRegion[1] = region.address + region.size;
if (region.address == size_t(-1)) {
this->m_hashRegion[0] = this->m_hashRegion[1] = 0;
} else {
this->m_hashRegion[0] = region.address;
this->m_hashRegion[1] = region.address + region.size;
}
this->m_shouldInvalidate = true;
}
});

View File

@ -204,10 +204,53 @@ namespace hex {
});
EventManager::subscribe<EventSettingsChanged>(this, [this] {
auto alpha = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.highlight_alpha");
{
auto alpha = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.highlight_alpha");
if (alpha.is_number())
this->m_highlightAlpha = alpha;
}
{
auto columnCount = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.column_count");
this->m_memoryEditor.Cols = static_cast<int>(columnCount);
}
{
auto hexii = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.hexii");
this->m_memoryEditor.OptShowHexII = static_cast<int>(hexii);
}
{
auto ascii = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.ascii");
this->m_memoryEditor.OptShowAscii = static_cast<int>(ascii);
}
{
auto advancedDecoding = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.advanced_decoding");
this->m_memoryEditor.OptShowAdvancedDecoding = static_cast<int>(advancedDecoding);
}
{
auto greyOutZeros = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.grey_zeros");
this->m_memoryEditor.OptGreyOutZeroes = static_cast<int>(greyOutZeros);
}
{
auto upperCaseHex = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.uppercase_hex");
this->m_memoryEditor.OptUpperCaseHex = static_cast<int>(upperCaseHex);
}
{
auto showExtraInfo = ContentRegistry::Settings::getSetting("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.extra_info");
this->m_memoryEditor.OptShowExtraInfo = static_cast<int>(showExtraInfo);
}
});
EventManager::subscribe<QuerySelection>(this, [this](auto &region) {
@ -246,25 +289,26 @@ namespace hex {
ImGui::EndPopup();
}
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::TextUnformatted(hex::format("hex.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount()).c_str());
ImGui::SameLine();
if (provider->getPageCount() > 1) {
ImGui::TextUnformatted(hex::format("hex.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount()).c_str());
if (ImGui::ArrowButton("prevPage", ImGuiDir_Left)) {
provider->setCurrentPage(provider->getCurrentPage() - 1);
ImGui::SameLine();
EventManager::post<EventRegionSelected>(Region { std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd), 1 });
if (ImGui::ArrowButton("prevPage", ImGuiDir_Left)) {
provider->setCurrentPage(provider->getCurrentPage() - 1);
EventManager::post<EventRegionSelected>(Region { std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd), 1 });
}
ImGui::SameLine();
if (ImGui::ArrowButton("nextPage", ImGuiDir_Right)) {
provider->setCurrentPage(provider->getCurrentPage() + 1);
EventManager::post<EventRegionSelected>(Region { std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd), 1 });
}
}
ImGui::SameLine();
if (ImGui::ArrowButton("nextPage", ImGuiDir_Right)) {
provider->setCurrentPage(provider->getCurrentPage() + 1);
EventManager::post<EventRegionSelected>(Region { std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd), 1 });
}
}
ImGui::End();

View File

@ -24,14 +24,22 @@ namespace hex {
ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX));
if (ImGui::BeginPopupModal(View::toWindowName("hex.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
ImGui::TextUnformatted(LangEntry(category));
ImGui::Separator();
for (auto &[name, callback] : entries) {
if (callback(LangEntry(name), ContentRegistry::Settings::getSettingsData()[category][name]))
EventManager::post<EventSettingsChanged>();
if (ImGui::BeginTabBar("settings")) {
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
if (ImGui::BeginTabItem(LangEntry(category))) {
ImGui::TextUnformatted(LangEntry(category));
ImGui::Separator();
for (auto &[name, callback] : entries) {
if (callback(LangEntry(name), ContentRegistry::Settings::getSettingsData()[category][name]))
EventManager::post<EventSettingsChanged>();
}
ImGui::EndTabItem();
}
}
ImGui::NewLine();
ImGui::EndTabBar();
}
ImGui::EndPopup();
} else