diff options
author | Ali Alzyod <ali198724@gmail.com> | 2020-02-04 17:45:32 +0100 |
---|---|---|
committer | Xavi Artigas <xavierartigas@yahoo.es> | 2020-02-04 17:54:34 +0100 |
commit | ba99891710a558412f0962f79993a5b9651eae59 (patch) | |
tree | f97d6cdb1c0dca2e78c033e0b47b7caaa5e2dfdd | |
parent | 5f5253214c4f2c9d224ed5b21affb1be8f9e624b (diff) |
efl.canvas.textblock: update style strings
Summary:
Update
backing -> background_type
backing_color -> background_color
underline_dash_color -> underline_dashed_color
underline - > underline_type
strikethrough - > strikethrough_type
style -> (effect_type + shadow_direction)
underline_dash_width -> underline_dashed_width
underline_dashed_gap -> underline_dashed_gap
**+prevent unified APIs from supporting legacy style tags, and prevent legacy APIs from the ability to use new unified tags**
Reviewers: zmike, woohyun, segfaultxavi, bu5hm4n, cedric
Reviewed By: segfaultxavi, bu5hm4n
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8523
Differential Revision: https://phab.enlightenment.org/D11188
-rw-r--r-- | src/lib/evas/canvas/efl_canvas_textblock.eo | 65 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_textblock.c | 1035 | ||||
-rw-r--r-- | src/tests/evas/evas_test_textblock.c | 26 |
3 files changed, 662 insertions, 464 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_textblock.eo b/src/lib/evas/canvas/efl_canvas_textblock.eo index 2ecfd7bd8d..7d20786c5f 100644 --- a/src/lib/evas/canvas/efl_canvas_textblock.eo +++ b/src/lib/evas/canvas/efl_canvas_textblock.eo | |||
@@ -137,47 +137,47 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, | |||
137 | 137 | ||
138 | - $underline_color: Color code for the text underline (See bottom for the complete list of supported codes). | 138 | - $underline_color: Color code for the text underline (See bottom for the complete list of supported codes). |
139 | Default value is $[rgba(0,0,0,0)] meaning that no underline will be rendered. | 139 | Default value is $[rgba(0,0,0,0)] meaning that no underline will be rendered. |
140 | Requires $underline. | 140 | Requires $underline_type. |
141 | See @Efl.Text_Style.text_underline_color. | 141 | See @Efl.Text_Style.text_underline_color. |
142 | 142 | ||
143 | - $secondary_underline_color: Color code for the secondary text underline (See bottom for the complete list | 143 | - $secondary_underline_color: Color code for the secondary text underline (See bottom for the complete list |
144 | of supported codes). Only valid when $[underline=double]. | 144 | of supported codes). Only valid when $[underline_type=double]. |
145 | Default value is $[rgba(0,0,0,0)] meaning that secondary underline will not be rendered. | 145 | Default value is $[rgba(0,0,0,0)] meaning that secondary underline will not be rendered. |
146 | See @Efl.Text_Style.text_secondary_underline_color. | 146 | See @Efl.Text_Style.text_secondary_underline_color. |
147 | 147 | ||
148 | - $underline_dash_color: Color code for the dashed underline (See bottom for the complete list of supported | 148 | - $underline_dashed_color: Color code for the dashed underline (See bottom for the complete list of supported |
149 | codes). Only valid when $[underline=dashed]. | 149 | codes). Only valid when $[underline_type=dashed]. |
150 | Default value is $[rgba(0,0,0,0)] meaning that dashed underline will not be rendered. | 150 | Default value is $[rgba(0,0,0,0)] meaning that dashed underline will not be rendered. |
151 | See @Efl.Text_Style.text_underline_dashed_color. | 151 | See @Efl.Text_Style.text_underline_dashed_color. |
152 | 152 | ||
153 | - $outline_color: Color code for the text outline (See bottom for the complete list of supported codes). | 153 | - $outline_color: Color code for the text outline (See bottom for the complete list of supported codes). |
154 | Only valid when the $style attribute includes an outline. | 154 | Only valid when the $effect_type attribute includes an outline. |
155 | Default value is $[rgba(0,0,0,0)] meaning that no outline will be rendered. | 155 | Default value is $[rgba(0,0,0,0)] meaning that no outline will be rendered. |
156 | See @Efl.Text_Style.text_outline_color. | 156 | See @Efl.Text_Style.text_outline_color. |
157 | 157 | ||
158 | - $shadow_color: Color code for the text shadow (See bottom for the complete list of supported codes). | 158 | - $shadow_color: Color code for the text shadow (See bottom for the complete list of supported codes). |
159 | Only valid when the $style attribute includes a shadow. | 159 | Only valid when the $effect_type attribute includes a shadow. |
160 | Default value is $[rgba(0,0,0,0)] meaning that no shadow will be rendered. | 160 | Default value is $[rgba(0,0,0,0)] meaning that no shadow will be rendered. |
161 | See @Efl.Text_Style.text_shadow_color. | 161 | See @Efl.Text_Style.text_shadow_color. |
162 | 162 | ||
163 | - $glow_color: Color code for the glow component of the text (See bottom for the complete list of supported | 163 | - $glow_color: Color code for the glow component of the text (See bottom for the complete list of supported |
164 | codes). Only valid when the $style attribute includes a glow. | 164 | codes). Only valid when the $effect_type attribute includes a glow. |
165 | Default value is $[rgba(0,0,0,0)] meaning that no glow will be rendered. | 165 | Default value is $[rgba(0,0,0,0)] meaning that no glow will be rendered. |
166 | See @Efl.Text_Style.text_glow_color. | 166 | See @Efl.Text_Style.text_glow_color. |
167 | 167 | ||
168 | - $secondary_glow_color: Color code for the secondary (inner) glow component of the text (See bottom for | 168 | - $secondary_glow_color: Color code for the secondary (inner) glow component of the text (See bottom for |
169 | the complete list of supported codes). Only valid when the $style attribute includes a glow. | 169 | the complete list of supported codes). Only valid when the $effect_type attribute includes a glow. |
170 | Default value is $[rgba(0,0,0,0)] meaning that only the primary $glow_color will be used. | 170 | Default value is $[rgba(0,0,0,0)] meaning that only the primary $glow_color will be used. |
171 | See @Efl.Text_Style.text_secondary_glow_color. | 171 | See @Efl.Text_Style.text_secondary_glow_color. |
172 | 172 | ||
173 | - $backing_color: Color code for the background of the text (See bottom for the complete list of supported | 173 | - $background_color: Color code for the background of the text (See bottom for the complete list of supported |
174 | codes). Use a fully transparent color to disable the background. | 174 | codes). Use a fully transparent color to disable the background. |
175 | Default value is $[rgba(0,0,0,0)] meaning that no backing will be rendered. | 175 | Default value is $[rgba(0,0,0,0)] meaning that no background will be rendered. |
176 | Requires $backing. | 176 | Requires $background_type. |
177 | See @Efl.Text_Style.text_background_color. | 177 | See @Efl.Text_Style.text_background_color. |
178 | 178 | ||
179 | - $strikethrough_color: Color code for the line striking through the text (See bottom for the complete list | 179 | - $strikethrough_color: Color code for the line striking through the text (See bottom for the complete list |
180 | of supported codes). Only valid when $[strikethrough=on] | 180 | of supported codes). Only valid when $[strikethrough_type=single] |
181 | Default value is $[rgba(0,0,0,0)] meaning that no strike-through line will be rendered. | 181 | Default value is $[rgba(0,0,0,0)] meaning that no strike-through line will be rendered. |
182 | See @Efl.Text_Style.text_strikethrough_color. | 182 | See @Efl.Text_Style.text_strikethrough_color. |
183 | 183 | ||
@@ -219,34 +219,35 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, | |||
219 | Default value is $[0]. | 219 | Default value is $[0]. |
220 | Examples: $[right_margin=10], $[right_margin=+10], $[right_margin=reset]. | 220 | Examples: $[right_margin=10], $[right_margin=+10], $[right_margin=reset]. |
221 | 221 | ||
222 | - $underline: Style of the underline. The value must be one of $off (No underlining), | 222 | - $underline_type: Style of the underline. The value must be one of $none (No underlining), |
223 | $single (A single line under the text), $on (Alias for $single), $double (Two lines under the text), | 223 | $single (A single line under the text) , $double (Two lines under the text), |
224 | $dashed (A dashed line under the text). | 224 | $dashed (A dashed line under the text). |
225 | Default value is $off. | 225 | Default value is $none. |
226 | Requires either $underline_color, $secondary_underline_color or $underline_dash_color. | 226 | Requires either $underline_color, $secondary_underline_color or $underline_dashed_color. |
227 | See @Efl.Text_Style.text_underline_type. | 227 | See @Efl.Text_Style.text_underline_type. |
228 | 228 | ||
229 | - $strikethrough: Enables crossed-out text. Possible values are $on and $off. | 229 | - $strikethrough_type: Enables crossed-out text. Possible values are $single and $none. |
230 | Default value is $off. | 230 | Default value is $none. |
231 | Requires $strikethrough_color. | 231 | Requires $strikethrough_color. |
232 | See @Efl.Text_Style.text_strikethrough_type. | 232 | See @Efl.Text_Style.text_strikethrough_type. |
233 | 233 | ||
234 | - $backing: Enables background color for the text. Possible values are $on and $off. | 234 | - $background_type: Enables background color for the text. Possible values are $solid and $none. |
235 | Default value is $off. | 235 | Default value is $none. |
236 | Requires $backing_color. | 236 | Requires $background_color. |
237 | See @Efl.Text_Style.text_background_type. | 237 | See @Efl.Text_Style.text_background_type. |
238 | 238 | ||
239 | - $style: Controls a number of decorations around the text, like shadow, outline and glow, including | 239 | - $effect_type: Controls a number of decorations around the text, like shadow, outline and glow, including |
240 | combinations of them. Possible values are $plain (No decoration, alias for $off and $none), | 240 | combinations of them. Possible values are $none (No decoration), |
241 | $shadow, $outline, $soft_outline, $outline_shadow, $outline_soft_shadow, $glow (alias for $soft_outline), | 241 | $shadow, $outline, $soft_outline, $outline_shadow, $outline_soft_shadow, $glow (alias for $soft_outline), |
242 | $far_shadow, $soft_shadow and $far_soft_shadow. | 242 | $far_shadow, $soft_shadow and $far_soft_shadow. |
243 | All values involving a shadow accept a second parameter, separated by a comma, to indicate the shadow | 243 | Default value is $none. |
244 | direction. Valid positions are $bottom_right, $bottom, $bottom_left, $left, $top_left, $top, $top_right | ||
245 | and $right. | ||
246 | Default value is $plain. | ||
247 | Requires either $shadow_color, $glow_color or $outline_color. | 244 | Requires either $shadow_color, $glow_color or $outline_color. |
248 | Examples: $[style=outline], $[style=shadow,bottom_right], $[style=outline_shadow,bottom]. | 245 | See @Efl.Text_Style.text_effect_type |
249 | See @Efl.Text_Style.text_effect_type and @Efl.Text_Style.text_shadow_direction. | 246 | |
247 | - $shadow_direction: Indicate the shadow direction. Valid positions are $bottom_right, $bottom, $bottom_left, $left, $top_left, $top, $top_right | ||
248 | and $right. | ||
249 | Requires either $effect_type. | ||
250 | See @Efl.Text_Style.text_shadow_direction. | ||
250 | 251 | ||
251 | - $tab_stops: Size (in pixels) of the tab character. The value must be a number greater than one. | 252 | - $tab_stops: Size (in pixels) of the tab character. The value must be a number greater than one. |
252 | Default value is $[32]. | 253 | Default value is $[32]. |
@@ -303,15 +304,15 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, | |||
303 | Examples: $[replacement_char=*]. | 304 | Examples: $[replacement_char=*]. |
304 | See @Efl.Text_Format.replacement_char. | 305 | See @Efl.Text_Format.replacement_char. |
305 | 306 | ||
306 | - $underline_dash_width: Length (in pixels) of the dashes when $underline is $dashed. | 307 | - $underline_dashed_width: Length (in pixels) of the dashes when $underline_type is $dashed. |
307 | Default value is $[6]. | 308 | Default value is $[6]. |
308 | See @Efl.Text_Style.text_underline_dashed_width. | 309 | See @Efl.Text_Style.text_underline_dashed_width. |
309 | 310 | ||
310 | - $underline_dash_gap: Length (in pixels) of the gaps between the dashes when $underline is $dashed. | 311 | - $underline_dashed_gap: Length (in pixels) of the gaps between the dashes when $underline_type is $dashed. |
311 | Default value is $[2]. | 312 | Default value is $[2]. |
312 | See @Efl.Text_Style.text_underline_dashed_gap. | 313 | See @Efl.Text_Style.text_underline_dashed_gap. |
313 | 314 | ||
314 | - $underline_height: Width (in pixels) of the single underline when $underline is $single. | 315 | - $underline_height: Width (in pixels) of the single underline when $underline_type is $single. |
315 | Default value is $[1]. | 316 | Default value is $[1]. |
316 | See @Efl.Text_Style.text_underline_height. | 317 | See @Efl.Text_Style.text_underline_height. |
317 | 318 | ||
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index c654822871..bc7393fff6 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c | |||
@@ -531,6 +531,7 @@ struct _Evas_Object_Textblock | |||
531 | Eina_Bool wrap_changed : 1; | 531 | Eina_Bool wrap_changed : 1; |
532 | Eina_Bool auto_styles : 1; | 532 | Eina_Bool auto_styles : 1; |
533 | Eina_Bool fit_in_progress : 1; | 533 | Eina_Bool fit_in_progress : 1; |
534 | Eina_Bool is_legacy : 1; | ||
534 | }; | 535 | }; |
535 | 536 | ||
536 | struct _Evas_Textblock_Selection_Iterator | 537 | struct _Evas_Textblock_Selection_Iterator |
@@ -1400,12 +1401,14 @@ static const char *underline_colorstr = NULL; | |||
1400 | static const char *underline2_colorstr = NULL; | 1401 | static const char *underline2_colorstr = NULL; |
1401 | static const char *secondary_underline_colorstr = NULL; | 1402 | static const char *secondary_underline_colorstr = NULL; |
1402 | static const char *underline_dash_colorstr = NULL; | 1403 | static const char *underline_dash_colorstr = NULL; |
1404 | static const char *underline_dashed_colorstr = NULL; | ||
1403 | static const char *outline_colorstr = NULL; | 1405 | static const char *outline_colorstr = NULL; |
1404 | static const char *shadow_colorstr = NULL; | 1406 | static const char *shadow_colorstr = NULL; |
1405 | static const char *glow_colorstr = NULL; | 1407 | static const char *glow_colorstr = NULL; |
1406 | static const char *glow2_colorstr = NULL; | 1408 | static const char *glow2_colorstr = NULL; |
1407 | static const char *secondary_glow_colorstr = NULL; | 1409 | static const char *secondary_glow_colorstr = NULL; |
1408 | static const char *backing_colorstr = NULL; | 1410 | static const char *backing_colorstr = NULL; |
1411 | static const char *background_colorstr = NULL; | ||
1409 | static const char *strikethrough_colorstr = NULL; | 1412 | static const char *strikethrough_colorstr = NULL; |
1410 | static const char *alignstr = NULL; | 1413 | static const char *alignstr = NULL; |
1411 | static const char *valignstr = NULL; | 1414 | static const char *valignstr = NULL; |
@@ -1414,9 +1417,14 @@ static const char *wrapstr = NULL; | |||
1414 | static const char *left_marginstr = NULL; | 1417 | static const char *left_marginstr = NULL; |
1415 | static const char *right_marginstr = NULL; | 1418 | static const char *right_marginstr = NULL; |
1416 | static const char *underlinestr = NULL; | 1419 | static const char *underlinestr = NULL; |
1420 | static const char *underline_typestr = NULL; | ||
1417 | static const char *strikethroughstr = NULL; | 1421 | static const char *strikethroughstr = NULL; |
1422 | static const char *strikethrough_typestr = NULL; | ||
1418 | static const char *backingstr = NULL; | 1423 | static const char *backingstr = NULL; |
1424 | static const char *background_typestr = NULL; | ||
1419 | static const char *stylestr = NULL; | 1425 | static const char *stylestr = NULL; |
1426 | static const char *effect_typestr = NULL; | ||
1427 | static const char *shadow_directionstr = NULL; | ||
1420 | static const char *tabstopsstr = NULL; | 1428 | static const char *tabstopsstr = NULL; |
1421 | static const char *tab_stopsstr = NULL; | 1429 | static const char *tab_stopsstr = NULL; |
1422 | static const char *linesizestr = NULL; | 1430 | static const char *linesizestr = NULL; |
@@ -1434,7 +1442,9 @@ static const char *ellipsisstr = NULL; | |||
1434 | static const char *passwordstr = NULL; | 1442 | static const char *passwordstr = NULL; |
1435 | static const char *replacement_charstr = NULL; | 1443 | static const char *replacement_charstr = NULL; |
1436 | static const char *underline_dash_widthstr = NULL; | 1444 | static const char *underline_dash_widthstr = NULL; |
1445 | static const char *underline_dashed_widthstr = NULL; | ||
1437 | static const char *underline_dash_gapstr = NULL; | 1446 | static const char *underline_dash_gapstr = NULL; |
1447 | static const char *underline_dashed_gapstr = NULL; | ||
1438 | static const char *underline_heightstr = NULL; | 1448 | static const char *underline_heightstr = NULL; |
1439 | static const char *gfx_filterstr = NULL; | 1449 | static const char *gfx_filterstr = NULL; |
1440 | 1450 | ||
@@ -1595,12 +1605,14 @@ _format_command_init(void) | |||
1595 | underline2_colorstr = eina_stringshare_add("underline2_color"); | 1605 | underline2_colorstr = eina_stringshare_add("underline2_color"); |
1596 | secondary_underline_colorstr = eina_stringshare_add("secondary_underline_color"); | 1606 | secondary_underline_colorstr = eina_stringshare_add("secondary_underline_color"); |
1597 | underline_dash_colorstr = eina_stringshare_add("underline_dash_color"); | 1607 | underline_dash_colorstr = eina_stringshare_add("underline_dash_color"); |
1608 | underline_dashed_colorstr = eina_stringshare_add("underline_dashed_color"); | ||
1598 | outline_colorstr = eina_stringshare_add("outline_color"); | 1609 | outline_colorstr = eina_stringshare_add("outline_color"); |
1599 | shadow_colorstr = eina_stringshare_add("shadow_color"); | 1610 | shadow_colorstr = eina_stringshare_add("shadow_color"); |
1600 | glow_colorstr = eina_stringshare_add("glow_color"); | 1611 | glow_colorstr = eina_stringshare_add("glow_color"); |
1601 | glow2_colorstr = eina_stringshare_add("glow2_color"); | 1612 | glow2_colorstr = eina_stringshare_add("glow2_color"); |
1602 | secondary_glow_colorstr = eina_stringshare_add("secondary_glow_color"); | 1613 | secondary_glow_colorstr = eina_stringshare_add("secondary_glow_color"); |
1603 | backing_colorstr = eina_stringshare_add("backing_color"); | 1614 | backing_colorstr = eina_stringshare_add("backing_color"); |
1615 | background_colorstr = eina_stringshare_add("background_color"); | ||
1604 | strikethrough_colorstr = eina_stringshare_add("strikethrough_color"); | 1616 | strikethrough_colorstr = eina_stringshare_add("strikethrough_color"); |
1605 | alignstr = eina_stringshare_add("align"); | 1617 | alignstr = eina_stringshare_add("align"); |
1606 | valignstr = eina_stringshare_add("valign"); | 1618 | valignstr = eina_stringshare_add("valign"); |
@@ -1609,9 +1621,14 @@ _format_command_init(void) | |||
1609 | left_marginstr = eina_stringshare_add("left_margin"); | 1621 | left_marginstr = eina_stringshare_add("left_margin"); |
1610 | right_marginstr = eina_stringshare_add("right_margin"); | 1622 | right_marginstr = eina_stringshare_add("right_margin"); |
1611 | underlinestr = eina_stringshare_add("underline"); | 1623 | underlinestr = eina_stringshare_add("underline"); |
1624 | underline_typestr = eina_stringshare_add("underline_type"); | ||
1612 | strikethroughstr = eina_stringshare_add("strikethrough"); | 1625 | strikethroughstr = eina_stringshare_add("strikethrough"); |
1626 | strikethrough_typestr = eina_stringshare_add("strikethrough_type"); | ||
1613 | backingstr = eina_stringshare_add("backing"); | 1627 | backingstr = eina_stringshare_add("backing"); |
1628 | background_typestr = eina_stringshare_add("background_type"); | ||
1614 | stylestr = eina_stringshare_add("style"); | 1629 | stylestr = eina_stringshare_add("style"); |
1630 | effect_typestr = eina_stringshare_add("effect_type"); | ||
1631 | shadow_directionstr = eina_stringshare_add("shadow_direction"); | ||
1615 | tabstopsstr = eina_stringshare_add("tabstops"); | 1632 | tabstopsstr = eina_stringshare_add("tabstops"); |
1616 | tab_stopsstr = eina_stringshare_add("tab_stops"); | 1633 | tab_stopsstr = eina_stringshare_add("tab_stops"); |
1617 | linesizestr = eina_stringshare_add("linesize"); | 1634 | linesizestr = eina_stringshare_add("linesize"); |
@@ -1629,7 +1646,9 @@ _format_command_init(void) | |||
1629 | passwordstr = eina_stringshare_add("password"); | 1646 | passwordstr = eina_stringshare_add("password"); |
1630 | replacement_charstr = eina_stringshare_add("replacement_char"); | 1647 | replacement_charstr = eina_stringshare_add("replacement_char"); |
1631 | underline_dash_widthstr = eina_stringshare_add("underline_dash_width"); | 1648 | underline_dash_widthstr = eina_stringshare_add("underline_dash_width"); |
1649 | underline_dashed_widthstr = eina_stringshare_add("underline_dashed_width"); | ||
1632 | underline_dash_gapstr = eina_stringshare_add("underline_dash_gap"); | 1650 | underline_dash_gapstr = eina_stringshare_add("underline_dash_gap"); |
1651 | underline_dashed_gapstr = eina_stringshare_add("underline_dashed_gap"); | ||
1633 | underline_heightstr = eina_stringshare_add("underline_height"); | 1652 | underline_heightstr = eina_stringshare_add("underline_height"); |
1634 | gfx_filterstr = eina_stringshare_add("gfx_filter"); // FIXME: bg, fg filters | 1653 | gfx_filterstr = eina_stringshare_add("gfx_filter"); // FIXME: bg, fg filters |
1635 | } | 1654 | } |
@@ -1658,12 +1677,14 @@ _format_command_shutdown(void) | |||
1658 | eina_stringshare_del(underline2_colorstr); | 1677 | eina_stringshare_del(underline2_colorstr); |
1659 | eina_stringshare_del(secondary_underline_colorstr); | 1678 | eina_stringshare_del(secondary_underline_colorstr); |
1660 | eina_stringshare_del(underline_dash_colorstr); | 1679 | eina_stringshare_del(underline_dash_colorstr); |
1680 | eina_stringshare_del(underline_dashed_colorstr); | ||
1661 | eina_stringshare_del(outline_colorstr); | 1681 | eina_stringshare_del(outline_colorstr); |
1662 | eina_stringshare_del(shadow_colorstr); | 1682 | eina_stringshare_del(shadow_colorstr); |
1663 | eina_stringshare_del(glow_colorstr); | 1683 | eina_stringshare_del(glow_colorstr); |
1664 | eina_stringshare_del(glow2_colorstr); | 1684 | eina_stringshare_del(glow2_colorstr); |
1665 | eina_stringshare_del(secondary_glow_colorstr); | 1685 | eina_stringshare_del(secondary_glow_colorstr); |
1666 | eina_stringshare_del(backing_colorstr); | 1686 | eina_stringshare_del(backing_colorstr); |
1687 | eina_stringshare_del(background_colorstr); | ||
1667 | eina_stringshare_del(strikethrough_colorstr); | 1688 | eina_stringshare_del(strikethrough_colorstr); |
1668 | eina_stringshare_del(alignstr); | 1689 | eina_stringshare_del(alignstr); |
1669 | eina_stringshare_del(valignstr); | 1690 | eina_stringshare_del(valignstr); |
@@ -1672,9 +1693,14 @@ _format_command_shutdown(void) | |||
1672 | eina_stringshare_del(left_marginstr); | 1693 | eina_stringshare_del(left_marginstr); |
1673 | eina_stringshare_del(right_marginstr); | 1694 | eina_stringshare_del(right_marginstr); |
1674 | eina_stringshare_del(underlinestr); | 1695 | eina_stringshare_del(underlinestr); |
1696 | eina_stringshare_del(underline_typestr); | ||
1675 | eina_stringshare_del(strikethroughstr); | 1697 | eina_stringshare_del(strikethroughstr); |
1698 | eina_stringshare_del(strikethrough_typestr); | ||
1676 | eina_stringshare_del(backingstr); | 1699 | eina_stringshare_del(backingstr); |
1700 | eina_stringshare_del(background_typestr); | ||
1677 | eina_stringshare_del(stylestr); | 1701 | eina_stringshare_del(stylestr); |
1702 | eina_stringshare_del(effect_typestr); | ||
1703 | eina_stringshare_del(shadow_directionstr); | ||
1678 | eina_stringshare_del(tabstopsstr); | 1704 | eina_stringshare_del(tabstopsstr); |
1679 | eina_stringshare_del(tab_stopsstr); | 1705 | eina_stringshare_del(tab_stopsstr); |
1680 | eina_stringshare_del(linesizestr); | 1706 | eina_stringshare_del(linesizestr); |
@@ -1692,7 +1718,9 @@ _format_command_shutdown(void) | |||
1692 | eina_stringshare_del(passwordstr); | 1718 | eina_stringshare_del(passwordstr); |
1693 | eina_stringshare_del(replacement_charstr); | 1719 | eina_stringshare_del(replacement_charstr); |
1694 | eina_stringshare_del(underline_dash_widthstr); | 1720 | eina_stringshare_del(underline_dash_widthstr); |
1721 | eina_stringshare_del(underline_dashed_widthstr); | ||
1695 | eina_stringshare_del(underline_dash_gapstr); | 1722 | eina_stringshare_del(underline_dash_gapstr); |
1723 | eina_stringshare_del(underline_dashed_gapstr); | ||
1696 | eina_stringshare_del(underline_heightstr); | 1724 | eina_stringshare_del(underline_heightstr); |
1697 | eina_stringshare_del(gfx_filterstr); | 1725 | eina_stringshare_del(gfx_filterstr); |
1698 | } | 1726 | } |
@@ -1722,6 +1750,543 @@ _format_clean_param(char *s) | |||
1722 | return len; | 1750 | return len; |
1723 | } | 1751 | } |
1724 | 1752 | ||
1753 | static void | ||
1754 | _format_command_legacy_only(Evas_Object_Textblock_Format *fmt, const char *cmd, char *param, int len) | ||
1755 | { | ||
1756 | if (cmd == backing_colorstr) | ||
1757 | /** | ||
1758 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1759 | * | ||
1760 | * @subsection evas_textblock_style_backing_color Backing Color | ||
1761 | * | ||
1762 | * Sets a background color for text. The following formats are | ||
1763 | * accepted: | ||
1764 | * @li "#RRGGBB" | ||
1765 | * @li "#RRGGBBAA" | ||
1766 | * @li "#RGB" | ||
1767 | * @li "#RGBA" | ||
1768 | * @li "rgb(r,g,b)" | ||
1769 | * @li "rgba(r,g,b,a)" | ||
1770 | * @li "color_name" like "red" | ||
1771 | * @code | ||
1772 | * backing_color=<color> | ||
1773 | * @endcode | ||
1774 | */ | ||
1775 | evas_common_format_color_parse(param, len, | ||
1776 | &(fmt->color.backing.r), &(fmt->color.backing.g), | ||
1777 | &(fmt->color.backing.b), &(fmt->color.backing.a)); | ||
1778 | else if (cmd == backingstr) | ||
1779 | { | ||
1780 | /** | ||
1781 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1782 | * | ||
1783 | * @subsection evas_textblock_style_backing Backing | ||
1784 | * | ||
1785 | * Sets if the text will have backing. The value must be one of | ||
1786 | * the following: | ||
1787 | * @li "off" - No backing | ||
1788 | * @li "on" - Backing | ||
1789 | * @code | ||
1790 | * backing=on/off | ||
1791 | * @endcode | ||
1792 | */ | ||
1793 | if (len == 3 && !strcmp(param, "off")) | ||
1794 | fmt->backing = 0; | ||
1795 | else if (len == 2 && !strcmp(param, "on")) | ||
1796 | fmt->backing = 1; | ||
1797 | } | ||
1798 | else if (cmd == underline2_colorstr) | ||
1799 | /** | ||
1800 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1801 | * | ||
1802 | * @subsection evas_textblock_style_underline2_color Second Underline Color | ||
1803 | * | ||
1804 | * Sets the color of the second line of underline(when using underline | ||
1805 | * mode "double"). The following formats are accepted: | ||
1806 | * @li "#RRGGBB" | ||
1807 | * @li "#RRGGBBAA" | ||
1808 | * @li "#RGB" | ||
1809 | * @li "#RGBA" | ||
1810 | * @li "rgb(r,g,b)" | ||
1811 | * @li "rgba(r,g,b,a)" | ||
1812 | * @li "color_name" like "red" | ||
1813 | * @code | ||
1814 | * underline2_color=<color> | ||
1815 | * @endcode | ||
1816 | */ | ||
1817 | evas_common_format_color_parse(param, len, | ||
1818 | &(fmt->color.underline2.r), &(fmt->color.underline2.g), | ||
1819 | &(fmt->color.underline2.b), &(fmt->color.underline2.a)); | ||
1820 | else if (cmd == glow2_colorstr) | ||
1821 | /** | ||
1822 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1823 | * | ||
1824 | * @subsection evas_textblock_style_glow2_color Second Glow Color | ||
1825 | * | ||
1826 | * Sets the second color of the glow of text. The following formats are | ||
1827 | * accepted: | ||
1828 | * @li "#RRGGBB" | ||
1829 | * @li "#RRGGBBAA" | ||
1830 | * @li "#RGB" | ||
1831 | * @li "#RGBA" | ||
1832 | * @li "rgb(r,g,b)" | ||
1833 | * @li "rgba(r,g,b,a)" | ||
1834 | * @li "color_name" like "red" | ||
1835 | * @code | ||
1836 | * glow2_color=<color> | ||
1837 | * @endcode | ||
1838 | */ | ||
1839 | evas_common_format_color_parse(param, len, | ||
1840 | &(fmt->color.glow2.r), &(fmt->color.glow2.g), | ||
1841 | &(fmt->color.glow2.b), &(fmt->color.glow2.a)); | ||
1842 | else if (cmd == tabstopsstr) | ||
1843 | { | ||
1844 | /** | ||
1845 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1846 | * | ||
1847 | * @subsection evas_textblock_style_tabstops Tabstops | ||
1848 | * | ||
1849 | * Sets the size of the tab character. The value must be a number | ||
1850 | * greater than one. | ||
1851 | * @code | ||
1852 | * tabstops=<number> | ||
1853 | * @endcode | ||
1854 | */ | ||
1855 | fmt->tabstops = atoi(param); | ||
1856 | if (fmt->tabstops < 1) fmt->tabstops = 1; | ||
1857 | } | ||
1858 | else if (cmd == linesizestr) | ||
1859 | { | ||
1860 | /** | ||
1861 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1862 | * | ||
1863 | * @subsection evas_textblock_style_linesize Line size | ||
1864 | * | ||
1865 | * Sets the size of line of text. The value should be a number. | ||
1866 | * @warning Setting this value sets linerelsize to 0%! | ||
1867 | * @code | ||
1868 | * linesize=<number> | ||
1869 | * @endcode | ||
1870 | */ | ||
1871 | fmt->linesize = atoi(param); | ||
1872 | fmt->linerelsize = 0.0; | ||
1873 | } | ||
1874 | else if (cmd == linerelsizestr) | ||
1875 | { | ||
1876 | /** | ||
1877 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1878 | * | ||
1879 | * @subsection evas_textblock_style_linerelsize Relative line size | ||
1880 | * | ||
1881 | * Sets the relative size of line of text. The value must be a | ||
1882 | * percentage. | ||
1883 | * @warning Setting this value sets linesize to 0! | ||
1884 | * @code | ||
1885 | * linerelsize=<number>% | ||
1886 | * @endcode | ||
1887 | */ | ||
1888 | char *endptr = NULL; | ||
1889 | double val = strtod(param, &endptr); | ||
1890 | if (endptr) | ||
1891 | { | ||
1892 | while (*endptr && _is_white(*endptr)) | ||
1893 | endptr++; | ||
1894 | if (*endptr == '%') | ||
1895 | { | ||
1896 | fmt->linerelsize = val / 100.0; | ||
1897 | fmt->linesize = 0; | ||
1898 | if (fmt->linerelsize < 0.0) fmt->linerelsize = 0.0; | ||
1899 | } | ||
1900 | } | ||
1901 | } | ||
1902 | else if (cmd == linegapstr) | ||
1903 | { | ||
1904 | /** | ||
1905 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1906 | * | ||
1907 | * @subsection evas_textblock_style_linegap Line gap | ||
1908 | * | ||
1909 | * Sets the size of the line gap in text. The value should be a | ||
1910 | * number. | ||
1911 | * @warning Setting this value sets linerelgap to 0%! | ||
1912 | * @code | ||
1913 | * linegap=<number> | ||
1914 | * @endcode | ||
1915 | */ | ||
1916 | fmt->linegap = atoi(param); | ||
1917 | fmt->linerelgap = 0.0; | ||
1918 | } | ||
1919 | else if (cmd == linerelgapstr) | ||
1920 | { | ||
1921 | /** | ||
1922 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1923 | * | ||
1924 | * @subsection evas_textblock_style_linerelgap Relative line gap | ||
1925 | * | ||
1926 | * Sets the relative size of the line gap in text. The value must be | ||
1927 | * a percentage. | ||
1928 | * @warning Setting this value sets linegap to 0! | ||
1929 | * @code | ||
1930 | * linerelgap=<number>% | ||
1931 | * @endcode | ||
1932 | */ | ||
1933 | char *endptr = NULL; | ||
1934 | double val = strtod(param, &endptr); | ||
1935 | if (endptr) | ||
1936 | { | ||
1937 | while (*endptr && _is_white(*endptr)) | ||
1938 | endptr++; | ||
1939 | if (*endptr == '%') | ||
1940 | { | ||
1941 | fmt->linerelgap = val / 100.0; | ||
1942 | fmt->linegap = 0; | ||
1943 | if (fmt->linerelgap < 0.0) fmt->linerelgap = 0.0; | ||
1944 | } | ||
1945 | } | ||
1946 | } | ||
1947 | else if (cmd == linefillstr) | ||
1948 | { | ||
1949 | /** | ||
1950 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1951 | * | ||
1952 | * @subsection evas_textblock_style_linefill Line fill | ||
1953 | * | ||
1954 | * Sets the size of the line fill in text. The value must be a | ||
1955 | * percentage. | ||
1956 | * @code | ||
1957 | * linefill=<number>% | ||
1958 | * @endcode | ||
1959 | */ | ||
1960 | char *endptr = NULL; | ||
1961 | double val = strtod(param, &endptr); | ||
1962 | if (endptr) | ||
1963 | { | ||
1964 | while (*endptr && _is_white(*endptr)) | ||
1965 | endptr++; | ||
1966 | if (*endptr == '%') | ||
1967 | { | ||
1968 | fmt->linefill = val / 100.0; | ||
1969 | if (fmt->linefill < 0.0) fmt->linefill = 0.0; | ||
1970 | } | ||
1971 | } | ||
1972 | } | ||
1973 | else if (cmd == underline_dash_colorstr) | ||
1974 | /** | ||
1975 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1976 | * | ||
1977 | * @subsection evas_textblock_style_underline_dash_color Underline Dash Color | ||
1978 | * | ||
1979 | * Sets the color of dashed underline. The following formats are accepted: | ||
1980 | * @li "#RRGGBB" | ||
1981 | * @li "#RRGGBBAA" | ||
1982 | * @li "#RGB" | ||
1983 | * @li "#RGBA" | ||
1984 | * @li "rgb(r,g,b)" | ||
1985 | * @li "rgba(r,g,b,a)" | ||
1986 | * @li "color_name" like "red" | ||
1987 | * @code | ||
1988 | * underline_dash_color=<color> | ||
1989 | * @endcode | ||
1990 | */ | ||
1991 | evas_common_format_color_parse(param, len, | ||
1992 | &(fmt->color.underline_dash.r), &(fmt->color.underline_dash.g), | ||
1993 | &(fmt->color.underline_dash.b), &(fmt->color.underline_dash.a)); | ||
1994 | else if (cmd == underlinestr) | ||
1995 | { | ||
1996 | /** | ||
1997 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1998 | * | ||
1999 | * @subsection evas_textblock_style_underline Underline | ||
2000 | * | ||
2001 | * Sets if and how a text will be underlined. The value must be one of | ||
2002 | * the following: | ||
2003 | * @li "off" - No underlining | ||
2004 | * @li "single" - A single line under the text | ||
2005 | * @li "on" - Alias for "single" | ||
2006 | * @li "double" - Two lines under the text | ||
2007 | * @li "dashed" - A dashed line under the text | ||
2008 | * @code | ||
2009 | * underline=off/single/on/double/dashed | ||
2010 | * @endcode | ||
2011 | */ | ||
2012 | static const struct { | ||
2013 | const char *param; | ||
2014 | int len; | ||
2015 | Eina_Bool underline; | ||
2016 | Eina_Bool underline2; | ||
2017 | Eina_Bool underline_dash; | ||
2018 | } underlines_named[] = { | ||
2019 | { "off", 3, 0, 0, 0 }, | ||
2020 | { "on", 2, 1, 0, 0 }, | ||
2021 | { "single", 6, 1, 0, 0 }, | ||
2022 | { "double", 6, 1, 1, 0 }, | ||
2023 | { "dashed", 6, 0, 0, 1 }, | ||
2024 | { NULL, 0, 0, 0, 0 } | ||
2025 | }; | ||
2026 | unsigned int i; | ||
2027 | |||
2028 | fmt->underline = fmt->underline2 = fmt->underline_dash = 0; | ||
2029 | for (i = 0; underlines_named[i].param; ++i) | ||
2030 | if (underlines_named[i].len == len && | ||
2031 | !strcmp(underlines_named[i].param, param)) | ||
2032 | { | ||
2033 | fmt->underline = underlines_named[i].underline; | ||
2034 | fmt->underline2 = underlines_named[i].underline2; | ||
2035 | fmt->underline_dash = underlines_named[i].underline_dash; | ||
2036 | break; | ||
2037 | } | ||
2038 | } | ||
2039 | else if (cmd == strikethroughstr) | ||
2040 | { | ||
2041 | /** | ||
2042 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2043 | * | ||
2044 | * @subsection evas_textblock_style_strikethrough Strikethrough | ||
2045 | * | ||
2046 | * Sets if the text will be striked through. The value must be one of | ||
2047 | * the following: | ||
2048 | * @li "off" - No strikethrough | ||
2049 | * @li "on" - Strikethrough | ||
2050 | * @code | ||
2051 | * strikethrough=on/off | ||
2052 | * @endcode | ||
2053 | */ | ||
2054 | if (len == 3 && !strcmp(param, "off")) | ||
2055 | fmt->strikethrough = 0; | ||
2056 | else if (len == 2 && !strcmp(param, "on")) | ||
2057 | fmt->strikethrough = 1; | ||
2058 | } | ||
2059 | else if (cmd == stylestr) | ||
2060 | { | ||
2061 | /** | ||
2062 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2063 | * | ||
2064 | * @subsection evas_textblock_style_style Style | ||
2065 | * | ||
2066 | * Sets the style of the text. The value must be a string composed of | ||
2067 | * two comma separated parts. The first part of the value sets the | ||
2068 | * appearance of the text, the second the position. | ||
2069 | * | ||
2070 | * The first part may be any of the following values: | ||
2071 | * @li "plain" | ||
2072 | * @li "off" - Alias for "plain" | ||
2073 | * @li "none" - Alias for "plain" | ||
2074 | * @li "shadow" | ||
2075 | * @li "outline" | ||
2076 | * @li "soft_outline" | ||
2077 | * @li "outline_shadow" | ||
2078 | * @li "outline_soft_shadow" | ||
2079 | * @li "glow" | ||
2080 | * @li "far_shadow" | ||
2081 | * @li "soft_shadow" | ||
2082 | * @li "far_soft_shadow" | ||
2083 | * The second part may be any of the following values: | ||
2084 | * @li "bottom_right" | ||
2085 | * @li "bottom" | ||
2086 | * @li "bottom_left" | ||
2087 | * @li "left" | ||
2088 | * @li "top_left" | ||
2089 | * @li "top" | ||
2090 | * @li "top_right" | ||
2091 | * @li "right" | ||
2092 | * @code | ||
2093 | * style=<appearance>,<position> | ||
2094 | * @endcode | ||
2095 | */ | ||
2096 | char *part1, *part2; | ||
2097 | |||
2098 | part1 = alloca(len + 1); | ||
2099 | *part1 = 0; | ||
2100 | |||
2101 | part2 = alloca(len + 1); | ||
2102 | *part2 = 0; | ||
2103 | |||
2104 | _style_string_split(param, part1, part2); | ||
2105 | |||
2106 | _format_shadow_set(fmt, part1, EINA_FALSE, NULL); | ||
2107 | |||
2108 | if (*part2) | ||
2109 | _format_shadow_direction_set(fmt, part2, EINA_FALSE, NULL); | ||
2110 | } | ||
2111 | else if (cmd == underline_dash_widthstr) | ||
2112 | { | ||
2113 | /** | ||
2114 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2115 | * | ||
2116 | * @subsection evas_textblock_style_underline_dash_width Underline dash width | ||
2117 | * | ||
2118 | * Sets the width of the underline dash. The value should be a number. | ||
2119 | * @code | ||
2120 | * underline_dash_width=<number> | ||
2121 | * @endcode | ||
2122 | */ | ||
2123 | fmt->underline_dash_width = atoi(param); | ||
2124 | if (fmt->underline_dash_width <= 0) fmt->underline_dash_width = 1; | ||
2125 | } | ||
2126 | else if (cmd == underline_dash_gapstr) | ||
2127 | { | ||
2128 | /** | ||
2129 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2130 | * | ||
2131 | * @subsection evas_textblock_style_underline_dash_gap Underline dash gap | ||
2132 | * | ||
2133 | * Sets the gap of the underline dash. The value should be a number. | ||
2134 | * @code | ||
2135 | * underline_dash_gap=<number> | ||
2136 | * @endcode | ||
2137 | */ | ||
2138 | fmt->underline_dash_gap = atoi(param); | ||
2139 | if (fmt->underline_dash_gap <= 0) fmt->underline_dash_gap = 1; | ||
2140 | } | ||
2141 | } | ||
2142 | |||
2143 | static void | ||
2144 | _format_command_unified_only( Efl_Canvas_Textblock_Data *o, Evas_Object_Textblock_Format *fmt, const char *cmd, char *param, int len) | ||
2145 | { | ||
2146 | if (cmd == background_colorstr) | ||
2147 | evas_common_format_color_parse(param, len, | ||
2148 | &(fmt->color.backing.r), &(fmt->color.backing.g), | ||
2149 | &(fmt->color.backing.b), &(fmt->color.backing.a)); | ||
2150 | else if (cmd == background_typestr) | ||
2151 | { | ||
2152 | if (len == 4 && !strcmp(param, "none")) | ||
2153 | fmt->backing = 0; | ||
2154 | else if (len == 5 && !strcmp(param, "solid")) | ||
2155 | fmt->backing = 1; | ||
2156 | } | ||
2157 | else if (cmd == secondary_underline_colorstr) | ||
2158 | evas_common_format_color_parse(param, len, | ||
2159 | &(fmt->color.underline2.r), &(fmt->color.underline2.g), | ||
2160 | &(fmt->color.underline2.b), &(fmt->color.underline2.a)); | ||
2161 | else if (cmd == secondary_glow_colorstr) | ||
2162 | evas_common_format_color_parse(param, len, | ||
2163 | &(fmt->color.glow2.r), &(fmt->color.glow2.g), | ||
2164 | &(fmt->color.glow2.b), &(fmt->color.glow2.a)); | ||
2165 | else if (cmd == tab_stopsstr) | ||
2166 | { | ||
2167 | fmt->tabstops = atoi(param); | ||
2168 | if (fmt->tabstops < 1) fmt->tabstops = 1; | ||
2169 | } | ||
2170 | else if (cmd == line_sizestr) | ||
2171 | { | ||
2172 | fmt->linesize = atoi(param); | ||
2173 | fmt->linerelsize = 0.0; | ||
2174 | } | ||
2175 | else if (cmd == line_rel_sizestr) | ||
2176 | { | ||
2177 | char *endptr = NULL; | ||
2178 | double val = strtod(param, &endptr); | ||
2179 | if (endptr) | ||
2180 | { | ||
2181 | while (*endptr && _is_white(*endptr)) | ||
2182 | endptr++; | ||
2183 | if (*endptr == '%') | ||
2184 | { | ||
2185 | fmt->linerelsize = val / 100.0; | ||
2186 | fmt->linesize = 0; | ||
2187 | if (fmt->linerelsize < 0.0) fmt->linerelsize = 0.0; | ||
2188 | } | ||
2189 | } | ||
2190 | } | ||
2191 | else if (cmd == line_gapstr) | ||
2192 | { | ||
2193 | fmt->linegap = atoi(param); | ||
2194 | fmt->linerelgap = 0.0; | ||
2195 | } | ||
2196 | else if (cmd == line_rel_gapstr) | ||
2197 | { | ||
2198 | char *endptr = NULL; | ||
2199 | double val = strtod(param, &endptr); | ||
2200 | if (endptr) | ||
2201 | { | ||
2202 | while (*endptr && _is_white(*endptr)) | ||
2203 | endptr++; | ||
2204 | if (*endptr == '%') | ||
2205 | { | ||
2206 | fmt->linerelgap = val / 100.0; | ||
2207 | fmt->linegap = 0; | ||
2208 | if (fmt->linerelgap < 0.0) fmt->linerelgap = 0.0; | ||
2209 | } | ||
2210 | } | ||
2211 | } | ||
2212 | else if (cmd == line_fillstr) | ||
2213 | { | ||
2214 | char *endptr = NULL; | ||
2215 | double val = strtod(param, &endptr); | ||
2216 | if (endptr) | ||
2217 | { | ||
2218 | while (*endptr && _is_white(*endptr)) | ||
2219 | endptr++; | ||
2220 | if (*endptr == '%') | ||
2221 | { | ||
2222 | fmt->linefill = val / 100.0; | ||
2223 | if (fmt->linefill < 0.0) fmt->linefill = 0.0; | ||
2224 | } | ||
2225 | } | ||
2226 | } | ||
2227 | else if (cmd == underline_dashed_colorstr) | ||
2228 | evas_common_format_color_parse(param, len, | ||
2229 | &(fmt->color.underline_dash.r), &(fmt->color.underline_dash.g), | ||
2230 | &(fmt->color.underline_dash.b), &(fmt->color.underline_dash.a)); | ||
2231 | else if (cmd == underline_typestr) | ||
2232 | { | ||
2233 | typedef struct { | ||
2234 | const char *param; | ||
2235 | int len; | ||
2236 | Eina_Bool underline; | ||
2237 | Eina_Bool underline2; | ||
2238 | Eina_Bool underline_dash; | ||
2239 | } Underline_Info; | ||
2240 | |||
2241 | fmt->underline = fmt->underline2 = fmt->underline_dash = 0; | ||
2242 | unsigned int i; | ||
2243 | #define SET_UNDERLINE_VALUES() \ | ||
2244 | for (i = 0; underlines_named[i].param; ++i) { \ | ||
2245 | if (underlines_named[i].len == len && \ | ||
2246 | !strcmp(underlines_named[i].param, param)) \ | ||
2247 | { \ | ||
2248 | fmt->underline = underlines_named[i].underline; \ | ||
2249 | fmt->underline2 = underlines_named[i].underline2; \ | ||
2250 | fmt->underline_dash = underlines_named[i].underline_dash; \ | ||
2251 | break;\ | ||
2252 | } \ | ||
2253 | } | ||
2254 | static Underline_Info underlines_named[] = { | ||
2255 | { "none", 4, 0, 0, 0 }, | ||
2256 | { "single", 6, 1, 0, 0 }, | ||
2257 | { "double", 6, 1, 1, 0 }, | ||
2258 | { "dashed", 6, 0, 0, 1 }, | ||
2259 | { NULL, 0, 0, 0, 0 } | ||
2260 | }; | ||
2261 | SET_UNDERLINE_VALUES(); | ||
2262 | } | ||
2263 | else if (cmd == strikethrough_typestr) | ||
2264 | { | ||
2265 | if (len == 4 && !strcmp(param, "none")) | ||
2266 | fmt->strikethrough = 0; | ||
2267 | else if (len == 6 && !strcmp(param, "single")) | ||
2268 | fmt->strikethrough = 1; | ||
2269 | } | ||
2270 | else if (cmd == effect_typestr) | ||
2271 | { | ||
2272 | _format_shadow_set(fmt, param, EINA_TRUE, o); | ||
2273 | } | ||
2274 | else if (cmd == shadow_directionstr) | ||
2275 | { | ||
2276 | _format_shadow_direction_set(fmt, param, EINA_TRUE, o); | ||
2277 | } | ||
2278 | else if (cmd == underline_dashed_widthstr) | ||
2279 | { | ||
2280 | fmt->underline_dash_width = atoi(param); | ||
2281 | if (fmt->underline_dash_width <= 0) fmt->underline_dash_width = 1; | ||
2282 | } | ||
2283 | else if (cmd == underline_dashed_gapstr) | ||
2284 | { | ||
2285 | fmt->underline_dash_gap = atoi(param); | ||
2286 | if (fmt->underline_dash_gap <= 0) fmt->underline_dash_gap = 1; | ||
2287 | } | ||
2288 | } | ||
2289 | |||
1725 | /** | 2290 | /** |
1726 | * @internal | 2291 | * @internal |
1727 | * Parses the cmd and parameter and adds the parsed format to fmt. | 2292 | * Parses the cmd and parameter and adds the parsed format to fmt. |
@@ -1735,6 +2300,8 @@ static void | |||
1735 | _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *cmd, char *param) | 2300 | _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *cmd, char *param) |
1736 | { | 2301 | { |
1737 | int len; | 2302 | int len; |
2303 | Efl_Canvas_Textblock_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
2304 | Eina_Bool is_legacy = o->is_legacy; | ||
1738 | 2305 | ||
1739 | len = _format_clean_param(param); | 2306 | len = _format_clean_param(param); |
1740 | 2307 | ||
@@ -1960,49 +2527,6 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
1960 | evas_common_format_color_parse(param, len, | 2527 | evas_common_format_color_parse(param, len, |
1961 | &(fmt->color.underline.r), &(fmt->color.underline.g), | 2528 | &(fmt->color.underline.r), &(fmt->color.underline.g), |
1962 | &(fmt->color.underline.b), &(fmt->color.underline.a)); | 2529 | &(fmt->color.underline.b), &(fmt->color.underline.a)); |
1963 | else if (cmd == underline2_colorstr || cmd == secondary_underline_colorstr) | ||
1964 | /** | ||
1965 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1966 | * | ||
1967 | * @subsection evas_textblock_style_underline2_color Second Underline Color | ||
1968 | * | ||
1969 | * Sets the color of the second line of underline(when using underline | ||
1970 | * mode "double"). The following formats are accepted: | ||
1971 | * @li "#RRGGBB" | ||
1972 | * @li "#RRGGBBAA" | ||
1973 | * @li "#RGB" | ||
1974 | * @li "#RGBA" | ||
1975 | * @li "rgb(r,g,b)" | ||
1976 | * @li "rgba(r,g,b,a)" | ||
1977 | * @li "color_name" like "red" | ||
1978 | * @code | ||
1979 | * underline2_color=<color> | ||
1980 | * @endcode | ||
1981 | */ | ||
1982 | evas_common_format_color_parse(param, len, | ||
1983 | &(fmt->color.underline2.r), &(fmt->color.underline2.g), | ||
1984 | &(fmt->color.underline2.b), &(fmt->color.underline2.a)); | ||
1985 | else if (cmd == underline_dash_colorstr) | ||
1986 | /** | ||
1987 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
1988 | * | ||
1989 | * @subsection evas_textblock_style_underline_dash_color Underline Dash Color | ||
1990 | * | ||
1991 | * Sets the color of dashed underline. The following formats are accepted: | ||
1992 | * @li "#RRGGBB" | ||
1993 | * @li "#RRGGBBAA" | ||
1994 | * @li "#RGB" | ||
1995 | * @li "#RGBA" | ||
1996 | * @li "rgb(r,g,b)" | ||
1997 | * @li "rgba(r,g,b,a)" | ||
1998 | * @li "color_name" like "red" | ||
1999 | * @code | ||
2000 | * underline_dash_color=<color> | ||
2001 | * @endcode | ||
2002 | */ | ||
2003 | evas_common_format_color_parse(param, len, | ||
2004 | &(fmt->color.underline_dash.r), &(fmt->color.underline_dash.g), | ||
2005 | &(fmt->color.underline_dash.b), &(fmt->color.underline_dash.a)); | ||
2006 | else if (cmd == outline_colorstr) | 2530 | else if (cmd == outline_colorstr) |
2007 | /** | 2531 | /** |
2008 | * @page evas_textblock_style_page Evas Textblock Style Options | 2532 | * @page evas_textblock_style_page Evas Textblock Style Options |
@@ -2069,50 +2593,6 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
2069 | evas_common_format_color_parse(param, len, | 2593 | evas_common_format_color_parse(param, len, |
2070 | &(fmt->color.glow.r), &(fmt->color.glow.g), | 2594 | &(fmt->color.glow.r), &(fmt->color.glow.g), |
2071 | &(fmt->color.glow.b), &(fmt->color.glow.a)); | 2595 | &(fmt->color.glow.b), &(fmt->color.glow.a)); |
2072 | else if (cmd == glow2_colorstr || cmd == secondary_glow_colorstr) | ||
2073 | /** | ||
2074 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2075 | * | ||
2076 | * @subsection evas_textblock_style_glow2_color Second Glow Color | ||
2077 | * | ||
2078 | * Sets the second color of the glow of text. The following formats are | ||
2079 | * accepted: | ||
2080 | * @li "#RRGGBB" | ||
2081 | * @li "#RRGGBBAA" | ||
2082 | * @li "#RGB" | ||
2083 | * @li "#RGBA" | ||
2084 | * @li "rgb(r,g,b)" | ||
2085 | * @li "rgba(r,g,b,a)" | ||
2086 | * @li "color_name" like "red" | ||
2087 | * @code | ||
2088 | * glow2_color=<color> | ||
2089 | * @endcode | ||
2090 | */ | ||
2091 | evas_common_format_color_parse(param, len, | ||
2092 | &(fmt->color.glow2.r), &(fmt->color.glow2.g), | ||
2093 | &(fmt->color.glow2.b), &(fmt->color.glow2.a)); | ||
2094 | else if (cmd == backing_colorstr) | ||
2095 | /** | ||
2096 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2097 | * | ||
2098 | * @subsection evas_textblock_style_backing_color Backing Color | ||
2099 | * | ||
2100 | * Sets a background color for text. The following formats are | ||
2101 | * accepted: | ||
2102 | * @li "#RRGGBB" | ||
2103 | * @li "#RRGGBBAA" | ||
2104 | * @li "#RGB" | ||
2105 | * @li "#RGBA" | ||
2106 | * @li "rgb(r,g,b)" | ||
2107 | * @li "rgba(r,g,b,a)" | ||
2108 | * @li "color_name" like "red" | ||
2109 | * @code | ||
2110 | * backing_color=<color> | ||
2111 | * @endcode | ||
2112 | */ | ||
2113 | evas_common_format_color_parse(param, len, | ||
2114 | &(fmt->color.backing.r), &(fmt->color.backing.g), | ||
2115 | &(fmt->color.backing.b), &(fmt->color.backing.a)); | ||
2116 | else if (cmd == strikethrough_colorstr) | 2596 | else if (cmd == strikethrough_colorstr) |
2117 | /** | 2597 | /** |
2118 | * @page evas_textblock_style_page Evas Textblock Style Options | 2598 | * @page evas_textblock_style_page Evas Textblock Style Options |
@@ -2405,248 +2885,6 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
2405 | if (fmt->margin.r < 0) fmt->margin.r = 0; | 2885 | if (fmt->margin.r < 0) fmt->margin.r = 0; |
2406 | } | 2886 | } |
2407 | } | 2887 | } |
2408 | else if (cmd == underlinestr) | ||
2409 | { | ||
2410 | /** | ||
2411 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2412 | * | ||
2413 | * @subsection evas_textblock_style_underline Underline | ||
2414 | * | ||
2415 | * Sets if and how a text will be underlined. The value must be one of | ||
2416 | * the following: | ||
2417 | * @li "off" - No underlining | ||
2418 | * @li "single" - A single line under the text | ||
2419 | * @li "on" - Alias for "single" | ||
2420 | * @li "double" - Two lines under the text | ||
2421 | * @li "dashed" - A dashed line under the text | ||
2422 | * @code | ||
2423 | * underline=off/single/on/double/dashed | ||
2424 | * @endcode | ||
2425 | */ | ||
2426 | static const struct { | ||
2427 | const char *param; | ||
2428 | int len; | ||
2429 | Eina_Bool underline; | ||
2430 | Eina_Bool underline2; | ||
2431 | Eina_Bool underline_dash; | ||
2432 | } underlines_named[] = { | ||
2433 | { "off", 3, 0, 0, 0 }, | ||
2434 | { "on", 2, 1, 0, 0 }, | ||
2435 | { "single", 6, 1, 0, 0 }, | ||
2436 | { "double", 6, 1, 1, 0 }, | ||
2437 | { "dashed", 6, 0, 0, 1 }, | ||
2438 | { NULL, 0, 0, 0, 0 } | ||
2439 | }; | ||
2440 | unsigned int i; | ||
2441 | |||
2442 | fmt->underline = fmt->underline2 = fmt->underline_dash = 0; | ||
2443 | for (i = 0; underlines_named[i].param; ++i) | ||
2444 | if (underlines_named[i].len == len && | ||
2445 | !strcmp(underlines_named[i].param, param)) | ||
2446 | { | ||
2447 | fmt->underline = underlines_named[i].underline; | ||
2448 | fmt->underline2 = underlines_named[i].underline2; | ||
2449 | fmt->underline_dash = underlines_named[i].underline_dash; | ||
2450 | break; | ||
2451 | } | ||
2452 | } | ||
2453 | else if (cmd == strikethroughstr) | ||
2454 | { | ||
2455 | /** | ||
2456 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2457 | * | ||
2458 | * @subsection evas_textblock_style_strikethrough Strikethrough | ||
2459 | * | ||
2460 | * Sets if the text will be striked through. The value must be one of | ||
2461 | * the following: | ||
2462 | * @li "off" - No strikethrough | ||
2463 | * @li "on" - Strikethrough | ||
2464 | * @code | ||
2465 | * strikethrough=on/off | ||
2466 | * @endcode | ||
2467 | */ | ||
2468 | if (len == 3 && !strcmp(param, "off")) | ||
2469 | fmt->strikethrough = 0; | ||
2470 | else if (len == 2 && !strcmp(param, "on")) | ||
2471 | fmt->strikethrough = 1; | ||
2472 | } | ||
2473 | else if (cmd == backingstr) | ||
2474 | { | ||
2475 | /** | ||
2476 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2477 | * | ||
2478 | * @subsection evas_textblock_style_backing Backing | ||
2479 | * | ||
2480 | * Sets if the text will have backing. The value must be one of | ||
2481 | * the following: | ||
2482 | * @li "off" - No backing | ||
2483 | * @li "on" - Backing | ||
2484 | * @code | ||
2485 | * backing=on/off | ||
2486 | * @endcode | ||
2487 | */ | ||
2488 | if (len == 3 && !strcmp(param, "off")) | ||
2489 | fmt->backing = 0; | ||
2490 | else if (len == 2 && !strcmp(param, "on")) | ||
2491 | fmt->backing = 1; | ||
2492 | } | ||
2493 | else if (cmd == stylestr) | ||
2494 | { | ||
2495 | /** | ||
2496 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2497 | * | ||
2498 | * @subsection evas_textblock_style_style Style | ||
2499 | * | ||
2500 | * Sets the style of the text. The value must be a string composed of | ||
2501 | * two comma separated parts. The first part of the value sets the | ||
2502 | * appearance of the text, the second the position. | ||
2503 | * | ||
2504 | * The first part may be any of the following values: | ||
2505 | * @li "plain" | ||
2506 | * @li "off" - Alias for "plain" | ||
2507 | * @li "none" - Alias for "plain" | ||
2508 | * @li "shadow" | ||
2509 | * @li "outline" | ||
2510 | * @li "soft_outline" | ||
2511 | * @li "outline_shadow" | ||
2512 | * @li "outline_soft_shadow" | ||
2513 | * @li "glow" | ||
2514 | * @li "far_shadow" | ||
2515 | * @li "soft_shadow" | ||
2516 | * @li "far_soft_shadow" | ||
2517 | * The second part may be any of the following values: | ||
2518 | * @li "bottom_right" | ||
2519 | * @li "bottom" | ||
2520 | * @li "bottom_left" | ||
2521 | * @li "left" | ||
2522 | * @li "top_left" | ||
2523 | * @li "top" | ||
2524 | * @li "top_right" | ||
2525 | * @li "right" | ||
2526 | * @code | ||
2527 | * style=<appearance>,<position> | ||
2528 | * @endcode | ||
2529 | */ | ||
2530 | char *part1, *part2; | ||
2531 | |||
2532 | part1 = alloca(len + 1); | ||
2533 | *part1 = 0; | ||
2534 | |||
2535 | part2 = alloca(len + 1); | ||
2536 | *part2 = 0; | ||
2537 | |||
2538 | _style_string_split(param, part1, part2); | ||
2539 | |||
2540 | _format_shadow_set(fmt, part1, EINA_FALSE, NULL); | ||
2541 | |||
2542 | if (*part2) | ||
2543 | _format_shadow_direction_set(fmt, part2, EINA_FALSE, NULL); | ||
2544 | } | ||
2545 | else if (cmd == tabstopsstr || cmd == tab_stopsstr) | ||
2546 | { | ||
2547 | /** | ||
2548 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2549 | * | ||
2550 | * @subsection evas_textblock_style_tabstops Tabstops | ||
2551 | * | ||
2552 | * Sets the size of the tab character. The value must be a number | ||
2553 | * greater than one. | ||
2554 | * @code | ||
2555 | * tabstops=<number> | ||
2556 | * @endcode | ||
2557 | */ | ||
2558 | fmt->tabstops = atoi(param); | ||
2559 | if (fmt->tabstops < 1) fmt->tabstops = 1; | ||
2560 | } | ||
2561 | else if (cmd == linesizestr || cmd == line_sizestr) | ||
2562 | { | ||
2563 | /** | ||
2564 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2565 | * | ||
2566 | * @subsection evas_textblock_style_linesize Line size | ||
2567 | * | ||
2568 | * Sets the size of line of text. The value should be a number. | ||
2569 | * @warning Setting this value sets linerelsize to 0%! | ||
2570 | * @code | ||
2571 | * linesize=<number> | ||
2572 | * @endcode | ||
2573 | */ | ||
2574 | fmt->linesize = atoi(param); | ||
2575 | fmt->linerelsize = 0.0; | ||
2576 | } | ||
2577 | else if (cmd == linerelsizestr || cmd == line_rel_sizestr) | ||
2578 | { | ||
2579 | /** | ||
2580 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2581 | * | ||
2582 | * @subsection evas_textblock_style_linerelsize Relative line size | ||
2583 | * | ||
2584 | * Sets the relative size of line of text. The value must be a | ||
2585 | * percentage. | ||
2586 | * @warning Setting this value sets linesize to 0! | ||
2587 | * @code | ||
2588 | * linerelsize=<number>% | ||
2589 | * @endcode | ||
2590 | */ | ||
2591 | char *endptr = NULL; | ||
2592 | double val = strtod(param, &endptr); | ||
2593 | if (endptr) | ||
2594 | { | ||
2595 | while (*endptr && _is_white(*endptr)) | ||
2596 | endptr++; | ||
2597 | if (*endptr == '%') | ||
2598 | { | ||
2599 | fmt->linerelsize = val / 100.0; | ||
2600 | fmt->linesize = 0; | ||
2601 | if (fmt->linerelsize < 0.0) fmt->linerelsize = 0.0; | ||
2602 | } | ||
2603 | } | ||
2604 | } | ||
2605 | else if (cmd == linegapstr || cmd == line_gapstr) | ||
2606 | { | ||
2607 | /** | ||
2608 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2609 | * | ||
2610 | * @subsection evas_textblock_style_linegap Line gap | ||
2611 | * | ||
2612 | * Sets the size of the line gap in text. The value should be a | ||
2613 | * number. | ||
2614 | * @warning Setting this value sets linerelgap to 0%! | ||
2615 | * @code | ||
2616 | * linegap=<number> | ||
2617 | * @endcode | ||
2618 | */ | ||
2619 | fmt->linegap = atoi(param); | ||
2620 | fmt->linerelgap = 0.0; | ||
2621 | } | ||
2622 | else if (cmd == linerelgapstr || cmd == line_rel_gapstr) | ||
2623 | { | ||
2624 | /** | ||
2625 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2626 | * | ||
2627 | * @subsection evas_textblock_style_linerelgap Relative line gap | ||
2628 | * | ||
2629 | * Sets the relative size of the line gap in text. The value must be | ||
2630 | * a percentage. | ||
2631 | * @warning Setting this value sets linegap to 0! | ||
2632 | * @code | ||
2633 | * linerelgap=<number>% | ||
2634 | * @endcode | ||
2635 | */ | ||
2636 | char *endptr = NULL; | ||
2637 | double val = strtod(param, &endptr); | ||
2638 | if (endptr) | ||
2639 | { | ||
2640 | while (*endptr && _is_white(*endptr)) | ||
2641 | endptr++; | ||
2642 | if (*endptr == '%') | ||
2643 | { | ||
2644 | fmt->linerelgap = val / 100.0; | ||
2645 | fmt->linegap = 0; | ||
2646 | if (fmt->linerelgap < 0.0) fmt->linerelgap = 0.0; | ||
2647 | } | ||
2648 | } | ||
2649 | } | ||
2650 | else if (cmd == itemstr) | 2888 | else if (cmd == itemstr) |
2651 | { | 2889 | { |
2652 | /** | 2890 | /** |
@@ -2662,32 +2900,6 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
2662 | // itemstr == replacement object items in textblock - inline imges | 2900 | // itemstr == replacement object items in textblock - inline imges |
2663 | // for example | 2901 | // for example |
2664 | } | 2902 | } |
2665 | else if (cmd == linefillstr || cmd == line_fillstr) | ||
2666 | { | ||
2667 | /** | ||
2668 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2669 | * | ||
2670 | * @subsection evas_textblock_style_linefill Line fill | ||
2671 | * | ||
2672 | * Sets the size of the line fill in text. The value must be a | ||
2673 | * percentage. | ||
2674 | * @code | ||
2675 | * linefill=<number>% | ||
2676 | * @endcode | ||
2677 | */ | ||
2678 | char *endptr = NULL; | ||
2679 | double val = strtod(param, &endptr); | ||
2680 | if (endptr) | ||
2681 | { | ||
2682 | while (*endptr && _is_white(*endptr)) | ||
2683 | endptr++; | ||
2684 | if (*endptr == '%') | ||
2685 | { | ||
2686 | fmt->linefill = val / 100.0; | ||
2687 | if (fmt->linefill < 0.0) fmt->linefill = 0.0; | ||
2688 | } | ||
2689 | } | ||
2690 | } | ||
2691 | else if (cmd == ellipsisstr) | 2903 | else if (cmd == ellipsisstr) |
2692 | { | 2904 | { |
2693 | /** | 2905 | /** |
@@ -2739,36 +2951,6 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
2739 | Efl_Canvas_Textblock_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 2951 | Efl_Canvas_Textblock_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); |
2740 | eina_stringshare_replace(&o->repch, param); | 2952 | eina_stringshare_replace(&o->repch, param); |
2741 | } | 2953 | } |
2742 | else if (cmd == underline_dash_widthstr) | ||
2743 | { | ||
2744 | /** | ||
2745 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2746 | * | ||
2747 | * @subsection evas_textblock_style_underline_dash_width Underline dash width | ||
2748 | * | ||
2749 | * Sets the width of the underline dash. The value should be a number. | ||
2750 | * @code | ||
2751 | * underline_dash_width=<number> | ||
2752 | * @endcode | ||
2753 | */ | ||
2754 | fmt->underline_dash_width = atoi(param); | ||
2755 | if (fmt->underline_dash_width <= 0) fmt->underline_dash_width = 1; | ||
2756 | } | ||
2757 | else if (cmd == underline_dash_gapstr) | ||
2758 | { | ||
2759 | /** | ||
2760 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2761 | * | ||
2762 | * @subsection evas_textblock_style_underline_dash_gap Underline dash gap | ||
2763 | * | ||
2764 | * Sets the gap of the underline dash. The value should be a number. | ||
2765 | * @code | ||
2766 | * underline_dash_gap=<number> | ||
2767 | * @endcode | ||
2768 | */ | ||
2769 | fmt->underline_dash_gap = atoi(param); | ||
2770 | if (fmt->underline_dash_gap <= 0) fmt->underline_dash_gap = 1; | ||
2771 | } | ||
2772 | else if (cmd == underline_heightstr) | 2954 | else if (cmd == underline_heightstr) |
2773 | { | 2955 | { |
2774 | /** | 2956 | /** |
@@ -2800,6 +2982,18 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch | |||
2800 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Textblock_Filter)); | 2982 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Textblock_Filter)); |
2801 | eina_stringshare_replace(&fmt->gfx_filter->name, param); | 2983 | eina_stringshare_replace(&fmt->gfx_filter->name, param); |
2802 | } | 2984 | } |
2985 | else | ||
2986 | { | ||
2987 | if (is_legacy) | ||
2988 | { | ||
2989 | _format_command_legacy_only(fmt, cmd, param, len); | ||
2990 | } | ||
2991 | else | ||
2992 | { | ||
2993 | _format_command_unified_only(o, fmt, cmd, param, len); | ||
2994 | } | ||
2995 | |||
2996 | } | ||
2803 | } | 2997 | } |
2804 | 2998 | ||
2805 | //FIXME Create common function for both _default _format_command & _format_command | 2999 | //FIXME Create common function for both _default _format_command & _format_command |
@@ -3350,7 +3544,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) | |||
3350 | PRINTF_APPEND_COLOR(secondary_underline_colorstr, fmt->color.underline2.r, fmt->color.underline2.g, | 3544 | PRINTF_APPEND_COLOR(secondary_underline_colorstr, fmt->color.underline2.r, fmt->color.underline2.g, |
3351 | fmt->color.underline2.b, fmt->color.underline2.a); | 3545 | fmt->color.underline2.b, fmt->color.underline2.a); |
3352 | 3546 | ||
3353 | PRINTF_APPEND_COLOR(underline_dash_colorstr, fmt->color.underline_dash.r, fmt->color.underline_dash.g, | 3547 | PRINTF_APPEND_COLOR(underline_dashed_colorstr, fmt->color.underline_dash.r, fmt->color.underline_dash.g, |
3354 | fmt->color.underline_dash.b, fmt->color.underline_dash.a); | 3548 | fmt->color.underline_dash.b, fmt->color.underline_dash.a); |
3355 | 3549 | ||
3356 | PRINTF_APPEND_COLOR(outline_colorstr, fmt->color.outline.r, fmt->color.outline.g, | 3550 | PRINTF_APPEND_COLOR(outline_colorstr, fmt->color.outline.r, fmt->color.outline.g, |
@@ -3365,7 +3559,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) | |||
3365 | PRINTF_APPEND_COLOR(secondary_glow_colorstr, fmt->color.glow2.r, fmt->color.glow2.g, | 3559 | PRINTF_APPEND_COLOR(secondary_glow_colorstr, fmt->color.glow2.r, fmt->color.glow2.g, |
3366 | fmt->color.glow2.b, fmt->color.glow2.a); | 3560 | fmt->color.glow2.b, fmt->color.glow2.a); |
3367 | 3561 | ||
3368 | PRINTF_APPEND_COLOR(backing_colorstr, fmt->color.backing.r, fmt->color.backing.g, | 3562 | PRINTF_APPEND_COLOR(background_colorstr, fmt->color.backing.r, fmt->color.backing.g, |
3369 | fmt->color.backing.b, fmt->color.backing.a); | 3563 | fmt->color.backing.b, fmt->color.backing.a); |
3370 | 3564 | ||
3371 | PRINTF_APPEND_COLOR(strikethrough_colorstr, fmt->color.strikethrough.r, fmt->color.strikethrough.g, | 3565 | PRINTF_APPEND_COLOR(strikethrough_colorstr, fmt->color.strikethrough.r, fmt->color.strikethrough.g, |
@@ -3423,7 +3617,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) | |||
3423 | PRINTF_APPEND_INT(right_marginstr, fmt->margin.r); | 3617 | PRINTF_APPEND_INT(right_marginstr, fmt->margin.r); |
3424 | 3618 | ||
3425 | 3619 | ||
3426 | char *underline_value_str = "off"; | 3620 | char *underline_value_str = "none"; |
3427 | 3621 | ||
3428 | if (fmt->underline == EINA_TRUE && fmt->underline2 == EINA_TRUE) | 3622 | if (fmt->underline == EINA_TRUE && fmt->underline2 == EINA_TRUE) |
3429 | underline_value_str = "double"; | 3623 | underline_value_str = "double"; |
@@ -3432,88 +3626,80 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) | |||
3432 | else if (fmt->underline_dash == EINA_TRUE) | 3626 | else if (fmt->underline_dash == EINA_TRUE) |
3433 | underline_value_str = "dashed"; | 3627 | underline_value_str = "dashed"; |
3434 | 3628 | ||
3435 | PRINTF_APPEND_STR(underlinestr, underline_value_str); | 3629 | PRINTF_APPEND_STR(underline_typestr, underline_value_str); |
3436 | PRINTF_APPEND_STR(strikethroughstr, (fmt->strikethrough == 0 ? "off" : "on")); | 3630 | PRINTF_APPEND_STR(strikethrough_typestr, (fmt->strikethrough == 0 ? "none" : "single")); |
3437 | PRINTF_APPEND_STR(backingstr, (fmt->backing == 0 ? "off" : "on")); | 3631 | PRINTF_APPEND_STR(background_typestr, (fmt->backing == 0 ? "none" : "solid")); |
3438 | 3632 | ||
3439 | char *style_value_str_1 = "off"; | 3633 | Efl_Text_Style_Effect_Type effect = _FMT_INFO(effect); |
3440 | char *style_value_str_2 = NULL; | ||
3441 | Efl_Text_Style_Effect_Type style1 = _FMT_INFO(effect); | ||
3442 | Efl_Text_Style_Effect_Type style2 = _FMT_INFO(shadow_direction); | ||
3443 | 3634 | ||
3444 | switch (style1) | 3635 | switch (effect) |
3445 | { | 3636 | { |
3446 | case EFL_TEXT_STYLE_EFFECT_TYPE_NONE: | 3637 | case EFL_TEXT_STYLE_EFFECT_TYPE_NONE: |
3447 | style_value_str_1 = "plain"; | 3638 | PRINTF_APPEND_STR(effect_typestr, "none"); |
3448 | break; | 3639 | break; |
3449 | case EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW: | 3640 | case EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW: |
3450 | style_value_str_1 = "shadow"; | 3641 | PRINTF_APPEND_STR(effect_typestr, "shadow"); |
3451 | break; | 3642 | break; |
3452 | case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE: | 3643 | case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE: |
3453 | style_value_str_1 = "outline"; | 3644 | PRINTF_APPEND_STR(effect_typestr, "outline"); |
3454 | break; | 3645 | break; |
3455 | case EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE: | 3646 | case EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE: |
3456 | style_value_str_1 = "soft_outline"; | 3647 | PRINTF_APPEND_STR(effect_typestr, "soft_outline"); |
3457 | break; | 3648 | break; |
3458 | case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW: | 3649 | case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW: |
3459 | style_value_str_1 = "outline_shadow"; | 3650 | PRINTF_APPEND_STR(effect_typestr, "outline_shadow"); |
3460 | break; | 3651 | break; |
3461 | case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW: | 3652 | case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW: |
3462 | style_value_str_1 = "outline_soft_shadow"; | 3653 | PRINTF_APPEND_STR(effect_typestr, "outline_soft_shadow"); |
3463 | break; | 3654 | break; |
3464 | case EFL_TEXT_STYLE_EFFECT_TYPE_GLOW: | 3655 | case EFL_TEXT_STYLE_EFFECT_TYPE_GLOW: |
3465 | style_value_str_1 = "glow"; | 3656 | PRINTF_APPEND_STR(effect_typestr, "glow"); |
3466 | break; | 3657 | break; |
3467 | case EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW: | 3658 | case EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW: |
3468 | style_value_str_1 = "far_shadow"; | 3659 | PRINTF_APPEND_STR(effect_typestr, "far_shadow"); |
3469 | break; | 3660 | break; |
3470 | case EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW: | 3661 | case EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW: |
3471 | style_value_str_1 = "soft_shadow"; | 3662 | PRINTF_APPEND_STR(effect_typestr, "soft_shadow"); |
3472 | break; | 3663 | break; |
3473 | case EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW: | 3664 | case EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW: |
3474 | style_value_str_1 = "far_soft_shadow"; | 3665 | PRINTF_APPEND_STR(effect_typestr, "far_soft_shadow"); |
3475 | break; | 3666 | break; |
3476 | default: | 3667 | default: |
3477 | style_value_str_1 = "off"; | ||
3478 | break; | 3668 | break; |
3479 | } | 3669 | } |
3480 | 3670 | ||
3481 | switch (style2) | 3671 | Efl_Text_Style_Shadow_Direction shadow_direction = _FMT_INFO(shadow_direction); |
3672 | |||
3673 | switch (shadow_direction) | ||
3482 | { | 3674 | { |
3483 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT: | 3675 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT: |
3484 | style_value_str_2 = "bottom_right"; | 3676 | PRINTF_APPEND_STR(shadow_directionstr, "bottom_right"); |
3485 | break; | 3677 | break; |
3486 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM: | 3678 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM: |
3487 | style_value_str_2 = "bottom"; | 3679 | PRINTF_APPEND_STR(shadow_directionstr, "bottom"); |
3488 | break; | 3680 | break; |
3489 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT: | 3681 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT: |
3490 | style_value_str_2 = "bottom_left"; | 3682 | PRINTF_APPEND_STR(shadow_directionstr, "bottom_left"); |
3491 | break; | 3683 | break; |
3492 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_LEFT: | 3684 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_LEFT: |
3493 | style_value_str_2 = "left"; | 3685 | PRINTF_APPEND_STR(shadow_directionstr, "left"); |
3494 | break; | 3686 | break; |
3495 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT: | 3687 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT: |
3496 | style_value_str_2 = "top_left"; | 3688 | PRINTF_APPEND_STR(shadow_directionstr, "top_left"); |
3497 | break; | 3689 | break; |
3498 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP: | 3690 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP: |
3499 | style_value_str_2 = "top"; | 3691 | PRINTF_APPEND_STR(shadow_directionstr, "top"); |
3500 | break; | 3692 | break; |
3501 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT: | 3693 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT: |
3502 | style_value_str_2 = "top_right"; | 3694 | PRINTF_APPEND_STR(shadow_directionstr, "top_right"); |
3503 | break; | 3695 | break; |
3504 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT: | 3696 | case EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT: |
3505 | style_value_str_2 = "right"; | 3697 | PRINTF_APPEND_STR(shadow_directionstr, "right"); |
3506 | break; | 3698 | break; |
3507 | default: | 3699 | default: |
3508 | style_value_str_2 = NULL; | ||
3509 | break; | 3700 | break; |
3510 | } | 3701 | } |
3511 | 3702 | ||
3512 | if (style_value_str_2 != NULL) | ||
3513 | eina_strbuf_append_printf(format_buffer, "%s=%s,%s ", stylestr, style_value_str_1, style_value_str_2); | ||
3514 | else | ||
3515 | PRINTF_APPEND_STR(stylestr, style_value_str_1); | ||
3516 | |||
3517 | PRINTF_APPEND_INT(tab_stopsstr, fmt->tabstops); | 3703 | PRINTF_APPEND_INT(tab_stopsstr, fmt->tabstops); |
3518 | PRINTF_APPEND_INT(line_sizestr, fmt->linesize); | 3704 | PRINTF_APPEND_INT(line_sizestr, fmt->linesize); |
3519 | PRINTF_APPEND_PERCENT_FLOAT(line_rel_sizestr, (fmt->linerelsize*100)); | 3705 | PRINTF_APPEND_PERCENT_FLOAT(line_rel_sizestr, (fmt->linerelsize*100)); |
@@ -3526,8 +3712,8 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt) | |||
3526 | if (o->repch) | 3712 | if (o->repch) |
3527 | PRINTF_APPEND_STR(replacement_charstr, o->repch); | 3713 | PRINTF_APPEND_STR(replacement_charstr, o->repch); |
3528 | 3714 | ||
3529 | PRINTF_APPEND_INT(underline_dash_widthstr, fmt->underline_dash_width); | 3715 | PRINTF_APPEND_INT(underline_dashed_widthstr, fmt->underline_dash_width); |
3530 | PRINTF_APPEND_INT(underline_dash_gapstr, fmt->underline_dash_gap); | 3716 | PRINTF_APPEND_INT(underline_dashed_gapstr, fmt->underline_dash_gap); |
3531 | PRINTF_APPEND_FLOAT(underline_heightstr, fmt->underline_height); | 3717 | PRINTF_APPEND_FLOAT(underline_heightstr, fmt->underline_height); |
3532 | 3718 | ||
3533 | const char *temp = eina_strbuf_string_get(format_buffer); | 3719 | const char *temp = eina_strbuf_string_get(format_buffer); |
@@ -7656,6 +7842,7 @@ evas_object_textblock_add(Evas *e) | |||
7656 | efl_text_multiline_set(efl_added, EINA_TRUE), | 7842 | efl_text_multiline_set(efl_added, EINA_TRUE), |
7657 | efl_canvas_object_legacy_ctor(efl_added)); | 7843 | efl_canvas_object_legacy_ctor(efl_added)); |
7658 | o = efl_data_scope_get(eo_obj, MY_CLASS); | 7844 | o = efl_data_scope_get(eo_obj, MY_CLASS); |
7845 | o->is_legacy = EINA_TRUE; | ||
7659 | o->legacy_newline = EINA_TRUE; | 7846 | o->legacy_newline = EINA_TRUE; |
7660 | o->auto_styles = EINA_FALSE; | 7847 | o->auto_styles = EINA_FALSE; |
7661 | _FMT(password) = EINA_TRUE; | 7848 | _FMT(password) = EINA_TRUE; |
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 1fee7eb5b1..76bf4c68b1 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c | |||
@@ -4909,23 +4909,33 @@ EFL_START_TEST(efl_canvas_textblock_style) | |||
4909 | efl_canvas_textblock_style_apply(txt, "wrap=none"); | 4909 | efl_canvas_textblock_style_apply(txt, "wrap=none"); |
4910 | ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE); | 4910 | ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE); |
4911 | 4911 | ||
4912 | efl_canvas_textblock_style_apply(txt, "backing=on"); | 4912 | efl_canvas_textblock_style_apply(txt, "background_type=solid"); |
4913 | ck_assert_int_eq(efl_text_background_type_get(txt), EFL_TEXT_STYLE_BACKGROUND_TYPE_SOLID_COLOR); | 4913 | ck_assert_int_eq(efl_text_background_type_get(txt), EFL_TEXT_STYLE_BACKGROUND_TYPE_SOLID_COLOR); |
4914 | 4914 | ||
4915 | efl_canvas_textblock_style_apply(txt, "style=far_soft_shadow"); | 4915 | efl_canvas_textblock_style_apply(txt, "background_color=red"); |
4916 | efl_text_background_color_get(txt, &r, &g, &b, &a); | ||
4917 | ck_assert_int_eq(r, 0xFF); | ||
4918 | ck_assert_int_eq(g, 0x00); | ||
4919 | ck_assert_int_eq(b, 0x00); | ||
4920 | ck_assert_int_eq(a, 0xFF); | ||
4921 | |||
4922 | efl_canvas_textblock_style_apply(txt, "effect_type=far_soft_shadow"); | ||
4916 | ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW); | 4923 | ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW); |
4917 | 4924 | ||
4918 | efl_canvas_textblock_style_apply(txt, "style=glow,top_right"); | 4925 | efl_canvas_textblock_style_apply(txt, "shadow_direction=top_right"); |
4919 | ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_GLOW); | ||
4920 | ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); | 4926 | ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); |
4921 | 4927 | ||
4922 | efl_canvas_textblock_style_apply(txt, "style=far_shadow,top"); | 4928 | efl_canvas_textblock_style_apply(txt, "shadow_direction=top"); |
4923 | ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW); | ||
4924 | ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP); | 4929 | ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP); |
4925 | 4930 | ||
4926 | efl_canvas_textblock_style_apply(txt, "style=soft_outline,top,bottom"); | 4931 | efl_canvas_textblock_style_apply(txt, "effect_type=soft_outline"); |
4927 | ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE); | 4932 | ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE); |
4928 | ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); | 4933 | |
4934 | efl_canvas_textblock_style_apply(txt, "underline_type=none"); | ||
4935 | ck_assert_int_eq(efl_text_underline_type_get(txt), EFL_TEXT_STYLE_UNDERLINE_TYPE_NONE); | ||
4936 | |||
4937 | efl_canvas_textblock_style_apply(txt, "strikethrough_type=single"); | ||
4938 | ck_assert_int_eq(efl_text_strikethrough_type_get(txt), EFL_TEXT_STYLE_STRIKETHROUGH_TYPE_SINGLE); | ||
4929 | 4939 | ||
4930 | efl_canvas_textblock_style_apply(txt, "color=#EF596C"); | 4940 | efl_canvas_textblock_style_apply(txt, "color=#EF596C"); |
4931 | efl_text_color_get(txt, &r, &g, &b, &a); | 4941 | efl_text_color_get(txt, &r, &g, &b, &a); |