X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-effects-style.cpp;h=75fabd77d3253a6e3716bb8058a272d64a7e9526;hp=44302d77ffcc21f62803af3b40671e88cf3ba8bf;hb=565f93cb19bc3e1058fc057bea74c973489deab3;hpb=07b1b771c6a3affaf013f93c1306723eae0621e4 diff --git a/dali-toolkit/internal/text/text-effects-style.cpp b/dali-toolkit/internal/text/text-effects-style.cpp index 44302d7..75fabd7 100644 --- a/dali-toolkit/internal/text/text-effects-style.cpp +++ b/dali-toolkit/internal/text/text-effects-style.cpp @@ -138,12 +138,39 @@ bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& va bool heightDefined = false; float height = 0.f; - const bool empty = ParseUnderlineProperties( propertiesMap, - enabled, - colorDefined, - color, - heightDefined, - height ); + bool empty = true; + + if ( propertiesMap.Empty() ) + { + // Map empty so check if a string provided + const std::string propertyString = value.Get(); + + if ( !propertyString.empty() ) + { + Property::Map parsedStringMap; + Text::ParsePropertyString( propertyString, parsedStringMap ); + + empty = ParseUnderlineProperties( parsedStringMap, + enabled, + colorDefined, + color, + heightDefined, + height ); + + controller->UnderlineSetByString( !empty); + } + } + else + { + empty = ParseUnderlineProperties( propertiesMap, + enabled, + colorDefined, + color, + heightDefined, + height ); + + controller->UnderlineSetByString( false ); + } if( !empty ) { @@ -202,20 +229,40 @@ void GetUnderlineProperties( ControllerPtr controller, Property::Value& value, E const Vector4& color = controller->GetUnderlineColor(); const float height = controller->GetUnderlineHeight(); - Property::Map map; + if ( controller->IsUnderlineSetByString() ) + { + std::string underlineProperties = "{\"enable\":"; + const std::string enabledStr = enabled ? "true" : "false"; + underlineProperties += "\"" + enabledStr + "\","; + + std::string colorStr; + Vector4ToColorString( color, colorStr ); + underlineProperties += "\"color\":\"" + colorStr + "\","; + + std::string heightStr; + FloatToString( height, heightStr ); + underlineProperties += "\"height\":\"" + heightStr + "\"}"; + + value = underlineProperties; + } + else + { + Property::Map map; - const std::string enabledStr = enabled ? TRUE_TOKEN : FALSE_TOKEN; - map.Insert( ENABLE_KEY, enabledStr ); + const std::string enabledStr = enabled ? TRUE_TOKEN : FALSE_TOKEN; + map.Insert( ENABLE_KEY, enabledStr ); - std::string colorStr; - Vector4ToColorString( color, colorStr ); - map.Insert( COLOR_KEY, colorStr ); + std::string colorStr; + Vector4ToColorString( color, colorStr ); + map.Insert( COLOR_KEY, colorStr ); - std::string heightStr; - FloatToString( height, heightStr ); - map.Insert( HEIGHT_KEY, heightStr ); + std::string heightStr; + FloatToString( height, heightStr ); + map.Insert( HEIGHT_KEY, heightStr ); + + value = map; + } - value = map; break; } case EffectStyle::INPUT: @@ -244,11 +291,35 @@ bool SetShadowProperties( ControllerPtr controller, const Property::Value& value bool offsetDefined = false; Vector2 offset; - const bool empty = ParseShadowProperties( propertiesMap, - colorDefined, - color, - offsetDefined, - offset ); + bool empty = true; + + if ( propertiesMap.Empty() ) + { + // Map empty so check if a string provided + const std::string propertyString = value.Get(); + + Property::Map parsedStringMap; + Text::ParsePropertyString( propertyString, parsedStringMap ); + + empty = ParseShadowProperties( parsedStringMap, + colorDefined, + color, + offsetDefined, + offset ); + + controller->ShadowSetByString( !empty ); + + } + else + { + empty = ParseShadowProperties( propertiesMap, + colorDefined, + color, + offsetDefined, + offset ); + + controller->ShadowSetByString( false ); + } if( !empty ) { @@ -299,17 +370,34 @@ void GetShadowProperties( ControllerPtr controller, Property::Value& value, Effe const Vector4& color = controller->GetShadowColor(); const Vector2& offset = controller->GetShadowOffset(); - Property::Map map; + if ( controller->IsShadowSetByString() ) + { + std::string shadowProperties = "{"; - std::string colorStr; - Vector4ToColorString( color, colorStr ); - map.Insert( COLOR_KEY, colorStr ); + std::string colorStr; + Vector4ToColorString( color, colorStr ); + shadowProperties += "\"color\":\"" + colorStr + "\","; - std::string offsetStr; - Vector2ToString( offset, offsetStr ); - map.Insert( OFFSET_KEY, offsetStr ); + std::string offsetStr; + Vector2ToString( offset, offsetStr ); + shadowProperties += "\"offset\":\"" + offsetStr + "\"}"; - value = map; + value = shadowProperties; + } + else + { + Property::Map map; + + std::string colorStr; + Vector4ToColorString( color, colorStr ); + map.Insert( COLOR_KEY, colorStr ); + + std::string offsetStr; + Vector2ToString( offset, offsetStr ); + map.Insert( OFFSET_KEY, offsetStr ); + + value = map; + } break; } case EffectStyle::INPUT: