Use underscores instead of spaces for all internal names. And renamed some script functions at the same time.

* cannocial_name_form now outputs "_", where it used to use " "
* this simplifies reflectio and scripting code, because now C++ names are also MSE internal names
* added 'caption' property to fields. This is used instead of the name in NativeLookEditor, since the latter will now contain underscores.
* renamed text related script functions for consistency, since we were touching that part of the code anyway.
This commit is contained in:
Twan van Laarhoven
2020-04-22 23:33:06 +02:00
parent be4bb8d8ed
commit 713a9e4a40
33 changed files with 240 additions and 197 deletions
+3 -2
View File
@@ -192,7 +192,8 @@ void ChoiceStyle::initImage() {
// OR_ELSE
ScriptCustomCollectionP lookup(new ScriptCustomCollection());
FOR_EACH(ci, choice_images) {
lookup->key_value[ci.first] = ci.second.getValidScriptP();
lookup->key_value[uncanonical_name_form(ci.first)] =
lookup->key_value[ci.first] = ci.second.getValidScriptP();
}
Script& script = image.getMutableScript();
script.addInstruction(I_PUSH_CONST, lookup);
@@ -270,7 +271,7 @@ template <> void reflect_content(GetMember& tag, const ChoiceStyle& cs
}
IMPLEMENT_REFLECTION(ChoiceStyle) {
REFLECT_ALIAS(300, "card list colors", "colors card list");
REFLECT_ALIAS(300, "card_list_colors", "colors_card_list");
REFLECT_BASE(Style);
REFLECT(popup_style);
REFLECT(render_style);
+1 -1
View File
@@ -63,7 +63,7 @@ String InfoValue::toString() const {
return value;
}
bool InfoValue::update(Context& ctx) {
if (value.empty()) value = field().name;
if (value.empty()) value = field().caption;
bool change = field().script.invokeOn(ctx, value);
Value::update(ctx);
return change;
+1 -1
View File
@@ -53,7 +53,7 @@ IMPLEMENT_REFLECTION_NAMELESS(MultipleChoiceValue) {
bool MultipleChoiceValue::update(Context& ctx) {
String old_value = value();
ctx.setVariable(_("last change"), to_script(last_change));
ctx.setVariable(_("last_change"), to_script(last_change));
ChoiceValue::update(ctx);
normalForm();
return value() != old_value;