std::vector<std::string> lines = split(text, '\n');
for (unsigned int i = 0; i != lines.size(); i++) {
- std::wstring wlabel = utf8_to_wide(unescape_string(lines[i]));
+ std::wstring wlabel = unescape_translate(unescape_string(
+ utf8_to_wide(lines[i])));
core::rect<s32> rect;
auto style = getStyleForElement("label", spec.fname);
e->setNotClipped(style.getBool(StyleSpec::NOCLIP, false));
- e->setDrawBorder(style.getBool(StyleSpec::BORDER, false));
e->setOverrideColor(style.getColor(StyleSpec::TEXTCOLOR, video::SColor(0xFFFFFFFF)));
- if (style.isNotDefault(StyleSpec::BGCOLOR)) {
- e->setBackgroundColor(style.getColor(StyleSpec::BGCOLOR));
- }
m_fields.push_back(spec);
}
auto style = getStyleForElement("vertlabel", spec.fname, "label");
e->setNotClipped(style.getBool(StyleSpec::NOCLIP, false));
- e->setDrawBorder(style.getBool(StyleSpec::BORDER, false));
e->setOverrideColor(style.getColor(StyleSpec::TEXTCOLOR, video::SColor(0xFFFFFFFF)));
- if (style.isNotDefault(StyleSpec::BGCOLOR)) {
- e->setBackgroundColor(style.getColor(StyleSpec::BGCOLOR));
- }
m_fields.push_back(spec);
return;
if (element.empty())
return;
+ if (parseVersionDirect(element))
+ return;
+
std::vector<std::string> parts = split(element,'[');
// ugly workaround to keep compatibility
}
/* Copy of the "real_coordinates" element for after the form size. */
- mydata.real_coordinates = false;
+ mydata.real_coordinates = m_formspec_version >= 2;
for (; i < elements.size(); i++) {
std::vector<std::string> parts = split(elements[i], '[');
std::string name = trim(parts[0]);
if (enable_prepends) {
// Backup the coordinates so that prepends can use the coordinates of choice.
bool rc_backup = mydata.real_coordinates;
+ bool version_backup = m_formspec_version;
mydata.real_coordinates = false; // Old coordinates by default.
+
std::vector<std::string> prepend_elements = split(m_formspec_prepend, ']');
for (const auto &element : prepend_elements)
parseElement(&mydata, element);
+
+ m_formspec_version = version_backup;
mydata.real_coordinates = rc_backup; // Restore coordinates
}
}
if (layer == 1) {
- // Draw item stack
if (selected)
item.takeItem(m_selected_amount);
if (!item.empty()) {
+ // Draw item stack
drawItemStack(driver, m_font, item,
rect, &AbsoluteClippingRect, m_client,
rotation_kind);
- }
-
- // Draw tooltip
- std::wstring tooltip_text;
- if (hovering && !m_selected_item) {
- const std::string &desc = item.metadata.getString("description");
- if (desc.empty())
- tooltip_text =
- utf8_to_wide(item.getDefinition(m_client->idef()).description);
- else
- tooltip_text = utf8_to_wide(desc);
-
- if (!item.name.empty()) {
- if (tooltip_text.empty())
- tooltip_text = utf8_to_wide(item.name);
- else if (m_tooltip_append_itemname)
- tooltip_text += utf8_to_wide("\n[" + item.name + "]");
+ // Draw tooltip
+ if (hovering && !m_selected_item) {
+ std::string tooltip = item.getDescription(m_client->idef());
+ if (m_tooltip_append_itemname)
+ tooltip += "\n[" + item.name + "]";
+ showTooltip(utf8_to_wide(tooltip), m_default_tooltip_color,
+ m_default_tooltip_bgcolor);
}
}
- if (!tooltip_text.empty()) {
- showTooltip(tooltip_text, m_default_tooltip_color,
- m_default_tooltip_bgcolor);
- }
}
}
}