diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index 0acd9de74..f6ce39104 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -722,6 +722,8 @@ "hex.builtin.view.data_inspector.no_data": "No bytes selected", "hex.builtin.view.data_inspector.table.name": "Name", "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 /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.menu.file.load_processor": "Load data processor...", "hex.builtin.view.data_processor.menu.file.save_processor": "Save data processor...", diff --git a/plugins/builtin/source/content/views/view_data_inspector.cpp b/plugins/builtin/source/content/views/view_data_inspector.cpp index d864a7b0e..93eebd538 100644 --- a/plugins/builtin/source/content/views/view_data_inspector.cpp +++ b/plugins/builtin/source/content/views/view_data_inspector.cpp @@ -276,6 +276,15 @@ namespace hex::plugin::builtin { 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(); } @@ -288,14 +297,21 @@ namespace hex::plugin::builtin { // Draw inspector settings - // Draw endian setting - this->drawEndianSetting(); + if (ImGuiExt::BeginSubWindow("hex.ui.common.settings"_lang)) { + ImGui::PushItemWidth(-1); + { + // Draw endian setting + this->drawEndianSetting(); - // Draw radix setting - this->drawRadixSetting(); + // Draw radix setting + this->drawRadixSetting(); - // Draw invert setting - this->drawInvertSetting(); + // Draw invert setting + this->drawInvertSetting(); + } + ImGui::PopItemWidth(); + } + ImGuiExt::EndSubWindow(); } void ViewDataInspector::drawInspectorRows() { @@ -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], - ImGuiSliderFlags_NoInput)) { + if (ImGui::SliderInt("##endian", &selection, 0, options.size() - 1, options[selection].c_str(), ImGuiSliderFlags_NoInput)) { m_shouldInvalidate = true; switch (selection) { @@ -454,11 +472,14 @@ namespace hex::plugin::builtin { 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, - options[selection], ImGuiSliderFlags_NoInput)) { + std::array options = { + 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; switch (selection) { @@ -478,10 +499,13 @@ namespace hex::plugin::builtin { void ViewDataInspector::drawInvertSetting() { 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, - options[selection], ImGuiSliderFlags_NoInput)) { + std::array options = { + 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_invert = selection == 1;