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-impl.cpp;h=4334f0e6548fbe5c5735bec3ff160eee9bf072a2;hp=4b0549608d36e7010bc006f52c06fca75ab3d546;hb=eb86a7e2a223a3876fa8be052872df527aad777f;hpb=bff2e237fc25cfeb9a067ab730fe68f89f81122c diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 4b05496..4334f0e 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -783,6 +783,11 @@ void Controller::Impl::SetEditable(bool editable) if(mEventData) { mEventData->mEditingEnabled = editable; + + if(mEventData->mDecorator) + { + mEventData->mDecorator->SetEditable(editable); + } } } @@ -1586,7 +1591,7 @@ Actor Controller::Impl::CreateBackgroundActor() const Vector2 textSize = mView.GetLayoutSize(); - const float offsetX = textSize.width * 0.5f; + const float offsetX = alignmentOffset + textSize.width * 0.5f; const float offsetY = textSize.height * 0.5f; const Vector4* const backgroundColorsBuffer = mView.GetBackgroundColors(); @@ -1732,6 +1737,86 @@ Actor Controller::Impl::CreateBackgroundActor() return actor; } +void Controller::Impl::RelayoutForNewLineSize() +{ + // relayout all characters + mTextUpdateInfo.mCharacterIndex = 0; + mTextUpdateInfo.mNumberOfCharactersToRemove = mTextUpdateInfo.mPreviousNumberOfCharacters; + mTextUpdateInfo.mNumberOfCharactersToAdd = mModel->mLogicalModel->mText.Count(); + mOperationsPending = static_cast(mOperationsPending | LAYOUT); + + //remove selection + if(mEventData && mEventData->mState == EventData::SELECTING) + { + ChangeState(EventData::EDITING); + } + + RequestRelayout(); +} + +bool Controller::Impl::IsInputStyleChangedSignalsQueueEmpty() +{ + return (NULL == mEventData) || (0u == mEventData->mInputStyleChangedQueue.Count()); +} + +void Controller::Impl::ProcessInputStyleChangedSignals() +{ + if(mEventData) + { + if(mEditableControlInterface) + { + // Emit the input style changed signal for each mask + std::for_each(mEventData->mInputStyleChangedQueue.begin(), + mEventData->mInputStyleChangedQueue.end(), + [&](const auto mask) { mEditableControlInterface->InputStyleChanged(mask); } ); + } + + mEventData->mInputStyleChangedQueue.Clear(); + } +} + +void Controller::Impl::ScrollBy(Vector2 scroll) +{ + if(mEventData && (fabs(scroll.x) > Math::MACHINE_EPSILON_0 || fabs(scroll.y) > Math::MACHINE_EPSILON_0)) + { + const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize(); + const Vector2 currentScroll = mModel->mScrollPosition; + + scroll.x = -scroll.x; + scroll.y = -scroll.y; + + if(fabs(scroll.x) > Math::MACHINE_EPSILON_0) + { + mModel->mScrollPosition.x += scroll.x; + ClampHorizontalScroll(layoutSize); + } + + if(fabs(scroll.y) > Math::MACHINE_EPSILON_0) + { + mModel->mScrollPosition.y += scroll.y; + ClampVerticalScroll(layoutSize); + } + + if(mModel->mScrollPosition != currentScroll) + { + mEventData->mDecorator->UpdatePositions(mModel->mScrollPosition - currentScroll); + RequestRelayout(); + } + } +} + +float Controller::Impl::GetHorizontalScrollPosition() +{ + // Scroll values are negative internally so we convert them to positive numbers + return mEventData ? -mModel->mScrollPosition.x : 0.0f; +} + +float Controller::Impl::GetVerticalScrollPosition() +{ + // Scroll values are negative internally so we convert them to positive numbers + return mEventData ? -mModel->mScrollPosition.y : 0.0f; +} + void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns) { //Underlined character runs for markup-processor