fix: Missing paste behaviour option translations

This commit is contained in:
WerWolv 2025-01-18 14:36:31 +01:00
parent 771e191f28
commit 181be1a58e
4 changed files with 7 additions and 4 deletions

View File

@ -209,7 +209,7 @@ namespace hex {
class DropDown : public Widget {
public:
explicit DropDown(const std::vector<std::string> &items, const std::vector<nlohmann::json> &settingsValues, const nlohmann::json &defaultItem) : m_items(items), m_settingsValues(settingsValues), m_defaultItem(defaultItem) { }
explicit DropDown(const std::vector<UnlocalizedString> &items, const std::vector<nlohmann::json> &settingsValues, const nlohmann::json &defaultItem) : m_items(items), m_settingsValues(settingsValues), m_defaultItem(defaultItem) { }
bool draw(const std::string &name) override;
@ -220,7 +220,7 @@ namespace hex {
const nlohmann::json& getValue() const;
protected:
std::vector<std::string> m_items;
std::vector<UnlocalizedString> m_items;
std::vector<nlohmann::json> m_settingsValues;
nlohmann::json m_defaultItem;

View File

@ -402,7 +402,7 @@ namespace hex {
bool DropDown::draw(const std::string &name) {
auto preview = "";
if (static_cast<size_t>(m_value) < m_items.size())
preview = m_items[m_value].c_str();
preview = m_items[m_value].get().c_str();
bool changed = false;
if (ImGui::BeginCombo(name.c_str(), Lang(preview))) {

View File

@ -496,6 +496,9 @@
"hex.builtin.setting.hex_editor.highlight_color": "Selection highlight color",
"hex.builtin.setting.hex_editor.pattern_parent_highlighting": "Highlight pattern parents on hover",
"hex.builtin.setting.hex_editor.paste_behaviour": "Single-Byte Paste behaviour",
"hex.builtin.setting.hex_editor.paste_behaviour.none": "Ask me next time",
"hex.builtin.setting.hex_editor.paste_behaviour.everything": "Paste everything",
"hex.builtin.setting.hex_editor.paste_behaviour.selection": "Paste over selection",
"hex.builtin.setting.hex_editor.sync_scrolling": "Synchronize editor scroll position",
"hex.builtin.setting.hex_editor.show_highlights": "Show colorful highlightings",
"hex.builtin.setting.hex_editor.show_selection": "Move selection display to hex editor footer",

View File

@ -900,7 +900,7 @@ namespace hex::plugin::builtin {
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.pattern_parent_highlighting", true);
std::vector<std::string> pasteBehaviourNames = { "Ask me next time", "Paste everything", "Paste over selection" };
std::vector<std::string> pasteBehaviourNames = { "hex.builtin.setting.hex_editor.paste_behaviour.none", "hex.builtin.setting.hex_editor.paste_behaviour.everything", "hex.builtin.setting.hex_editor.paste_behaviour.selection" };
std::vector<nlohmann::json> pasteBehaviourValues = { "none", "everything", "selection" };
ContentRegistry::Settings::add<Widgets::DropDown>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.paste_behaviour",
pasteBehaviourNames,