Merge "Fixed cursor behavior when no text is set" into devel/master
authorPaul Wisbey <p.wisbey@samsung.com>
Thu, 20 Aug 2015 16:38:36 +0000 (09:38 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 20 Aug 2015 16:38:36 +0000 (09:38 -0700)
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp

index 2f8d0e4..3e67d8c 100644 (file)
@@ -772,7 +772,6 @@ struct Decorator::Impl : public ConnectionTracker
 
         for( std::size_t v = 0; iter != endIter; ++iter,v+=4 )
         {
-
           QuadCoordinates& quad = *iter;
 
           // top-left (v+0)
@@ -846,7 +845,10 @@ struct Decorator::Impl : public ConnectionTracker
 
       mHighlightQuadList.clear();
 
-      mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
+      if( mHighlightRenderer )
+      {
+        mHighlightRenderer.SetDepthIndex( mTextDepth - 2u ); // text is rendered at mTextDepth and text's shadow at mTextDepth -1u.
+      }
     }
   }
 
index 4b1658c..3073611 100644 (file)
@@ -279,6 +279,12 @@ struct Controller::Impl
     return ( mEventData && mEventData->mIsShowingPlaceholderText );
   }
 
+  bool IsShowingRealText() const
+  {
+    return ( !IsShowingPlaceholderText() &&
+             0u != mLogicalModel->mText.Count() );
+  }
+
   /**
    * @brief Called when placeholder-text is hidden
    */
index 457a6c5..a47e824 100644 (file)
@@ -1390,11 +1390,10 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y )
 
   if( NULL != mImpl->mEventData )
   {
-    const bool isShowingPlaceholderText = mImpl->IsShowingPlaceholderText();
     if( 1u == tapCount )
     {
-      if( !isShowingPlaceholderText &&
-          ( EventData::EDITING == mImpl->mEventData->mState ) )
+      if( mImpl->IsShowingRealText() &&
+          EventData::EDITING == mImpl->mEventData->mState )
       {
         mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
       }
@@ -1412,11 +1411,13 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y )
 
       mImpl->RequestRelayout();
     }
-    else if( !isShowingPlaceholderText &&
-             mImpl->mEventData->mSelectionEnabled &&
-             ( 2u == tapCount ) )
+    else if( 2u == tapCount )
     {
-      SelectEvent( x, y, false );
+      if( mImpl->mEventData->mSelectionEnabled &&
+          mImpl->IsShowingRealText() )
+      {
+        SelectEvent( x, y, false );
+      }
     }
   }