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
IMF to be notified after Backspace key pressed
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
text-controller-impl.cpp
diff --git
a/dali-toolkit/internal/text/text-controller-impl.cpp
b/dali-toolkit/internal/text/text-controller-impl.cpp
index
5ae3d7f
..
e533a3f
100644
(file)
--- a/
dali-toolkit/internal/text/text-controller-impl.cpp
+++ b/
dali-toolkit/internal/text/text-controller-impl.cpp
@@
-33,7
+33,7
@@
namespace
{
#if defined(DEBUG_ENABLED)
{
#if defined(DEBUG_ENABLED)
- Debug::Filter* gLogFilter = Debug::Filter::New(Debug::
Concise
, true, "LOG_TEXT_CONTROLS");
+ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::
NoLogging
, true, "LOG_TEXT_CONTROLS");
#endif
/**
#endif
/**
@@
-277,6
+277,8
@@
bool Controller::Impl::ProcessInputEvents()
void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
{
void Controller::Impl::UpdateModel( OperationsMask operationsRequired )
{
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::UpdateModel\n" );
+
// Calculate the operations to be done.
const OperationsMask operations = static_cast<OperationsMask>( mOperationsPending & operationsRequired );
// Calculate the operations to be done.
const OperationsMask operations = static_cast<OperationsMask>( mOperationsPending & operationsRequired );
@@
-461,6
+463,7
@@
void Controller::Impl::GetDefaultFonts( Vector<FontRun>& fonts, Length numberOfC
{
if( mFontDefaults )
{
{
if( mFontDefaults )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::GetDefaultFonts font family(%s)\n", mFontDefaults->mFontDescription.family.c_str() );
FontRun fontRun;
fontRun.characterRun.characterIndex = 0;
fontRun.characterRun.numberOfCharacters = numberOfCharacters;
FontRun fontRun;
fontRun.characterRun.characterIndex = 0;
fontRun.characterRun.numberOfCharacters = numberOfCharacters;
@@
-874,9
+877,11
@@
void Controller::Impl::RetrieveSelection( std::string& selectedText, bool delete
return;
}
return;
}
+ const bool handlesCrossed = mEventData->mLeftSelectionPosition > mEventData->mRightSelectionPosition;
+
//Get start and end position of selection
//Get start and end position of selection
- uint32_t startOfSelectedText = mEventData->mLeftSelectionPosition;
- uint32_t lengthOfSelectedText =
mEventData->mRightSelectionPosition
- startOfSelectedText;
+ uint32_t startOfSelectedText =
handlesCrossed ? mEventData->mRightSelectionPosition :
mEventData->mLeftSelectionPosition;
+ uint32_t lengthOfSelectedText =
( handlesCrossed ? mEventData->mLeftSelectionPosition : mEventData->mRightSelectionPosition )
- startOfSelectedText;
// Validate the start and end selection points
if( ( startOfSelectedText + lengthOfSelectedText ) <= mLogicalModel->mText.Count() )
// Validate the start and end selection points
if( ( startOfSelectedText + lengthOfSelectedText ) <= mLogicalModel->mText.Count() )
@@
-895,7
+900,7
@@
void Controller::Impl::RetrieveSelection( std::string& selectedText, bool delete
Vector<Character>::Iterator last = first + lengthOfSelectedText;
currentText.Erase( first, last );
}
Vector<Character>::Iterator last = first + lengthOfSelectedText;
currentText.Erase( first, last );
}
- mEventData->mPrimaryCursorPosition = mEventData->mLeftSelectionPosition;
+ mEventData->mPrimaryCursorPosition =
handlesCrossed ? mEventData->mRightSelectionPosition :
mEventData->mLeftSelectionPosition;
mEventData->mScrollAfterDelete = true;
mEventData->mDecoratorUpdated = true;
}
mEventData->mScrollAfterDelete = true;
mEventData->mDecoratorUpdated = true;
}
@@
-968,8
+973,16
@@
void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart
const LineRun& firstLine = *lines.Begin();
const float height = firstLine.ascender + -firstLine.descender;
const LineRun& firstLine = *lines.Begin();
const float height = firstLine.ascender + -firstLine.descender;
+ const bool isLastCharacter = selectionEnd >= mLogicalModel->mText.Count();
+ const bool startDirection = ( ( NULL == modelCharacterDirectionsBuffer ) ? false : *( modelCharacterDirectionsBuffer + selectionStart ) );
+ const bool endDirection = ( ( NULL == modelCharacterDirectionsBuffer ) ? false : *( modelCharacterDirectionsBuffer + ( selectionEnd - ( isLastCharacter ? 1u : 0u ) ) ) );
+
// Swap the indices if the start is greater than the end.
// Swap the indices if the start is greater than the end.
- const bool indicesSwapped = ( selectionStart > selectionEnd );
+ const bool indicesSwapped = selectionStart > selectionEnd;
+
+ // Tell the decorator to flip the selection handles if needed.
+ mEventData->mDecorator->SetSelectionHandleFlipState( indicesSwapped, startDirection, endDirection );
+
if( indicesSwapped )
{
std::swap( selectionStart, selectionEnd );
if( indicesSwapped )
{
std::swap( selectionStart, selectionEnd );
@@
-989,9
+1002,6
@@
void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart
const Length numberOfCharactersEnd = *( charactersPerGlyphBuffer + glyphEnd );
bool splitEndGlyph = ( glyphStart != glyphEnd ) && ( numberOfCharactersEnd > 1u ) && HasLigatureMustBreak( mLogicalModel->GetScript( selectionEndMinusOne ) );
const Length numberOfCharactersEnd = *( charactersPerGlyphBuffer + glyphEnd );
bool splitEndGlyph = ( glyphStart != glyphEnd ) && ( numberOfCharactersEnd > 1u ) && HasLigatureMustBreak( mLogicalModel->GetScript( selectionEndMinusOne ) );
- // Tell the decorator to swap the selection handles if needed.
- mEventData->mDecorator->SwapSelectionHandlesEnabled( firstLine.direction != indicesSwapped );
-
const Vector2 offset = mEventData->mScrollPosition + mAlignmentOffset;
// Traverse the glyphs.
const Vector2 offset = mEventData->mScrollPosition + mAlignmentOffset;
// Traverse the glyphs.
@@
-1076,7
+1086,7
@@
void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart
mEventData->mDecorator->SetPosition( RIGHT_SELECTION_HANDLE, secondaryPosition.x, secondaryPosition.y, secondaryCursorInfo.lineHeight );
// Cursor to be positioned at end of selection so if selection interrupted and edit mode restarted the cursor will be at end of selection
mEventData->mDecorator->SetPosition( RIGHT_SELECTION_HANDLE, secondaryPosition.x, secondaryPosition.y, secondaryCursorInfo.lineHeight );
// Cursor to be positioned at end of selection so if selection interrupted and edit mode restarted the cursor will be at end of selection
- mEventData->mPrimaryCursorPosition = (
indicesSwapped)?mEventData->mLeftSelectionPosition:
mEventData->mRightSelectionPosition;
+ mEventData->mPrimaryCursorPosition = (
indicesSwapped ) ? mEventData->mLeftSelectionPosition :
mEventData->mRightSelectionPosition;
// Set the flag to update the decorator.
mEventData->mDecoratorUpdated = true;
// Set the flag to update the decorator.
mEventData->mDecoratorUpdated = true;