From: Paul Wisbey Date: Wed, 4 Mar 2015 10:34:40 +0000 (-0800) Subject: Merge "Text segmentation interface" into new_text X-Git-Tag: new_text_0.1~24 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=6516c90c9e264cf0a682aff36cb9bc5f1964b3e2;hp=74823f7eeaab6369be99032467f30465503de51d Merge "Text segmentation interface" into new_text --- diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index c4a636e..03dcf44 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include // INTERNAL INCLUDES @@ -43,16 +44,17 @@ namespace Dali namespace Toolkit { -const Property::Index TextField::PROPERTY_RENDERING_BACKEND( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX ); -const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 ); -const Property::Index TextField::PROPERTY_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 ); -const Property::Index TextField::PROPERTY_CURSOR_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 ); -const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 ); -const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 ); -const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 ); -const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 ); -const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 ); -const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 9 ); +const Property::Index TextField::PROPERTY_RENDERING_BACKEND( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX ); +const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 ); +const Property::Index TextField::PROPERTY_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 ); +const Property::Index TextField::PROPERTY_CURSOR_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 ); +const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 ); +const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 ); +const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 ); +const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 ); +const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 ); +const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 9 ); +const Property::Index TextField::PROPERTY_DECORATION_BOUNDING_BOX( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 10 ); namespace Internal { @@ -68,17 +70,17 @@ BaseHandle Create() TypeRegistration mType( typeid(Toolkit::TextField), typeid(Toolkit::Control), Create ); -PropertyRegistration property01( mType, "rendering-backend", Toolkit::TextField::PROPERTY_RENDERING_BACKEND, Property::INTEGER, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property02( mType, "placeholder-text", Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property03( mType, "text", Toolkit::TextField::PROPERTY_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property04( mType, "cursor-image", Toolkit::TextField::PROPERTY_CURSOR_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property05( mType, "primary-cursor-color", Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property06( mType, "secondary-cursor-color", Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property07( mType, "enable-cursor-blink", Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK, Property::BOOLEAN, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property08( mType, "cursor-blink-interval", Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property09( mType, "cursor-blink-duration", Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty ); -PropertyRegistration property10( mType, "grab-handle-image", Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); - +PropertyRegistration property01( mType, "rendering-backend", Toolkit::TextField::PROPERTY_RENDERING_BACKEND, Property::INTEGER, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property02( mType, "placeholder-text", Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property03( mType, "text", Toolkit::TextField::PROPERTY_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property04( mType, "cursor-image", Toolkit::TextField::PROPERTY_CURSOR_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property05( mType, "primary-cursor-color", Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property06( mType, "secondary-cursor-color", Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property07( mType, "enable-cursor-blink", Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK, Property::BOOLEAN, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property08( mType, "cursor-blink-interval", Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property09( mType, "cursor-blink-duration", Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property10( mType, "grab-handle-image", Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty ); +PropertyRegistration property11( mType, "decoration bounding-box", Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX, Property::RECTANGLE, &TextField::SetProperty, &TextField::GetProperty ); } // namespace Toolkit::TextField TextField::New() @@ -193,6 +195,14 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX: + { + if( impl.mDecorator ) + { + impl.mDecorator->SetBoundingBox( value.Get< Rect >() ); + } + break; + } } } } @@ -285,6 +295,14 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX: + { + if( impl.mDecorator ) + { + value = impl.mDecorator->GetBoundingBox(); + } + break; + } } } @@ -309,6 +327,13 @@ void TextField::OnInitialize() mDoubleTapDetector.SetTapsRequired( 2 ); mDoubleTapDetector.DetectedSignal().Connect( this, &TextField::OnDoubleTap ); mDoubleTapDetector.Attach(Self()); + + // Set BoundingBox to stage size if not already set. + if ( mDecorator->GetBoundingBox().IsEmpty() ) + { + Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); + mDecorator->SetBoundingBox( Rect( 0.0f, 0.0f, stageSize.width, stageSize.height ) ); + } } void TextField::OnRelayout( const Vector2& size, ActorSizeContainer& container ) diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index f6a9a22..27d0ee2 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp @@ -353,6 +353,13 @@ void MultilanguageSupport::SetScripts( const Vector& text, } } +void MultilanguageSupport::ReplaceScripts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ +} + void MultilanguageSupport::ValidateFonts( const Vector& text, const Vector& scripts, Vector& fonts ) @@ -528,6 +535,13 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, } } +void MultilanguageSupport::ValidateFonts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ +} + } // namespace Internal } // namespace Text diff --git a/dali-toolkit/internal/text/multi-language-support-impl.h b/dali-toolkit/internal/text/multi-language-support-impl.h index 643dea3..65933b5 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.h +++ b/dali-toolkit/internal/text/multi-language-support-impl.h @@ -96,13 +96,29 @@ public: void SetScripts( const Vector& text, const Vector& lineBreakInfo, Vector& scripts ); + + /** + * @copydoc Dali::MultilanguageSupport::ReplaceScripts() + */ + void ReplaceScripts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); + /** - * @copydoc Dali::MultilanguageSupport::ValidateFonts() + * @copydoc Dali::MultilanguageSupport::ValidateFonts( const Vector& text, const Vector& scripts, Vector& fonts ) */ void ValidateFonts( const Vector& text, const Vector& scripts, Vector& fonts ); + /** + * @copydoc Dali::MultilanguageSupport::ValidateFonts( LogicalModel& model, CharacterIndex characterIndex, Length numberOfCharactersToRemove, Length numberOfCharactersToInsert ) + */ + void ValidateFonts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); private: Vector mDefaultFontPerScriptCache; ///< Caches the default font for a script. Vector mValidFontsPerScriptCache; ///< Caches valid fonts for a script. diff --git a/dali-toolkit/public-api/controls/text-controls/text-field.cpp b/dali-toolkit/public-api/controls/text-controls/text-field.cpp index bbe9d1f..397f6a5 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-field.cpp +++ b/dali-toolkit/public-api/controls/text-controls/text-field.cpp @@ -37,6 +37,7 @@ const std::string TextField::ENABLE_CURSOR_BLINK_PROPERTY_NAME("enable-cursor-bl const std::string TextField::CURSOR_BLINK_INTERVAL_PROPERTY_NAME("cursor-blink-interval"); const std::string TextField::CURSOR_BLINK_DURATION_PROPERTY_NAME("cursor-blink-duration"); const std::string TextField::GRAB_HANDLE_IMAGE_PROPERTY_NAME("grab-handle-image"); +const std::string TextField::DECORATION_BOUNDING_BOX("decoration-bounding-box"); TextField TextField::New() { diff --git a/dali-toolkit/public-api/controls/text-controls/text-field.h b/dali-toolkit/public-api/controls/text-controls/text-field.h index 293e293..4d97b03 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-field.h +++ b/dali-toolkit/public-api/controls/text-controls/text-field.h @@ -41,28 +41,30 @@ class DALI_IMPORT_API TextField : public Control public: // Property indices - static const Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type INT - static const Property::Index PROPERTY_PLACEHOLDER_TEXT; ///< name "placeholder-text", type STRING - static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING - static const Property::Index PROPERTY_CURSOR_IMAGE; ///< name "cursor-image", type STRING - static const Property::Index PROPERTY_PRIMARY_CURSOR_COLOR; ///< name "primary-cursor-color", type VECTOR4 - static const Property::Index PROPERTY_SECONDARY_CURSOR_COLOR; ///< name "secondary-cursor-color", type VECTOR4 - static const Property::Index PROPERTY_ENABLE_CURSOR_BLINK; ///< name "enable-cursor-blink", type BOOLEAN - static const Property::Index PROPERTY_CURSOR_BLINK_INTERVAL; ///< name "cursor-blink-interval", type FLOAT - static const Property::Index PROPERTY_CURSOR_BLINK_DURATION; ///< name "cursor-blink-duration", type FLOAT - static const Property::Index PROPERTY_GRAB_HANDLE_IMAGE; ///< name "grab-handle-image", type STRING + static const Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type INT + static const Property::Index PROPERTY_PLACEHOLDER_TEXT; ///< name "placeholder-text", type STRING + static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING + static const Property::Index PROPERTY_CURSOR_IMAGE; ///< name "cursor-image", type STRING + static const Property::Index PROPERTY_PRIMARY_CURSOR_COLOR; ///< name "primary-cursor-color", type VECTOR4 + static const Property::Index PROPERTY_SECONDARY_CURSOR_COLOR; ///< name "secondary-cursor-color", type VECTOR4 + static const Property::Index PROPERTY_ENABLE_CURSOR_BLINK; ///< name "enable-cursor-blink", type BOOLEAN + static const Property::Index PROPERTY_CURSOR_BLINK_INTERVAL; ///< name "cursor-blink-interval", type FLOAT + static const Property::Index PROPERTY_CURSOR_BLINK_DURATION; ///< name "cursor-blink-duration", type FLOAT + static const Property::Index PROPERTY_GRAB_HANDLE_IMAGE; ///< name "grab-handle-image", type STRING + static const Property::Index PROPERTY_DECORATION_BOUNDING_BOX; ///< name "decoration-bounding-box", type RECTANGLE // Property names - static const std::string RENDERING_BACKEND_PROPERTY_NAME; ///< Property, name "rendering-backend", type INT - static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME; ///< Property, name "placeholder-text", type STRING - static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING - static const std::string CURSOR_IMAGE_PROPERTY_NAME; ///< Property, name "cursor-image", type STRING - static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "primary-cursor-color", type VECTOR4 - static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color", type VECTOR4 - static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME; ///< Property, name "enable-cursor-blink", type BOOLEAN - static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME; ///< Property, name "cursor-blink-interval", type FLOAT - static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME; ///< Property, name "cursor-blink-duration", type FLOAT - static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME; ///< Property, name "grab-handle-image", type STRING + static const std::string RENDERING_BACKEND_PROPERTY_NAME; ///< Property, name "rendering-backend", type INT + static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME; ///< Property, name "placeholder-text", type STRING + static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING + static const std::string CURSOR_IMAGE_PROPERTY_NAME; ///< Property, name "cursor-image", type STRING + static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "primary-cursor-color", type VECTOR4 + static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color", type VECTOR4 + static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME; ///< Property, name "enable-cursor-blink", type BOOLEAN + static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME; ///< Property, name "cursor-blink-interval", type FLOAT + static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME; ///< Property, name "cursor-blink-duration", type FLOAT + static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME; ///< Property, name "grab-handle-image", type STRING + static const std::string DECORATION_BOUNDING_BOX; ///< Property, name "decoration-bounding-box", type RECTANGLE /** * Create the TextField control. diff --git a/dali-toolkit/public-api/text/bidirectional-support.cpp b/dali-toolkit/public-api/text/bidirectional-support.cpp index c3b2a52..02645f4 100644 --- a/dali-toolkit/public-api/text/bidirectional-support.cpp +++ b/dali-toolkit/public-api/text/bidirectional-support.cpp @@ -33,12 +33,27 @@ void SetBidirectionalInfo( const Vector& text, { } +void ReplaceBidirectionalInfo( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ +} + void ReorderLines( const Vector& bidirectionalInfo, const Vector& lineRuns, Vector& lineInfoRuns ) { } +void ReorderLines( LogicalModel& logicalModel, + const VisualModel& visualModel, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ +} + } // namespace Text } // namespace Toolkit diff --git a/dali-toolkit/public-api/text/bidirectional-support.h b/dali-toolkit/public-api/text/bidirectional-support.h index 178c319..e45fc06 100644 --- a/dali-toolkit/public-api/text/bidirectional-support.h +++ b/dali-toolkit/public-api/text/bidirectional-support.h @@ -47,6 +47,25 @@ void SetBidirectionalInfo( const Vector& text, Vector& bidirectionalInfo ); /** + * Replaces the bidirectional info from the logical model. + * + * @pre The @p model needs to have a text set. + * @pre The @p model needs to have the line break info set. + * + * 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,out] model The text's logical model. + * @param[in] characterIndex Index to the first character. + * @param[in] numberOfCharactersToRemove The number of characters removed from the text. + * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + */ +void ReplaceBidirectionalInfo( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); + +/** * Sets the visual to logical and logical to visual map tables. * * Any map tables previously set are removed. @@ -63,6 +82,28 @@ void ReorderLines( const Vector& bidirectionalInf const Vector& lineRuns, Vector& lineInfoRuns ); +/** + * Replaces the visual to logical and logical to visual map tables. + * + * @pre The @p logicalModel needs to have a text set. + * @pre The @p logicalModel needs to have the line break info set. + * @pre The @p visualModel needs to have the laid-out lines info set. + * + * 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,out] logicalModel The text's logical model. + * @param[in] visualModel The text's visual model. + * @param[in] characterIndex Index to the first character. + * @param[in] numberOfCharactersToRemove The number of characters removed from the text. + * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + */ +void ReorderLines( LogicalModel& logicalModel, + const VisualModel& visualModel, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); + } // namespace Text } // namespace Toolkit diff --git a/dali-toolkit/public-api/text/decorator/text-decorator.cpp b/dali-toolkit/public-api/text/decorator/text-decorator.cpp index 148fbc8..0b15b49 100644 --- a/dali-toolkit/public-api/text/decorator/text-decorator.cpp +++ b/dali-toolkit/public-api/text/decorator/text-decorator.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +57,7 @@ const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.5f, 2.0f, 1.0f ); const Dali::Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.5f, 1.5f, 1.0f ); const std::size_t CURSOR_BLINK_INTERVAL = 500; // Cursor blink interval +const std::size_t MILLISECONDS = 1000; } // end of namespace @@ -116,10 +118,11 @@ struct Decorator::Impl : public ConnectionTracker mActiveGrabHandle(false), mActiveSelection( false ), mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ), - mCursorBlinkDuration(0.0f), + mCursorBlinkDuration( 0.0f ), mCursorBlinkStatus( true ), - mGrabDisplacementX(0.0f), - mGrabDisplacementY(0.0f) + mGrabDisplacementX( 0.0f ), + mGrabDisplacementY( 0.0f ), + mBoundingBox( Rect() ) { } @@ -467,7 +470,7 @@ struct Decorator::Impl : public ConnectionTracker TapGestureDetector mTapDetector; PanGestureDetector mPanGestureDetector; - + Rect mBoundingBox; }; DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer ) @@ -475,6 +478,16 @@ DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer ) return DecoratorPtr( new Decorator(parent, observer) ); } +void Decorator::SetBoundingBox( const Rect& boundingBox ) +{ + mImpl->mBoundingBox = boundingBox; +} + +const Rect& Decorator::GetBoundingBox() const +{ + return mImpl->mBoundingBox; +} + void Decorator::Relayout( const Vector2& size ) { mImpl->Relayout( size ); @@ -554,7 +567,7 @@ void Decorator::StopCursorBlink() void Decorator::SetCursorBlinkInterval( float seconds ) { - mImpl->mCursorBlinkInterval = seconds*1000; // Convert to milliseconds + mImpl->mCursorBlinkInterval = seconds*MILLISECONDS; // Convert to milliseconds } float Decorator::GetCursorBlinkInterval() const diff --git a/dali-toolkit/public-api/text/decorator/text-decorator.h b/dali-toolkit/public-api/text/decorator/text-decorator.h index 144f0ef..4038d3f 100644 --- a/dali-toolkit/public-api/text/decorator/text-decorator.h +++ b/dali-toolkit/public-api/text/decorator/text-decorator.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include namespace Dali { @@ -128,6 +129,36 @@ public: static DecoratorPtr New( Dali::Toolkit::Internal::Control& parent, Observer& observer ); /** + * @brief Set the bounding box which handles, popup and similar decorations will not exceed. + * + * The default value is the width and height of the stage from the top left origin. + * If a title bar for example is on the top of the screen then the y should be the title's height and + * the boundary height the stage height minus the title's height. + * Restrictions - The boundary box should be set up with a fixed z position for the text-input and the default camera. + * + * ------------------------------------------ + * |(x,y) | + * |o---------------------------------------| + * || || + * || Bounding Box || boundary height + * || || + * |----------------------------------------| + * ------------------------------------------ + * boundary width + * + * @param[in] boundingBox Vector( x coordinate, y coordinate, width, height ) + */ + void SetBoundingBox( const Rect& boundingBox ); + + /** + * @brief Retrieve the bounding box origin and dimensions. + * + * default is set once control is added to stage, before this the return vector will be Vector4:ZERO + * @return Rect the bounding box origin, width and height + */ + const Rect& GetBoundingBox() const; + + /** * @brief The decorator waits until a relayout before creating actors etc. * * @param[in] size The size of the parent control after size-negotiation. diff --git a/dali-toolkit/public-api/text/multi-language-support.cpp b/dali-toolkit/public-api/text/multi-language-support.cpp index b9edd83..1d43f37 100644 --- a/dali-toolkit/public-api/text/multi-language-support.cpp +++ b/dali-toolkit/public-api/text/multi-language-support.cpp @@ -57,6 +57,17 @@ void MultilanguageSupport::SetScripts( const Vector& text, scripts ); } +void MultilanguageSupport::ReplaceScripts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ + GetImplementation( *this ).ReplaceScripts( model, + characterIndex, + numberOfCharactersToRemove, + numberOfCharactersToInsert ); +} + void MultilanguageSupport::ValidateFonts( const Vector& text, const Vector& scripts, Vector& fonts ) @@ -66,6 +77,17 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, fonts ); } +void MultilanguageSupport::ValidateFonts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ + GetImplementation( *this ).ValidateFonts( model, + characterIndex, + numberOfCharactersToRemove, + numberOfCharactersToInsert ); +} + } // namespace Text } // namespace Toolkit diff --git a/dali-toolkit/public-api/text/multi-language-support.h b/dali-toolkit/public-api/text/multi-language-support.h index 531fdad..36eb349 100644 --- a/dali-toolkit/public-api/text/multi-language-support.h +++ b/dali-toolkit/public-api/text/multi-language-support.h @@ -97,6 +97,24 @@ public: Vector& scripts ); /** + * Replaces the scrips of the given range of characters. + * + * @pre The @p model needs to have a text set. + * + * 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,out] model The text's logical model. + * @param[in] characterIndex Index to the first character. + * @param[in] numberOfCharactersToRemove The number of characters removed from the text. + * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + */ + void ReplaceScripts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); + + /** * @brief Validates the character's font of the whole text. * * It may update fonts set by application developers. @@ -116,6 +134,28 @@ public: void ValidateFonts( const Vector& text, const Vector& scripts, Vector& fonts ); + + /** + * Validates the character's font of the given range of characters. + * + * It may update fonts set by the mark-up processor. + * It sets default fonts based on the script to those characters without a font set. + * + * @pre The @p model needs to have a text set. + * @pre The @p model needs to have the scripts set. + * + * 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,out] model The text's logical model. + * @param[in] characterIndex Index to the first character. + * @param[in] numberOfCharactersToRemove The number of characters removed from the text. + * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + */ + void ValidateFonts( LogicalModel& model, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); }; } // namespace Text diff --git a/dali-toolkit/public-api/text/shaper.cpp b/dali-toolkit/public-api/text/shaper.cpp index 6a68310..376a1b7 100644 --- a/dali-toolkit/public-api/text/shaper.cpp +++ b/dali-toolkit/public-api/text/shaper.cpp @@ -193,6 +193,14 @@ void ShapeText( const Vector& text, charactersPerGlyph.Resize( totalNumberOfGlyphs ); } +void ShapeText( const LogicalModel& logicalModel, + VisualModel& visualModel, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ) +{ +} + } // namespace Text } // namespace Toolkit diff --git a/dali-toolkit/public-api/text/shaper.h b/dali-toolkit/public-api/text/shaper.h index 3381610..e18fd76 100644 --- a/dali-toolkit/public-api/text/shaper.h +++ b/dali-toolkit/public-api/text/shaper.h @@ -32,6 +32,9 @@ namespace Toolkit namespace Text { +class LogicalModel; +class VisualModel; + /** * Shapes the whole text. * @@ -51,6 +54,29 @@ void ShapeText( const Vector& text, Vector& characterIndices, Vector& charactersPerGlyph ); +/** + * Replaces the shape info of the given range of characters. + * + * @pre The @p model needs to have a text set. + * @pre The @p model needs to have the scripts set. + * @pre The @p model needs to have the fonts set. + * @pre The @p model needs to have the bidirectional info set. + * + * 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] logicalModel The text's logical model. + * @param[in,out] visualModel The text's logical model. + * @param[in] characterIndex Index to the first character. + * @param[in] numberOfCharactersToRemove The number of characters removed from the text. + * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + */ +void ShapeText( const LogicalModel& logicalModel, + VisualModel& visualModel, + CharacterIndex characterIndex, + Length numberOfCharactersToRemove, + Length numberOfCharactersToInsert ); + } // namespace Text } // namespace Toolkit