From: Paul Wisbey Date: Fri, 13 Mar 2015 10:58:56 +0000 (-0700) Subject: Merge "TextModel interface" into new_text X-Git-Tag: dali_1.0.38~11^2~59 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=21c8df56ea5b766c923c9c1d6bb1152c8c640616;hp=4152dcf2ef7de247e32a74c920ba364c5f32da60 Merge "TextModel interface" into new_text --- diff --git a/dali-toolkit/internal/text/logical-model.cpp b/dali-toolkit/internal/text/logical-model.cpp index b91b285..20cd630 100644 --- a/dali-toolkit/internal/text/logical-model.cpp +++ b/dali-toolkit/internal/text/logical-model.cpp @@ -105,6 +105,13 @@ Character LogicalModel::GetCharacter( CharacterIndex characterIndex ) const return mImpl->mText[characterIndex]; } +void LogicalModel::ReplaceText( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const Character* const text, + Length numberOfCharactersToInsert ) +{ +} + void LogicalModel::SetScripts( const ScriptRun* const scripts, Length numberOfRuns ) { @@ -215,6 +222,13 @@ Script LogicalModel::GetScript( CharacterIndex characterIndex ) const return TextAbstraction::UNKNOWN; } +void LogicalModel::ReplaceScripts( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const ScriptRun* const scriptRuns, + Length numberOfCharactersToInsert ) +{ +} + void LogicalModel::SetFonts( const FontRun* const fonts, Length numberOfRuns ) { @@ -323,6 +337,13 @@ FontId LogicalModel::GetFont( CharacterIndex characterIndex ) const return 0u; } +void LogicalModel::ReplaceFonts( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const FontRun* const fontRuns, + Length numberOfCharactersToInsert ) +{ +} + void LogicalModel::SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo, Length length ) { @@ -351,6 +372,13 @@ LineBreakInfo LogicalModel::GetLineBreakInfo( CharacterIndex characterIndex ) co return *( mImpl->mLineBreakInfo.Begin() + characterIndex ); } +void LogicalModel::ReplaceLineBreakInfo( CharacterIndex characterIndex, + Length numberOfItemsToRemove, + const LineBreakInfo* const lineBreakInfo, + Length numberOfItemsToInsert ) +{ +} + void LogicalModel::SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo, Length length ) { @@ -379,6 +407,13 @@ WordBreakInfo LogicalModel::GetWordBreakInfo( CharacterIndex characterIndex ) co return *( mImpl->mWordBreakInfo.Begin() + characterIndex ); } +void LogicalModel::ReplaceWordBreakInfo( CharacterIndex characterIndex, + Length numberOfItemsToRemove, + const WordBreakInfo* const wordBreakInfo, + Length numberOfItemsToInsert ) +{ +} + void LogicalModel::SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo, Length numberOfRuns ) { @@ -465,6 +500,13 @@ void LogicalModel::GetBidirectionalInfo( BidirectionalParagraphInfoRun* bidirect memcpy( bidirectionalInfo, modelBidirectionalParagraphInfo.Begin() + bidiCache.firstRun, bidiCache.numberOfRuns * sizeof( BidirectionalParagraphInfoRun ) ); } +void ReplaceBidirectionalInfo( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const BidirectionalParagraphInfoRun* const bidirectionalInfo, + Length numberOfCharactersToInsert ) +{ +} + void LogicalModel::GetCharacterDirections( CharacterDirection* directions, CharacterIndex characterIndex, Length numberOfCharacters ) const @@ -533,6 +575,13 @@ void LogicalModel::SetVisualToLogicalMap( const BidirectionalLineInfoRun* const } } +void LogicalModel::ReplaceVisualToLogicalMap( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const BidirectionalLineInfoRun* const bidirectionalInfo, + Length numberOfCharactersToInsert ) +{ +} + CharacterIndex LogicalModel::GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const { if( 0u == mImpl->mLogicalToVisualMap.Count() ) diff --git a/dali-toolkit/internal/text/logical-model.h b/dali-toolkit/internal/text/logical-model.h index 8e3f5df..43490d1 100644 --- a/dali-toolkit/internal/text/logical-model.h +++ b/dali-toolkit/internal/text/logical-model.h @@ -100,6 +100,22 @@ public: */ Character GetCharacter( CharacterIndex characterIndex ) const; + /** + * Replaces characters from the text. + * + * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. + * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Where to replace the text. + * @param[in] numberOfCharactersToRemove The number of characters to be removed. + * @param[in] text Pointer to a buffer with the text encoded in utf32. + * @param[in] numberOfCharactersToInsert The number of characters in the buffer. + */ + void ReplaceText( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const Character* const text, + Length numberOfCharactersToInsert ); + // Language support interface. /** @@ -154,6 +170,22 @@ public: Script GetScript( CharacterIndex characterIndex ) const; /** + * Replaces script runs for the given range of characters. + * + * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. + * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Index of the first character where to replace the scripts. + * @param[in] numberOfCharactersToRemove The number of characters to be the script removed. + * @param[in] scriptRuns Pointer to a buffer with the script runs. + * @param[in] numberOfCharactersToInsert The number of characters to be the script inserted. + */ + void ReplaceScripts( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const ScriptRun* const scriptRuns, + Length numberOfCharactersToInsert ); + + /** * Sets the font runs. * * Replaces any fonts previously set. @@ -204,6 +236,22 @@ public: */ FontId GetFont( CharacterIndex characterIndex ) const; + /** + * Replaces font runs for the given range of characters. + * + * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. + * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Index of the first character where to replace the fonts. + * @param[in] numberOfCharactersToRemove The number of characters to be the font removed. + * @param[in] fontRuns Pointer to a buffer with the font runs. + * @param[in] numberOfCharactersToInsert The number of characters to be the font inserted. + */ + void ReplaceFonts( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const FontRun* const fontRuns, + Length numberOfCharactersToInsert ); + // Break info interface. /** @@ -253,6 +301,24 @@ public: LineBreakInfo GetLineBreakInfo( CharacterIndex characterIndex ) const; /** + * Replaces line break info. + * + * See GetLineBreakInfo() to get how the line break info is encoded. + * + * If the @p numberOfItemsToRemove is zero, this operation is like an insert. + * If the @p numberOfItemsToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Where to replace the line break info. + * @param[in] numberOfItemsToRemove The number of items to be removed. + * @param[in] lineBreakInfo Pointer to a buffer with the line break info. + * @param[in] numberOfItemsToInsert The number of items in the buffer. + */ + void ReplaceLineBreakInfo( CharacterIndex characterIndex, + Length numberOfItemsToRemove, + const LineBreakInfo* const lineBreakInfo, + Length numberOfItemsToInsert ); + + /** * Sets the word break info. * * See GetWordBreakInfo() to get how the word break info is encoded. @@ -300,6 +366,24 @@ public: */ WordBreakInfo GetWordBreakInfo( CharacterIndex characterIndex ) const; + /** + * Replaces word break info. + * + * See GetWordBreakInfo() to get how the word break info is encoded. + * + * If the @p numberOfItemsToRemove is zero, this operation is like an insert. + * If the @p numberOfItemsToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Where to replace the word break info. + * @param[in] numberOfItemsToRemove The number of items to be removed. + * @param[in] wordBreakInfo Pointer to a buffer with the word break info. + * @param[in] numberOfItemsToInsert The number of items in the buffer. + */ + void ReplaceWordBreakInfo( CharacterIndex characterIndex, + Length numberOfItemsToRemove, + const WordBreakInfo* const wordBreakInfo, + Length numberOfItemsToInsert ); + // Bidirectional support interface. /** @@ -349,6 +433,22 @@ public: Length numberOfCharacters ) const; /** + * Replaces bidirectional info runs for the given range of characters. + * + * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. + * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Index of the first character where to replace the bidirectional info. + * @param[in] numberOfCharactersToRemove The number of characters to be the bidirectional info removed. + * @param[in] bidirectionalInfo Pointer to a buffer with the bidirectional info runs. + * @param[in] numberOfCharactersToInsert The number of characters to be the bidirectional info inserted. + */ + void ReplaceBidirectionalInfo( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const BidirectionalParagraphInfoRun* const bidirectionalInfo, + Length numberOfCharactersToInsert ); + + /** * Retrieves the direction of the characters. * * It sets @c true for right to left characters and @c false for left to right. @@ -393,6 +493,22 @@ public: Length numberOfRuns ); /** + * Replaces the visual to logical and logical to visual map tables for the given range of characters. + * + * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. + * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. + * + * @param[in] characterIndex Index of the first character where to replace the map tables. + * @param[in] numberOfCharactersToRemove The number of characters to be removed. + * @param[in] bidirectionalInfo Pointer to a buffer with the bidirectional info runs. + * @param[in] numberOfCharactersToInsert The number of characters to be inserted. + */ + void ReplaceVisualToLogicalMap( CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + const BidirectionalLineInfoRun* const bidirectionalInfo, + Length numberOfCharactersToInsert ); + + /** * Retrieves the visual character index for the given logical character index. * * @param[in] logicalCharacterIndex The logical character index. diff --git a/dali-toolkit/internal/text/visual-model.cpp b/dali-toolkit/internal/text/visual-model.cpp index 55d8797..e7015e0 100644 --- a/dali-toolkit/internal/text/visual-model.cpp +++ b/dali-toolkit/internal/text/visual-model.cpp @@ -173,6 +173,14 @@ const GlyphInfo& VisualModel::GetGlyphInfo( GlyphIndex glyphIndex ) const return mImpl->mGlyphs[glyphIndex]; } +void VisualModel::ReplaceGlyphs( GlyphIndex glyphIndex, + Length numberOfGlyphsToRemove, + const GlyphInfo* const glyphs, + const Length* const numberOfCharacters, + Length numberOfGlyphsToInsert ) +{ +} + CharacterIndex VisualModel::GetCharacterIndex( GlyphIndex glyphIndex ) const { return mImpl->mGlyphsToCharacters[glyphIndex]; @@ -253,6 +261,13 @@ const Vector2& VisualModel::GetGlyphPosition( GlyphIndex glyphIndex ) const return *( mImpl->mGlyphPositions.Begin() + glyphIndex ); } +void VisualModel::ReplaceGlyphPositions( GlyphIndex glyphIndex, + Length numberOfGlyphsToRemove, + const Vector2* const positions, + Length numberOfGlyphsToInsert ) +{ +} + void VisualModel::SetLines( const LineRun* const lines, Length numberOfLines ) { @@ -366,6 +381,13 @@ void VisualModel::GetLinesOfGlyphRange( LineRun* lines, memcpy( lines, modelLines.Begin() + lineCache.firstLine, lineCache.numberOfLines * sizeof( LineRun ) ); } +void VisualModel::ReplaceLines( GlyphIndex glyphIndex, + Length numberOfGlyphsToRemove, + const LineRun* const lines, + Length numberOfGlyphsToInsert ) +{ +} + void VisualModel::SetNaturalSize( const Vector2& size ) { mImpl->mNaturalSize = size; diff --git a/dali-toolkit/internal/text/visual-model.h b/dali-toolkit/internal/text/visual-model.h index 1a7120a..4dee216 100644 --- a/dali-toolkit/internal/text/visual-model.h +++ b/dali-toolkit/internal/text/visual-model.h @@ -104,6 +104,24 @@ public: */ const GlyphInfo& GetGlyphInfo( GlyphIndex glyphIndex ) const; + /** + * Replaces glyphs. + * + * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. + * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. + * + * @param[in] glyphIndex Where to replace the glyphs. + * @param[in] numberOfGlyphsToRemove The number of glyphs to be removed. + * @param[in] glyphs Pointer to a buffer with the new glyphs. + * @param[in] numberOfCharacters Pointer to a buffer with the number of characters per glyph. + * @param[in] numberOfGlyphsToInsert The number of new glyphs in the buffer. + */ + void ReplaceGlyphs( GlyphIndex glyphIndex, + Length numberOfGlyphsToRemove, + const GlyphInfo* const glyphs, + const Length* const numberOfCharacters, + Length numberOfGlyphsToInsert ); + // Character <--> Glyph conversion /** @@ -224,6 +242,22 @@ public: */ const Vector2& GetGlyphPosition( GlyphIndex glyphIndex ) const; + /** + * Replaces glyph's positions. + * + * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. + * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. + * + * @param[in] glyphIndex Where to replace the glyph's positions. + * @param[in] numberOfGlyphsToRemove The number of glyph's positions to be removed. + * @param[in] positions Pointer to a buffer with the new glyph's positions. + * @param[in] numberOfGlyphsToInsert The number of new glyph's positions in the buffer. + */ + void ReplaceGlyphPositions( GlyphIndex glyphIndex, + Length numberOfGlyphsToRemove, + const Vector2* const positions, + Length numberOfGlyphsToInsert ); + // Line interface. /** @@ -284,6 +318,22 @@ public: GlyphIndex glyphIndex, Length numberOfGlyphs ) const; + /** + * Replaces lines for the given range of glyphs. + * + * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. + * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. + * + * @param[in] glyphIndex Index of the first glyph where to replace the line info. + * @param[in] numberOfGlyphsToRemove The number of glyphs to be the line info removed. + * @param[in] lines Pointer to a buffer with the lines. + * @param[in] numberOfGlyphsToInsert The number of characters to be the line info inserted. + */ + void ReplaceLines( GlyphIndex glyphIndex, + Length numberOfGlyphsToRemove, + const LineRun* const lines, + Length numberOfGlyphsToInsert ); + // Size interface /**