From 92480e026ce2bfc7e2a5166b9097c31a37a84346 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Thu, 15 May 2014 11:49:45 +0100 Subject: [PATCH] TextView - Split width exceed policy and EllipsizeEnd height exceed policy combination added. Change-Id: I0ccbedc95504857f4bd17615e163d2b6db478c2f Signed-off-by: Victor Cebollada --- .../internal/controls/text-view/relayout-utilities.cpp | 15 +++++++++++---- .../controls/text-view/split-by-char-policies.cpp | 1 + .../text-view/split-by-new-line-char-policies.cpp | 3 ++- .../controls/text-view/split-by-word-policies.cpp | 9 +-------- .../internal/controls/text-view/text-view-impl.cpp | 5 +++++ .../internal/controls/text-view/text-view-impl.h | 1 + 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp index 567a56e..dbec30e 100644 --- a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp +++ b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp @@ -517,8 +517,11 @@ void UpdateAlignment( const TextView::LayoutParameters& layoutParameters, // If the exceed policy is ellipsize at the end, negative offsets are not wanted. // In that case, it will align the line to the left and/or top, and ellipsize the end. - const bool ellipsizeAlignToLeft = ( layoutParameters.mExceedPolicy == TextView::EllipsizeEndOriginal ) || ( layoutParameters.mExceedPolicy == TextView::EllipsizeEnd ); - const bool ellipsizeAlignToTop = ( layoutParameters.mExceedPolicy == TextView::EllipsizeEnd ); + const bool ellipsizeAlignToLeft = ( layoutParameters.mExceedPolicy == TextView::EllipsizeEndOriginal ) || + ( layoutParameters.mExceedPolicy == TextView::EllipsizeEnd ) || + ( layoutParameters.mExceedPolicy == TextView::SplitEllipsizeEnd ); + const bool ellipsizeAlignToTop = ( layoutParameters.mExceedPolicy == TextView::EllipsizeEnd ) || + ( layoutParameters.mExceedPolicy == TextView::SplitEllipsizeEnd ); RelayoutParameters relayoutParameters; @@ -1009,6 +1012,7 @@ void CalculateVisibilityForEllipsize( const Internal::TextView::LayoutParameters break; } + case TextView::SplitEllipsizeEnd: case TextView::EllipsizeEnd: { // Ellipsizes the text if it doesn't fit in the width and fully fits in the text-view's height. @@ -1205,7 +1209,8 @@ void EllipsizeLine( const TextView::LayoutParameters& layoutParameters, } else { - if( TextView::EllipsizeEnd == layoutParameters.mExceedPolicy ) + if( ( TextView::EllipsizeEnd == layoutParameters.mExceedPolicy ) || + ( TextView::SplitEllipsizeEnd == layoutParameters.mExceedPolicy )) { if( !ellipsizeParameters.mIsLineHeightFullyVisible ) { @@ -1429,7 +1434,8 @@ void UpdateVisibilityForEllipsize( const TextView::LayoutParameters& layoutParam // If the next line exceeds the text-view height then it's going to be invisible and current line needs to be ellipsized. ellipsizeParameters.mIsLineHeightFullyVisible = true; ellipsizeParameters.mIsNextLineFullyVisibleHeight = true; - if( TextView::EllipsizeEnd == layoutParameters.mExceedPolicy ) + if( ( TextView::EllipsizeEnd == layoutParameters.mExceedPolicy ) || + ( TextView::SplitEllipsizeEnd == layoutParameters.mExceedPolicy ) ) { // Need to check if there is lines which doesn't fit in the height. @@ -1499,6 +1505,7 @@ void UpdateVisibility( const TextView::LayoutParameters& layoutParameters, break; } case TextView::EllipsizeEndOriginal: + case TextView::SplitEllipsizeEnd: case TextView::EllipsizeEnd: // Fall through { // Set first all characters to visible as UpdateVisibilityForEllipsize() doesn't traverse all of them. diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp b/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp index 819d87e..a35f4dc 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp +++ b/base/dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp @@ -168,6 +168,7 @@ void CalculateSizeAndPosition( const TextView::LayoutParameters& layoutParameter case TextView::OriginalShrink: case TextView::SplitOriginal: case TextView::SplitFade: + case TextView::SplitEllipsizeEnd: case TextView::SplitShrink: case TextView::ShrinkOriginal: case TextView::ShrinkFade: diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp b/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp index b1b55de..5529f58 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp +++ b/base/dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp @@ -236,7 +236,8 @@ void CalculateSizeAndPosition( const TextView::LayoutParameters& layoutParameter break; } case TextView::SplitOriginal: - case TextView::SplitFade: // Fall Through + case TextView::SplitFade: + case TextView::SplitEllipsizeEnd: // Fall Through { characterLayoutInfo.mPosition = SplitPosition( relayoutParameters, layoutParameters, diff --git a/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp b/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp index 4b97f03..49fcfdc 100644 --- a/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp +++ b/base/dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp @@ -562,15 +562,8 @@ void CalculateSizeAndPosition( const TextView::LayoutParameters& layoutParameter break; } case TextView::SplitOriginal: - { - characterLayoutInfo.mPosition = SplitWhenExceedPosition( relayoutParameters, - layoutParameters, - relayoutData ); - - relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f ); - break; - } case TextView::SplitFade: + case TextView::SplitEllipsizeEnd: { characterLayoutInfo.mPosition = SplitWhenExceedPosition( relayoutParameters, layoutParameters, diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp index 7e9c5fa..426357d 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp @@ -1779,6 +1779,11 @@ void TextView::CombineExceedPolicies() mLayoutParameters.mExceedPolicy = SplitShrink; break; } + case Toolkit::TextView::EllipsizeEnd: + { + mLayoutParameters.mExceedPolicy = SplitEllipsizeEnd; + break; + } default: { DALI_ASSERT_ALWAYS( !"TextView::CombineExceedPolicies() Invalid width and height exceed policies combination" ); diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-impl.h b/base/dali-toolkit/internal/controls/text-view/text-view-impl.h index 5564296..d723d8d 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-impl.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-impl.h @@ -60,6 +60,7 @@ public: SplitOriginal, ///< Split if it exceeds the width but no action if it exceeds the height. SplitFade, ///< Split if it exceeds the width and faded if it exceeds the height. SplitShrink, ///< Split if it exceeds the width and shrunk if it exceeds the height. + SplitEllipsizeEnd, ///< Split if it exceeds the width and ellipsize if it exceeds the height. Fade, ///< Faded if it exceeds any boundary. FadeOriginal, ///< Faded if it exceeds the width but no action if it exceeds the height. ShrinkOriginal, ///< Shrunk if it exceeds the width but no action if it exceeds the height. -- 2.7.4