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=f7958ffa40a063ca7f0d19ffabb4b644d0afc410;hp=07cb7fe859cf8d98360f8abb2a4755b38d91ff0d;hb=4469fbe38e5ce460187346003a013552a9d393a5;hpb=cdbcb0ee5a36cec166fd8fcb94e0da6571adc864 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 07cb7fe..f7958ff 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -453,12 +453,12 @@ bool Controller::RemoveText( int cursorOffset, int numberOfChars ) cursorIndex = oldCursorIndex + cursorOffset; } - if( (cursorIndex + numberOfChars) > currentText.Count() ) + if( ( cursorIndex + numberOfChars ) > currentText.Count() ) { numberOfChars = currentText.Count() - cursorIndex; } - if( (cursorIndex + numberOfChars) <= currentText.Count() ) + if( ( cursorIndex + numberOfChars ) <= currentText.Count() ) { Vector::Iterator first = currentText.Begin() + cursorIndex; Vector::Iterator last = first + numberOfChars; @@ -667,7 +667,7 @@ float Controller::GetHeightForWidth( float width ) ProcessModifyEvents(); Size layoutSize; - if( width != mImpl->mVisualModel->mControlSize.width ) + if( fabsf( width - mImpl->mVisualModel->mControlSize.width ) > Math::MACHINE_EPSILON_1000 ) { // Operations that can be done only once until the text changes. const OperationsMask onlyOnceOperations = static_cast( CONVERT_TO_UTF32 | @@ -1520,7 +1520,7 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) else if( EventData::EDITING != mImpl->mEventData->mState && EventData::EDITING_WITH_GRAB_HANDLE != mImpl->mEventData->mState ) { - if( mImpl->IsShowingPlaceholderText() && ! mImpl->IsFocusedPlaceholderAvailable() ) + if( mImpl->IsShowingPlaceholderText() && !mImpl->IsFocusedPlaceholderAvailable() ) { // Hide placeholder text ResetText(); @@ -1709,12 +1709,21 @@ void Controller::PasteText( const std::string& stringToPaste ) InsertText( stringToPaste, Text::Controller::COMMIT ); mImpl->ChangeState( EventData::EDITING ); mImpl->RequestRelayout(); + + // Do this last since it provides callbacks into application code + mImpl->mControlInterface.TextChanged(); } void Controller::PasteClipboardItemEvent() { + // Retrieve the clipboard contents first ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() ); std::string stringToPaste( notifier.GetContent() ); + + // Commit the current pre-edit text; the contents of the clipboard should be appended + mImpl->ResetImfManager(); + + // Paste PasteText( stringToPaste ); } @@ -1797,7 +1806,7 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent ) { - bool update( false ); + bool update = false; bool requestRelayout = false; std::string text; @@ -1925,17 +1934,15 @@ void Controller::NotifyImfManager() { if( mImpl->mEventData ) { - ImfManager imfManager = ImfManager::Get(); - - if( imfManager ) + if( mImpl->mEventData->mImfManager ) { // Notifying IMF of a cursor change triggers a surrounding text request so updating it now. std::string text; GetText( text ); - imfManager.SetSurroundingText( text ); + mImpl->mEventData->mImfManager.SetSurroundingText( text ); - imfManager.SetCursorPosition( GetLogicalCursorPosition() ); - imfManager.NotifyCursorPosition(); + mImpl->mEventData->mImfManager.SetCursorPosition( GetLogicalCursorPosition() ); + mImpl->mEventData->mImfManager.NotifyCursorPosition(); } } }