X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=6866ff4350655b2fc7f110c690714e448c78a9de;hb=6ea2f17f49c9c694a24d951160a7389c844d7889;hp=f29ab2294ff0cc5d69ba6c4756165c471bf7e542;hpb=f2039d47f9bed8104575da80a2ecf0bb6e37ff8d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index f29ab22..6866ff4 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -25,6 +25,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -75,11 +76,13 @@ ControllerPtr Controller::New(ControlInterface* controlInterface) ControllerPtr Controller::New(ControlInterface* controlInterface, EditableControlInterface* editableControlInterface, - SelectableControlInterface* selectableControlInterface) + SelectableControlInterface* selectableControlInterface, + AnchorControlInterface* anchorControlInterface) { return ControllerPtr(new Controller(controlInterface, editableControlInterface, - selectableControlInterface)); + selectableControlInterface, + anchorControlInterface)); } // public : Configure the text controller. @@ -122,6 +125,8 @@ void Controller::SetMarkupProcessorEnabled(bool enable) GetText(text); SetText(text); } + + mImpl->mModel->mVisualModel->SetMarkupProcessorEnabled(enable); } bool Controller::IsMarkupProcessorEnabled() const @@ -401,15 +406,22 @@ void Controller::SetLineWrapMode(Text::LineWrap::Mode lineWrapMode) { if(lineWrapMode != mImpl->mModel->mLineWrapMode) { - // Set the text wrap mode. - mImpl->mModel->mLineWrapMode = lineWrapMode; - // Update Text layout for applying wrap mode - mImpl->mOperationsPending = static_cast(mImpl->mOperationsPending | + mImpl->mOperationsPending = static_cast(mImpl->mOperationsPending | ALIGN | LAYOUT | UPDATE_LAYOUT_SIZE | REORDER); + + if((mImpl->mModel->mLineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) || (lineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) || + (mImpl->mModel->mLineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::MIXED) || (lineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::MIXED)) // hyphen is treated as line break + { + mImpl->mOperationsPending = static_cast(mImpl->mOperationsPending | GET_LINE_BREAKS); + } + + // Set the text wrap mode. + mImpl->mModel->mLineWrapMode = lineWrapMode; + mImpl->mTextUpdateInfo.mCharacterIndex = 0u; mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); @@ -1722,6 +1734,11 @@ bool Controller::KeyEvent(const Dali::KeyEvent& keyEvent) return EventHandler::KeyEvent(*this, keyEvent); } +void Controller::AnchorEvent(float x, float y) +{ + EventHandler::AnchorEvent(*this, x, y); +} + void Controller::TapEvent(unsigned int tapCount, float x, float y) { EventHandler::TapEvent(*this, tapCount, x, y); @@ -1936,6 +1953,19 @@ bool Controller::RemoveSelectedText() return TextUpdater::RemoveSelectedText(*this); } +void Controller::InsertTextAnchor(int numberOfCharacters, + CharacterIndex previousCursorIndex) +{ + TextUpdater::InsertTextAnchor(*this, numberOfCharacters, previousCursorIndex); +} + +void Controller::RemoveTextAnchor(int cursorOffset, + int numberOfCharacters, + CharacterIndex previousCursorIndex) +{ + TextUpdater::RemoveTextAnchor(*this, cursorOffset, numberOfCharacters, previousCursorIndex); +} + // private : Relayout. bool Controller::DoRelayout(const Size& size, @@ -2060,6 +2090,11 @@ void Controller::SetControlInterface(ControlInterface* controlInterface) mImpl->mControlInterface = controlInterface; } +void Controller::SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface) +{ + mImpl->mAnchorControlInterface = anchorControlInterface; +} + bool Controller::ShouldClearFocusOnEscape() const { return mImpl->mShouldClearFocusOnEscape; @@ -2073,19 +2108,20 @@ Actor Controller::CreateBackgroundActor() // private : Private contructors & copy operator. Controller::Controller() -: Controller(nullptr, nullptr, nullptr) +: Controller(nullptr, nullptr, nullptr, nullptr) { } Controller::Controller(ControlInterface* controlInterface) -: Controller(controlInterface, nullptr, nullptr) +: Controller(controlInterface, nullptr, nullptr, nullptr) { } Controller::Controller(ControlInterface* controlInterface, EditableControlInterface* editableControlInterface, - SelectableControlInterface* selectableControlInterface) -: mImpl(new Controller::Impl(controlInterface, editableControlInterface, selectableControlInterface)) + SelectableControlInterface* selectableControlInterface, + AnchorControlInterface* anchorControlInterface) +: mImpl(new Controller::Impl(controlInterface, editableControlInterface, selectableControlInterface, anchorControlInterface)) { }