From: Lee Morgan Date: Wed, 22 Oct 2014 11:09:01 +0000 (+0100) Subject: [dali_1.0.14] Merge branch 'tizen' X-Git-Tag: dali_1.0.14^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=e58197b2ce320f167a24865cdd048f0cc0c05e45;hp=8a7823e6d838e4420c632141592b3433a49000a5 [dali_1.0.14] Merge branch 'tizen' Change-Id: Ia6d26ced5e918291ae73a4499440b5c1ed0107f8 --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp index c88aa92..ccfb863 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp @@ -679,7 +679,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "IMAGE_PATH_1", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "ImageActor" ) ); + map[ "type" ] = "ImageActor"; button.SetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR, map ); DALI_TEST_EQUALS( "ImageActor", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); @@ -691,7 +691,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "IMAGE_PATH_2", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "Actor" ) ); + map[ "type" ] = "Actor"; button.SetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR, map ); DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); @@ -704,7 +704,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "IMAGE_PATH_3", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "Actor" ) ); + map[ "type" ] = "Actor"; button.SetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR, map ); DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); @@ -716,7 +716,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "TextView", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "Actor" ) ); + map[ "type" ] = "Actor"; button.SetProperty( PushButton::PROPERTY_LABEL_ACTOR, map ); DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp index a50ffc9..fe75b1d 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp @@ -595,12 +595,12 @@ int UtcDaliTableViewSetGetProperty(void) //{ "policy": "fixed", "value": 30.0 }, Property::Map item1; - item1.push_back( Property::StringValuePair( "policy", "fixed" ) ); - item1.push_back( Property::StringValuePair( "value", 30.f) ); + item1[ "policy" ] = "fixed"; + item1[ "value" ] = 30.f; //{ "policy": "relative", "value": 0.2 }, Property::Map item2; - item2.push_back( Property::StringValuePair( "policy", "relative" ) ); - item2.push_back( Property::StringValuePair( "value", 0.2f ) ); + item2[ "policy" ] = "relative"; + item2[ "value" ] = 0.2f; // Test "layout-rows" property DALI_TEST_CHECK( tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_ROWS) == TableView::PROPERTY_LAYOUT_ROWS ); @@ -613,20 +613,20 @@ int UtcDaliTableViewSetGetProperty(void) * } */ Property::Map layoutRows; - layoutRows.push_back( Property::StringValuePair("1", item1) ); - layoutRows.push_back( Property::StringValuePair("3", item2) ); + layoutRows[ "1" ] = item1; + layoutRows[ "3" ] = item2; tableView.SetProperty( TableView::PROPERTY_LAYOUT_ROWS, layoutRows ); DALI_TEST_EQUALS( tableView.GetFixedHeight( 1u ), 30.f, TEST_LOCATION ); DALI_TEST_EQUALS( tableView.GetRelativeHeight( 3u ), 0.2f, TEST_LOCATION ); Property::Map layoutRowsGet = tableView.GetProperty(TableView::PROPERTY_LAYOUT_ROWS).Get(); - DALI_TEST_CHECK( layoutRowsGet[0].first.compare(layoutRows[0].first) == 0 ); - DALI_TEST_CHECK( layoutRowsGet[0].second.GetValue( "policy" ).Get().compare(layoutRows[0].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutRowsGet[0].second.GetValue( "value" ).Get(),layoutRows[0].second.GetValue( "value" ).Get(), TEST_LOCATION ); - DALI_TEST_CHECK( layoutRowsGet[1].first.compare(layoutRows[1].first) == 0 ); - DALI_TEST_CHECK( layoutRowsGet[1].second.GetValue( "policy" ).Get().compare(layoutRows[1].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutRowsGet[1].second.GetValue( "value" ).Get(),layoutRows[1].second.GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutRowsGet.GetKey(0).compare(layoutRows.GetKey(0)) == 0 ); + DALI_TEST_CHECK( layoutRowsGet.GetValue(0).GetValue( "policy" ).Get().compare(layoutRows.GetValue(0).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutRowsGet.GetValue(0).GetValue( "value" ).Get(),layoutRows.GetValue(0).GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutRowsGet.GetKey(1).compare(layoutRows.GetKey(1)) == 0 ); + DALI_TEST_CHECK( layoutRowsGet.GetValue(1).GetValue( "policy" ).Get().compare(layoutRows.GetValue(1).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutRowsGet.GetValue(1).GetValue( "value" ).Get(),layoutRows.GetValue(1).GetValue( "value" ).Get(), TEST_LOCATION ); // Test "layout-columns" property DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_LAYOUT_COLUMNS ) == TableView::PROPERTY_LAYOUT_COLUMNS ); @@ -639,20 +639,20 @@ int UtcDaliTableViewSetGetProperty(void) * } */ Property::Map layoutColumns; - layoutColumns.push_back( Property::StringValuePair("2", item2) ); - layoutColumns.push_back( Property::StringValuePair("3", item1) ); + layoutColumns[ "2" ] = item2; + layoutColumns[ "3" ] = item1; tableView.SetProperty( TableView::PROPERTY_LAYOUT_COLUMNS, layoutColumns ); DALI_TEST_EQUALS( tableView.GetRelativeWidth( 2u ), 0.2f, TEST_LOCATION ); DALI_TEST_EQUALS( tableView.GetFixedWidth( 3u ), 30.f, TEST_LOCATION ); Property::Map layoutColumnsGet = tableView.GetProperty(TableView::PROPERTY_LAYOUT_COLUMNS).Get(); - DALI_TEST_CHECK( layoutColumnsGet[0].first.compare(layoutColumns[0].first) == 0 ); - DALI_TEST_CHECK( layoutColumnsGet[0].second.GetValue( "policy" ).Get().compare(layoutColumns[0].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutColumnsGet[0].second.GetValue( "value" ).Get(),layoutColumns[0].second.GetValue( "value" ).Get(), TEST_LOCATION ); - DALI_TEST_CHECK( layoutColumnsGet[1].first.compare(layoutColumns[1].first) == 0 ); - DALI_TEST_CHECK( layoutColumnsGet[1].second.GetValue( "policy" ).Get().compare(layoutColumns[1].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutColumnsGet[1].second.GetValue( "value" ).Get(),layoutColumns[1].second.GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutColumnsGet.GetKey(0).compare(layoutColumns.GetKey(0)) == 0 ); + DALI_TEST_CHECK( layoutColumnsGet.GetValue(0).GetValue( "policy" ).Get().compare(layoutColumns.GetValue(0).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutColumnsGet.GetValue(0).GetValue( "value" ).Get(),layoutColumns.GetValue(0).GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutColumnsGet.GetKey(1).compare(layoutColumns.GetKey(1)) == 0 ); + DALI_TEST_CHECK( layoutColumnsGet.GetValue(1).GetValue( "policy" ).Get().compare(layoutColumns.GetValue(1).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutColumnsGet.GetValue(1).GetValue( "value" ).Get(),layoutColumns.GetValue(1).GetValue( "value" ).Get(), TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index 5cc1e0e..c58bb83 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -414,7 +414,7 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_CHECK( !control.GetBackgroundActor() ); DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION ); DALI_TEST_EQUALS( control.GetProperty( Control::PROPERTY_BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION ); - DALI_TEST_CHECK( control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().empty() ); + DALI_TEST_CHECK( control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().Empty() ); control.SetProperty( Control::PROPERTY_BACKGROUND_COLOR, Color::RED ); DALI_TEST_CHECK( control.GetBackgroundActor() ); @@ -422,9 +422,9 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_EQUALS( control.GetProperty( Control::PROPERTY_BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION ); Property::Map imageMap; - imageMap.push_back( Property::StringValuePair( "filename", "TestImage" ) ); + imageMap[ "filename" ] = "TestImage"; Property::Map map; - map.push_back( Property::StringValuePair( "image", imageMap ) ); + map[ "image" ] = imageMap; control.SetProperty( Control::PROPERTY_BACKGROUND, map ); DALI_TEST_CHECK( control.GetBackgroundActor() ); DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION ); @@ -440,7 +440,7 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_CHECK( !control.GetBackgroundActor() ); DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION ); DALI_TEST_EQUALS( control.GetProperty( Control::PROPERTY_BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION ); - DALI_TEST_CHECK( control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().empty() ); + DALI_TEST_CHECK( control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().Empty() ); END_TEST; } diff --git a/base/dali-toolkit/internal/builder/builder-impl.cpp b/base/dali-toolkit/internal/builder/builder-impl.cpp index 3f134b6..083e804 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.cpp +++ b/base/dali-toolkit/internal/builder/builder-impl.cpp @@ -167,7 +167,7 @@ std::string PropertyValueToString( const Property::Value& value ) } case Property::MAP: { - ret = std::string("Map Size=") + ToString( value.Get().size() ); + ret = std::string("Map Size=") + ToString( value.Get().Count() ); break; } case Property::TYPE_COUNT: @@ -766,7 +766,7 @@ void Builder::AddActors( const std::string §ionName, Actor toActor ) { DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded"); - PropertyValueMap overrideMap; + Property::Map overrideMap; Replacement replacements(overrideMap, mReplacementMap); OptionalChild add = IsChild(*mParser.GetRoot(), sectionName); @@ -824,13 +824,13 @@ Animation Builder::CreateAnimation( const std::string& animationName, const Repl return anim; } -Animation Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map, Dali::Actor sourceActor ) +Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor ) { Replacement replacement(map, mReplacementMap); return CreateAnimation( animationName, replacement, sourceActor); } -Animation Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map ) +Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map ) { Replacement replacement(map, mReplacementMap); return CreateAnimation( animationName, replacement, Stage::GetCurrent().GetRootLayer() ); @@ -906,12 +906,9 @@ void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::U } -void Builder::AddConstants( const PropertyValueMap& map ) +void Builder::AddConstants( const Property::Map& map ) { - for(PropertyValueMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) - { - mReplacementMap[ (*iter).first ] = (*iter).second; - } + mReplacementMap.Merge( map ); } void Builder::AddConstant( const std::string& key, const Property::Value& value ) @@ -919,17 +916,17 @@ void Builder::AddConstant( const std::string& key, const Property::Value& value mReplacementMap[key] = value; } -const PropertyValueMap& Builder::GetConstants() const +const Property::Map& Builder::GetConstants() const { return mReplacementMap; } const Property::Value& Builder::GetConstant( const std::string& key ) const { - PropertyValueMap::const_iterator iter = mReplacementMap.find( key ); - if( iter != mReplacementMap.end() ) + Property::Value* match = mReplacementMap.Find( key ); + if( match ) { - return (*iter).second; + return (*match); } else { @@ -938,7 +935,7 @@ const Property::Value& Builder::GetConstant( const std::string& key ) const } } -void Builder::LoadConstants( const TreeNode& root, PropertyValueMap& intoMap ) +void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap ) { Replacement replacer(intoMap); @@ -967,10 +964,10 @@ void Builder::LoadConstants( const TreeNode& root, PropertyValueMap& intoMap ) } #if defined(DEBUG_ENABLED) - PropertyValueMap::const_iterator iter = intoMap.find( "CONFIG_SCRIPT_LOG_LEVEL" ); - if( iter != intoMap.end() && (*iter).second.GetType() == Property::STRING ) + Property::Value* iter = intoMap.Find( "CONFIG_SCRIPT_LOG_LEVEL" ); + if( iter && iter->GetType() == Property::STRING ) { - std::string logLevel( (*iter).second.Get< std::string >() ); + std::string logLevel( iter->Get< std::string >() ); if( logLevel == "NoLogging" ) { gFilterScript->SetLogLevel( Integration::Log::NoLogging ); @@ -1016,7 +1013,7 @@ bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Re } } -BaseHandle Builder::Create( const std::string& templateName, const PropertyValueMap& map ) +BaseHandle Builder::Create( const std::string& templateName, const Property::Map& map ) { Replacement replacement( map, mReplacementMap ); return Create( templateName, replacement ); diff --git a/base/dali-toolkit/internal/builder/builder-impl.h b/base/dali-toolkit/internal/builder/builder-impl.h index e82ed93..5efb772 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.h +++ b/base/dali-toolkit/internal/builder/builder-impl.h @@ -81,7 +81,7 @@ public: /** * @copydoc Toolkit::Builder::AddConstants */ - void AddConstants( const PropertyValueMap& map ); + void AddConstants( const Property::Map& map ); /** * @copydoc Toolkit::Builder::AddConstant @@ -91,7 +91,7 @@ public: /** * @copydoc Toolkit::Builder::GetConstants */ - const PropertyValueMap& GetConstants() const; + const Property::Map& GetConstants() const; /** * @copydoc Toolkit::Builder::GetConstant @@ -104,9 +104,9 @@ public: Animation CreateAnimation( const std::string& animationName ); /** - * @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map ); + * @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName, const Property::Map& map ); */ - Animation CreateAnimation( const std::string& animationName, const PropertyValueMap& map ); + Animation CreateAnimation( const std::string& animationName, const Property::Map& map ); /** * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,Dali::Actor); @@ -114,9 +114,9 @@ public: Animation CreateAnimation( const std::string& animationName, Dali::Actor sourceActor ); /** - * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,const PropertyValueMap&,Dali::Actor); + * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,const Property::Map&, Dali::Actor); */ - Animation CreateAnimation( const std::string& animationName, const PropertyValueMap& map, Dali::Actor sourceActor ); + Animation CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor ); /** * @copydoc Toolkit::Builder::Create( const std::string& templateName ); @@ -124,9 +124,9 @@ public: BaseHandle Create( const std::string& templateName ); /** - * @copydoc Toolkit::Builder::Create( const std::string& templateName, const PropertyValueMap& map ); + * @copydoc Toolkit::Builder::Create( const std::string& templateName, const Property::Map& map ); */ - BaseHandle Create( const std::string& templateName, const PropertyValueMap& map ); + BaseHandle Create( const std::string& templateName, const Property::Map& map ); /** * @copydoc Toolkit::Builder::CreateFromJson( const std::string& json ); @@ -210,13 +210,13 @@ private: SlotDelegate mSlotDelegate; - PropertyValueMap mReplacementMap; + Property::Map mReplacementMap; BaseHandle Create( const std::string& templateName, const Replacement& constant ); BaseHandle DoCreate( const TreeNode& root, const TreeNode& node, Actor parent, const Replacement& replacements ); - void LoadConstants( const TreeNode& root, PropertyValueMap& intoMap ); + void LoadConstants( const TreeNode& root, Property::Map& intoMap ); void LoadIncludes( const std::string& data ); diff --git a/base/dali-toolkit/internal/builder/replacement.cpp b/base/dali-toolkit/internal/builder/replacement.cpp index 259cb87..7dc7818 100644 --- a/base/dali-toolkit/internal/builder/replacement.cpp +++ b/base/dali-toolkit/internal/builder/replacement.cpp @@ -32,31 +32,16 @@ namespace Internal namespace // anon { -PropertyValueMap::const_iterator FindReplacement( const std::string &str, - const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap ) +Property::Value* FindReplacement( const std::string &str, const Property::Map& overrideMap, const Property::Map& defaultMap ) { - PropertyValueMap::const_iterator ret = defaultMap.end(); + Property::Value* ret = overrideMap.Find( str ); - PropertyValueMap::const_iterator iter = overrideMap.find( str ); - - if( iter != overrideMap.end() ) - { - ret = iter; - } - else + if ( !ret ) { - PropertyValueMap::const_iterator iter = defaultMap.find( str ); + ret = defaultMap.Find( str ); - if( iter != defaultMap.end() ) - { - ret = iter; - } - else - { - // @ todo - // try localized text ie dgettext. Look for colon {DOMAIN:TEXT} {LC_MESSAGE:ID_XXXX} - - } + // @ todo + // try localized text ie dgettext. Look for colon {DOMAIN:TEXT} {LC_MESSAGE:ID_XXXX} } return ret; @@ -114,7 +99,7 @@ bool GetSubstitutionPosition( const std::string &initialValue, std::size_t &star } bool ResolvePartialReplacement( const std::string &initialValue, Property::Value &out, - const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap ) + const Property::Map& overrideMap, const Property::Map& defaultMap ) { if( initialValue.size() >= 2 ) @@ -135,15 +120,15 @@ bool ResolvePartialReplacement( const std::string &initialValue, Property::Value { const std::string str( initialValue.substr( startPos, size ) ); - PropertyValueMap::const_iterator iter = FindReplacement( str, overrideMap, defaultMap ); + Property::Value* value = FindReplacement( str, overrideMap, defaultMap ); - if( iter == defaultMap.end() ) + if( !value ) { DALI_SCRIPT_WARNING( "Cannot find replacement for '%s'\n", str.c_str() ); } else { - if( Property::STRING != (*iter).second.GetType() ) + if( Property::STRING != value->GetType() ) { DALI_SCRIPT_WARNING( "Cannot replace substring in non string property type='%s'. Initial value '%s'\n", PropertyTypes::GetName( out.GetType() ), initialValue.c_str() ); @@ -152,7 +137,7 @@ bool ResolvePartialReplacement( const std::string &initialValue, Property::Value { std::string newString = \ initialValue.substr(0, startPos - 1) + - (*iter).second.Get() + + value->Get< std::string >() + initialValue.substr( startPos + size + 1 ); return ResolvePartialReplacement( newString, out, overrideMap, defaultMap ); @@ -168,7 +153,7 @@ bool ResolvePartialReplacement( const std::string &initialValue, Property::Value } // namespace anon -Replacement::Replacement( const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap ) +Replacement::Replacement( const Property::Map& overrideMap, const Property::Map& defaultMap ) : mOverrideMap( &overrideMap ), mDefaultMap( &defaultMap ) { @@ -176,10 +161,10 @@ Replacement::Replacement( const PropertyValueMap& overrideMap, const PropertyVal namespace { -PropertyValueMap noMap; +Property::Map noMap; } -Replacement::Replacement( const PropertyValueMap& defaultMap ) +Replacement::Replacement( const Property::Map& defaultMap ) : mOverrideMap( &noMap ), mDefaultMap( &defaultMap ) { @@ -195,7 +180,7 @@ OptionalString Replacement::HasFullReplacement( const TreeNode & node ) const { OptionalString ret; - if( node.HasSubstitution() && ((*mOverrideMap).size() || (*mDefaultMap).size()) ) + if( node.HasSubstitution() && ((*mOverrideMap).Count() || (*mDefaultMap).Count()) ) { OptionalString v = ::IsString( node ); if( v ) @@ -216,15 +201,15 @@ Property::Value Replacement::GetFullReplacement( const std::string& replacementS DALI_ASSERT_DEBUG( mOverrideMap && "missing map"); DALI_ASSERT_DEBUG( mDefaultMap && "missing map"); - PropertyValueMap::const_iterator iter = FindReplacement( replacementString, *mOverrideMap, *mDefaultMap ); + Property::Value* value = FindReplacement( replacementString, *mOverrideMap, *mDefaultMap ); - if( iter == (*mDefaultMap).end() ) + if( !value ) { DALI_SCRIPT_WARNING("Cannot find replacement for '%s'\n", replacementString.c_str()); } else { - out = (*iter).second; + out = *value; #if defined(DEBUG_ENABLED) DALI_SCRIPT_VERBOSE(" Full replacement for '%s' => to Type '%s'\n", replacementString.c_str(), @@ -265,45 +250,6 @@ OptionalBoolean Replacement::IsBoolean( OptionalChild child ) const } } -// template (*ISTYPE)( const TreeNode& node ), Property::Type TYPE> -// OptionalValue IsOfType( const TreeNode& node, const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap ) -// { -// OptionalValue ret; -// if( OptionalString replace = HasFullReplacement( node, overrideMap, defaultMap ) ) -// { -// Property::Value value = GetFullReplacement( *replace, overrideMap, defaultMap ); -// if( TYPE == value.GetType() ) -// { -// ret = value.Get(); -// } -// } -// else -// { -// ret = ISTYPE( node ); -// } -// return ret; - -// } - -// OptionalFloat Replacement::IsFloat( const TreeNode & node ) const -// { -// return IsOfType( node, *mOverrideMap, *mDefaultMap ); -// /* OptionalFloat ret; */ -// /* if( OptionalString replace = HasFullReplacement( node ) ) */ -// /* { */ -// /* Property::Value value = GetFullReplacement( replace ); */ -// /* if( Property::FLOAT == value.GetType() ) */ -// /* { */ -// /* ret = value.Get(); */ -// /* } */ -// /* } */ -// /* else */ -// /* { */ -// /* ret = IsFloat( node ); */ -// /* } */ -// /* return ret; */ -// } - OptionalFloat Replacement::IsFloat( const TreeNode & node ) const { OptionalFloat ret; @@ -329,7 +275,7 @@ OptionalString Replacement::IsString( const TreeNode& node ) const DALI_ASSERT_DEBUG( mOverrideMap && "missing map"); DALI_ASSERT_DEBUG( mDefaultMap && "missing map"); - if( node.HasSubstitution() && ((*mOverrideMap).size() || (*mDefaultMap).size()) ) + if( node.HasSubstitution() && ((*mOverrideMap).Count() || (*mDefaultMap).Count()) ) { if( OptionalString v = ::IsString( node ) ) { diff --git a/base/dali-toolkit/internal/builder/replacement.h b/base/dali-toolkit/internal/builder/replacement.h index 71e55d0..0b54942 100644 --- a/base/dali-toolkit/internal/builder/replacement.h +++ b/base/dali-toolkit/internal/builder/replacement.h @@ -56,7 +56,7 @@ public: * @param overrideMap The user overriding map * @param defaultMap The default map to use */ - Replacement( const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap ); + Replacement( const Property::Map& overrideMap, const Property::Map& defaultMap ); /* * Constructor with default map @@ -64,7 +64,7 @@ public: * Make a deep copy of the tree. * @param overrideMap The user overriding map */ - Replacement( const PropertyValueMap& defaultMap ); + Replacement( const Property::Map& defaultMap ); /* @brief Check node for a type * @@ -229,10 +229,10 @@ public: private: // Overriding map (overrides the default map). The map is not owned. - const PropertyValueMap* const mOverrideMap; + const Property::Map* const mOverrideMap; - // Defautl map. The map is not owned. - const PropertyValueMap* const mDefaultMap; + // Default map. The map is not owned. + const Property::Map* const mDefaultMap; // compiler // Replacement & operation=( Replacement& replacement ); diff --git a/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index 7aca7ff..3baf1de 100644 --- a/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -20,14 +20,16 @@ // EXTERNAL INCLUDES #include +#include +#include // INTERNAL INCLUDES -#include #include #include #include -using namespace std; +using std::string; +using std::set; using namespace Dali; namespace // unnamed namespace @@ -719,18 +721,16 @@ void ItemView::InsertItems( const ItemContainer& newItems, float durationSeconds mAddingItems = true; // Insert from lowest id to highest - set sortedItems; + std::set sortedItems; for( ConstItemIter iter = newItems.begin(); newItems.end() != iter; ++iter ) { sortedItems.insert( *iter ); } - for( set::iterator iter = sortedItems.begin(); sortedItems.end() != iter; ++iter ) + for( std::set::iterator iter = sortedItems.begin(); sortedItems.end() != iter; ++iter ) { Self().Add( iter->second ); - cout << "inserting item: " << iter->first << endl; - ItemPoolIter foundIter = mItemPool.find( iter->first ); if( mItemPool.end() != foundIter ) { @@ -898,7 +898,7 @@ void ItemView::RemoveActorsOutsideRange( ItemRange range ) void ItemView::AddActorsWithinRange( ItemRange range, float durationSeconds ) { - range.end = min(mItemFactory.GetNumberOfItems(), range.end); + range.end = std::min(mItemFactory.GetNumberOfItems(), range.end); // The order of addition depends on the scroll direction. if (mRefreshOrderHint) @@ -1099,7 +1099,7 @@ float ItemView::ClampFirstItemPosition(float targetPosition, const Vector3& targ { Actor self = Self(); float minLayoutPosition = layout.GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), targetSize); - float clamppedPosition = min(0.0f, max(minLayoutPosition, targetPosition)); + float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, targetPosition)); mScrollOvershoot = targetPosition - clamppedPosition; self.SetProperty(mPropertyMinimumLayoutPosition, minLayoutPosition); @@ -1146,7 +1146,7 @@ void ItemView::OnPan(PanGesture gesture) RemoveAnimation(mScrollAnimation); - float flickAnimationDuration = Clamp( mActiveLayout->GetItemFlickAnimationDuration() * max(1.0f, fabsf(firstItemScrollPosition - GetCurrentLayoutPosition(0))) + float flickAnimationDuration = Clamp( mActiveLayout->GetItemFlickAnimationDuration() * std::max(1.0f, fabsf(firstItemScrollPosition - GetCurrentLayoutPosition(0))) , DEFAULT_MINIMUM_SWIPE_DURATION, DEFAULT_MAXIMUM_SWIPE_DURATION); mScrollAnimation = Animation::New(flickAnimationDuration); @@ -1570,7 +1570,7 @@ float ItemView::CalculateScrollOvershoot() float positionDelta = GetCurrentLayoutPosition(0) + scrollDistance; float minLayoutPosition = mActiveLayout->GetMinimumLayoutPosition(mItemFactory.GetNumberOfItems(), Self().GetCurrentSize()); self.SetProperty(mPropertyMinimumLayoutPosition, minLayoutPosition); - float clamppedPosition = min(0.0f, max(minLayoutPosition, positionDelta)); + float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, positionDelta)); overshoot = positionDelta - clamppedPosition; } diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index ff6fbb9..1d3b7b1 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -1208,10 +1208,10 @@ Vector3 ScrollView::GetDomainSize() const void ScrollView::TransformTo(const Vector3& position, DirectionBias horizontalBias, DirectionBias verticalBias) { - TransformTo(position, mSnapDuration, horizontalBias, verticalBias); + TransformTo(position, mSnapDuration, mSnapAlphaFunction, horizontalBias, verticalBias); } -void ScrollView::TransformTo(const Vector3& position, float duration, +void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias) { Actor self( Self() ); @@ -1254,7 +1254,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, mScrollStartedSignalV2.Emit( currentScrollPosition ); bool animating = AnimateTo(-position, Vector3::ONE * duration, - mSnapAlphaFunction, + alpha, true, horizontalBias, verticalBias, @@ -1290,13 +1290,22 @@ void ScrollView::ScrollTo(const Vector3& position, float duration) ScrollTo(position, duration, DirectionBiasNone, DirectionBiasNone); } +void ScrollView::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha) +{ + ScrollTo(position, duration, alpha, DirectionBiasNone, DirectionBiasNone); +} + void ScrollView::ScrollTo(const Vector3& position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias) { - DALI_LOG_SCROLL_STATE("[0x%X] position[%.2f, %.2f] duration[%.2f]", - this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); + ScrollTo(position, duration, mSnapAlphaFunction, horizontalBias, verticalBias); +} - TransformTo(position, duration, horizontalBias, verticalBias); +void ScrollView::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha, + DirectionBias horizontalBias, DirectionBias verticalBias) +{ + DALI_LOG_SCROLL_STATE("[0x%X] position[%.2f, %.2f] duration[%.2f]", this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); + TransformTo(position, duration, alpha, horizontalBias, verticalBias); } void ScrollView::ScrollTo(unsigned int page) diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h index 5f2569d..ad55741 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h @@ -366,9 +366,9 @@ public: DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone); /** - * @copydoc ScrollTo(const Vector3&, float, DirectionBias, DirectionBias) + * @copydoc ScrollTo(const Vector3&, float, AlhpaFunction, DirectionBias, DirectionBias) */ - void TransformTo(const Vector3& position, float duration, + void TransformTo(const Vector3& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone); /** @@ -382,12 +382,23 @@ public: void ScrollTo(const Vector3& position, float duration); /** + * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha) + */ + void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha); + + /** * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias) */ void ScrollTo(const Vector3& position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias); /** + * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias) + */ + void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha, + DirectionBias horizontalBias, DirectionBias verticalBias); + + /** * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page) */ void ScrollTo(unsigned int page); diff --git a/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.h b/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.h index a536a51..43959fd 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.h +++ b/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.h @@ -18,9 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include +// INTERNAL INCLUDES #include #include #include diff --git a/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index 7a60aa6..ef2935d 100644 --- a/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -1160,13 +1160,14 @@ void TableView::SetHeightOrWidthProperty(TableView& tableViewImpl, if( Property::MAP == value.GetType() ) { Property::Map map = value.Get(); - unsigned int rowIndex; - for( Property::Map::const_iterator iter = map.begin(); iter != map.end(); iter++) + unsigned int rowIndex(0); + for ( unsigned int i = 0, count = map.Count(); i < count; ++i ) { - if( istringstream(iter->first) >> rowIndex // the key is a number - && Property::MAP == (iter->second).GetType()) + Property::Value& item = map.GetValue(i); + + if( istringstream(map.GetKey(i)) >> rowIndex // the key is a number + && Property::MAP == item.GetType()) { - Property::Value item = iter->second; if( item.HasKey( "policy" ) && item.HasKey( "value" ) ) { Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ); @@ -1212,19 +1213,19 @@ void TableView::GetMapPropertyValue( const std::vector& fixedSize, const { Property::StringValuePair valuePair( "value", fixedSize[index] ); Property::Map item; - item.push_back( fixedPolicyPair ); - item.push_back( valuePair ); + item[ fixedPolicyPair.first ] = fixedPolicyPair.second; + item[ valuePair.first ] = valuePair.second; - map.push_back( Property::StringValuePair( static_cast( &(std::ostringstream() << index ) )->str(), item ) ); + map[ static_cast( &(std::ostringstream() << index ) )->str() ] = item; } else if( ! EqualsZero( relativeSize[index] ) ) { Property::StringValuePair valuePair( "value", relativeSize[index] ); Property::Map item; - item.push_back( relativePolicyPair ); - item.push_back( valuePair ); + item[ relativePolicyPair.first ] = relativePolicyPair.second; + item[ valuePair.first ] = valuePair.second; - map.push_back( Property::StringValuePair( static_cast( &(std::ostringstream() << index ) )->str(), item ) ); + map[ static_cast( &(std::ostringstream() << index ) )->str() ] = item; } } } diff --git a/base/dali-toolkit/internal/focus-manager/focus-manager-impl.h b/base/dali-toolkit/internal/focus-manager/focus-manager-impl.h index c64d490..e56df59 100644 --- a/base/dali-toolkit/internal/focus-manager/focus-manager-impl.h +++ b/base/dali-toolkit/internal/focus-manager/focus-manager-impl.h @@ -20,9 +20,10 @@ // EXTERNAL INCLUDES #include +#include +#include // INTERNAL INCLUDES -#include #include namespace Dali diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.cpp b/base/dali-toolkit/internal/styling/style-manager-impl.cpp index acf1ced..9e5b6a1 100644 --- a/base/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/base/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include // EXTERNAL INCLUDES @@ -74,18 +73,6 @@ BaseHandle Create() } TypeRegistration STYLE_MANAGER_TYPE( typeid(Dali::Toolkit::StyleManager), typeid(Dali::BaseHandle), Create, true /* Create instance at startup */ ); -/** - * Merge two maps into one - */ -void MergeMaps( const PropertyValueMap& a, const PropertyValueMap& b, PropertyValueMap& out ) -{ - out = a; - for( PropertyValueMap::const_iterator it = b.begin(), itEnd = b.end(); it != itEnd; ++it ) - { - out[ it->first ] = it->second; - } -} - } // namespace Toolkit::StyleManager StyleManager::Get() @@ -108,8 +95,7 @@ Toolkit::StyleManager StyleManager::Get() } StyleManager::StyleManager() - : mOrientationDegrees( 0 ), // Portrait - mSetThemeConnection( false ) + : mOrientationDegrees( 0 ) // Portrait { // Add theme builder constants mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH; @@ -125,16 +111,17 @@ StyleManager::StyleManager() StyleManager::~StyleManager() { - // Disconnect from signal - SetOrientation( Orientation() ); } void StyleManager::SetOrientationValue( int orientation ) { - mOrientationDegrees = orientation; - - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; + if( orientation != mOrientationDegrees ) + { + mOrientationDegrees = orientation; + // TODO: if orientation changed, apply the new style to all controls + // dont want to really do the whole load from file again if the bundle contains both portrait & landscape + SetTheme(); + } } int StyleManager::GetOrientationValue() @@ -169,10 +156,10 @@ void StyleManager::SetStyleConstant( const std::string& key, const Property::Val bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& valueOut ) { - Toolkit::PropertyValueMap::iterator valueIt = mStyleBuilderConstants.find( key ); - if( valueIt != mStyleBuilderConstants.end() ) + Property::Value* value = mStyleBuilderConstants.Find( key ); + if( value ) { - valueOut = valueIt->second; + valueOut = *value; return true; } @@ -182,15 +169,12 @@ bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& va void StyleManager::OnOrientationChanged( Orientation orientation ) { mOrientation = orientation; - - if( mOrientation ) - { - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; - } + // TODO: if orientation changed, apply the new style to all controls + // dont want to really do the whole load from file again if the bundle contains both portrait & landscape + SetTheme(); } -Toolkit::Builder StyleManager::CreateBuilder( const PropertyValueMap& constants ) +Toolkit::Builder StyleManager::CreateBuilder( const Property::Map& constants ) { Toolkit::Builder builder = Toolkit::Builder::New(); builder.AddConstants( constants ); @@ -301,8 +285,8 @@ void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& json else { // Merge theme and style constants - PropertyValueMap constants; - MergeMaps( mThemeBuilderConstants, mStyleBuilderConstants, constants ); + Property::Map constants( mThemeBuilderConstants ); + constants.Merge( mStyleBuilderConstants ); // Create it builder = CreateBuilder( constants ); @@ -350,8 +334,8 @@ void StyleManager::RequestThemeChange( const std::string& themeFile ) { mThemeFile = themeFile; - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; + // need to do style change synchronously as app might create a UI control on the next line + SetTheme(); } void StyleManager::RequestDefaultTheme() @@ -359,18 +343,11 @@ void StyleManager::RequestDefaultTheme() RequestThemeChange( DEFAULT_THEME ); } -bool StyleManager::IsThemeRequestPending() -{ - return mSetThemeConnection; -} - void StyleManager::SetTheme() { mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); LoadJSON( mThemeBuilder, mThemeFile ); - mSetThemeConnection = false; - StyleChange change; change.themeChange = true; mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), change ); diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.h b/base/dali-toolkit/internal/styling/style-manager-impl.h index d8d97b4..09a6d93 100644 --- a/base/dali-toolkit/internal/styling/style-manager-impl.h +++ b/base/dali-toolkit/internal/styling/style-manager-impl.h @@ -20,9 +20,9 @@ // EXTERNAL INCLUDES #include #include +#include // INTERNAL INCLUDES - #include #include #include @@ -155,7 +155,7 @@ private: * * @return Return the newly created builder */ - Toolkit::Builder CreateBuilder( const PropertyValueMap& constants ); + Toolkit::Builder CreateBuilder( const Property::Map& constants ); /** * @brief Load a JSON file into given builder @@ -240,13 +240,11 @@ private: std::string mThemeFile; ///< The full path of the current theme file - Toolkit::PropertyValueMap mThemeBuilderConstants; ///< Contants to give the theme builder - Toolkit::PropertyValueMap mStyleBuilderConstants; ///< Constants specific to building styles + Property::Map mThemeBuilderConstants; ///< Contants to give the theme builder + Property::Map mStyleBuilderConstants; ///< Constants specific to building styles BuilderMap mBuilderCache; ///< Cache of builders keyed by JSON file name - bool mSetThemeConnection; ///< Has the callback to set the theme been set - // Signals Toolkit::StyleManager::StyleChangeSignalType mStyleChangeSignal; ///< Emitted when the style( theme/font ) changes }; diff --git a/base/dali-toolkit/internal/styling/util.h b/base/dali-toolkit/internal/styling/util.h deleted file mode 100644 index c00c136..0000000 --- a/base/dali-toolkit/internal/styling/util.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_UTIL_H__ -#define __DALI_TOOLKIT_INTERNAL_UTIL_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES - -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace Util -{ - -/** - * @brief Callback that the EventProcessingFinishedSignal signal calls - * - * Priorities calls to managers - */ -inline void EventProcessingFinishedSignalPrioritizer() -{ - // Priority 0: Set all styles - Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); - if( GetImpl(styleManager).IsThemeRequestPending() ) - { - GetImpl(styleManager).SetTheme(); - } - - // Todo: Priority 1: Do relayout after styles have been set -} - -/** - * @brief Connect to the EventProcessingFinishedSignal - * - * Needs to be called only once, but will still operate successfully if called multiple times. - * Makes the assumption that this is the only thing connecting to the EventProcessingFinishedSignal. - */ -inline void ConnectEventProcessingFinishedSignal() -{ - Stage stage = Stage::GetCurrent(); - - // This is only intended for one purpose! - if( stage.EventProcessingFinishedSignal().GetConnectionCount() == 0 ) - { - stage.EventProcessingFinishedSignal().Connect( &EventProcessingFinishedSignalPrioritizer ); - } -} - -} // namespace Util - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__ - diff --git a/base/dali-toolkit/public-api/builder/builder.cpp b/base/dali-toolkit/public-api/builder/builder.cpp index fbf4223..3f531a3 100644 --- a/base/dali-toolkit/public-api/builder/builder.cpp +++ b/base/dali-toolkit/public-api/builder/builder.cpp @@ -54,7 +54,7 @@ void Builder::LoadFromString( const std::string &data, UIFormat rep ) GetImpl(*this).LoadFromString( data ); } -void Builder::AddConstants( const PropertyValueMap& map ) +void Builder::AddConstants( const Property::Map& map ) { GetImpl(*this).AddConstants( map ); } @@ -64,7 +64,7 @@ void Builder::AddConstant( const std::string& key, const Property::Value& value GetImpl(*this).AddConstant( key, value ); } -const PropertyValueMap& Builder::GetConstants() const +const Property::Map& Builder::GetConstants() const { return GetImpl(*this).GetConstants(); } @@ -79,7 +79,7 @@ Animation Builder::CreateAnimation( const std::string& animationName ) return GetImpl(*this).CreateAnimation( animationName ); } -Animation Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map ) +Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map ) { return GetImpl(*this).CreateAnimation( animationName, map ); } @@ -89,7 +89,7 @@ Animation Builder::CreateAnimation( const std::string& animationName, Dali::Acto return GetImpl(*this).CreateAnimation( animationName, sourceActor ); } -Animation Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map, Dali::Actor sourceActor ) +Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor ) { return GetImpl(*this).CreateAnimation( animationName, map, sourceActor ); } @@ -99,7 +99,7 @@ BaseHandle Builder::Create( const std::string& templateName ) return GetImpl(*this).Create( templateName ); } -BaseHandle Builder::Create( const std::string& templateName, const PropertyValueMap& map ) +BaseHandle Builder::Create( const std::string& templateName, const Property::Map& map ) { return GetImpl(*this).Create( templateName, map ); } diff --git a/base/dali-toolkit/public-api/builder/builder.h b/base/dali-toolkit/public-api/builder/builder.h index b0db57e..d703749 100644 --- a/base/dali-toolkit/public-api/builder/builder.h +++ b/base/dali-toolkit/public-api/builder/builder.h @@ -18,7 +18,7 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include namespace Dali DALI_IMPORT_API @@ -32,8 +32,6 @@ namespace Internal DALI_INTERNAL class Builder; } -typedef std::map PropertyValueMap; - /** * This class provides the ability to load and style an actor tree from a string representation. * @@ -161,14 +159,14 @@ class Builder : public BaseHandle * @brief Adds user defined constants to all future style template or animation expansions * * e.g. - * PropertyValueMap map; + * Property::Map map; * map["IMAGE_DIRECTORY"] = "/usr/share/images"; * builder.AddConstants( map ); * * @pre The Builder has been initialized. * @param map The user defined constants used in template expansions. */ - void AddConstants( const PropertyValueMap& map ); + void AddConstants( const Property::Map& map ); /** * @brief Adds or modifies a user defined constant to all future style template or animation expansions @@ -189,7 +187,7 @@ class Builder : public BaseHandle * * e.g. * @code - * PropertyValueMap map = builder.GetConstants(); // get copy of current constants + * Property::Map map = builder.GetConstants(); // get copy of current constants * map["IMAGE_DIRECTORY"] = "/usr/share/images"; // make modification * builder.AddConstants( map ); // write back changes * @endcode @@ -197,14 +195,14 @@ class Builder : public BaseHandle * @pre The Builder has been initialized. * @return A reference to the currently defined constants. */ - const PropertyValueMap& GetConstants() const; + const Property::Map& GetConstants() const; /** * @brief Gets a currently defined constant, or returns Property::INVALID * * e.g. * @code - * PropertyValueMap map = builder.GetConstants(); // get copy of current constants + * Property::Map map = builder.GetConstants(); // get copy of current constants * map["IMAGE_DIRECTORY"] = "/usr/share/images"; // make modification * builder.AddConstants( map ); // write back changes * @endcode @@ -231,7 +229,7 @@ class Builder : public BaseHandle * @brief Creates an animation from the set of known animations with user defined constants * * e.g. - * PropertyValueMap map; + * Property::Map map; * map["ACTOR"] = actor.GetName(); // replaces '{ACTOR} in the template * Animation a = builder.CreateAnimation( "wobble"); * @@ -243,7 +241,7 @@ class Builder : public BaseHandle * @param map The user defined constants used in style template expansion. * @returns The base handle of the created object */ - Animation CreateAnimation( const std::string& animationName, const PropertyValueMap& map ); + Animation CreateAnimation( const std::string& animationName, const Property::Map& map ); /** * @brief Creates an animation from the set of known animations. @@ -267,7 +265,7 @@ class Builder : public BaseHandle * * The animation is applied to a specific actor. * e.g. - * PropertyValueMap map; + * Property::Map map; * map["ACTOR"] = actor.GetName(); // replaces '{ACTOR} in the template * Actor myInstance = builder.Create( "template-actor-tree" ) * Animation a = builder.CreateAnimation( "wobble", myInstance); @@ -281,7 +279,7 @@ class Builder : public BaseHandle * @param sourceActor The starting point in an actor tree, from which to look for property owners * @returns The base handle of the created object */ - Animation CreateAnimation( const std::string& animationName, const PropertyValueMap& map, Dali::Actor sourceActor ); + Animation CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor ); /** * @brief Creates an object (e.g. an actor) from the set of known style templates @@ -302,7 +300,7 @@ class Builder : public BaseHandle * @brief Creates an object from the style templates with user defined constants * * e.g. - * PropertyValueMap map; + * Property::Map map; * map["IMAGE_DIR"] = "/usr/share/images"; // replaces '{IMAGE_DIR} in the template * mActor.Add( Actor::DownCast(builder.Create( "default-image", map) ) ); * @@ -314,7 +312,7 @@ class Builder : public BaseHandle * @param map The user defined constants used in template expansion. * @returns The base handle of the created object */ - BaseHandle Create( const std::string& templateName, const PropertyValueMap& map ); + BaseHandle Create( const std::string& templateName, const Property::Map& map ); /** * @brief Creates an object (e.g. an actor) from given json snippet diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index c7b03dc..35f68c4 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -336,7 +336,7 @@ public: controlImpl.SetBackground( image ); } } - else if ( value.Get< Property::Map >().empty() ) + else if ( value.Get< Property::Map >().Empty() ) { // An empty map means the background is no longer required controlImpl.ClearBackground(); @@ -421,7 +421,7 @@ public: Image image = imageActor.GetImage(); Property::Map imageMap; Scripting::CreatePropertyMap( image, imageMap ); - map.push_back( Property::StringValuePair( "image", imageMap ) ); + map[ "image" ] = imageMap; } } diff --git a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h index 372e3c3..1b835e3 100755 --- a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h +++ b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h @@ -18,8 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include + +// INTERNAL INCLUDES #include namespace Dali DALI_IMPORT_API diff --git a/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h b/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h index b8133ed..f4e6eb5 100755 --- a/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h +++ b/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h @@ -26,9 +26,9 @@ Note:This layout is customized for music player application, so there are some l // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES -#include #include namespace Dali DALI_IMPORT_API diff --git a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h index 72f54e6..e695726 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h +++ b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h @@ -18,8 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include + +// INTERNAL INCLUDES #include #include diff --git a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h index ef38209..e4ae17a 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h +++ b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h @@ -20,7 +20,8 @@ // EXTERNAL INCLUDES #include // std::pair -#include +#include +#include namespace Dali DALI_IMPORT_API { diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h index c4dca02..62fa417 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h @@ -18,8 +18,9 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include namespace Dali DALI_IMPORT_API { diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp index 30e95d0..5007fdc 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp @@ -541,12 +541,23 @@ void ScrollView::ScrollTo(const Vector3 &position, float duration) GetImpl(*this).ScrollTo(position, duration); } +void ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha) +{ + GetImpl(*this).ScrollTo(position, duration, alpha); +} + void ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias) { GetImpl(*this).ScrollTo(position, duration, horizontalBias, verticalBias); } +void ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, + DirectionBias horizontalBias, DirectionBias verticalBias) +{ + GetImpl(*this).ScrollTo(position, duration, alpha, horizontalBias, verticalBias); +} + void ScrollView::ScrollTo(unsigned int page) { GetImpl(*this).ScrollTo(page); diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h index e09c8ed..5c04e61 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h @@ -906,6 +906,21 @@ public: void ScrollTo(const Vector3 &position, float duration); /** + * @brief Scrolls View to position specified (contents will scroll to this position) + * + * Position 0,0 is the origin. Increasing X scrolls contents left, while + * increasing Y scrolls contents up. + * - If Rulers have been applied to the axes, then the contents will scroll until + * reaching the domain boundary. + * @note Contents will not snap to ruler snap points. + * + * @param[in] position The position to scroll to. + * @param[in] duration The duration of the animation in seconds + * @param[in] alpha The alpha function to use + */ + void ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha); + + /** * @brief Scrolls View to position specified (contents will scroll to this position). * * Position 0,0 is the origin. Increasing X scrolls contents left, while @@ -926,6 +941,27 @@ public: DirectionBias horizontalBias, DirectionBias verticalBias); /** + * @brief Scrolls View to position specified (contents will scroll to this position) + * + * Position 0,0 is the origin. Increasing X scrolls contents left, while + * increasing Y scrolls contents up. + * - If Rulers have been applied to the axes, then the contents will scroll until + * reaching the domain boundary. + * @note Contents will not snap to ruler snap points. + * Biasing parameters are provided such that in scenarios with 2 or 2x2 pages in + * wrap mode, the application developer can decide whether to scroll left or right + * to get to the target page + * + * @param[in] position The position to scroll to. + * @param[in] duration The duration of the animation in seconds + * @param[in] horizontalBias Whether to bias scrolling to left or right. + * @param[in] verticalBias Whether to bias scrolling to top or bottom. + * @param[in] alpha Alpha function to use + */ + void ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, + DirectionBias horizontalBias, DirectionBias verticalBias); + + /** * @brief Scrolls View to page currently based on assumption that each page is * "(page) * ScrollViewSize.width, 0". * diff --git a/base/dali-toolkit/public-api/controls/table-view/table-view.h b/base/dali-toolkit/public-api/controls/table-view/table-view.h index 9051045..b5cad9f 100644 --- a/base/dali-toolkit/public-api/controls/table-view/table-view.h +++ b/base/dali-toolkit/public-api/controls/table-view/table-view.h @@ -18,8 +18,10 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES -#include #include namespace Dali DALI_IMPORT_API diff --git a/base/dali-toolkit/public-api/markup-processor/markup-processor.h b/base/dali-toolkit/public-api/markup-processor/markup-processor.h index e162620..5400599 100644 --- a/base/dali-toolkit/public-api/markup-processor/markup-processor.h +++ b/base/dali-toolkit/public-api/markup-processor/markup-processor.h @@ -18,9 +18,8 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include - #include #include diff --git a/optional/dali-toolkit/internal/controls/image-view/image-view-impl.h b/optional/dali-toolkit/internal/controls/image-view/image-view-impl.h index 2eebaa0..4bef6dd 100644 --- a/optional/dali-toolkit/internal/controls/image-view/image-view-impl.h +++ b/optional/dali-toolkit/internal/controls/image-view/image-view-impl.h @@ -18,8 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include + +// INTERNAL INCLUDES #include #include diff --git a/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h b/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h index 2e3f856..d438a64 100644 --- a/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h +++ b/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h @@ -18,8 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include + +// INTERNAL INCLUDES #include #include #include diff --git a/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.h b/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.h index 8f03f8c..db2ea12 100644 --- a/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.h +++ b/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.h @@ -18,7 +18,9 @@ * */ +// EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include diff --git a/optional/dali-toolkit/internal/controls/view/view-impl.h b/optional/dali-toolkit/internal/controls/view/view-impl.h index 3531149..447bbaf 100644 --- a/optional/dali-toolkit/internal/controls/view/view-impl.h +++ b/optional/dali-toolkit/internal/controls/view/view-impl.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include diff --git a/optional/dali-toolkit/public-api/controls/navigation-frame/page.h b/optional/dali-toolkit/public-api/controls/navigation-frame/page.h index af0f17d..1032a2e 100644 --- a/optional/dali-toolkit/public-api/controls/navigation-frame/page.h +++ b/optional/dali-toolkit/public-api/controls/navigation-frame/page.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include diff --git a/optional/dali-toolkit/public-api/dali-toolkit-version.cpp b/optional/dali-toolkit/public-api/dali-toolkit-version.cpp index d010941..09baeb4 100644 --- a/optional/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/optional/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 13; +const unsigned int TOOLKIT_MICRO_VERSION = 14; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 472ca41..d65f823 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.0.13 +Version: 1.0.14 Release: 1 Group: System/Libraries License: Apache-2.0