projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JavaScript binding for new mesh APIs
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
text-controller.cpp
diff --git
a/dali-toolkit/internal/text/text-controller.cpp
b/dali-toolkit/internal/text/text-controller.cpp
index
89f0123
..
eddde06
100644
(file)
--- a/
dali-toolkit/internal/text/text-controller.cpp
+++ b/
dali-toolkit/internal/text/text-controller.cpp
@@
-89,7
+89,6
@@
void Controller::SetText( const std::string& text )
{
// If popup shown then hide it by switching to Editing state
if( ( EventData::SELECTING == mImpl->mEventData->mState ) ||
{
// If popup shown then hide it by switching to Editing state
if( ( EventData::SELECTING == mImpl->mEventData->mState ) ||
- ( EventData::SELECTION_CHANGED == mImpl->mEventData->mState ) ||
( EventData::EDITING_WITH_POPUP == mImpl->mEventData->mState ) ||
( EventData::EDITING_WITH_GRAB_HANDLE == mImpl->mEventData->mState ) )
{
( EventData::EDITING_WITH_POPUP == mImpl->mEventData->mState ) ||
( EventData::EDITING_WITH_GRAB_HANDLE == mImpl->mEventData->mState ) )
{
@@
-454,12
+453,12
@@
bool Controller::RemoveText( int cursorOffset, int numberOfChars )
cursorIndex = oldCursorIndex + cursorOffset;
}
cursorIndex = oldCursorIndex + cursorOffset;
}
- if( (
cursorIndex + numberOfChars
) > currentText.Count() )
+ if( (
cursorIndex + numberOfChars
) > currentText.Count() )
{
numberOfChars = currentText.Count() - cursorIndex;
}
{
numberOfChars = currentText.Count() - cursorIndex;
}
- if( (
cursorIndex + numberOfChars
) <= currentText.Count() )
+ if( (
cursorIndex + numberOfChars
) <= currentText.Count() )
{
Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
Vector<Character>::Iterator last = first + numberOfChars;
{
Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
Vector<Character>::Iterator last = first + numberOfChars;
@@
-1485,8
+1484,7
@@
bool Controller::RemoveSelectedText()
{
bool textRemoved( false );
{
bool textRemoved( false );
- if ( EventData::SELECTING == mImpl->mEventData->mState ||
- EventData::SELECTION_CHANGED == mImpl->mEventData->mState )
+ if( EventData::SELECTING == mImpl->mEventData->mState )
{
std::string removedString;
mImpl->RetrieveSelection( removedString, true );
{
std::string removedString;
mImpl->RetrieveSelection( removedString, true );
@@
-1522,7
+1520,7
@@
void Controller::TapEvent( unsigned int tapCount, float x, float y )
else if( EventData::EDITING != mImpl->mEventData->mState &&
EventData::EDITING_WITH_GRAB_HANDLE != mImpl->mEventData->mState )
{
else if( EventData::EDITING != mImpl->mEventData->mState &&
EventData::EDITING_WITH_GRAB_HANDLE != mImpl->mEventData->mState )
{
- if( mImpl->IsShowingPlaceholderText() && !
mImpl->IsFocusedPlaceholderAvailable() )
+ if( mImpl->IsShowingPlaceholderText() && !mImpl->IsFocusedPlaceholderAvailable() )
{
// Hide placeholder text
ResetText();
{
// Hide placeholder text
ResetText();
@@
-1623,14
+1621,7
@@
void Controller::SelectEvent( float x, float y, bool selectAll )
{
if( mImpl->mEventData )
{
{
if( mImpl->mEventData )
{
- if ( mImpl->mEventData->mState == EventData::SELECTING )
- {
- mImpl->ChangeState( EventData::SELECTION_CHANGED );
- }
- else
- {
- mImpl->ChangeState( EventData::SELECTING );
- }
+ mImpl->ChangeState( EventData::SELECTING );
if( selectAll )
{
if( selectAll )
{
@@
-1718,12
+1709,21
@@
void Controller::PasteText( const std::string& stringToPaste )
InsertText( stringToPaste, Text::Controller::COMMIT );
mImpl->ChangeState( EventData::EDITING );
mImpl->RequestRelayout();
InsertText( stringToPaste, Text::Controller::COMMIT );
mImpl->ChangeState( EventData::EDITING );
mImpl->RequestRelayout();
+
+ // Do this last since it provides callbacks into application code
+ mImpl->mControlInterface.TextChanged();
}
void Controller::PasteClipboardItemEvent()
{
}
void Controller::PasteClipboardItemEvent()
{
+ // Retrieve the clipboard contents first
ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
std::string stringToPaste( notifier.GetContent() );
ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
std::string stringToPaste( notifier.GetContent() );
+
+ // Commit the current pre-edit text; the contents of the clipboard should be appended
+ mImpl->ResetImfManager();
+
+ // Paste
PasteText( stringToPaste );
}
PasteText( stringToPaste );
}
@@
-1806,7
+1806,7
@@
void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
{
ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
{
- bool update
( false )
;
+ bool update
= false
;
bool requestRelayout = false;
std::string text;
bool requestRelayout = false;
std::string text;
@@
-1898,8
+1898,7
@@
bool Controller::BackspaceKeyEvent()
bool removed( false );
bool removed( false );
- if ( EventData::SELECTING == mImpl->mEventData->mState ||
- EventData::SELECTION_CHANGED == mImpl->mEventData->mState )
+ if( EventData::SELECTING == mImpl->mEventData->mState )
{
removed = RemoveSelectedText();
}
{
removed = RemoveSelectedText();
}
@@
-1935,17
+1934,15
@@
void Controller::NotifyImfManager()
{
if( mImpl->mEventData )
{
{
if( mImpl->mEventData )
{
- ImfManager imfManager = ImfManager::Get();
-
- if( imfManager )
+ if( mImpl->mEventData->mImfManager )
{
// Notifying IMF of a cursor change triggers a surrounding text request so updating it now.
std::string text;
GetText( text );
{
// Notifying IMF of a cursor change triggers a surrounding text request so updating it now.
std::string text;
GetText( text );
-
i
mfManager.SetSurroundingText( text );
+
mImpl->mEventData->mI
mfManager.SetSurroundingText( text );
-
i
mfManager.SetCursorPosition( GetLogicalCursorPosition() );
-
i
mfManager.NotifyCursorPosition();
+
mImpl->mEventData->mI
mfManager.SetCursorPosition( GetLogicalCursorPosition() );
+
mImpl->mEventData->mI
mfManager.NotifyCursorPosition();
}
}
}
}
}
}