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
+1 -1
View File
@@ -237,7 +237,7 @@ void CardListBase::rebuild() {
else if (f.second->card_list_align & ALIGN_CENTER) align = wxLIST_FORMAT_CENTRE;
else align = wxLIST_FORMAT_LEFT;
InsertColumn((long)column_fields.size(),
tr(*set->game, f.second->card_list_name, capitalize),
tr(*set->game, f.second->card_list_name, identity),
align, cs.width);
column_fields.push_back(f.second);
}
+2 -2
View File
@@ -76,7 +76,7 @@ void CardListColumnSelectDialog::initList() {
// Init items
Color window_color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
FOR_EACH(c, columns) {
list->Append(tr(*game, c.field->card_list_name, capitalize));
list->Append(tr(*game, c.field->card_list_name, identity));
// check
int i = list->GetCount() - 1;
list->Check(i, c.settings.visible);
@@ -89,7 +89,7 @@ void CardListColumnSelectDialog::initList() {
void CardListColumnSelectDialog::refreshItem(int i) {
list->Check (i, columns[i].settings.visible);
list->SetString(i, tr(*game, columns[i].field->card_list_name, capitalize) );
list->SetString(i, tr(*game, columns[i].field->card_list_name, identity) );
}
// ----------------------------------------------------------------------------- : Events
+2 -2
View File
@@ -44,7 +44,7 @@ void NativeLookEditor::drawViewer(RotatedDC& dc, ValueViewer& v) {
dc.SetFont(*wxNORMAL_FONT);
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
// TODO : tr using stylesheet or using game?
dc.DrawText(tr(getStylePackage(), s.fieldP->name, capitalize_sentence),
dc.DrawText(tr(getStylePackage(), s.fieldP->caption, identity),
RealPoint(margin_left - s.left, 1));
}
// draw viewer
@@ -68,7 +68,7 @@ void NativeLookEditor::resizeViewers() {
// width of the label string
int w;
Style& s = *v->getStyle();
String text = tr(getStylePackage(), s.fieldP->name, capitalize_sentence);
String text = tr(getStylePackage(), s.fieldP->caption, identity);
dc.GetTextExtent(text,&w,nullptr);
label_width = max(label_width, w + label_margin);
}