X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Ftext-view%2Frelayout-utilities.cpp;h=6c7dd1c690b4019ec0be2725e51b1a0542d69bb8;hb=3ca8997f4668fc8bbae789e5b467e864b8e80c44;hp=567a56e2f926a21294cc659db01306056730d86e;hpb=e58fa784d19a558e35f458ecf6d262a2344beb4f;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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..6c7dd1c 100644 --- a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp +++ b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // FILE HEADER #include "relayout-utilities.h" @@ -517,8 +518,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 +1013,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 +1210,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 ) { @@ -1256,6 +1262,7 @@ void SetTextVisible( TextView::RelayoutData& relayoutData ) characterLayoutInfo.mGradientColor = Vector4::ZERO; characterLayoutInfo.mStartPoint = Vector2::ZERO; characterLayoutInfo.mEndPoint = Vector2::ZERO; + characterLayoutInfo.mColorAlpha = characterLayoutInfo.mStyledText.mStyle.GetTextColor().a; } // end characters } // end words } // end group of words @@ -1429,7 +1436,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 +1507,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. @@ -1699,7 +1708,7 @@ void CalculateUnderlineInfo( TextView::RelayoutData& relayoutData, TextViewRelay ++textUnderlineStatus.mLineGlobalIndex; // If it's a new line, point to the next one. } - if( characterGroup.mStyledText.mStyle.GetUnderline() ) + if( characterGroup.mStyledText.mStyle.IsUnderlineEnabled() ) { if( !textUnderlineStatus.mCurrentUnderlineStatus || // Current character is underlined but previous one it wasn't. isNewLine ) // Current character is underlined and is the first of current laid-out line. @@ -1816,7 +1825,7 @@ void SetUnderlineInfo( TextView::RelayoutData& relayoutData ) } } - if( characterGroup.mStyledText.mStyle.GetUnderline() ) + if( characterGroup.mStyledText.mStyle.IsUnderlineEnabled() ) { if( textUnderlineStatus.mCurrentUnderlineStatus ) { @@ -1836,15 +1845,12 @@ void SetUnderlineInfo( TextView::RelayoutData& relayoutData ) textUnderlineStatus.mCurrentUnderlineStatus = true; - // Sets the underline's thickness. - characterGroup.mStyledText.mStyle.SetUnderlineThickness( underlineInfo.mMaxThickness ); - // Before setting the position it needs to be adjusted to match the base line. const float bearingOffset = ( currentLineHeight - currentLineAscender ) - ( characterGroup.mSize.height - characterGroup.mAscender ); const float positionOffset = ( underlineInfo.mMaxHeight - characterGroup.mSize.height ) - bearingOffset; - // Sets the underline's position. - characterGroup.mStyledText.mStyle.SetUnderlinePosition( underlineInfo.mPosition - positionOffset ); + // Sets the underline's parameters. + characterGroup.mStyledText.mStyle.SetUnderline( true, underlineInfo.mMaxThickness, underlineInfo.mPosition - positionOffset ); // Mark the group of characters to be set the new style into the text-actor. characterGroup.mSetStyle = true; @@ -1976,7 +1982,8 @@ RenderableActor CreateGlyphActor( const Text& text, const TextStyle& style, Text else { // The text-actor cache is empty. Create a new one. - textActor = TextActor::New( text, style, false, true ); + TextActorParameters parameters( style, TextActorParameters::FONT_DETECTION_OFF ); + textActor = TextActor::New( text, parameters ); } return textActor;