From: Victor Cebollada Date: Wed, 6 May 2015 11:18:20 +0000 (+0100) Subject: Cursor fix. X-Git-Tag: accepted/tizen/common/20150512.125104~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=27c3ff64b7236bb404bd931259674094390d63a1;hp=6843654a76dd5ac486ec3dc69e32798023dda176 Cursor fix. Update the cursor position after all text is removed and the place holder text appears. Change-Id: I4455e5b382db195b5129cfd13c47c022811122c9 Signed-off-by: Victor Cebollada --- diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index c50b753..4ce45eb 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include @@ -35,6 +36,10 @@ namespace { +#if defined(DEBUG_ENABLED) + Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS"); +#endif + /** * @brief Some characters can be shaped in more than one glyph. * This struct is used to retrieve metrics from these group of glyphs. @@ -138,9 +143,11 @@ EventData::~EventData() bool Controller::Impl::ProcessInputEvents() { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::ProcessInputEvents\n" ); if( NULL == mEventData ) { // Nothing to do if there is no text input. + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents no event data\n" ); return false; } @@ -235,6 +242,7 @@ bool Controller::Impl::ProcessInputEvents() mEventData->mEventQueue.clear(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents\n" ); return mEventData->mDecoratorUpdated; } @@ -1052,9 +1060,11 @@ CharacterIndex Controller::Impl::CalculateNewCursorIndex( CharacterIndex index ) void Controller::Impl::UpdateCursorPosition() { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::UpdateCursorPosition %p\n", this ); if( NULL == mEventData ) { // Nothing to do if there is no text input. + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition no event data\n" ); return; } @@ -1071,6 +1081,7 @@ void Controller::Impl::UpdateCursorPosition() cursorPosition.y, cursorInfo.primaryCursorHeight, cursorInfo.lineHeight ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Primary cursor position: %f,%f\n", cursorPosition.x, cursorPosition.y ); // Sets the grab handle position. mEventData->mDecorator->SetPosition( GRAB_HANDLE, @@ -1086,11 +1097,13 @@ void Controller::Impl::UpdateCursorPosition() cursorInfo.secondaryPosition.y + offset.y, cursorInfo.secondaryCursorHeight, cursorInfo.lineHeight ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + offset.x, cursorInfo.secondaryPosition.y + offset.y ); } else { mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY ); } + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition\n" ); } void Controller::Impl::UpdateSelectionHandle( HandleType handleType ) diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 61ca6e0..af06986 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -452,6 +452,7 @@ const Vector2& Controller::GetAlignmentOffset() const Vector3 Controller::GetNaturalSize() { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetNaturalSize\n" ); Vector3 naturalSize; // Make sure the model is up-to-date before layouting @@ -459,8 +460,6 @@ Vector3 Controller::GetNaturalSize() if( mImpl->mRecalculateNaturalSize ) { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetNaturalSize\n" ); - // Operations that can be done only once until the text changes. const OperationsMask onlyOnceOperations = static_cast( CONVERT_TO_UTF32 | GET_SCRIPTS | @@ -501,7 +500,7 @@ Vector3 Controller::GetNaturalSize() { naturalSize = mImpl->mVisualModel->GetNaturalSize(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z ); } return naturalSize; @@ -509,6 +508,7 @@ Vector3 Controller::GetNaturalSize() float Controller::GetHeightForWidth( float width ) { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetHeightForWidth %p width %f\n", this, width ); // Make sure the model is up-to-date before layouting ProcessModifyEvents(); @@ -542,10 +542,12 @@ float Controller::GetHeightForWidth( float width ) // Do the size related operations again. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | sizeOperations ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height ); } else { layoutSize = mImpl->mVisualModel->GetActualSize(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth cached %f\n", layoutSize.height ); } return layoutSize.height; @@ -727,6 +729,7 @@ bool Controller::DoRelayout( const Size& size, OperationsMask operationsRequired, Size& layoutSize ) { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height ); bool viewUpdated( false ); // Calculate the operations to be done. @@ -743,6 +746,7 @@ bool Controller::DoRelayout( const Size& size, if( 0u == numberOfGlyphs ) { // Nothing else to do if there is no glyphs. + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" ); return true; } @@ -858,6 +862,7 @@ bool Controller::DoRelayout( const Size& size, layoutSize = mImpl->mVisualModel->GetActualSize(); } + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated %s\n", ( viewUpdated ? "true" : "false" ) ); return viewUpdated; } @@ -996,6 +1001,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) if( 0u == mImpl->mLogicalModel->mText.Count() ) { ShowPlaceholderText(); + mImpl->mEventData->mUpdateCursorPosition = true; } else {