X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-event-handler.cpp;h=5d78405c140224cdef39e4ca4e69c6e277b756f4;hb=73a2e4a851e3b5b1f35281ed895d06c2bc8b76c5;hp=79a917ec53ec62a1b9b02d84891959811744edee;hpb=e06940d202331c003c1ec793143efd20437cc9f3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller-event-handler.cpp b/dali-toolkit/internal/text/text-controller-event-handler.cpp index 79a917e..5d78405 100644 --- a/dali-toolkit/internal/text/text-controller-event-handler.cpp +++ b/dali-toolkit/internal/text/text-controller-event-handler.cpp @@ -84,8 +84,17 @@ void Controller::EventHandler::KeyboardFocusLostEvent(Controller& controller) // Init selection position if(controller.mImpl->mEventData->mState == EventData::SELECTING) { + uint32_t oldStart, oldEnd; + oldStart = controller.mImpl->mEventData->mLeftSelectionPosition; + oldEnd = controller.mImpl->mEventData->mRightSelectionPosition; + controller.mImpl->mEventData->mLeftSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; controller.mImpl->mEventData->mRightSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; + + if(controller.mImpl->mSelectableControlInterface != nullptr) + { + controller.mImpl->mSelectableControlInterface->SelectionChanged(oldStart, oldEnd, controller.mImpl->mEventData->mPrimaryCursorPosition, controller.mImpl->mEventData->mPrimaryCursorPosition); + } } controller.mImpl->ChangeState(EventData::INACTIVE); @@ -158,12 +167,22 @@ bool Controller::EventHandler::KeyEvent(Controller& controller, const Dali::KeyE // Release the active highlight. if(controller.mImpl->mEventData->mState == EventData::SELECTING) { + uint32_t oldStart, oldEnd; + oldStart = controller.mImpl->mEventData->mLeftSelectionPosition; + oldEnd = controller.mImpl->mEventData->mRightSelectionPosition; + controller.mImpl->ChangeState(EventData::EDITING); // Update selection position. controller.mImpl->mEventData->mLeftSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; controller.mImpl->mEventData->mRightSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; controller.mImpl->mEventData->mUpdateCursorPosition = true; + + if(controller.mImpl->mSelectableControlInterface != nullptr) + { + controller.mImpl->mSelectableControlInterface->SelectionChanged(oldStart, oldEnd, controller.mImpl->mEventData->mLeftSelectionPosition, controller.mImpl->mEventData->mRightSelectionPosition); + } + controller.mImpl->RequestRelayout(); } return false; @@ -597,12 +616,21 @@ void Controller::EventHandler::ProcessModifyEvents(Controller& controller) if(NULL != controller.mImpl->mEventData) { + uint32_t oldStart, oldEnd; + oldStart = controller.mImpl->mEventData->mLeftSelectionPosition; + oldEnd = controller.mImpl->mEventData->mRightSelectionPosition; + // When the text is being modified, delay cursor blinking controller.mImpl->mEventData->mDecorator->DelayCursorBlink(); // Update selection position after modifying the text controller.mImpl->mEventData->mLeftSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; controller.mImpl->mEventData->mRightSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition; + + if(controller.mImpl->mSelectableControlInterface != nullptr && controller.mImpl->mEventData->mState == EventData::SELECTING) + { + controller.mImpl->mSelectableControlInterface->SelectionChanged(oldStart, oldEnd, controller.mImpl->mEventData->mLeftSelectionPosition, controller.mImpl->mEventData->mRightSelectionPosition); + } } // DISCARD temporary text @@ -924,43 +952,17 @@ void Controller::EventHandler::TextPopupButtonTouched(Controller& controller, Da { case Toolkit::TextSelectionPopup::CUT: { - if(!controller.IsEditable()) return; - controller.mImpl->SendSelectionToClipboard(true); // Synchronous call to modify text - controller.mImpl->mOperationsPending = ALL_OPERATIONS; - - if((0u != controller.mImpl->mModel->mLogicalModel->mText.Count()) || - !controller.mImpl->IsPlaceholderAvailable()) - { - controller.mImpl->QueueModifyEvent(ModifyEvent::TEXT_DELETED); - } - else - { - controller.ShowPlaceholderText(); - } - - controller.mImpl->mEventData->mUpdateCursorPosition = true; - controller.mImpl->mEventData->mScrollAfterDelete = true; - - controller.mImpl->RequestRelayout(); - - if(NULL != controller.mImpl->mEditableControlInterface) - { - controller.mImpl->mEditableControlInterface->TextChanged(true); - } + controller.CutText(); break; } case Toolkit::TextSelectionPopup::COPY: { - controller.mImpl->SendSelectionToClipboard(false); // Text not modified - - controller.mImpl->mEventData->mUpdateCursorPosition = true; - - controller.mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup + controller.CopyText(); break; } case Toolkit::TextSelectionPopup::PASTE: { - controller.mImpl->RequestGetTextFromClipboard(); // Request clipboard service to retrieve an item + controller.PasteText(); break; } case Toolkit::TextSelectionPopup::SELECT: