}
else
{
- CharacterIndex lastIndex = 0u;
+ Length numberOfCharactersToUpdate = 0u;
if( mTextUpdateInfo.mFullRelayoutNeeded )
{
- lastIndex = mTextUpdateInfo.mPreviousNumberOfCharacters;
+ numberOfCharactersToUpdate = mTextUpdateInfo.mPreviousNumberOfCharacters;
}
else
{
- lastIndex = ( mTextUpdateInfo.mNumberOfCharactersToRemove > 0u ) ? mTextUpdateInfo.mNumberOfCharactersToRemove : 1u;
+ numberOfCharactersToUpdate = ( mTextUpdateInfo.mNumberOfCharactersToRemove > 0u ) ? mTextUpdateInfo.mNumberOfCharactersToRemove : 1u;
}
mLogicalModel->FindParagraphs( mTextUpdateInfo.mCharacterIndex,
- lastIndex,
+ numberOfCharactersToUpdate,
paragraphsToBeUpdated );
}
void Controller::Impl::ClearFullModelData( OperationsMask operations )
{
- if( GET_LINE_BREAKS & operations )
+ if( NO_OPERATION != ( GET_LINE_BREAKS & operations ) )
{
mLogicalModel->mLineBreakInfo.Clear();
mLogicalModel->mParagraphInfo.Clear();
}
- if( GET_WORD_BREAKS & operations )
+ if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
{
mLogicalModel->mLineBreakInfo.Clear();
}
- if( GET_SCRIPTS & operations )
+ if( NO_OPERATION != ( GET_SCRIPTS & operations ) )
{
mLogicalModel->mScriptRuns.Clear();
}
- if( VALIDATE_FONTS & operations )
+ if( NO_OPERATION != ( VALIDATE_FONTS & operations ) )
{
mLogicalModel->mFontRuns.Clear();
}
if( 0u != mLogicalModel->mBidirectionalParagraphInfo.Count() )
{
- if( BIDI_INFO & operations )
+ if( NO_OPERATION != ( BIDI_INFO & operations ) )
{
mLogicalModel->mBidirectionalParagraphInfo.Clear();
mLogicalModel->mCharacterDirections.Clear();
}
- if( REORDER & operations )
+ if( NO_OPERATION != ( REORDER & operations ) )
{
// Free the allocated memory used to store the conversion table in the bidirectional line info run.
for( Vector<BidirectionalLineInfoRun>::Iterator it = mLogicalModel->mBidirectionalLineInfo.Begin(),
bidiLineInfo.visualToLogicalMap = NULL;
}
mLogicalModel->mBidirectionalLineInfo.Clear();
-
- mLogicalModel->mLogicalToVisualMap.Clear();
- mLogicalModel->mVisualToLogicalMap.Clear();
}
}
- if( SHAPE_TEXT & operations )
+ if( NO_OPERATION != ( SHAPE_TEXT & operations ) )
{
mVisualModel->mGlyphs.Clear();
mVisualModel->mGlyphsToCharacters.Clear();
mVisualModel->mGlyphPositions.Clear();
}
- if( LAYOUT & operations )
+ if( NO_OPERATION != ( LAYOUT & operations ) )
{
mVisualModel->mLines.Clear();
}
- if( COLOR & operations )
+ if( NO_OPERATION != ( COLOR & operations ) )
{
mVisualModel->mColorIndices.Clear();
}
{
const CharacterIndex endIndexPlusOne = endIndex + 1u;
- if( GET_LINE_BREAKS & operations )
+ if( NO_OPERATION != ( GET_LINE_BREAKS & operations ) )
{
// Clear the line break info.
LineBreakInfo* lineBreakInfoBuffer = mLogicalModel->mLineBreakInfo.Begin();
mLogicalModel->mParagraphInfo );
}
- if( GET_WORD_BREAKS & operations )
+ if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
{
// Clear the word break info.
WordBreakInfo* wordBreakInfoBuffer = mLogicalModel->mWordBreakInfo.Begin();
wordBreakInfoBuffer + endIndexPlusOne );
}
- if( GET_SCRIPTS & operations )
+ if( NO_OPERATION != ( GET_SCRIPTS & operations ) )
{
// Clear the scripts.
ClearCharacterRuns( startIndex,
mLogicalModel->mScriptRuns );
}
- if( VALIDATE_FONTS & operations )
+ if( NO_OPERATION != ( VALIDATE_FONTS & operations ) )
{
// Clear the fonts.
ClearCharacterRuns( startIndex,
if( 0u != mLogicalModel->mBidirectionalParagraphInfo.Count() )
{
- if( BIDI_INFO & operations )
+ if( NO_OPERATION != ( BIDI_INFO & operations ) )
{
// Clear the bidirectional paragraph info.
ClearCharacterRuns( startIndex,
characterDirectionsBuffer + endIndexPlusOne );
}
- if( REORDER & operations )
+ if( NO_OPERATION != ( REORDER & operations ) )
{
uint32_t startRemoveIndex = mLogicalModel->mBidirectionalLineInfo.Count();
uint32_t endRemoveIndex = startRemoveIndex;
mLogicalModel->mBidirectionalLineInfo.Erase( bidirectionalLineInfoBuffer + startRemoveIndex,
bidirectionalLineInfoBuffer + endRemoveIndex );
-
- // Clear the logical to visual and the visual to logical conversion tables.
- CharacterIndex* logicalToVisualMapBuffer = mLogicalModel->mLogicalToVisualMap.Begin();
- mLogicalModel->mLogicalToVisualMap.Erase( logicalToVisualMapBuffer + startIndex,
- logicalToVisualMapBuffer + endIndexPlusOne );
-
- CharacterIndex* visualToLogicalMapBuffer = mLogicalModel->mVisualToLogicalMap.Begin();
- mLogicalModel->mVisualToLogicalMap.Erase( visualToLogicalMapBuffer + startIndex,
- visualToLogicalMapBuffer + endIndexPlusOne );
}
}
}
const GlyphIndex endGlyphIndexPlusOne = *( charactersToGlyphBuffer + endIndex ) + *( glyphsPerCharacterBuffer + endIndex );
const Length numberOfGlyphsRemoved = endGlyphIndexPlusOne - mTextUpdateInfo.mStartGlyphIndex;
- if( SHAPE_TEXT & operations )
+ if( NO_OPERATION != ( SHAPE_TEXT & operations ) )
{
// Update the character to glyph indices.
for( Vector<GlyphIndex>::Iterator it = charactersToGlyphBuffer + endIndexPlusOne,
positionsBuffer + endGlyphIndexPlusOne );
}
- if( LAYOUT & operations )
+ if( NO_OPERATION != ( LAYOUT & operations ) )
{
// Clear the lines.
uint32_t startRemoveIndex = mVisualModel->mLines.Count();
linesBuffer + endRemoveIndex );
}
- if( COLOR & operations )
+ if( NO_OPERATION != ( COLOR & operations ) )
{
if( 0u != mVisualModel->mColorIndices.Count() )
{
if( mTextUpdateInfo.mClearAll ||
( 0u != paragraphCharacters ) )
{
- ClearModelData( startIndex, startIndex + ( ( paragraphCharacters > 0u ) ? paragraphCharacters - 1u : 0u ), operationsRequired );
+ ClearModelData( startIndex, startIndex + ( ( paragraphCharacters > 0u ) ? paragraphCharacters - 1u : 0u ), operations );
}
mTextUpdateInfo.mClearAll = false;
Vector<LineBreakInfo>& lineBreakInfo = mLogicalModel->mLineBreakInfo;
const Length requestedNumberOfCharacters = mTextUpdateInfo.mRequestedNumberOfCharacters;
- if( GET_LINE_BREAKS & operations )
+ if( NO_OPERATION != ( GET_LINE_BREAKS & operations ) )
{
// Retrieves the line break info. The line break info is used to split the text in 'paragraphs' to
// calculate the bidirectional info for each 'paragraph'.
}
Vector<WordBreakInfo>& wordBreakInfo = mLogicalModel->mWordBreakInfo;
- if( GET_WORD_BREAKS & operations )
+ if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
{
// Retrieves the word break info. The word break info is used to layout the text (where to wrap the text in lines).
wordBreakInfo.Resize( numberOfCharacters, TextAbstraction::WORD_NO_BREAK );
updated = true;
}
- const bool getScripts = GET_SCRIPTS & operations;
- const bool validateFonts = VALIDATE_FONTS & operations;
+ const bool getScripts = NO_OPERATION != ( GET_SCRIPTS & operations );
+ const bool validateFonts = NO_OPERATION != ( VALIDATE_FONTS & operations );
Vector<ScriptRun>& scripts = mLogicalModel->mScriptRuns;
Vector<FontRun>& validFonts = mLogicalModel->mFontRuns;
Vector<Character> mirroredUtf32Characters;
bool textMirrored = false;
const Length numberOfParagraphs = mLogicalModel->mParagraphInfo.Count();
- if( BIDI_INFO & operations )
+ if( NO_OPERATION != ( BIDI_INFO & operations ) )
{
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mLogicalModel->mBidirectionalParagraphInfo;
bidirectionalInfo.Reserve( numberOfParagraphs );
newParagraphGlyphs.Reserve( numberOfParagraphs );
const Length currentNumberOfGlyphs = glyphs.Count();
- if( SHAPE_TEXT & operations )
+ if( NO_OPERATION != ( SHAPE_TEXT & operations ) )
{
const Vector<Character>& textToShape = textMirrored ? mirroredUtf32Characters : utf32Characters;
// Shapes the text.
const Length numberOfGlyphs = glyphs.Count() - currentNumberOfGlyphs;
- if( GET_GLYPH_METRICS & operations )
+ if( NO_OPERATION != ( GET_GLYPH_METRICS & operations ) )
{
GlyphInfo* glyphsBuffer = glyphs.Begin();
mMetrics->GetGlyphMetrics( glyphsBuffer + mTextUpdateInfo.mStartGlyphIndex, numberOfGlyphs );
updated = true;
}
- if( COLOR & operationsRequired )
+ if( NO_OPERATION != ( COLOR & operations ) )
{
// Set the color runs in glyphs.
SetColorSegmentationInfo( mLogicalModel->mColorRuns,
void Controller::Impl::HideClipboard()
{
- if( mClipboard )
+ if( mClipboard && mClipboardHideEnabled )
{
mClipboard.HideClipboard();
}
}
+void Controller::Impl::SetClipboardHideEnable(bool enable)
+{
+ mClipboardHideEnabled = enable;
+}
+
bool Controller::Impl::CopyStringToClipboard( std::string& source )
{
//Send string to clipboard
const Vector<Vector2>& positions = mVisualModel->mGlyphPositions;
const Vector2* const positionsBuffer = positions.Begin();
- // Get the visual to logical conversion tables.
- const CharacterIndex* const visualToLogicalBuffer = ( 0u != mLogicalModel->mVisualToLogicalMap.Count() ) ? mLogicalModel->mVisualToLogicalMap.Begin() : NULL;
- const CharacterIndex* const visualToLogicalCursorBuffer = mLogicalModel->mVisualToLogicalCursorMap.Begin();
-
// Get the character to glyph conversion table.
const GlyphIndex* const charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
// Get the glyph's info buffer.
const GlyphInfo* const glyphInfoBuffer = mVisualModel->mGlyphs.Begin();
- // If the vector is void, there is no right to left characters.
- const bool hasRightToLeftCharacters = NULL != visualToLogicalBuffer;
-
const CharacterIndex startCharacter = line.characterRun.characterIndex;
const CharacterIndex endCharacter = line.characterRun.characterIndex + line.characterRun.numberOfCharacters;
DALI_ASSERT_DEBUG( endCharacter <= mLogicalModel->mText.Count() && "Invalid line info" );
for( ; !matched && ( visualIndex < endCharacter ); ++visualIndex )
{
// The character in logical order.
- const CharacterIndex characterLogicalOrderIndex = hasRightToLeftCharacters ? *( visualToLogicalBuffer + visualIndex ) : visualIndex;
+ const CharacterIndex characterLogicalOrderIndex = mLogicalModel->GetLogicalCharacterIndex( visualIndex );
// Get the script of the character.
const Script script = mLogicalModel->GetScript( characterLogicalOrderIndex );
{
// Get the first character/glyph of the group of glyphs.
const CharacterIndex firstVisualCharacterIndex = 1u + visualIndex - numberOfCharacters;
- const CharacterIndex firstLogicalCharacterIndex = hasRightToLeftCharacters ? *( visualToLogicalBuffer + firstVisualCharacterIndex ) : firstVisualCharacterIndex;
+ const CharacterIndex firstLogicalCharacterIndex = mLogicalModel->GetLogicalCharacterIndex( firstVisualCharacterIndex );
const GlyphIndex firstLogicalGlyphIndex = *( charactersToGlyphBuffer + firstLogicalCharacterIndex );
// Get the metrics for the group of glyphs.
}
-
// Return the logical position of the cursor in characters.
if( !matched )
visualIndex = endCharacter;
}
- logicalIndex = hasRightToLeftCharacters ? *( visualToLogicalCursorBuffer + visualIndex ) : visualIndex;
+ logicalIndex = mLogicalModel->GetLogicalCursorIndex( visualIndex );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "%p closest visualIndex %d logicalIndex %d\n", this, visualIndex, logicalIndex );
DALI_ASSERT_DEBUG( ( logicalIndex <= mLogicalModel->mText.Count() && logicalIndex >= 0 ) && "GetClosestCursorIndex - Out of bounds index" );