X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=61ca6e036b63f88ba7f091a4ea38eca35175d060;hp=57356d0ef1eb1cc6741ef910d8b7e2c6e1f1b094;hb=6843654a76dd5ac486ec3dc69e32798023dda176;hpb=2d2ecb83398d1c811911b8a734fb844a16616636 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 57356d0..61ca6e0 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -128,12 +128,7 @@ void Controller::GetText( std::string& text ) const if( 0u != utf32Characters.Count() ) { - uint32_t numberOfBytes = GetNumberOfUtf8Bytes( &utf32Characters[0], utf32Characters.Count() ); - - text.resize( numberOfBytes ); - - // This is a bit horrible but std::string returns a (signed) char* - Utf32ToUtf8( &utf32Characters[0], utf32Characters.Count(), reinterpret_cast(&text[0]) ); + Utf32ToUtf8( &utf32Characters[0], utf32Characters.Count(), text ); } } else @@ -464,6 +459,8 @@ 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 | @@ -497,10 +494,14 @@ Vector3 Controller::GetNaturalSize() mImpl->mVisualModel->SetNaturalSize( naturalSize.GetVectorXY() ); mImpl->mRecalculateNaturalSize = false; + + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z ); } else { naturalSize = mImpl->mVisualModel->GetNaturalSize(); + + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z ); } return naturalSize; @@ -552,7 +553,7 @@ float Controller::GetHeightForWidth( float width ) bool Controller::Relayout( const Size& size ) { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::Relayout %p --> size %f,%f\n", this, size.width, size.height ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f\n", this, size.width, size.height ); if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) ) { @@ -563,7 +564,7 @@ bool Controller::Relayout( const Size& size ) glyphsRemoved = true; } // Not worth to relayout if width or height is equal to zero. - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::Relayout <-- (skipped)\n" ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout (skipped)\n" ); return glyphsRemoved; } @@ -602,7 +603,7 @@ bool Controller::Relayout( const Size& size ) updated = mImpl->ProcessInputEvents() || updated; } - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::Relayout <--\n" ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout\n" ); return updated; } @@ -1122,6 +1123,37 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) { DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" ); + if( NULL != mImpl->mEventData ) + { + if( 1u == tapCount ) + { + bool tapDuringEditMode( EventData::EDITING == mImpl->mEventData->mState ); + + mImpl->ChangeState( EventData::EDITING ); + + if( mImpl->IsShowingPlaceholderText() ) + { + // Alternative placeholder-text is used when editing + ShowPlaceholderText(); + } + else if( EventData::EDITING == mImpl->mEventData->mState ) + { + // Grab handle is not shown until a tap is received whilst EDITING + if( tapDuringEditMode ) + { + mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, true ); + } + mImpl->mEventData->mDecorator->SetPopupActive( false ); + } + } + else if( mImpl->mEventData->mSelectionEnabled && + ( 2u == tapCount ) ) + { + mImpl->ChangeState( EventData::SELECTING ); + } + } + + // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated if( mImpl->mEventData ) { Event event( Event::TAP_EVENT ); @@ -1214,6 +1246,9 @@ void Controller::ShowPlaceholderText() mImpl->mEventData->mIsShowingPlaceholderText = true; + // Cancel previously queued inserts etc. + mImpl->mModifyEvents.clear(); + // Disable handles when showing place-holder text mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, false ); mImpl->mEventData->mDecorator->SetHandleActive( LEFT_SELECTION_HANDLE, false );