From 78cd26f4564532a0f193ba9d1d7f0ef3903149d2 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 27 May 2024 11:32:12 +0200 Subject: [PATCH] fixed char_paremeter edit_option, added edit_option for string_parameters, improved warning for lack of edit_option --- config.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config.cpp b/config.cpp index 13a6b317..08f417f1 100644 --- a/config.cpp +++ b/config.cpp @@ -57,7 +57,8 @@ struct parameter : public std::enable_shared_from_this { virtual bool affects(void *v) { return false; } void show_edit_option() { show_edit_option(default_key); } virtual void show_edit_option(int key) { - println(hlog, "default called!"); } + println(hlog, "warning: no edit option defined for ", name); + } virtual string search_key() { return name + "|" + legacy_config_name + "|" + menu_item_name + "|" + help_text; } @@ -308,6 +309,7 @@ struct int_parameter : public val_parameter { struct string_parameter: public val_parameter { string save() override { return *value; } void load_from_raw(const string& s) override { *value = s; } + void show_edit_option(int key) override; }; struct char_parameter : public val_parameter { @@ -534,10 +536,14 @@ void matrix_parameter::show_edit_option(int key) { } void char_parameter::show_edit_option(int key) { - string s = s0; s += value; + string s = s0; s += *(value); dialog::addSelItem(XLAT(menu_item_name), s, key); } +void string_parameter::show_edit_option(int key) { + dialog::addSelItem(XLAT(menu_item_name), *value, key); + } + void parameter::setup(const parameter_names& n) { name = n.name; legacy_config_name = n.legacy_config_name;