1
0
mirror of synced 2025-01-11 05:42:15 +01:00

impr: Added note about adding new data inspector row

This commit is contained in:
WerWolv 2024-12-23 21:47:16 +01:00
parent c5d3387962
commit 914024c0b5
2 changed files with 42 additions and 16 deletions

View File

@ -722,6 +722,8 @@
"hex.builtin.view.data_inspector.no_data": "No bytes selected", "hex.builtin.view.data_inspector.no_data": "No bytes selected",
"hex.builtin.view.data_inspector.table.name": "Name", "hex.builtin.view.data_inspector.table.name": "Name",
"hex.builtin.view.data_inspector.table.value": "Value", "hex.builtin.view.data_inspector.table.value": "Value",
"hex.builtin.view.data_inspector.custom_row.title": "Adding custom rows",
"hex.builtin.view.data_inspector.custom_row.hint": "It's possible to define custom data processor rows by placing pattern language scripts in the <ImHex>/scripts/inspectors folder.\n\nCheck the documentation for more information.",
"hex.builtin.view.data_processor.help_text": "Right click to add a new node", "hex.builtin.view.data_processor.help_text": "Right click to add a new node",
"hex.builtin.view.data_processor.menu.file.load_processor": "Load data processor...", "hex.builtin.view.data_processor.menu.file.load_processor": "Load data processor...",
"hex.builtin.view.data_processor.menu.file.save_processor": "Save data processor...", "hex.builtin.view.data_processor.menu.file.save_processor": "Save data processor...",

View File

@ -276,6 +276,15 @@ namespace hex::plugin::builtin {
this->drawInspectorRows(); this->drawInspectorRows();
if (m_tableEditingModeEnabled) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TableNextColumn();
ImGuiExt::HelpHover("hex.builtin.view.data_inspector.custom_row.hint"_lang, ICON_VS_INFO);
ImGui::SameLine();
ImGui::TextUnformatted("hex.builtin.view.data_inspector.custom_row.title"_lang);
}
ImGui::EndTable(); ImGui::EndTable();
} }
@ -288,6 +297,9 @@ namespace hex::plugin::builtin {
// Draw inspector settings // Draw inspector settings
if (ImGuiExt::BeginSubWindow("hex.ui.common.settings"_lang)) {
ImGui::PushItemWidth(-1);
{
// Draw endian setting // Draw endian setting
this->drawEndianSetting(); this->drawEndianSetting();
@ -297,6 +309,10 @@ namespace hex::plugin::builtin {
// Draw invert setting // Draw invert setting
this->drawInvertSetting(); this->drawInvertSetting();
} }
ImGui::PopItemWidth();
}
ImGuiExt::EndSubWindow();
}
void ViewDataInspector::drawInspectorRows() { void ViewDataInspector::drawInspectorRows() {
int inspectorRowId = 1; int inspectorRowId = 1;
@ -424,10 +440,12 @@ namespace hex::plugin::builtin {
} }
}(); }();
std::array options = {"hex.ui.common.little"_lang, "hex.ui.common.big"_lang}; std::array options = {
hex::format("{}: {}", "hex.ui.common.endian"_lang, "hex.ui.common.little"_lang),
hex::format("{}: {}", "hex.ui.common.endian"_lang, "hex.ui.common.big"_lang)
};
if (ImGui::SliderInt("hex.ui.common.endian"_lang, &selection, 0, options.size() - 1, options[selection], if (ImGui::SliderInt("##endian", &selection, 0, options.size() - 1, options[selection].c_str(), ImGuiSliderFlags_NoInput)) {
ImGuiSliderFlags_NoInput)) {
m_shouldInvalidate = true; m_shouldInvalidate = true;
switch (selection) { switch (selection) {
@ -454,11 +472,14 @@ namespace hex::plugin::builtin {
return 2; return 2;
} }
}(); }();
std::array options = {"hex.ui.common.decimal"_lang, "hex.ui.common.hexadecimal"_lang,
"hex.ui.common.octal"_lang};
if (ImGui::SliderInt("hex.ui.common.number_format"_lang, &selection, 0, options.size() - 1, std::array options = {
options[selection], ImGuiSliderFlags_NoInput)) { hex::format("{}: {}", "hex.ui.common.number_format"_lang, "hex.ui.common.decimal"_lang),
hex::format("{}: {}", "hex.ui.common.number_format"_lang, "hex.ui.common.hexadecimal"_lang),
hex::format("{}: {}", "hex.ui.common.number_format"_lang, "hex.ui.common.octal"_lang)
};
if (ImGui::SliderInt("##format", &selection, 0, options.size() - 1, options[selection].c_str(), ImGuiSliderFlags_NoInput)) {
m_shouldInvalidate = true; m_shouldInvalidate = true;
switch (selection) { switch (selection) {
@ -478,10 +499,13 @@ namespace hex::plugin::builtin {
void ViewDataInspector::drawInvertSetting() { void ViewDataInspector::drawInvertSetting() {
int selection = m_invert ? 1 : 0; int selection = m_invert ? 1 : 0;
std::array options = {"hex.ui.common.no"_lang, "hex.ui.common.yes"_lang};
if (ImGui::SliderInt("hex.builtin.view.data_inspector.invert"_lang, &selection, 0, options.size() - 1, std::array options = {
options[selection], ImGuiSliderFlags_NoInput)) { hex::format("{}: {}", "hex.builtin.view.data_inspector.invert"_lang, "hex.ui.common.no"_lang),
hex::format("{}: {}", "hex.builtin.view.data_inspector.invert"_lang, "hex.ui.common.yes"_lang)
};
if (ImGui::SliderInt("##invert", &selection, 0, options.size() - 1, options[selection].c_str(), ImGuiSliderFlags_NoInput)) {
m_shouldInvalidate = true; m_shouldInvalidate = true;
m_invert = selection == 1; m_invert = selection == 1;