Changeset View
Changeset View
Standalone View
Standalone View
source/gui/GUItext.cpp
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | if (_to == _from && textChunk.m_From == textChunk.m_To) | ||||
// Handle additional attributes | // Handle additional attributes | ||||
for (const TextChunk::Tag::TagAttribute& tagAttrib : tag.m_TagAttributes) | for (const TextChunk::Tag::TagAttribute& tagAttrib : tag.m_TagAttributes) | ||||
{ | { | ||||
if (tagAttrib.attrib == L"displace" && !tagAttrib.value.empty()) | if (tagAttrib.attrib == L"displace" && !tagAttrib.value.empty()) | ||||
{ | { | ||||
// Displace the sprite | // Displace the sprite | ||||
CSize displacement; | CSize displacement; | ||||
// Parse the value | // Parse the value | ||||
if (!GUI<CSize>::ParseString(tagAttrib.value, displacement)) | if (!GUI<CSize>::ParseString(pGUI, tagAttrib.value, displacement)) | ||||
LOGERROR("Error parsing 'displace' value for tag [ICON]"); | LOGERROR("Error parsing 'displace' value for tag [ICON]"); | ||||
else | else | ||||
SpriteCall.m_Area += displacement; | SpriteCall.m_Area += displacement; | ||||
} | } | ||||
else if (tagAttrib.attrib == L"tooltip") | else if (tagAttrib.attrib == L"tooltip") | ||||
SpriteCall.m_Tooltip = tagAttrib.value; | SpriteCall.m_Tooltip = tagAttrib.value; | ||||
else if (tagAttrib.attrib == L"tooltip_style") | else if (tagAttrib.attrib == L"tooltip_style") | ||||
SpriteCall.m_TooltipStyle = tagAttrib.value; | SpriteCall.m_TooltipStyle = tagAttrib.value; | ||||
Show All 29 Lines | else if (_to > _from && !Feedback.m_NewLine) | ||||
// Go through tags and apply changes. | // Go through tags and apply changes. | ||||
for (const TextChunk::Tag& tag : textChunk.m_Tags) | for (const TextChunk::Tag& tag : textChunk.m_Tags) | ||||
{ | { | ||||
switch (tag.m_TagType) | switch (tag.m_TagType) | ||||
{ | { | ||||
case TextChunk::Tag::TAG_COLOR: | case TextChunk::Tag::TAG_COLOR: | ||||
TextCall.m_UseCustomColor = true; | TextCall.m_UseCustomColor = true; | ||||
if (!GUI<CColor>::ParseString(tag.m_TagValue, TextCall.m_Color) && pObject) | if (!GUI<CColor>::ParseString(pGUI, tag.m_TagValue, TextCall.m_Color) && pObject) | ||||
LOGERROR("Error parsing the value of a [color]-tag in GUI text when reading object \"%s\".", pObject->GetPresentableName().c_str()); | LOGERROR("Error parsing the value of a [color]-tag in GUI text when reading object \"%s\".", pObject->GetPresentableName().c_str()); | ||||
break; | break; | ||||
case TextChunk::Tag::TAG_FONT: | case TextChunk::Tag::TAG_FONT: | ||||
// TODO Gee: (2004-08-15) Check if Font exists? | // TODO Gee: (2004-08-15) Check if Font exists? | ||||
TextCall.m_Font = CStrIntern(utf8_from_wstring(tag.m_TagValue)); | TextCall.m_Font = CStrIntern(utf8_from_wstring(tag.m_TagValue)); | ||||
break; | break; | ||||
default: | default: | ||||
LOGERROR("Encountered unexpected tag applied to text"); | LOGERROR("Encountered unexpected tag applied to text"); | ||||
▲ Show 20 Lines • Show All 271 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator