From 00e724f08a9b35b7c80efd2894016ccc7d71f6ab Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Mon, 11 Sep 2017 15:04:33 +0900 Subject: [PATCH] Revert "[Tizen] Modified Layout direction property" This reverts commit b54a0a615fd52dd9317ea54542ba6add1f6ef8d5. Change-Id: Id3c3a7c7c73e0ebffbc16d45c5cab3704681a149 --- automated-tests/src/dali/utc-Dali-Actor.cpp | 15 +++-------- dali/devel-api/actors/actor-devel.h | 8 +++--- dali/internal/event/actors/actor-impl.cpp | 41 +++++++++-------------------- dali/internal/event/actors/actor-impl.h | 14 +--------- 4 files changed, 21 insertions(+), 57 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index ca98cef..98a6362 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -6163,16 +6163,11 @@ int UtcDaliActorLayoutDirectionProperty(void) actor1.Add( actor2 ); gLayoutDirectionType = DevelActor::LayoutDirection::LTR; DevelActor::LayoutDirectionChangedSignal( actor2 ).Connect( LayoutDirectionChanged ); - - DALI_TEST_EQUALS( actor1.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); actor1.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::RTL ); - DALI_TEST_EQUALS( actor1.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); - DALI_TEST_EQUALS( actor1.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION ); DALI_TEST_EQUALS( actor2.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION ); DALI_TEST_EQUALS( gLayoutDirectionType, DevelActor::LayoutDirection::RTL, TEST_LOCATION ); - actor1.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, true ); actor0.Add( actor1 ); DALI_TEST_EQUALS( actor1.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION ); DALI_TEST_EQUALS( actor2.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION ); @@ -6187,9 +6182,9 @@ int UtcDaliActorLayoutDirectionProperty(void) actor3.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" ); actor5.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::LTR ); - DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION ); - actor8.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, false ); - DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION ); + DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ), true, TEST_LOCATION ); + actor8.SetProperty( DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE, false ); + DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ), false, TEST_LOCATION ); actor7.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" ); @@ -6210,9 +6205,5 @@ int UtcDaliActorLayoutDirectionProperty(void) DALI_TEST_EQUALS( actor8.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION ); DALI_TEST_EQUALS( actor9.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION ); - actor8.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, true ); - DALI_TEST_EQUALS( actor8.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION ); - DALI_TEST_EQUALS( actor9.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION ); - END_TEST; } diff --git a/dali/devel-api/actors/actor-devel.h b/dali/devel-api/actors/actor-devel.h index 0468d10..22085a9 100644 --- a/dali/devel-api/actors/actor-devel.h +++ b/dali/devel-api/actors/actor-devel.h @@ -120,7 +120,7 @@ enum Type /** * @brief The direction of layout. - * @details Name "layoutDirection", type Property::INTEGER, @see LayoutDirection::Type for supported values. + * @details Name "layoutDirection", type Property::STRING. */ LAYOUT_DIRECTION = CLIPPING_MODE + 5, @@ -128,7 +128,7 @@ enum Type * @brief Determines whether child actors inherit the layout direction from a parent. * @details Name "layoutDirectionInheritance", type Property::BOOLEAN. */ - INHERIT_LAYOUT_DIRECTION = CLIPPING_MODE + 6 + LAYOUT_DIRECTION_INHERITANCE = CLIPPING_MODE + 6 }; } // namespace Property @@ -149,8 +149,8 @@ namespace LayoutDirection enum Type { - LTR, ///< Layout direction is from Left to Right direction (Default). - RTL ///< Layout direction is from Right to Left direction. + LTR, ///< Left to Right direction (Default). + RTL ///< Right to Left direction. }; } // namespace diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 9f5c1fb..5a97133 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -213,7 +213,7 @@ DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali: DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION ) DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT ) DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION ) -DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION ) +DALI_PROPERTY( "layoutDirectionInheritance", BOOLEAN, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ) DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX ) // Signals @@ -2124,7 +2124,7 @@ Actor::Actor( DerivedType derivedType ) mInheritScale( true ), mPositionUsesAnchorPoint( true ), mVisible( true ), - mInheritLayoutDirection( true ), + mLayoutDirectionInheritance( true ), mLayoutDirection( DevelActor::LayoutDirection::LTR ), mDrawMode( DrawMode::NORMAL ), mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ), @@ -2887,22 +2887,24 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr case Dali::DevelActor::Property::LAYOUT_DIRECTION: { Dali::DevelActor::LayoutDirection::Type direction = mLayoutDirection; + bool flag = false; if( Scripting::GetEnumerationProperty< DevelActor::LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) { - mInheritLayoutDirection = true; + flag = mLayoutDirectionInheritance; + mLayoutDirectionInheritance = true; InheritLayoutDirectionRecursively( this, direction ); - mInheritLayoutDirection = false; + mLayoutDirectionInheritance = flag; } break; } - case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION: + case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE: { bool value = false; - if( property.Get( value ) ) + if( property.Get( value ) && value != mLayoutDirectionInheritance ) { - SetInheritLayoutDirection( value ); + mLayoutDirectionInheritance = value; } break; } @@ -4155,9 +4157,9 @@ bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& valu break; } - case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION: + case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE: { - value = IsLayoutDirectionInherited(); + value = mLayoutDirectionInheritance; break; } @@ -5331,27 +5333,9 @@ void Actor::LowerBelow( Internal::Actor& target ) } } -void Actor::SetInheritLayoutDirection( bool inherit ) -{ - if( mInheritLayoutDirection != inherit ) - { - mInheritLayoutDirection = inherit; - - if( inherit && mParent ) - { - InheritLayoutDirectionRecursively( this, mParent->mLayoutDirection ); - } - } -} - -bool Actor::IsLayoutDirectionInherited() const -{ - return mInheritLayoutDirection; -} - void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor::LayoutDirection::Type direction ) { - if( actor && actor->mInheritLayoutDirection ) + if( actor && actor->mLayoutDirectionInheritance ) { if( actor->mLayoutDirection != direction) { @@ -5369,6 +5353,7 @@ void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor: } } } + } } // namespace Internal diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index b542de5..5b3098c 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -1921,18 +1921,6 @@ private: void SetVisibleInternal( bool visible, SendMessage::Type sendMessage ); /** - * Set whether a child actor inherits it's parent's layout direction. Default is to inherit. - * @param[in] inherit - true if the actor should inherit layout direction, false otherwise. - */ - void SetInheritLayoutDirection( bool inherit ); - - /** - * Returns whether the actor inherits it's parent's layout direction. - * @return true if the actor inherits it's parent's layout direction, false otherwise. - */ - bool IsLayoutDirectionInherited() const; - - /** * @brief Propagates layout direction recursively. * @param[in] actor The actor for seting layout direction. * @param[in] direction New layout direction. @@ -1994,7 +1982,7 @@ protected: bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited. bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not. bool mVisible : 1; ///< Cached: Whether the actor is visible or not. - bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent. + bool mLayoutDirectionInheritance : 1; ///< Whether the actor inherits the layout direction from parent. DevelActor::LayoutDirection::Type mLayoutDirection : 1; ///< Layout direction, Left to Right or Right to Left. DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited -- 2.7.4