X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fdecorator%2Ftext-decorator.cpp;h=67ae6427f6643e9f204144a1ec781f106d6f7626;hp=97aa0c86b5b35d4b480b0b154a6fc4ce6fd4f275;hb=fc72d9dfdefd7434202ed73ac579d425279947f3;hpb=c78e3b4813003fff8c306a7ab6a4e0bfbfdfb158 diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 97aa0c8..67ae642 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -116,14 +116,16 @@ struct Decorator::Impl : public ConnectionTracker CursorImpl() : x(0.0f), y(0.0f), - height(0.0f), + cursorHeight(0.0f), + lineHeight(0.0f), color(Dali::Color::WHITE) { } float x; float y; - float height; + float cursorHeight; + float lineHeight; Vector4 color; }; @@ -133,14 +135,14 @@ struct Decorator::Impl : public ConnectionTracker SelectionHandleImpl() : x(0.0f), y(0.0f), - cursorHeight(0.0f), + lineHeight(0.0f), flipped(false) { } float x; float y; - float cursorHeight; ///< Not the handle height + float lineHeight; ///< Not the handle height bool flipped; ImageActor actor; @@ -182,13 +184,13 @@ struct Decorator::Impl : public ConnectionTracker { mPrimaryCursor.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x, mCursor[PRIMARY_CURSOR].y + scrollPosition.y ); - mPrimaryCursor.SetSize( Vector2( 1.0f, mCursor[PRIMARY_CURSOR].height ) ); + mPrimaryCursor.SetSize( Size( 1.0f, mCursor[PRIMARY_CURSOR].cursorHeight ) ); } if( mSecondaryCursor ) { mSecondaryCursor.SetPosition( mCursor[SECONDARY_CURSOR].x + scrollPosition.x, mCursor[SECONDARY_CURSOR].y + scrollPosition.y ); - mSecondaryCursor.SetSize( Vector2( 1.0f, mCursor[SECONDARY_CURSOR].height ) ); + mSecondaryCursor.SetSize( Size( 1.0f, mCursor[SECONDARY_CURSOR].cursorHeight ) ); } // Show or hide the grab handle @@ -199,7 +201,7 @@ struct Decorator::Impl : public ConnectionTracker CreateGrabHandle(); mGrabHandle.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x, - mCursor[PRIMARY_CURSOR].y + scrollPosition.y + mCursor[PRIMARY_CURSOR].height ); + mCursor[PRIMARY_CURSOR].lineHeight + scrollPosition.y ); } else if( mGrabHandle ) { @@ -215,11 +217,11 @@ struct Decorator::Impl : public ConnectionTracker SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ]; primary.actor.SetPosition( primary.x + scrollPosition.x, - primary.y + scrollPosition.y + primary.cursorHeight ); + primary.lineHeight + scrollPosition.y ); SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ]; secondary.actor.SetPosition( secondary.x + scrollPosition.x, - secondary.y + scrollPosition.y + secondary.cursorHeight ); + secondary.lineHeight + scrollPosition.y ); CreateHighlight(); UpdateHighlight(); @@ -292,6 +294,10 @@ struct Decorator::Impl : public ConnectionTracker mActiveLayer.Add( mSecondaryCursor); } } + else + { + UnparentAndReset( mSecondaryCursor ); + } } } @@ -339,7 +345,7 @@ struct Decorator::Impl : public ConnectionTracker #endif mActiveLayer.SetParentOrigin( ParentOrigin::CENTER ); - mActiveLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mActiveLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION ); parent.Add( mActiveLayer ); @@ -373,8 +379,7 @@ struct Decorator::Impl : public ConnectionTracker #endif mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER ); mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - mGrabArea.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mGrabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ); mGrabHandle.Add( mGrabArea ); @@ -408,7 +413,7 @@ struct Decorator::Impl : public ConnectionTracker #ifdef DECORATOR_DEBUG primary.grabArea.SetName("SelectionHandleOneGrabArea"); #endif - primary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + primary.grabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); @@ -441,7 +446,7 @@ struct Decorator::Impl : public ConnectionTracker #ifdef DECORATOR_DEBUG secondary.grabArea.SetName("SelectionHandleTwoGrabArea"); #endif - secondary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + secondary.grabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); @@ -593,7 +598,7 @@ struct Decorator::Impl : public ConnectionTracker mGrabDisplacementY += gesture.displacement.y; float x = mCursor[PRIMARY_CURSOR].x + mGrabDisplacementX; - float y = mCursor[PRIMARY_CURSOR].y + mCursor[PRIMARY_CURSOR].height*0.5f + mGrabDisplacementY; + float y = mCursor[PRIMARY_CURSOR].y + mCursor[PRIMARY_CURSOR].lineHeight*0.5f + mGrabDisplacementY; if( Gesture::Started == gesture.state || Gesture::Continuing == gesture.state ) @@ -698,7 +703,7 @@ unsigned int Decorator::GetActiveCursor() const return mImpl->mActiveCursor; } -void Decorator::SetPosition( Cursor cursor, float x, float y, float height ) +void Decorator::SetPosition( Cursor cursor, float x, float y, float cursorHeight, float lineHeight ) { // Adjust grab handle displacement mImpl->mGrabDisplacementX -= x - mImpl->mCursor[cursor].x; @@ -706,14 +711,16 @@ void Decorator::SetPosition( Cursor cursor, float x, float y, float height ) mImpl->mCursor[cursor].x = x; mImpl->mCursor[cursor].y = y; - mImpl->mCursor[cursor].height = height; + mImpl->mCursor[cursor].cursorHeight = cursorHeight; + mImpl->mCursor[cursor].lineHeight = lineHeight; } -void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& height ) const +void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& cursorHeight, float& lineHeight ) const { x = mImpl->mCursor[cursor].x; y = mImpl->mCursor[cursor].y; - height = mImpl->mCursor[cursor].height; + cursorHeight = mImpl->mCursor[cursor].cursorHeight; + lineHeight = mImpl->mCursor[cursor].lineHeight; } void Decorator::SetColor( Cursor cursor, const Dali::Vector4& color ) @@ -806,14 +813,14 @@ void Decorator::SetPosition( SelectionHandle handle, float x, float y, float hei { mImpl->mSelectionHandle[handle].x = x; mImpl->mSelectionHandle[handle].y = y; - mImpl->mSelectionHandle[handle].cursorHeight = height; + mImpl->mSelectionHandle[handle].lineHeight = height; } void Decorator::GetPosition( SelectionHandle handle, float& x, float& y, float& height ) const { x = mImpl->mSelectionHandle[handle].x; y = mImpl->mSelectionHandle[handle].y; - height = mImpl->mSelectionHandle[handle].cursorHeight; + height = mImpl->mSelectionHandle[handle].lineHeight; } void Decorator::SetImage( SelectionHandle handle, SelectionHandleState state, Dali::Image image )