|
|
@@ -137,7 +137,7 @@ const Sprite* StyleSheet::GetSprite(const String& name) const
|
|
|
return spritesheet_list.GetSprite(name);
|
|
|
}
|
|
|
|
|
|
-DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_string_value, const PropertySource* source) const
|
|
|
+DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_string_value, const SharedPtr<const PropertySource>& source) const
|
|
|
{
|
|
|
// Decorators are declared as
|
|
|
// decorator: <decorator-value>[, <decorator-value> ...];
|
|
|
@@ -150,7 +150,7 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
|
|
|
if (decorator_string_value.empty() || decorator_string_value == NONE)
|
|
|
return decorator_list;
|
|
|
|
|
|
- const char* source_name = (source ? source->path.c_str() : "");
|
|
|
+ const char* source_path = (source ? source->path.c_str() : "");
|
|
|
const int source_line_number = (source ? source->line_number : 0);
|
|
|
|
|
|
// Make sure we don't split inside the parenthesis since they may appear in decorator shorthands.
|
|
|
@@ -173,7 +173,7 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
|
|
|
if (decorator)
|
|
|
decorator_list.emplace_back(std::move(decorator));
|
|
|
else
|
|
|
- Log::Message(Log::LT_WARNING, "Decorator name '%s' could not be found in any @decorator rule, declared at %s:%d", decorator_string.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Decorator name '%s' could not be found in any @decorator rule, declared at %s:%d", decorator_string.c_str(), source_path, source_line_number);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -184,7 +184,7 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
|
|
|
DecoratorInstancer* instancer = Factory::GetDecoratorInstancer(type);
|
|
|
if (!instancer)
|
|
|
{
|
|
|
- Log::Message(Log::LT_WARNING, "Decorator type '%s' not found, declared at %s:%d", type.c_str(), source ? source->path.c_str() : "", source ? source->line_number : -1);
|
|
|
+ Log::Message(Log::LT_WARNING, "Decorator type '%s' not found, declared at %s:%d", type.c_str(), source_path, source_line_number);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -195,12 +195,14 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
|
|
|
PropertyDictionary properties;
|
|
|
if (!specification.ParsePropertyDeclaration(properties, "decorator", shorthand))
|
|
|
{
|
|
|
- Log::Message(Log::LT_WARNING, "Could not parse decorator value '%s' at %s:%d", decorator_string.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Could not parse decorator value '%s' at %s:%d", decorator_string.c_str(), source_path, source_line_number);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
// Set unspecified values to their defaults
|
|
|
specification.SetPropertyDefaults(properties);
|
|
|
+
|
|
|
+ properties.SetSourceOfAllProperties(source);
|
|
|
|
|
|
SharedPtr<Decorator> decorator = instancer->InstanceDecorator(type, properties, DecoratorInstancerInterface(*this));
|
|
|
|
|
|
@@ -208,7 +210,7 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
|
|
|
decorator_list.emplace_back(std::move(decorator));
|
|
|
else
|
|
|
{
|
|
|
- Log::Message(Log::LT_WARNING, "Decorator '%s' could not be instanced, declared at %s:%d", decorator_string.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Decorator '%s' could not be instanced, declared at %s:%d", decorator_string.c_str(), source_path, source_line_number);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
@@ -217,7 +219,7 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
|
|
|
return decorator_list;
|
|
|
}
|
|
|
|
|
|
-FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_effect_string_value, const PropertySource* source) const
|
|
|
+FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_effect_string_value, const SharedPtr<const PropertySource>& source) const
|
|
|
{
|
|
|
// Font-effects are declared as
|
|
|
// font-effect: <font-effect-value>[, <font-effect-value> ...];
|
|
|
@@ -227,7 +229,7 @@ FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_e
|
|
|
if (font_effect_string_value.empty() || font_effect_string_value == NONE)
|
|
|
return nullptr;
|
|
|
|
|
|
- const char* source_name = (source ? source->path.c_str() : "");
|
|
|
+ const char* source_path = (source ? source->path.c_str() : "");
|
|
|
const int source_line_number = (source ? source->line_number : 0);
|
|
|
|
|
|
FontEffectList font_effect_list;
|
|
|
@@ -248,7 +250,7 @@ FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_e
|
|
|
if (invalid_parenthesis)
|
|
|
{
|
|
|
// We found no parenthesis, font-effects can only be declared anonymously for now.
|
|
|
- Log::Message(Log::LT_WARNING, "Invalid syntax for font-effect '%s', declared at %s:%d", font_effect_string.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Invalid syntax for font-effect '%s', declared at %s:%d", font_effect_string.c_str(), source_path, source_line_number);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -259,7 +261,7 @@ FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_e
|
|
|
FontEffectInstancer* instancer = Factory::GetFontEffectInstancer(type);
|
|
|
if (!instancer)
|
|
|
{
|
|
|
- Log::Message(Log::LT_WARNING, "Font-effect type '%s' not found, declared at %s:%d", type.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Font-effect type '%s' not found, declared at %s:%d", type.c_str(), source_path, source_line_number);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -270,13 +272,15 @@ FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_e
|
|
|
PropertyDictionary properties;
|
|
|
if (!specification.ParsePropertyDeclaration(properties, "font-effect", shorthand))
|
|
|
{
|
|
|
- Log::Message(Log::LT_WARNING, "Could not parse decorator value '%s' at %s:%d", font_effect_string.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Could not parse decorator value '%s' at %s:%d", font_effect_string.c_str(), source_path, source_line_number);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
// Set unspecified values to their defaults
|
|
|
specification.SetPropertyDefaults(properties);
|
|
|
|
|
|
+ properties.SetSourceOfAllProperties(source);
|
|
|
+
|
|
|
SharedPtr<FontEffect> font_effect = instancer->InstanceFontEffect(type, properties);
|
|
|
if (font_effect)
|
|
|
{
|
|
|
@@ -291,7 +295,7 @@ FontEffectListPtr StyleSheet::InstanceFontEffectsFromString(const String& font_e
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Log::Message(Log::LT_WARNING, "Font-effect '%s' could not be instanced, declared at %s:%d", font_effect_string.c_str(), source_name, source_line_number);
|
|
|
+ Log::Message(Log::LT_WARNING, "Font-effect '%s' could not be instanced, declared at %s:%d", font_effect_string.c_str(), source_path, source_line_number);
|
|
|
continue;
|
|
|
}
|
|
|
}
|