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

ui: Replace data inspector endian and format radio boxes with sliders

This commit is contained in:
WerWolv 2022-03-26 17:44:01 +01:00
parent 0f0a836fa0
commit 965207d688
6 changed files with 61 additions and 25 deletions

View File

@ -110,29 +110,49 @@ namespace hex::plugin::builtin {
ImGui::Separator();
ImGui::NewLine();
if (ImGui::RadioButton("hex.builtin.common.little_endian"_lang, this->m_endian == std::endian::little)) {
this->m_endian = std::endian::little;
this->m_shouldInvalidate = true;
}
ImGui::SameLine();
if (ImGui::RadioButton("hex.builtin.common.big_endian"_lang, this->m_endian == std::endian::big)) {
this->m_endian = std::endian::big;
this->m_shouldInvalidate = true;
{
int selection = [this] {
switch (this->m_endian) {
default:
case std::endian::little: return 0;
case std::endian::big: return 1;
}
}();
std::array options = { "hex.builtin.common.little"_lang, "hex.builtin.common.big"_lang };
if (ImGui::SliderInt("hex.builtin.common.endian"_lang, &selection, 0, options.size() - 1, options[selection], ImGuiSliderFlags_NoInput)) {
this->m_shouldInvalidate = true;
switch (selection) {
default:
case 0: this->m_endian = std::endian::little; break;
case 1: this->m_endian = std::endian::big; break;
}
}
}
if (ImGui::RadioButton("hex.builtin.common.decimal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Decimal)) {
this->m_numberDisplayStyle = NumberDisplayStyle::Decimal;
this->m_shouldInvalidate = true;
}
ImGui::SameLine();
if (ImGui::RadioButton("hex.builtin.common.hexadecimal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Hexadecimal)) {
this->m_numberDisplayStyle = NumberDisplayStyle::Hexadecimal;
this->m_shouldInvalidate = true;
}
ImGui::SameLine();
if (ImGui::RadioButton("hex.builtin.common.octal"_lang, this->m_numberDisplayStyle == NumberDisplayStyle::Octal)) {
this->m_numberDisplayStyle = NumberDisplayStyle::Octal;
this->m_shouldInvalidate = true;
{
int selection = [this] {
switch (this->m_numberDisplayStyle) {
default:
case NumberDisplayStyle::Decimal: return 0;
case NumberDisplayStyle::Hexadecimal: return 1;
case NumberDisplayStyle::Octal: return 2;
}
}();
std::array options = { "hex.builtin.common.decimal"_lang, "hex.builtin.common.hexadecimal"_lang, "hex.builtin.common.octal"_lang };
if (ImGui::SliderInt("hex.builtin.common.number_format"_lang, &selection, 0, options.size() - 1, options[selection], ImGuiSliderFlags_NoInput)) {
this->m_shouldInvalidate = true;
switch (selection) {
default:
case 0: this->m_numberDisplayStyle = NumberDisplayStyle::Decimal; break;
case 1: this->m_numberDisplayStyle = NumberDisplayStyle::Hexadecimal; break;
case 2: this->m_numberDisplayStyle = NumberDisplayStyle::Octal; break;
}
}
}
} else {
std::string text = "hex.builtin.view.data_inspector.no_data"_lang;

View File

@ -50,9 +50,12 @@ namespace hex::plugin::builtin {
{ "hex.builtin.welcome.safety_backup.restore", "Ja, Wiederherstellen" },
{ "hex.builtin.welcome.safety_backup.delete", "Nein, Entfernen" },
{ "hex.builtin.common.endian", "Endian" },
{ "hex.builtin.common.little_endian", "Little Endian" },
{ "hex.builtin.common.big_endian", "Big Endian" },
{ "hex.builtin.common.little", "Little" },
{ "hex.builtin.common.big", "Big" },
{ "hex.builtin.common.number_format", "Format" },
{ "hex.builtin.common.decimal", "Dezimal" },
{ "hex.builtin.common.hexadecimal", "Hexadezimal" },
{ "hex.builtin.common.octal", "Oktal" },

View File

@ -51,9 +51,12 @@ namespace hex::plugin::builtin {
{ "hex.builtin.welcome.safety_backup.restore", "Yes, Restore" },
{ "hex.builtin.welcome.safety_backup.delete", "No, Delete" },
{ "hex.builtin.common.endian", "Endian" },
{ "hex.builtin.common.little_endian", "Little Endian" },
{ "hex.builtin.common.big_endian", "Big Endian" },
{ "hex.builtin.common.little", "Little" },
{ "hex.builtin.common.big", "Big" },
{ "hex.builtin.common.number_format", "Format" },
{ "hex.builtin.common.decimal", "Decimal" },
{ "hex.builtin.common.hexadecimal", "Hexadecimal" },
{ "hex.builtin.common.octal", "Octal" },

View File

@ -50,8 +50,12 @@ namespace hex::plugin::builtin {
{ "hex.builtin.welcome.safety_backup.restore", "Sì, Ripristina" },
{ "hex.builtin.welcome.safety_backup.delete", "No, Elimina" },
{ "hex.builtin.common.endian", "Endian" },
{ "hex.builtin.common.little_endian", "Little Endian" },
{ "hex.builtin.common.big_endian", "Big Endian" },
{ "hex.builtin.common.little", "Little" },
{ "hex.builtin.common.big", "Big" },
//{ "hex.builtin.common.number_format", "Format" },
{ "hex.builtin.common.decimal", "Decimale" },
{ "hex.builtin.common.hexadecimal", "Esadecimale" },
{ "hex.builtin.common.octal", "Ottale" },

View File

@ -50,9 +50,12 @@ namespace hex::plugin::builtin {
{ "hex.builtin.welcome.safety_backup.restore", "はい、復元します。" },
{ "hex.builtin.welcome.safety_backup.delete", "いいえ、破棄します。" },
{ "hex.builtin.common.endian", "エンディアン" },
{ "hex.builtin.common.little_endian", "リトルエンディアン" },
{ "hex.builtin.common.big_endian", "ビッグエンディアン" },
{ "hex.builtin.common.little", "リトル" },
{ "hex.builtin.common.big", "ビッグ" },
//{ "hex.builtin.common.number_format", "Format" },
{ "hex.builtin.common.decimal", "10進数" },
{ "hex.builtin.common.hexadecimal", "16進数" },
{ "hex.builtin.common.octal", "8進数" },

View File

@ -50,9 +50,12 @@ namespace hex::plugin::builtin {
{ "hex.builtin.welcome.safety_backup.restore", "恢复" },
{ "hex.builtin.welcome.safety_backup.delete", "删除" },
{ "hex.builtin.common.endian", "端序" },
{ "hex.builtin.common.little_endian", "小端序" },
{ "hex.builtin.common.big_endian", "大端序" },
{ "hex.builtin.common.little", "" },
{ "hex.builtin.common.big", "" },
//{ "hex.builtin.common.number_format", "Format" },
{ "hex.builtin.common.decimal", "十进制" },
{ "hex.builtin.common.hexadecimal", "十六进制" },
{ "hex.builtin.common.octal", "八进制" },