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=320a5e0ae30d5959afbcdeab7aac2b5ec0537423;hp=9d0cf87bcbda27fd17ae6ffe10133d3c2c8ac55b;hb=a5fa9ef7e55f908aa95d0896af2b947f44fa0088;hpb=5b3cf0e6742934674bdf62bbe15af00e39eae566 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 9d0cf87..320a5e0 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1160,6 +1160,13 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) // Menu/Home key behaviour does not allow edit mode to resume like Power key // Avoids calling the InsertText() method which can delete selected text } + else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode ) + { + // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the imf?) when the predictive text is enabled + // and a character is typed after the type of a upper case latin character. + + // Do nothing. + } else { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() ); @@ -1198,6 +1205,9 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ this, text.c_str(), (COMMIT == type ? "COMMIT" : "PRE_EDIT"), mImpl->mEventData->mPrimaryCursorPosition, mImpl->mEventData->mPreEditFlag, mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength ); + // TODO: At the moment the underline runs are only for pre-edit. + mImpl->mVisualModel->mUnderlineRuns.Clear(); + Vector utf32Characters; Length characterCount( 0u ); @@ -1255,7 +1265,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ } else // PRE_EDIT { - if( ! mImpl->mEventData->mPreEditFlag ) + if( !mImpl->mEventData->mPreEditFlag ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Entered PreEdit state" ); @@ -1266,6 +1276,22 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ mImpl->mEventData->mPreEditLength = utf32Characters.Count(); mImpl->mEventData->mPreEditFlag = true; + // Add the underline for the pre-edit text. + const GlyphIndex* const charactersToGlyphBuffer = mImpl->mVisualModel->mCharactersToGlyph.Begin(); + const Length* const glyphsPerCharacterBuffer = mImpl->mVisualModel->mGlyphsPerCharacter.Begin(); + + const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mImpl->mEventData->mPreEditStartPosition ); + const CharacterIndex lastPreEditCharacter = mImpl->mEventData->mPreEditStartPosition + ( ( mImpl->mEventData->mPreEditLength > 0u ) ? mImpl->mEventData->mPreEditLength - 1u : 0u ); + const Length numberOfGlyphsLastCharacter = *( glyphsPerCharacterBuffer + lastPreEditCharacter ); + const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + lastPreEditCharacter ) + ( numberOfGlyphsLastCharacter > 1u ? numberOfGlyphsLastCharacter - 1u : 0u ); + + GlyphRun underlineRun; + underlineRun.glyphIndex = glyphStart; + underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart; + + // TODO: At the moment the underline runs are only for pre-edit. + mImpl->mVisualModel->mUnderlineRuns.PushBack( underlineRun ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "mPreEditStartPosition %d mPreEditLength %d\n", mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength ); } } @@ -1495,6 +1521,12 @@ void Controller::DecorationEvent( HandleType handleType, HandleState state, floa mImpl->mEventData->mEventQueue.push_back( event ); break; } + case LEFT_SELECTION_HANDLE_MARKER: + case RIGHT_SELECTION_HANDLE_MARKER: + { + // Markers do not move the handles. + break; + } case HANDLE_TYPE_COUNT: { DALI_ASSERT_DEBUG( !"Controller::HandleEvent. Unexpected handle type" );