TextView - Rename Line to Paragraph.
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-processor-dbg.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // FILE HEADER
19 #include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/actors/text-actor.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 namespace TextViewProcessor
34 {
35
36 #if defined(DEBUG_ENABLED)
37 Debug::Filter* gTextViewProcessorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_TEXT_VIEW_PROCESSOR");
38 #endif
39
40 void dbgPrint( const WordLayoutInfo& word )
41 {
42   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
43        characterIt != endCharacterIt;
44        ++characterIt )
45   {
46     const CharacterLayoutInfo& character( *characterIt );
47
48     std::cout << "[" << character.mSize << std::endl;
49     std::cout << " ascender " << character.mAscender << std::endl;
50
51     TextActor textActor = TextActor::DownCast( character.mGlyphActor );
52     if( textActor )
53     {
54       std::cout << "[" << textActor.GetText() << "]";
55     }
56     else
57     {
58       std::cout << "[ImageActor]" << std::endl;
59     }
60     std::cout << "{" << character.mStyledText.mText.GetText() << "}";
61   }
62   std::cout << "     size " << word.mSize << std::endl;
63   std::cout << " ascender " << word.mAscender << std::endl;
64   std::cout << " num char " << word.mCharactersLayoutInfo.size() << std::endl;
65   std::cout << "     type ";
66   switch( word.mType )
67   {
68     case NoSeparator:
69     {
70       std::cout << "NoSeparator" << std::endl;
71       break;
72     }
73     case ParagraphSeparator:
74     {
75       std::cout << "ParagraphSeparator" << std::endl;
76       break;
77     }
78     case WordSeparator:
79     {
80       std::cout << "WordSeparator" << std::endl;
81       break;
82     }
83   }
84 }
85
86 void dbgPrint( const ParagraphLayoutInfo& paragraph )
87 {
88   std::cout << "< ";
89   std::cout << paragraph.mSize;
90   for( WordLayoutInfoContainer::const_iterator wordIt = paragraph.mWordsLayoutInfo.begin(), endWordIt = paragraph.mWordsLayoutInfo.end();
91        wordIt != endWordIt;
92        ++wordIt )
93   {
94     dbgPrint( *wordIt );
95   }
96   std::cout << " >";
97   std::cout << std::endl;
98 }
99
100 void dbgPrint( const TextLayoutInfo& textInfo )
101 {
102   std::cout << "||" << std::endl;
103   std::cout << textInfo.mWholeTextSize;
104   std::cout << textInfo.mNumberOfCharacters;
105   for( ParagraphLayoutInfoContainer::const_iterator it = textInfo.mParagraphsLayoutInfo.begin(), endIt = textInfo.mParagraphsLayoutInfo.end();
106        it != endIt;
107        ++it )
108   {
109     dbgPrint( *it );
110   }
111   std::cout << "||" << std::endl;
112 }
113
114 void dbgPrint( const TextStyle& style )
115 {
116   std::cout << "               font name : " << style.GetFontName() << std::endl;
117   std::cout << "              font style : " << style.GetFontStyle() << std::endl;
118   std::cout << "         font point size : " << style.GetFontPointSize() << std::endl;
119   std::cout << "                  weight : " << style.GetWeight() << std::endl;
120   std::cout << "              text color : " << style.GetTextColor() << std::endl;
121   std::cout << "                 italics : " << style.IsItalicsEnabled() << std::endl;
122   std::cout << "           italics angle : " << style.GetItalicsAngle() << std::endl;
123   std::cout << "               underline : " << style.IsUnderlineEnabled() << std::endl;
124   std::cout << "     underline thickness : " << style.GetUnderlineThickness() << std::endl;
125   std::cout << "      underline position : " << style.GetUnderlinePosition() << std::endl;
126   std::cout << "                  shadow : " << style.IsShadowEnabled() << std::endl;
127   std::cout << "            shadow color : " << style.GetShadowColor() << std::endl;
128   std::cout << "           shadow offset : " << style.GetShadowOffset() << std::endl;
129   std::cout << "             shadow size : " << style.GetShadowSize() << std::endl;
130   std::cout << "                    glow : " << style.IsGlowEnabled() << std::endl;
131   std::cout << "              glow color : " << style.GetGlowColor() << std::endl;
132   std::cout << "          glow intensity : " << style.GetGlowIntensity() << std::endl;
133   std::cout << "             smooth edge : " << style.GetSmoothEdge() << std::endl;
134   std::cout << "                 outline : " << style.IsOutlineEnabled() << std::endl;
135   std::cout << "           outline color : " << style.GetOutlineColor() << std::endl;
136   std::cout << "       outline thickness : " << style.GetOutlineThickness() << std::endl;
137   std::cout << "                gradient : " << style.IsGradientEnabled() << std::endl;
138   std::cout << "          gradient color : " << style.GetGradientColor() << std::endl;
139   std::cout << "    gradient start point : " << style.GetGradientStartPoint() << std::endl;
140   std::cout << "      gradient end point : " << style.GetGradientEndPoint() << std::endl;
141   std::cout << "    is font name default : " << style.IsFontNameDefault() << std::endl;
142   std::cout << "   is font style default : " << style.IsFontStyleDefault() << std::endl;
143   std::cout << "    is font size default : " << style.IsFontSizeDefault() << std::endl;
144   std::cout << "   is text color default : " << style.IsTextColorDefault() << std::endl;
145   std::cout << "  is font weight default : " << style.IsFontWeightDefault() << std::endl;
146   std::cout << "  is smooth edge default : " << style.IsSmoothEdgeDefault() << std::endl;
147   std::cout << "      is italics default : " << style.IsItalicsDefault() << std::endl;
148   std::cout << "    is underline default : " << style.IsUnderlineDefault() << std::endl;
149   std::cout << "       is shadow default : " << style.IsShadowDefault() << std::endl;
150   std::cout << "         is glow default : " << style.IsGlowDefault() << std::endl;
151   std::cout << "      is outline default : " << style.IsOutlineDefault() << std::endl;
152   std::cout << "     is gradient default : " << style.IsGradientDefault() << std::endl;
153 }
154
155 void dbgPrint( const TextInfoIndices& indices )
156 {
157   std::cout << "          paragraph : " << indices.mParagraphIndex << std::endl;
158   std::cout << "               word : " << indices.mWordIndex << std::endl;
159   std::cout << "               char : " << indices.mCharacterIndex << std::endl;
160 }
161
162 void dbgPrint( const MarkupProcessor::StyledTextArray& textArray )
163 {
164   for( MarkupProcessor::StyledTextArray::const_iterator it = textArray.begin(), endIt = textArray.end(); it != endIt; ++it )
165   {
166     const MarkupProcessor::StyledText& text( *it );
167
168     std::cout << text.mText.GetText();
169   }
170 }
171
172 void dbgPrintText( const WordLayoutInfo& word )
173 {
174   for( CharacterLayoutInfoContainer::const_iterator characterIt = word.mCharactersLayoutInfo.begin(), endCharacterIt = word.mCharactersLayoutInfo.end();
175        characterIt != endCharacterIt;
176        ++characterIt )
177   {
178     const CharacterLayoutInfo& character( *characterIt );
179
180     std::cout << character.mStyledText.mText.GetText();
181   }
182 }
183
184 } // namespace TextViewProcessor
185
186 } // namespace Internal
187
188 } // namespace Toolkit
189
190 } // namespace Dali