projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add bidirectional text tct." into devel/master
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
text-controller.cpp
diff --git
a/dali-toolkit/internal/text/text-controller.cpp
b/dali-toolkit/internal/text/text-controller.cpp
index
8897b33
..
4ce4b5a
100755
(executable)
--- a/
dali-toolkit/internal/text/text-controller.cpp
+++ b/
dali-toolkit/internal/text/text-controller.cpp
@@
-138,7
+138,7
@@
ControllerPtr Controller::New( ControlInterface* controlInterface,
// public : Configure the text controller.
// public : Configure the text controller.
-void Controller::EnableTextInput( DecoratorPtr decorator )
+void Controller::EnableTextInput( DecoratorPtr decorator
, InputMethodContext& inputMethodContext
)
{
if( !decorator )
{
{
if( !decorator )
{
@@
-151,7
+151,7
@@
void Controller::EnableTextInput( DecoratorPtr decorator )
if( NULL == mImpl->mEventData )
{
if( NULL == mImpl->mEventData )
{
- mImpl->mEventData = new EventData( decorator );
+ mImpl->mEventData = new EventData( decorator
, inputMethodContext
);
}
}
}
}
@@
-168,7
+168,14
@@
void Controller::SetGlyphType( TextAbstraction::GlyphType glyphType )
void Controller::SetMarkupProcessorEnabled( bool enable )
{
void Controller::SetMarkupProcessorEnabled( bool enable )
{
- mImpl->mMarkupProcessorEnabled = enable;
+ if( enable != mImpl->mMarkupProcessorEnabled )
+ {
+ //If Text was already set, call the SetText again for enabling or disabling markup
+ mImpl->mMarkupProcessorEnabled = enable;
+ std::string text;
+ GetText( text );
+ SetText( text );
+ }
}
bool Controller::IsMarkupProcessorEnabled() const
}
bool Controller::IsMarkupProcessorEnabled() const
@@
-493,7
+500,7
@@
void Controller::SetText( const std::string& text )
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
// Reset keyboard as text changed
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
// Reset keyboard as text changed
- mImpl->ResetI
mfManager
();
+ mImpl->ResetI
nputMethodContext
();
// Remove the previously set text and style.
ResetText();
// Remove the previously set text and style.
ResetText();
@@
-1983,6
+1990,7
@@
float Controller::GetHeightForWidth( float width )
// Clear the update info. This info will be set the next time the text is updated.
mImpl->mTextUpdateInfo.Clear();
// Clear the update info. This info will be set the next time the text is updated.
mImpl->mTextUpdateInfo.Clear();
+ mImpl->mTextUpdateInfo.mClearAll = true;
// Restore the actual control's width.
mImpl->mModel->mVisualModel->mControlSize.width = actualControlWidth;
// Restore the actual control's width.
mImpl->mModel->mVisualModel->mControlSize.width = actualControlWidth;
@@
-2164,12
+2172,14
@@
Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection()
if ( mImpl->mUpdateTextDirection )
{
// Operations that can be done only once until the text changes.
if ( mImpl->mUpdateTextDirection )
{
// Operations that can be done only once until the text changes.
- const OperationsMask onlyOnceOperations = static_cast<OperationsMask>( GET_SCRIPTS |
+ const OperationsMask onlyOnceOperations = static_cast<OperationsMask>( CONVERT_TO_UTF32 |
+ GET_SCRIPTS |
VALIDATE_FONTS |
GET_LINE_BREAKS |
GET_WORD_BREAKS |
BIDI_INFO |
VALIDATE_FONTS |
GET_LINE_BREAKS |
GET_WORD_BREAKS |
BIDI_INFO |
- SHAPE_TEXT );
+ SHAPE_TEXT |
+ GET_GLYPH_METRICS );
// Set the update info to relayout the whole text.
mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
// Set the update info to relayout the whole text.
mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
@@
-2184,6
+2194,9
@@
Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection()
LAYOUT | REORDER | UPDATE_DIRECTION ),
naturalSize.GetVectorXY() );
LAYOUT | REORDER | UPDATE_DIRECTION ),
naturalSize.GetVectorXY() );
+ // Do not do again the only once operations.
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending & ~onlyOnceOperations );
+
// Clear the update info. This info will be set the next time the text is updated.
mImpl->mTextUpdateInfo.Clear();
// Clear the update info. This info will be set the next time the text is updated.
mImpl->mTextUpdateInfo.Clear();
@@
-2390,7
+2403,7
@@
void Controller::KeyboardFocusGainEvent()
mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
mImpl->mEventData->mUpdateInputStyle = true;
}
mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
mImpl->mEventData->mUpdateInputStyle = true;
}
- mImpl->NotifyI
mf
MultiLineStatus();
+ mImpl->NotifyI
nputMethodContext
MultiLineStatus();
if( mImpl->IsShowingPlaceholderText() )
{
// Show alternative placeholder-text when editing
if( mImpl->IsShowingPlaceholderText() )
{
// Show alternative placeholder-text when editing
@@
-2549,7
+2562,7
@@
bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
}
else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
{
}
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
+ // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the
InputMethodContext
?) when the predictive text is enabled
// and a character is typed after the type of a upper case latin character.
// Do nothing.
// and a character is typed after the type of a upper case latin character.
// Do nothing.
@@
-2565,7
+2578,7
@@
bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
- // I
MF manager
is no longer handling key-events
+ // I
nputMethodContext
is no longer handling key-events
mImpl->ClearPreEditFlag();
InsertText( keyString, COMMIT );
mImpl->ClearPreEditFlag();
InsertText( keyString, COMMIT );
@@
-2582,9
+2595,9
@@
bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
( Dali::DALI_KEY_VOLUME_UP != keyCode ) &&
( Dali::DALI_KEY_VOLUME_DOWN != keyCode ) )
{
( Dali::DALI_KEY_VOLUME_UP != keyCode ) &&
( Dali::DALI_KEY_VOLUME_DOWN != keyCode ) )
{
- // Should not change the state if the key is the shift send by the
imf manager
.
+ // Should not change the state if the key is the shift send by the
InputMethodContext
.
// Otherwise, when the state is SELECTING the text controller can't send the right
// Otherwise, when the state is SELECTING the text controller can't send the right
- // surrounding info to the
imf
.
+ // surrounding info to the
InputMethodContext
.
mImpl->ChangeState( EventData::EDITING );
// Will request for relayout.
mImpl->ChangeState( EventData::EDITING );
// Will request for relayout.
@@
-2681,7
+2694,7
@@
void Controller::TapEvent( unsigned int tapCount, float x, float y )
}
// Reset keyboard as tap event has occurred.
}
// Reset keyboard as tap event has occurred.
- mImpl->ResetI
mfManager
();
+ mImpl->ResetI
nputMethodContext
();
}
void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
}
void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
@@
-2731,8
+2744,8
@@
void Controller::LongPressEvent( Gesture::State state, float x, float y )
}
else if( !mImpl->IsClipboardVisible() )
{
}
else if( !mImpl->IsClipboardVisible() )
{
- // Reset the
imf manager
to commit the pre-edit before selecting the text.
- mImpl->ResetI
mfManager
();
+ // Reset the
InputMethodContext
to commit the pre-edit before selecting the text.
+ mImpl->ResetI
nputMethodContext
();
Event event( Event::LONG_PRESS_EVENT );
event.p1.mInt = state;
Event event( Event::LONG_PRESS_EVENT );
event.p1.mInt = state;
@@
-2747,35
+2760,35
@@
void Controller::LongPressEvent( Gesture::State state, float x, float y )
}
}
}
}
-I
mfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imf
Event )
+I
nputMethodContext::CallbackData Controller::OnInputMethodContextEvent( InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContext
Event )
{
// Whether the text needs to be relaid-out.
bool requestRelayout = false;
{
// Whether the text needs to be relaid-out.
bool requestRelayout = false;
- // Whether to retrieve the text and cursor position to be sent to the I
MF manager
.
+ // Whether to retrieve the text and cursor position to be sent to the I
nputMethodContext
.
bool retrieveText = false;
bool retrieveCursor = false;
bool retrieveText = false;
bool retrieveCursor = false;
- switch( i
mf
Event.eventName )
+ switch( i
nputMethodContext
Event.eventName )
{
{
- case I
mfManager
::COMMIT:
+ case I
nputMethodContext
::COMMIT:
{
{
- InsertText( i
mf
Event.predictiveString, Text::Controller::COMMIT );
+ InsertText( i
nputMethodContext
Event.predictiveString, Text::Controller::COMMIT );
requestRelayout = true;
retrieveCursor = true;
break;
}
requestRelayout = true;
retrieveCursor = true;
break;
}
- case I
mfManager::PRE
EDIT:
+ case I
nputMethodContext::PRE_
EDIT:
{
{
- InsertText( i
mf
Event.predictiveString, Text::Controller::PRE_EDIT );
+ InsertText( i
nputMethodContext
Event.predictiveString, Text::Controller::PRE_EDIT );
requestRelayout = true;
retrieveCursor = true;
break;
}
requestRelayout = true;
retrieveCursor = true;
break;
}
- case I
mfManager::DELETE
SURROUNDING:
+ case I
nputMethodContext::DELETE_
SURROUNDING:
{
{
- const bool textDeleted = RemoveText( i
mf
Event.cursorOffset,
- i
mf
Event.numberOfChars,
+ const bool textDeleted = RemoveText( i
nputMethodContext
Event.cursorOffset,
+ i
nputMethodContext
Event.numberOfChars,
DONT_UPDATE_INPUT_STYLE );
if( textDeleted )
DONT_UPDATE_INPUT_STYLE );
if( textDeleted )
@@
-2796,20
+2809,20
@@
ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons
}
break;
}
}
break;
}
- case I
mfManager::GET
SURROUNDING:
+ case I
nputMethodContext::GET_
SURROUNDING:
{
retrieveText = true;
retrieveCursor = true;
break;
}
{
retrieveText = true;
retrieveCursor = true;
break;
}
- case I
mfManager::PRIVATE
COMMAND:
+ case I
nputMethodContext::PRIVATE_
COMMAND:
{
// PRIVATECOMMAND event is just for getting the private command message
retrieveText = true;
retrieveCursor = true;
break;
}
{
// PRIVATECOMMAND event is just for getting the private command message
retrieveText = true;
retrieveCursor = true;
break;
}
- case I
mfManager
::VOID:
+ case I
nputMethodContext
::VOID:
{
// do nothing
break;
{
// do nothing
break;
@@
-2857,7
+2870,7
@@
ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, cons
}
}
}
}
- I
mfManager::Imf
CallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
+ I
nputMethodContext::
CallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
if( requestRelayout &&
( NULL != mImpl->mEditableControlInterface ) )
if( requestRelayout &&
( NULL != mImpl->mEditableControlInterface ) )
@@
-2876,7
+2889,7
@@
void Controller::PasteClipboardItemEvent()
std::string stringToPaste( notifier.GetContent() );
// Commit the current pre-edit text; the contents of the clipboard should be appended
std::string stringToPaste( notifier.GetContent() );
// Commit the current pre-edit text; the contents of the clipboard should be appended
- mImpl->ResetI
mfManager
();
+ mImpl->ResetI
nputMethodContext
();
// Temporary disable hiding clipboard
mImpl->SetClipboardHideEnable( false );
// Temporary disable hiding clipboard
mImpl->SetClipboardHideEnable( false );
@@
-3068,7
+3081,7
@@
void Controller::InsertText( const std::string& text, Controller::InsertType typ
// TODO: At the moment the underline runs are only for pre-edit.
mImpl->mModel->mVisualModel->mUnderlineRuns.Clear();
// TODO: At the moment the underline runs are only for pre-edit.
mImpl->mModel->mVisualModel->mUnderlineRuns.Clear();
- // Remove the previous I
MF
pre-edit.
+ // Remove the previous I
nputMethodContext
pre-edit.
if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
{
removedPrevious = RemoveText( -static_cast<int>( mImpl->mEventData->mPrimaryCursorPosition - mImpl->mEventData->mPreEditStartPosition ),
if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
{
removedPrevious = RemoveText( -static_cast<int>( mImpl->mEventData->mPrimaryCursorPosition - mImpl->mEventData->mPreEditStartPosition ),
@@
-3115,10
+3128,10
@@
void Controller::InsertText( const std::string& text, Controller::InsertType typ
mImpl->ChangeState( EventData::EDITING );
mImpl->ChangeState( EventData::EDITING );
- // Handle the I
MF
(predicitive text) state changes
+ // Handle the I
nputMethodContext
(predicitive text) state changes
if( COMMIT == type )
{
if( COMMIT == type )
{
- // I
MF manager
is no longer handling key-events
+ // I
nputMethodContext
is no longer handling key-events
mImpl->ClearPreEditFlag();
}
else // PRE_EDIT
mImpl->ClearPreEditFlag();
}
else // PRE_EDIT
@@
-3292,7
+3305,7
@@
void Controller::InsertText( const std::string& text, Controller::InsertType typ
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "MaxLengthReached (%d)\n", mImpl->mModel->mLogicalModel->mText.Count() );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "MaxLengthReached (%d)\n", mImpl->mModel->mLogicalModel->mText.Count() );
- mImpl->ResetI
mfManager
();
+ mImpl->ResetI
nputMethodContext
();
if( NULL != mImpl->mEditableControlInterface )
{
if( NULL != mImpl->mEditableControlInterface )
{
@@
-3826,7
+3839,7
@@
bool Controller::DeleteEvent( int keyCode )
return removed;
}
return removed;
}
- // I
MF manager
is no longer handling key-events
+ // I
nputMethodContext
is no longer handling key-events
mImpl->ClearPreEditFlag();
if( EventData::SELECTING == mImpl->mEventData->mState )
mImpl->ClearPreEditFlag();
if( EventData::SELECTING == mImpl->mEventData->mState )