Replace deprecated TextStyle methods. 63/24163/1
authorVictor Cebollada <v.cebollada@samsung.com>
Thu, 12 Jun 2014 13:27:34 +0000 (14:27 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 17:47:04 +0000 (18:47 +0100)
Change-Id: I67ff44822a70e3279796be2a67efe635e24f3c82
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp
base/dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp
base/dali-toolkit/internal/controls/text-view/text-view-processor.cpp
base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp
base/dali-toolkit/public-api/markup-processor/markup-processor.cpp

index 3e90dd1..ed639e2 100644 (file)
@@ -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 );
   {
     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() );
   }
 
   DALI_ASSERT_DEBUG( cursorPosition <= mTextViewCharacterPositioning.GetNumberOfCharactersInText() );
index 5decd2f..8b962fc 100644 (file)
@@ -2136,7 +2136,7 @@ void TextInput::ApplyPreEditStyle( std::size_t preEditStartPosition, std::size_t
 {
   if ( mPreEditFlag && ( preEditStringLength > 0 ) )
   {
 {
   if ( mPreEditFlag && ( preEditStringLength > 0 ) )
   {
-    mUnderlinedPriorToPreEdit = mInputStyle.GetUnderline();
+    mUnderlinedPriorToPreEdit = mInputStyle.IsUnderlineEnabled();
     TextStyle style;
     style.SetUnderline( true );
     ApplyStyleToRange( style, TextStyle::UNDERLINE , preEditStartPosition, preEditStartPosition + preEditStringLength -1 );
     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.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() );
 
 
   DALI_ASSERT_DEBUG( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() );
 
index f24190c..87f0984 100644 (file)
@@ -1708,7 +1708,7 @@ void CalculateUnderlineInfo( TextView::RelayoutData& relayoutData, TextViewRelay
             ++textUnderlineStatus.mLineGlobalIndex; // If it's a new line, point to the next one.
           }
 
             ++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.
           {
             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 )
             {
           {
             if( textUnderlineStatus.mCurrentUnderlineStatus )
             {
@@ -1845,15 +1845,12 @@ void SetUnderlineInfo( TextView::RelayoutData& relayoutData )
 
             textUnderlineStatus.mCurrentUnderlineStatus = true;
 
 
             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;
 
             // 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;
 
             // Mark the group of characters to be set the new style into the text-actor.
             characterGroup.mSetStyle = true;
index b94a53c..100c570 100644 (file)
@@ -123,24 +123,28 @@ void dbgPrint( const TextLayoutInfo& textInfo )
 
 void dbgPrint( const TextStyle& style )
 {
 
 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 )
 }
 
 void dbgPrint( const TextInfoIndices& indices )
index 6551917..28ebb83 100644 (file)
@@ -1129,7 +1129,7 @@ void InitializeTextActorInfo( TextView::RelayoutData& relayoutData )
 
             if( characterLayout.mIsColorGlyph ||
                 !character.IsWhiteSpace() || // A new line character is also a white space.
 
             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.
 
             {
               // Do not create a glyph-actor if it's a white space (without underline) or a new line character.
 
index 2e7ff3b..c21c5c0 100644 (file)
@@ -156,7 +156,7 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
       characterLayoutInfo.mSize.height = characterLayoutInfo.mHeight;
       characterLayoutInfo.mAscender = ascender;
 
       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.
       {
         characterLayoutInfo.mUnderlineThickness = font.GetUnderlineThickness(); // Both thickness and position includes the
         characterLayoutInfo.mUnderlinePosition = font.GetUnderlinePosition();   // vertical pad adjust used in effects like glow or shadow.
index c99eb11..5d50c03 100644 (file)
@@ -892,9 +892,9 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
   {
     const StyledText& styledText( *it );
 
   {
     const StyledText& styledText( *it );
 
-    bool isItalics = styledText.mStyle.GetItalics();
+    bool isItalics = styledText.mStyle.IsItalicsEnabled();
     bool isBold = defaultStyle.GetWeight() != styledText.mStyle.GetWeight();
     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() );
     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.
     }
 
     // Write shadow.
-    if( styledText.mStyle.GetShadow() )
+    if( styledText.mStyle.IsShadowEnabled() )
     {
       markupString += LESS_THAN + XHTML_SHADOW_TAG;
 
     {
       markupString += LESS_THAN + XHTML_SHADOW_TAG;
 
@@ -980,7 +980,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     }
 
     // Write glow.
     }
 
     // Write glow.
-    if( styledText.mStyle.GetGlow() )
+    if( styledText.mStyle.IsGlowEnabled() )
     {
       markupString += LESS_THAN + XHTML_GLOW_TAG;
 
     {
       markupString += LESS_THAN + XHTML_GLOW_TAG;
 
@@ -998,7 +998,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     } // <glow>
 
     // Write outline.
     } // <glow>
 
     // Write outline.
-    if( styledText.mStyle.GetOutline() )
+    if( styledText.mStyle.IsOutlineEnabled() )
     {
       markupString += LESS_THAN + XHTML_OUTLINE_TAG;
 
     {
       markupString += LESS_THAN + XHTML_OUTLINE_TAG;
 
@@ -1027,19 +1027,19 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     }
 
     // Write outline close tag.
     }
 
     // Write outline close tag.
-    if( styledText.mStyle.GetOutline() )
+    if( styledText.mStyle.IsOutlineEnabled() )
     {
       markupString += LESS_THAN + ( SLASH + XHTML_OUTLINE_TAG + GREATER_THAN ); // </outline>
     }
 
     // Write glow close tag.
     {
       markupString += LESS_THAN + ( SLASH + XHTML_OUTLINE_TAG + GREATER_THAN ); // </outline>
     }
 
     // Write glow close tag.
-    if( styledText.mStyle.GetGlow() )
+    if( styledText.mStyle.IsGlowEnabled() )
     {
       markupString += LESS_THAN + ( SLASH + XHTML_GLOW_TAG + GREATER_THAN ); // </glow>
     }
 
     // Write shadow close tag.
     {
       markupString += LESS_THAN + ( SLASH + XHTML_GLOW_TAG + GREATER_THAN ); // </glow>
     }
 
     // Write shadow close tag.
-    if( styledText.mStyle.GetShadow() )
+    if( styledText.mStyle.IsShadowEnabled() )
     {
       markupString += LESS_THAN + ( SLASH + XHTML_SHADOW_TAG + GREATER_THAN ); // </shadow>
     }
     {
       markupString += LESS_THAN + ( SLASH + XHTML_SHADOW_TAG + GREATER_THAN ); // </shadow>
     }