From: Paul Wisbey
Date: Mon, 7 Sep 2015 15:07:38 +0000 (-0700)
Subject: Merge "Initialise Controller's DefaultFont description to that of the Platform defaul...
X-Git-Tag: dali_1.1.2~2
X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=3480a42d70353c1975e53f07a492cf12cdd76578;hp=a97820c064ff542c5c5e5151e976c1495af1235e
Merge "Initialise Controller's DefaultFont description to that of the Platform default font" into devel/master
---
diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp
index a0302bc..6bcb90c 100644
--- a/dali-toolkit/internal/text/text-controller.cpp
+++ b/dali-toolkit/internal/text/text-controller.cpp
@@ -1574,21 +1574,38 @@ void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
void Controller::LongPressEvent( Gesture::State state, float x, float y )
{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected LongPressEvent" );
- if ( mImpl->IsShowingPlaceholderText() || mImpl->mLogicalModel->mText.Count() == 0u )
+ if( state == Gesture::Started &&
+ mImpl->mEventData )
{
- if ( mImpl->mEventData )
+ if( ! mImpl->IsShowingRealText() )
{
Event event( Event::LONG_PRESS_EVENT );
event.p1.mInt = state;
mImpl->mEventData->mEventQueue.push_back( event );
mImpl->RequestRelayout();
}
- }
- else if( mImpl->mEventData )
- {
- SelectEvent( x, y, false );
+ else
+ {
+ // The 1st long-press on inactive text-field is treated as tap
+ if( EventData::INACTIVE == mImpl->mEventData->mState )
+ {
+ mImpl->ChangeState( EventData::EDITING );
+
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = 1;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
+
+ mImpl->RequestRelayout();
+ }
+ else
+ {
+ SelectEvent( x, y, false );
+ }
+ }
}
}
@@ -1713,6 +1730,13 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
{
mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
mImpl->mOperationsPending = ALL_OPERATIONS;
+
+ // This is to reset the virtual keyboard to Upper-case
+ if( 0u == mImpl->mLogicalModel->mText.Count() )
+ {
+ NotifyImfManager();
+ }
+
if( 0u != mImpl->mLogicalModel->mText.Count() ||
!mImpl->IsPlaceholderAvailable() )
{
@@ -1876,6 +1900,12 @@ bool Controller::BackspaceKeyEvent()
if( removed )
{
+ // This is to reset the virtual keyboard to Upper-case
+ if( 0u == mImpl->mLogicalModel->mText.Count() )
+ {
+ NotifyImfManager();
+ }
+
if( 0u != mImpl->mLogicalModel->mText.Count() ||
!mImpl->IsPlaceholderAvailable() )
{
@@ -1891,6 +1921,22 @@ bool Controller::BackspaceKeyEvent()
return removed;
}
+void Controller::NotifyImfManager()
+{
+ ImfManager imfManager = ImfManager::Get();
+
+ if( imfManager )
+ {
+ // Notifying IMF of a cursor change triggers a surrounding text request so updating it now.
+ std::string text;
+ GetText( text );
+ imfManager.SetSurroundingText( text );
+
+ imfManager.SetCursorPosition( GetLogicalCursorPosition() );
+ imfManager.NotifyCursorPosition();
+ }
+}
+
void Controller::ShowPlaceholderText()
{
if( mImpl->IsPlaceholderAvailable() )
diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h
index e665ac2..3c6125d 100644
--- a/dali-toolkit/internal/text/text-controller.h
+++ b/dali-toolkit/internal/text/text-controller.h
@@ -643,6 +643,11 @@ private:
bool BackspaceKeyEvent();
/**
+ * @brief Helper to notify IMF manager with surrounding text & cursor changes.
+ */
+ void NotifyImfManager();
+
+ /**
* @brief Helper to clear font-specific data.
*/
void ShowPlaceholderText();