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=e10556c67486745a1efcd54e531269c4977de45a;hp=07eb23bb08e4f686ea2d994bc2ce10c3761c7a2e;hb=cc7bb8e3f22f9ef519c46444ca0ada0f2c5cf5f9;hpb=0948428e3187667b1742f4acc895a5a35a5d6242 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 07eb23b..e10556c 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -2418,31 +2418,27 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) if( NULL != mImpl->mEventData ) { DALI_LOG_INFO( gLogFilter, Debug::Concise, "TapEvent state:%d \n", mImpl->mEventData->mState ); + EventData::State state( mImpl->mEventData->mState ); + bool relayoutNeeded( false ); // to avoid unnecessary relayouts when tapping an empty text-field - if( 1u == tapCount ) + if( mImpl->IsClipboardVisible() ) { - // This is to avoid unnecessary relayouts when tapping an empty text-field - bool relayoutNeeded( false ); - - if( ( EventData::EDITING_WITH_POPUP == mImpl->mEventData->mState ) || - ( EventData::EDITING_WITH_PASTE_POPUP == mImpl->mEventData->mState ) ) + if( EventData::INACTIVE == state || EventData::EDITING == state) + { + mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); + } + relayoutNeeded = true; + } + else if( 1u == tapCount ) + { + if( EventData::EDITING_WITH_POPUP == state || EventData::EDITING_WITH_PASTE_POPUP == state ) { mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); // If Popup shown hide it here so can be shown again if required. } - if( mImpl->IsShowingRealText() && ( EventData::INACTIVE != mImpl->mEventData->mState ) ) + if( mImpl->IsShowingRealText() && ( EventData::INACTIVE != state ) ) { - // Already in an active state so show a popup - if( !mImpl->IsClipboardEmpty() ) - { - // Shows Paste popup but could show full popup with Selection options. ( EDITING_WITH_POPUP ) - mImpl->ChangeState( EventData::EDITING_WITH_PASTE_POPUP ); - } - else - { - // Show cursor and grabhandle on first tap, this matches the behaviour of tapping when already editing - mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); - } + mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); relayoutNeeded = true; } else @@ -2453,7 +2449,7 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) ResetText(); } - if( EventData::INACTIVE == mImpl->mEventData->mState ) + if( EventData::INACTIVE == state ) { mImpl->ChangeState( EventData::EDITING ); } @@ -2463,18 +2459,6 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) } relayoutNeeded = true; } - - // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated - if( relayoutNeeded ) - { - Event event( Event::TAP_EVENT ); - event.p1.mUint = tapCount; - event.p2.mFloat = x; - event.p3.mFloat = y; - mImpl->mEventData->mEventQueue.push_back( event ); - - mImpl->RequestRelayout(); - } } else if( 2u == tapCount ) { @@ -2484,6 +2468,17 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) SelectEvent( x, y, false ); } } + // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated + if( relayoutNeeded ) + { + Event event( Event::TAP_EVENT ); + event.p1.mUint = tapCount; + event.p2.mFloat = x; + event.p3.mFloat = y; + mImpl->mEventData->mEventQueue.push_back( event ); + + mImpl->RequestRelayout(); + } } // Reset keyboard as tap event has occurred. @@ -2535,7 +2530,7 @@ void Controller::LongPressEvent( Gesture::State state, float x, float y ) mImpl->RequestRelayout(); } - else + else if( !mImpl->IsClipboardVisible() ) { // Reset the imf manger to commit the pre-edit before selecting the text. mImpl->ResetImfManager(); @@ -2703,9 +2698,7 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt } case Toolkit::TextSelectionPopup::PASTE: { - std::string stringToPaste(""); - mImpl->GetTextFromClipboard( 0, stringToPaste ); // Paste latest item from system clipboard - PasteText( stringToPaste ); + mImpl->RequestGetTextFromClipboard(); // Request clipboard service to retrieve an item break; } case Toolkit::TextSelectionPopup::SELECT: