Merge "Revert "Move Some Devel Properties & APIs to the Public API"" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.cpp
index 874503d..57e51d1 100644 (file)
@@ -108,7 +108,8 @@ EventData::EventData( DecoratorPtr decorator )
   mPasswordInput( false ),
   mIsPlaceholderPixelSize( false ),
   mIsPlaceholderElideEnabled( false ),
-  mPlaceholderEllipsisFlag( false )
+  mPlaceholderEllipsisFlag( false ),
+  mShiftSelectionFlag( true )
 {
   mImfManager = ImfManager::Get();
 }
@@ -888,7 +889,7 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
       TextAbstraction::FontDescription defaultFontDescription;
       TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
 
-      if( IsShowingPlaceholderText() && ( NULL != mEventData->mPlaceholderFont ) )
+      if( IsShowingPlaceholderText() && mEventData && ( NULL != mEventData->mPlaceholderFont ) )
       {
         // If the placeholder font is set specifically, only placeholder font is changed.
         defaultFontDescription = mEventData->mPlaceholderFont->mFontDescription;
@@ -1144,7 +1145,7 @@ float Controller::Impl::GetDefaultFontLineHeight()
 
 void Controller::Impl::OnCursorKeyEvent( const Event& event )
 {
-  if( NULL == mEventData )
+  if( NULL == mEventData || !IsShowingRealText() )
   {
     // Nothing to do if there is no text input.
     return;
@@ -1251,7 +1252,7 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
     mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
   }
 
-  if ( isShiftModifier && IsShowingRealText() )
+  if ( isShiftModifier && IsShowingRealText() && mEventData->mShiftSelectionFlag )
   {
     // Handle text selection
     bool selecting = false;
@@ -2291,7 +2292,7 @@ void Controller::Impl::RepositionSelectionHandles()
   const SelectionBoxInfo& firstSelectionBoxLineInfo = *( selectionBoxLinesInfo.Begin() );
   highLightPosition.y = firstSelectionBoxLineInfo.lineOffset;
 
-  mEventData->mDecorator->SetHighLightBox( highLightPosition, highLightSize );
+  mEventData->mDecorator->SetHighLightBox( highLightPosition, highLightSize, static_cast<float>( mModel->GetOutlineWidth() ) );
 
   if( !mEventData->mDecorator->IsSmoothHandlePanEnabled() )
   {
@@ -2711,6 +2712,13 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical,
   Text::GetCursorPosition( parameters,
                            cursorInfo );
 
+  // Adds Outline offset.
+  const float outlineWidth = static_cast<float>( mModel->GetOutlineWidth() );
+  cursorInfo.primaryPosition.x += outlineWidth;
+  cursorInfo.primaryPosition.y += outlineWidth;
+  cursorInfo.secondaryPosition.x += outlineWidth;
+  cursorInfo.secondaryPosition.y += outlineWidth;
+
   if( isMultiLine )
   {
     // If the text is editable and multi-line, the cursor position after a white space shouldn't exceed the boundaries of the text control.