Cursor fix. 00/39000/1
authorVictor Cebollada <v.cebollada@samsung.com>
Wed, 6 May 2015 11:18:20 +0000 (12:18 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Wed, 6 May 2015 11:25:37 +0000 (12:25 +0100)
Update the cursor position after all text is removed and
the place holder text appears.

Change-Id: I4455e5b382db195b5129cfd13c47c022811122c9
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller.cpp

index c50b753..4ce45eb 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/key.h>
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/key.h>
+#include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bidirectional-support.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bidirectional-support.h>
 namespace
 {
 
 namespace
 {
 
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
+#endif
+
 /**
  * @brief Some characters can be shaped in more than one glyph.
  * This struct is used to retrieve metrics from these group of glyphs.
 /**
  * @brief Some characters can be shaped in more than one glyph.
  * This struct is used to retrieve metrics from these group of glyphs.
@@ -138,9 +143,11 @@ EventData::~EventData()
 
 bool Controller::Impl::ProcessInputEvents()
 {
 
 bool Controller::Impl::ProcessInputEvents()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::ProcessInputEvents\n" );
   if( NULL == mEventData )
   {
     // Nothing to do if there is no text input.
   if( NULL == mEventData )
   {
     // Nothing to do if there is no text input.
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents no event data\n" );
     return false;
   }
 
     return false;
   }
 
@@ -235,6 +242,7 @@ bool Controller::Impl::ProcessInputEvents()
 
   mEventData->mEventQueue.clear();
 
 
   mEventData->mEventQueue.clear();
 
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents\n" );
   return mEventData->mDecoratorUpdated;
 }
 
   return mEventData->mDecoratorUpdated;
 }
 
@@ -1052,9 +1060,11 @@ CharacterIndex Controller::Impl::CalculateNewCursorIndex( CharacterIndex index )
 
 void Controller::Impl::UpdateCursorPosition()
 {
 
 void Controller::Impl::UpdateCursorPosition()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::UpdateCursorPosition %p\n", this );
   if( NULL == mEventData )
   {
     // Nothing to do if there is no text input.
   if( NULL == mEventData )
   {
     // Nothing to do if there is no text input.
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition no event data\n" );
     return;
   }
 
     return;
   }
 
@@ -1071,6 +1081,7 @@ void Controller::Impl::UpdateCursorPosition()
                                        cursorPosition.y,
                                        cursorInfo.primaryCursorHeight,
                                        cursorInfo.lineHeight );
                                        cursorPosition.y,
                                        cursorInfo.primaryCursorHeight,
                                        cursorInfo.lineHeight );
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Primary cursor position: %f,%f\n", cursorPosition.x, cursorPosition.y );
 
   // Sets the grab handle position.
   mEventData->mDecorator->SetPosition( GRAB_HANDLE,
 
   // Sets the grab handle position.
   mEventData->mDecorator->SetPosition( GRAB_HANDLE,
@@ -1086,11 +1097,13 @@ void Controller::Impl::UpdateCursorPosition()
                                          cursorInfo.secondaryPosition.y + offset.y,
                                          cursorInfo.secondaryCursorHeight,
                                          cursorInfo.lineHeight );
                                          cursorInfo.secondaryPosition.y + offset.y,
                                          cursorInfo.secondaryCursorHeight,
                                          cursorInfo.lineHeight );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + offset.x, cursorInfo.secondaryPosition.y + offset.y );
   }
   else
   {
     mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
   }
   }
   else
   {
     mEventData->mDecorator->SetActiveCursor( ACTIVE_CURSOR_PRIMARY );
   }
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition\n" );
 }
 
 void Controller::Impl::UpdateSelectionHandle( HandleType handleType )
 }
 
 void Controller::Impl::UpdateSelectionHandle( HandleType handleType )
index 61ca6e0..af06986 100644 (file)
@@ -452,6 +452,7 @@ const Vector2& Controller::GetAlignmentOffset() const
 
 Vector3 Controller::GetNaturalSize()
 {
 
 Vector3 Controller::GetNaturalSize()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetNaturalSize\n" );
   Vector3 naturalSize;
 
   // Make sure the model is up-to-date before layouting
   Vector3 naturalSize;
 
   // Make sure the model is up-to-date before layouting
@@ -459,8 +460,6 @@ Vector3 Controller::GetNaturalSize()
 
   if( mImpl->mRecalculateNaturalSize )
   {
 
   if( mImpl->mRecalculateNaturalSize )
   {
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetNaturalSize\n" );
-
     // Operations that can be done only once until the text changes.
     const OperationsMask onlyOnceOperations = static_cast<OperationsMask>( CONVERT_TO_UTF32  |
                                                                            GET_SCRIPTS       |
     // Operations that can be done only once until the text changes.
     const OperationsMask onlyOnceOperations = static_cast<OperationsMask>( CONVERT_TO_UTF32  |
                                                                            GET_SCRIPTS       |
@@ -501,7 +500,7 @@ Vector3 Controller::GetNaturalSize()
   {
     naturalSize = mImpl->mVisualModel->GetNaturalSize();
 
   {
     naturalSize = mImpl->mVisualModel->GetNaturalSize();
 
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
   }
 
   return naturalSize;
   }
 
   return naturalSize;
@@ -509,6 +508,7 @@ Vector3 Controller::GetNaturalSize()
 
 float Controller::GetHeightForWidth( float width )
 {
 
 float Controller::GetHeightForWidth( float width )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetHeightForWidth %p width %f\n", this, width );
   // Make sure the model is up-to-date before layouting
   ProcessModifyEvents();
 
   // Make sure the model is up-to-date before layouting
   ProcessModifyEvents();
 
@@ -542,10 +542,12 @@ float Controller::GetHeightForWidth( float width )
 
     // Do the size related operations again.
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | sizeOperations );
 
     // Do the size related operations again.
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | sizeOperations );
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height );
   }
   else
   {
     layoutSize = mImpl->mVisualModel->GetActualSize();
   }
   else
   {
     layoutSize = mImpl->mVisualModel->GetActualSize();
+    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth cached %f\n", layoutSize.height );
   }
 
   return layoutSize.height;
   }
 
   return layoutSize.height;
@@ -727,6 +729,7 @@ bool Controller::DoRelayout( const Size& size,
                              OperationsMask operationsRequired,
                              Size& layoutSize )
 {
                              OperationsMask operationsRequired,
                              Size& layoutSize )
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height );
   bool viewUpdated( false );
 
   // Calculate the operations to be done.
   bool viewUpdated( false );
 
   // Calculate the operations to be done.
@@ -743,6 +746,7 @@ bool Controller::DoRelayout( const Size& size,
     if( 0u == numberOfGlyphs )
     {
       // Nothing else to do if there is no glyphs.
     if( 0u == numberOfGlyphs )
     {
       // Nothing else to do if there is no glyphs.
+      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" );
       return true;
     }
 
       return true;
     }
 
@@ -858,6 +862,7 @@ bool Controller::DoRelayout( const Size& size,
     layoutSize = mImpl->mVisualModel->GetActualSize();
   }
 
     layoutSize = mImpl->mVisualModel->GetActualSize();
   }
 
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
   return viewUpdated;
 }
 
   return viewUpdated;
 }
 
@@ -996,6 +1001,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
         if( 0u == mImpl->mLogicalModel->mText.Count() )
         {
           ShowPlaceholderText();
         if( 0u == mImpl->mLogicalModel->mText.Count() )
         {
           ShowPlaceholderText();
+          mImpl->mEventData->mUpdateCursorPosition = true;
         }
         else
         {
         }
         else
         {