From: Victor Cebollada Date: Thu, 12 Jun 2014 13:27:34 +0000 (+0100) Subject: Replace deprecated TextStyle methods. X-Git-Tag: dali_1.0.0~48 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=542f7db49eb2cf604ad0a0baf15348a18b5bd0b4 Replace deprecated TextStyle methods. Change-Id: I67ff44822a70e3279796be2a67efe635e24f3c82 Signed-off-by: Victor Cebollada Signed-off-by: Adeel Kazmi --- diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp index 3e90dd1..ed639e2 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp @@ -525,7 +525,7 @@ void Decorator::DrawCursor(const std::size_t nthChar) { DALI_ASSERT_DEBUG( ( 0 <= cursorPosition-1 ) && ( cursorPosition-1 < mTextViewCharacterPositioning.StyledTextSize() ) ); const TextStyle styleAtCursor = mTextViewCharacterPositioning.GetStyleAt( cursorPosition-1 ); - mCursor.SetRotation( styleAtCursor.GetItalics() ? Degree( styleAtCursor.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS ); + mCursor.SetRotation( styleAtCursor.IsItalicsEnabled() ? Degree( styleAtCursor.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS ); } DALI_ASSERT_DEBUG( cursorPosition <= mTextViewCharacterPositioning.GetNumberOfCharactersInText() ); diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp index 5decd2f..8b962fc 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp @@ -2136,7 +2136,7 @@ void TextInput::ApplyPreEditStyle( std::size_t preEditStartPosition, std::size_t { if ( mPreEditFlag && ( preEditStringLength > 0 ) ) { - mUnderlinedPriorToPreEdit = mInputStyle.GetUnderline(); + mUnderlinedPriorToPreEdit = mInputStyle.IsUnderlineEnabled(); TextStyle style; style.SetUnderline( true ); ApplyStyleToRange( style, TextStyle::UNDERLINE , preEditStartPosition, preEditStartPosition + preEditStringLength -1 ); @@ -2898,7 +2898,7 @@ void TextInput::DrawCursor(const std::size_t nthChar) mCursor.SetSize(size); // If the character is italic then the cursor also tilts. - mCursor.SetRotation( mInputStyle.GetItalics() ? Degree( mInputStyle.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS ); + mCursor.SetRotation( mInputStyle.IsItalicsEnabled() ? Degree( mInputStyle.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS ); DALI_ASSERT_DEBUG( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() ); 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 f24190c..87f0984 100644 --- a/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp +++ b/base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp @@ -1708,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. @@ -1825,7 +1825,7 @@ void SetUnderlineInfo( TextView::RelayoutData& relayoutData ) } } - if( characterGroup.mStyledText.mStyle.GetUnderline() ) + if( characterGroup.mStyledText.mStyle.IsUnderlineEnabled() ) { if( textUnderlineStatus.mCurrentUnderlineStatus ) { @@ -1845,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; diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp index b94a53c..100c570 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp @@ -123,24 +123,28 @@ void dbgPrint( const TextLayoutInfo& textInfo ) void dbgPrint( const TextStyle& style ) { - std::cout << " font name : " << style.GetFontName() << std::endl; - std::cout << " font style : " << style.GetFontStyle() << std::endl; - std::cout << " font point size : " << style.GetFontPointSize() << std::endl; - std::cout << " weight : " << style.GetWeight() << std::endl; - std::cout << " text color : " << style.GetTextColor() << std::endl; - std::cout << " italics : " << style.GetItalics() << std::endl; - std::cout << " underline : " << style.GetUnderline() << std::endl; - std::cout << " shadow : " << style.GetShadow() << std::endl; - std::cout << " shadow color : " << style.GetShadowColor() << std::endl; - std::cout << " shadow offset : " << style.GetShadowOffset() << std::endl; - std::cout << " glow : " << style.GetGlow() << std::endl; - std::cout << " italics angle : " << style.GetItalicsAngle() << std::endl; - std::cout << " glow color : " << style.GetGlowColor() << std::endl; - std::cout << " glow intensity : " << style.GetGlowIntensity() << std::endl; - std::cout << " smooth edge : " << style.GetSmoothEdge() << std::endl; - std::cout << " outline : " << style.GetOutline() << std::endl; - std::cout << " outline color : " << style.GetOutlineColor() << std::endl; - std::cout << " outline thickness : " << style.GetOutlineThickness() << std::endl; + std::cout << " font name : " << style.GetFontName() << std::endl; + std::cout << " font style : " << style.GetFontStyle() << std::endl; + std::cout << " font point size : " << style.GetFontPointSize() << std::endl; + std::cout << " weight : " << style.GetWeight() << std::endl; + std::cout << " text color : " << style.GetTextColor() << std::endl; + std::cout << " italics : " << style.IsItalicsEnabled() << std::endl; + std::cout << " underline : " << style.IsUnderlineEnabled() << std::endl; + std::cout << " shadow : " << style.IsShadowEnabled() << std::endl; + std::cout << " shadow color : " << style.GetShadowColor() << std::endl; + std::cout << " shadow offset : " << style.GetShadowOffset() << std::endl; + std::cout << " glow : " << style.IsGlowEnabled() << std::endl; + std::cout << " italics angle : " << style.GetItalicsAngle() << std::endl; + std::cout << " glow color : " << style.GetGlowColor() << std::endl; + std::cout << " glow intensity : " << style.GetGlowIntensity() << std::endl; + std::cout << " smooth edge : " << style.GetSmoothEdge() << std::endl; + std::cout << " outline : " << style.IsOutlineEnabled() << std::endl; + std::cout << " outline color : " << style.GetOutlineColor() << std::endl; + std::cout << " outline thickness : " << style.GetOutlineThickness() << std::endl; + std::cout << " gradient : " << style.IsGradientEnabled() << std::endl; + std::cout << " gradient color : " << style.GetGradientColor() << std::endl; + std::cout << " gradient start point : " << style.GetGradientStartPoint() << std::endl; + std::cout << " gradient end point : " << style.GetGradientEndPoint() << std::endl; } void dbgPrint( const TextInfoIndices& indices ) diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp index 6551917..28ebb83 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp @@ -1129,7 +1129,7 @@ void InitializeTextActorInfo( TextView::RelayoutData& relayoutData ) if( characterLayout.mIsColorGlyph || !character.IsWhiteSpace() || // A new line character is also a white space. - ( character.IsWhiteSpace() && characterLayout.mStyledText.mStyle.GetUnderline() ) ) + ( character.IsWhiteSpace() && characterLayout.mStyledText.mStyle.IsUnderlineEnabled() ) ) { // Do not create a glyph-actor if it's a white space (without underline) or a new line character. diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp index 2e7ff3b..c21c5c0 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp @@ -156,7 +156,7 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word, characterLayoutInfo.mSize.height = characterLayoutInfo.mHeight; characterLayoutInfo.mAscender = ascender; - if( styledCharacter.mStyle.GetUnderline() ) + if( styledCharacter.mStyle.IsUnderlineEnabled() ) { characterLayoutInfo.mUnderlineThickness = font.GetUnderlineThickness(); // Both thickness and position includes the characterLayoutInfo.mUnderlinePosition = font.GetUnderlinePosition(); // vertical pad adjust used in effects like glow or shadow. diff --git a/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp b/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp index c99eb11..5d50c03 100644 --- a/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp +++ b/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp @@ -892,9 +892,9 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku { const StyledText& styledText( *it ); - bool isItalics = styledText.mStyle.GetItalics(); + bool isItalics = styledText.mStyle.IsItalicsEnabled(); bool isBold = defaultStyle.GetWeight() != styledText.mStyle.GetWeight(); - bool isUnderline = styledText.mStyle.GetUnderline(); + bool isUnderline = styledText.mStyle.IsUnderlineEnabled(); bool hasFontFace = defaultStyle.GetFontName() != styledText.mStyle.GetFontName(); bool hasFontStyle = defaultStyle.GetFontStyle() != styledText.mStyle.GetFontStyle(); bool hasFontSize = fabsf( defaultStyle.GetFontPointSize() - styledText.mStyle.GetFontPointSize() ) > GetRangedEpsilon( defaultStyle.GetFontPointSize(), styledText.mStyle.GetFontPointSize() ); @@ -961,7 +961,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // Write shadow. - if( styledText.mStyle.GetShadow() ) + if( styledText.mStyle.IsShadowEnabled() ) { markupString += LESS_THAN + XHTML_SHADOW_TAG; @@ -980,7 +980,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // Write glow. - if( styledText.mStyle.GetGlow() ) + if( styledText.mStyle.IsGlowEnabled() ) { markupString += LESS_THAN + XHTML_GLOW_TAG; @@ -998,7 +998,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // // Write outline. - if( styledText.mStyle.GetOutline() ) + if( styledText.mStyle.IsOutlineEnabled() ) { markupString += LESS_THAN + XHTML_OUTLINE_TAG; @@ -1027,19 +1027,19 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // Write outline close tag. - if( styledText.mStyle.GetOutline() ) + if( styledText.mStyle.IsOutlineEnabled() ) { markupString += LESS_THAN + ( SLASH + XHTML_OUTLINE_TAG + GREATER_THAN ); // } // Write glow close tag. - if( styledText.mStyle.GetGlow() ) + if( styledText.mStyle.IsGlowEnabled() ) { markupString += LESS_THAN + ( SLASH + XHTML_GLOW_TAG + GREATER_THAN ); // } // Write shadow close tag. - if( styledText.mStyle.GetShadow() ) + if( styledText.mStyle.IsShadowEnabled() ) { markupString += LESS_THAN + ( SLASH + XHTML_SHADOW_TAG + GREATER_THAN ); // }