mScrollDistance( SCROLL_DISTANCE ),
mTextDepth( 0u ),
mActiveCopyPastePopup( false ),
+ mPopupSetNewPosition( true ),
mCursorBlinkStatus( true ),
mDelayCursorBlink( false ),
mPrimaryCursorVisible( false ),
if( mCopyPastePopup.actor )
{
mCopyPastePopup.actor.HidePopup();
+ mPopupSetNewPosition = true;
}
}
}
return;
}
- if ( mHandle[LEFT_SELECTION_HANDLE].active || mHandle[RIGHT_SELECTION_HANDLE].active )
+ if( mPopupSetNewPosition )
{
- float minHandleXPosition = std::min ( mHandle[LEFT_SELECTION_HANDLE].position.x, mHandle[RIGHT_SELECTION_HANDLE].position.x );
- float maxHandleXPosition = std::max ( mHandle[LEFT_SELECTION_HANDLE].position.x, mHandle[RIGHT_SELECTION_HANDLE].position.x );
+ if ( mHandle[LEFT_SELECTION_HANDLE].active || mHandle[RIGHT_SELECTION_HANDLE].active )
+ {
+ float minHandleXPosition = std::min ( mHandle[LEFT_SELECTION_HANDLE].position.x, mHandle[RIGHT_SELECTION_HANDLE].position.x );
+ float maxHandleXPosition = std::max ( mHandle[LEFT_SELECTION_HANDLE].position.x, mHandle[RIGHT_SELECTION_HANDLE].position.x );
- float minHandleYPosition = std::min ( mHandle[LEFT_SELECTION_HANDLE].position.y, mHandle[RIGHT_SELECTION_HANDLE].position.y );
+ float minHandleYPosition = std::min ( mHandle[LEFT_SELECTION_HANDLE].position.y, mHandle[RIGHT_SELECTION_HANDLE].position.y );
- mCopyPastePopup.position.x = minHandleXPosition + ( ( maxHandleXPosition - minHandleXPosition ) *0.5f );
- mCopyPastePopup.position.y = minHandleYPosition + mCopyPastePopup.offset;
- }
- else
- {
- mCopyPastePopup.position = Vector3( mCursor[PRIMARY_CURSOR].position.x, mCursor[PRIMARY_CURSOR].position.y -100.0f , 0.0f ); //todo 100 to be an offset Property
+ mCopyPastePopup.position.x = minHandleXPosition + ( ( maxHandleXPosition - minHandleXPosition ) *0.5f );
+ mCopyPastePopup.position.y = minHandleYPosition + mCopyPastePopup.offset;
+ }
+ else
+ {
+ mCopyPastePopup.position = Vector3( mCursor[PRIMARY_CURSOR].position.x, mCursor[PRIMARY_CURSOR].position.y -100.0f , 0.0f ); //todo 100 to be an offset Property
+ }
}
Vector3 popupSize = Vector3( mCopyPastePopup.actor.GetRelayoutSize( Dimension::WIDTH ), mCopyPastePopup.actor.GetRelayoutSize( Dimension::HEIGHT ), 0.0f );
SetUpPopupPositionNotifications();
mCopyPastePopup.actor.SetPosition( mCopyPastePopup.position );
+ mPopupSetNewPosition = false;
}
void PopupRelayoutComplete( Actor actor )
int mTextDepth; ///< The depth used to render the text.
bool mActiveCopyPastePopup : 1;
+ bool mPopupSetNewPosition : 1;
bool mCursorBlinkStatus : 1; ///< Flag to switch between blink on and blink off.
bool mDelayCursorBlink : 1; ///< Used to avoid cursor blinking when entering text.
bool mPrimaryCursorVisible : 1; ///< Whether the primary cursor is visible.
void Decorator::SetEnabledPopupButtons( TextSelectionPopup::Buttons& enabledButtonsBitMask )
{
- mImpl->mEnabledPopupButtons = enabledButtonsBitMask;
+ mImpl->mEnabledPopupButtons = enabledButtonsBitMask;
- if ( !mImpl->mCopyPastePopup.actor )
- {
- mImpl->mCopyPastePopup.actor = TextSelectionPopup::New( &mImpl->mTextSelectionPopupCallbackInterface );
+ if ( !mImpl->mCopyPastePopup.actor )
+ {
+ mImpl->mCopyPastePopup.actor = TextSelectionPopup::New( &mImpl->mTextSelectionPopupCallbackInterface );
#ifdef DECORATOR_DEBUG
- mImpl->mCopyPastePopup.actor.SetName("mCopyPastePopup");
+ mImpl->mCopyPastePopup.actor.SetName("mCopyPastePopup");
#endif
- mImpl->mCopyPastePopup.actor.SetAnchorPoint( AnchorPoint::CENTER );
- mImpl->mCopyPastePopup.actor.OnRelayoutSignal().Connect( mImpl, &Decorator::Impl::PopupRelayoutComplete ); // Position popup after size negotiation
- }
+ mImpl->mCopyPastePopup.actor.SetAnchorPoint( AnchorPoint::CENTER );
+ mImpl->mCopyPastePopup.actor.OnRelayoutSignal().Connect( mImpl, &Decorator::Impl::PopupRelayoutComplete ); // Position popup after size negotiation
+ }
- mImpl->mCopyPastePopup.actor.EnableButtons( mImpl->mEnabledPopupButtons );
+ mImpl->mCopyPastePopup.actor.EnableButtons( mImpl->mEnabledPopupButtons );
}
TextSelectionPopup::Buttons& Decorator::GetEnabledPopupButtons()
// Now remove references for the old text
RemoveText();
mTextCache.Swap( newTextCache );
+ RemoveAllShadowRenderTasks();
if( thereAreUnderlinedGlyphs )
{
subActor.SetSize( actorSize );
subActor.SetColor( shadowColor );
- // Discard redundant render-tasks
- RemoveShadowRenderTask();
-
// Create a render task to render the effect
- mShadowTask = Stage::GetCurrent().GetRenderTaskList().CreateTask();
- mShadowTask.SetTargetFrameBuffer( meshRecord.mBuffer );
- mShadowTask.SetSourceActor( subActor );
- mShadowTask.SetClearEnabled( true );
- mShadowTask.SetClearColor( Vector4::ZERO );
- mShadowTask.SetExclusive( true );
- mShadowTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
- mShadowTask.FinishedSignal().Connect( this, &AtlasRenderer::Impl::RenderComplete );
+ RenderTask shadowTask = Stage::GetCurrent().GetRenderTaskList().CreateTask();
+ shadowTask.SetTargetFrameBuffer( meshRecord.mBuffer );
+ shadowTask.SetSourceActor( subActor );
+ shadowTask.SetClearEnabled( true );
+ shadowTask.SetClearColor( Vector4::ZERO );
+ shadowTask.SetExclusive( true );
+ shadowTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
+ shadowTask.FinishedSignal().Connect( this, &AtlasRenderer::Impl::RenderComplete );
+ mShadowTasks.push_back( shadowTask );
actor.Add( subActor );
return actor;
}
- void RemoveShadowRenderTask()
+ void RemoveShadowRenderTask( RenderTask renderTask )
{
- if( mShadowTask )
+ if( renderTask )
{
- mShadowTask.FinishedSignal().Disconnect( this, &AtlasRenderer::Impl::RenderComplete );
+ renderTask.FinishedSignal().Disconnect( this, &AtlasRenderer::Impl::RenderComplete );
// Guard to prevent accessing Stage after dali-core destruction
if( Stage::IsInstalled() )
{
- Stage::GetCurrent().GetRenderTaskList().RemoveTask( mShadowTask );
+ Stage::GetCurrent().GetRenderTaskList().RemoveTask( renderTask );
}
-
- mShadowTask.Reset();
+ renderTask.Reset();
}
}
}
}
- RemoveShadowRenderTask();
+ RemoveShadowRenderTask( renderTask );
+ }
+
+ void RemoveAllShadowRenderTasks()
+ {
+ for ( std::vector< RenderTask >::iterator shadowIterator = mShadowTasks.begin();
+ shadowIterator != mShadowTasks.end(); ++shadowIterator )
+ {
+ RemoveShadowRenderTask( *shadowIterator );
+ }
}
Actor mActor; ///< The actor parent which renders the text
AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching
- RenderTask mShadowTask; ///< Used to render shadows
+ std::vector< RenderTask > mShadowTasks; ///< Used to render shadows
TextAbstraction::FontClient mFontClient; ///> The font client used to supply glyph information
std::vector< MaxBlockSize > mBlockSizes; ///> Maximum size needed to contain a glyph in a block within a new atlas
std::vector< uint32_t > mFace; ///> Face indices for a quad
AtlasRenderer::~AtlasRenderer()
{
- mImpl->RemoveShadowRenderTask();
+ mImpl->RemoveAllShadowRenderTasks();
mImpl->RemoveText();
delete mImpl;