// 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>
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.
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.
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents no event data\n" );
return false;
}
- mEventData->mDecoratorUpdated = false;
-
if( mEventData->mDecorator )
{
for( std::vector<Event>::iterator iter = mEventData->mEventQueue.begin();
{
switch( iter->type )
{
- case Event::KEYBOARD_FOCUS_GAIN_EVENT:
- {
- OnKeyboardFocus( true );
- break;
- }
- case Event::KEYBOARD_FOCUS_LOST_EVENT:
- {
- OnKeyboardFocus( false );
- break;
- }
case Event::CURSOR_KEY_EVENT:
{
OnCursorKeyEvent( *iter );
mEventData->mEventQueue.clear();
- return mEventData->mDecoratorUpdated;
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::ProcessInputEvents\n" );
+
+ bool decoratorUpdated = mEventData->mDecoratorUpdated;
+ mEventData->mDecoratorUpdated = false;
+ return decoratorUpdated;
}
void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
Vector<Character>& utf32Characters = mLogicalModel->mText;
- const Length numberOfCharacters = mLogicalModel->GetNumberOfCharacters();
+ const Length numberOfCharacters = utf32Characters.Count();
Vector<LineBreakInfo>& lineBreakInfo = mLogicalModel->mLineBreakInfo;
if( GET_LINE_BREAKS & operations )
}
}
-void Controller::Impl::OnKeyboardFocus( bool hasFocus )
-{
- if( NULL == mEventData )
- {
- // Nothing to do if there is no text input.
- return;
- }
-
- if( !hasFocus )
- {
- ChangeState( EventData::INACTIVE );
- }
- else
- {
- ChangeState( EventData::EDITING );
- }
-}
-
void Controller::Impl::OnCursorKeyEvent( const Event& event )
{
if( NULL == mEventData )
void Controller::Impl::OnTapEvent( const Event& event )
{
- if( NULL == mEventData )
+ if( NULL != mEventData )
{
- // Nothing to do if there is no text input.
- return;
- }
-
- const unsigned int tapCount = event.p1.mUint;
+ const unsigned int tapCount = event.p1.mUint;
- if( 1u == tapCount )
- {
- // Grab handle is not shown until a tap is received whilst EDITING
- if( EventData::EDITING == mEventData->mState &&
- !IsShowingPlaceholderText() )
+ if( 1u == tapCount )
{
- if( mEventData->mGrabHandleEnabled )
+ if( ! IsShowingPlaceholderText() )
{
- mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, true );
- }
- mEventData->mDecorator->SetPopupActive( false );
- }
-
- ChangeState( EventData::EDITING );
-
- const float xPosition = event.p2.mFloat - mEventData->mScrollPosition.x - mAlignmentOffset.x;
- const float yPosition = event.p3.mFloat - mEventData->mScrollPosition.y - mAlignmentOffset.y;
-
- mEventData->mPrimaryCursorPosition = GetClosestCursorIndex( xPosition,
- yPosition );
+ const float xPosition = event.p2.mFloat - mEventData->mScrollPosition.x - mAlignmentOffset.x;
+ const float yPosition = event.p3.mFloat - mEventData->mScrollPosition.y - mAlignmentOffset.y;
- mEventData->mUpdateCursorPosition = true;
- mEventData->mScrollAfterUpdateCursorPosition = true;
- }
- else if( mEventData->mSelectionEnabled &&
- ( 2u == tapCount ) )
- {
- ChangeState( EventData::SELECTING );
+ mEventData->mPrimaryCursorPosition = GetClosestCursorIndex( xPosition,
+ yPosition );
+ }
+ else
+ {
+ mEventData->mPrimaryCursorPosition = 0u;
+ }
- RepositionSelectionHandles( event.p2.mFloat, event.p3.mFloat );
+ mEventData->mUpdateCursorPosition = true;
+ mEventData->mScrollAfterUpdateCursorPosition = true;
+ }
+ else if( mEventData->mSelectionEnabled &&
+ ( 2u == tapCount ) )
+ {
+ RepositionSelectionHandles( event.p2.mFloat, event.p3.mFloat );
+ }
}
}
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.
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition no event data\n" );
return;
}
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,
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 );
}
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::UpdateCursorPosition\n" );
}
void Controller::Impl::UpdateSelectionHandle( HandleType handleType )