efl.canvas.textblock: rename style strings to have underscore between words

Summary:
rename following styling strings:
tabstops -> tab_stops
linesize -> line_size
linerelsize -> line_rel_size
linegap -> line_gap
linerelgap -> line_rel_gap
linefill -> line_fill

This will affect Style_Apply, all_style_get,  and any method expect styling string

Reviewers: segfaultxavi, woohyun

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8523

Differential Revision: https://phab.enlightenment.org/D11043
This commit is contained in:
Ali Alzyod 2020-01-09 12:14:22 +01:00 committed by Xavi Artigas
parent dcc7813caf
commit 7b0a44dd33
3 changed files with 44 additions and 26 deletions

View File

@ -257,37 +257,37 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
Examples: $[style=outline], $[style=shadow,bottom_right], $[style=outline_shadow,bottom].
See @Efl.Text_Style.text_effect_type and @Efl.Text_Style.text_shadow_direction.
- $tabstops: Size (in pixels) of the tab character. The value must be a number greater than one.
- $tab_stops: Size (in pixels) of the tab character. The value must be a number greater than one.
Default value is $[32].
See @Efl.Text_Format.tab_stops.
- $linesize: Distance (in pixels) from the baseline of one line of text to the next. This is, a value of
- $line_size: Distance (in pixels) from the baseline of one line of text to the next. This is, a value of
$[0] would render all lines on top of each other (However, this value will be ignored if it results in
overlapping lines of text).
Setting this value sets $linerelsize to $[0%] (disables it).
Setting this value sets $line_rel_size to $[0%] (disables it).
Default value is $[0].
- $linerelsize: Distance (in percentage over the natural line height) from the baseline of one line of
- $line_rel_size: Distance (in percentage over the natural line height) from the baseline of one line of
text to the next. A value of $[100%] does not have any impact, smaller values render lines closer together
and bigger values render them further apart.
Setting this value sets $linesize to $[0] (disables it).
Setting this value sets $line_size to $[0] (disables it).
Default value is $[0%].
- $linegap: Additional empty space (in pixels) between the bottom of one line of text and the top of the
next. Setting this value sets $linerelgap to $[0%] (disables it).
- $line_gap: Additional empty space (in pixels) between the bottom of one line of text and the top of the
next. Setting this value sets $line_rel_gap to $[0%] (disables it).
Default value is $[0].
See @Efl.Text_Format.line_gap.
- $linerelgap: Additional empty space (in percentage over the natural line height) between the bottom of
- $line_rel_gap: Additional empty space (in percentage over the natural line height) between the bottom of
one line of text and the top of the next.
Setting this value sets $linegap to $[0] (disables it).
Setting this value sets $line_gap to $[0] (disables it).
Default value is $[0%].
See @Efl.Text_Format.line_rel_gap.
- $linefill: An alternate way to specify the $linesize as a percentage of the canvas height.
- $line_fill: An alternate way to specify the $line_size as a percentage of the canvas height.
A value of $[100%] means that a single line fills the canvas, whereas $[25%] means that 4 lines
fit in the same height.
When both $linefill and $linesize are specified the one resulting in the smallest line size is used.
When both $line_fill and $line_size are specified the one resulting in the smallest line size is used.
Default value is $[0].
- $ellipsis: Controls automatic addition of ellipsis "..." to replace text which cannot be shown.

View File

@ -1418,12 +1418,18 @@ static const char *strikethroughstr = NULL;
static const char *backingstr = NULL;
static const char *stylestr = NULL;
static const char *tabstopsstr = NULL;
static const char *tab_stopsstr = NULL;
static const char *linesizestr = NULL;
static const char *line_sizestr = NULL;
static const char *linerelsizestr = NULL;
static const char *line_rel_sizestr = NULL;
static const char *linegapstr = NULL;
static const char *line_gapstr = NULL;
static const char *linerelgapstr = NULL;
static const char *line_rel_gapstr = NULL;
static const char *itemstr = NULL;
static const char *linefillstr = NULL;
static const char *line_fillstr = NULL;
static const char *ellipsisstr = NULL;
static const char *passwordstr = NULL;
static const char *replacement_charstr = NULL;
@ -1607,12 +1613,18 @@ _format_command_init(void)
backingstr = eina_stringshare_add("backing");
stylestr = eina_stringshare_add("style");
tabstopsstr = eina_stringshare_add("tabstops");
tab_stopsstr = eina_stringshare_add("tab_stops");
linesizestr = eina_stringshare_add("linesize");
line_sizestr = eina_stringshare_add("line_size");
linerelsizestr = eina_stringshare_add("linerelsize");
line_rel_sizestr = eina_stringshare_add("line_rel_size");
linegapstr = eina_stringshare_add("linegap");
line_gapstr = eina_stringshare_add("line_gap");
linerelgapstr = eina_stringshare_add("linerelgap");
line_rel_gapstr = eina_stringshare_add("line_rel_gap");
itemstr = eina_stringshare_add("item");
linefillstr = eina_stringshare_add("linefill");
line_fillstr = eina_stringshare_add("line_fill");
ellipsisstr = eina_stringshare_add("ellipsis");
passwordstr = eina_stringshare_add("password");
replacement_charstr = eina_stringshare_add("replacement_char");
@ -1664,12 +1676,18 @@ _format_command_shutdown(void)
eina_stringshare_del(backingstr);
eina_stringshare_del(stylestr);
eina_stringshare_del(tabstopsstr);
eina_stringshare_del(tab_stopsstr);
eina_stringshare_del(linesizestr);
eina_stringshare_del(line_sizestr);
eina_stringshare_del(linerelsizestr);
eina_stringshare_del(line_rel_sizestr);
eina_stringshare_del(linegapstr);
eina_stringshare_del(line_gapstr);
eina_stringshare_del(linerelgapstr);
eina_stringshare_del(line_rel_gapstr);
eina_stringshare_del(itemstr);
eina_stringshare_del(linefillstr);
eina_stringshare_del(line_fillstr);
eina_stringshare_del(ellipsisstr);
eina_stringshare_del(passwordstr);
eina_stringshare_del(replacement_charstr);
@ -2524,7 +2542,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
if (*part2)
_format_shadow_direction_set(fmt, part2, EINA_FALSE, NULL);
}
else if (cmd == tabstopsstr)
else if (cmd == tabstopsstr || cmd == tab_stopsstr)
{
/**
* @page evas_textblock_style_page Evas Textblock Style Options
@ -2540,7 +2558,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
fmt->tabstops = atoi(param);
if (fmt->tabstops < 1) fmt->tabstops = 1;
}
else if (cmd == linesizestr)
else if (cmd == linesizestr || cmd == line_sizestr)
{
/**
* @page evas_textblock_style_page Evas Textblock Style Options
@ -2556,7 +2574,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
fmt->linesize = atoi(param);
fmt->linerelsize = 0.0;
}
else if (cmd == linerelsizestr)
else if (cmd == linerelsizestr || cmd == line_rel_sizestr)
{
/**
* @page evas_textblock_style_page Evas Textblock Style Options
@ -2584,7 +2602,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
}
}
}
else if (cmd == linegapstr)
else if (cmd == linegapstr || cmd == line_gapstr)
{
/**
* @page evas_textblock_style_page Evas Textblock Style Options
@ -2601,7 +2619,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
fmt->linegap = atoi(param);
fmt->linerelgap = 0.0;
}
else if (cmd == linerelgapstr)
else if (cmd == linerelgapstr || cmd == line_rel_gapstr)
{
/**
* @page evas_textblock_style_page Evas Textblock Style Options
@ -2644,7 +2662,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
// itemstr == replacement object items in textblock - inline imges
// for example
}
else if (cmd == linefillstr)
else if (cmd == linefillstr || cmd == line_fillstr)
{
/**
* @page evas_textblock_style_page Evas Textblock Style Options
@ -3329,7 +3347,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
PRINTF_APPEND_COLOR(underline_colorstr, fmt->color.underline.r, fmt->color.underline.g,
fmt->color.underline.b, fmt->color.underline.a);
PRINTF_APPEND_COLOR(underline2_colorstr, fmt->color.underline2.r, fmt->color.underline2.g,
PRINTF_APPEND_COLOR(secondary_underline_colorstr, fmt->color.underline2.r, fmt->color.underline2.g,
fmt->color.underline2.b, fmt->color.underline2.a);
PRINTF_APPEND_COLOR(underline_dash_colorstr, fmt->color.underline_dash.r, fmt->color.underline_dash.g,
@ -3344,7 +3362,7 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
PRINTF_APPEND_COLOR(glow_colorstr, fmt->color.glow.r, fmt->color.glow.g,
fmt->color.glow.b, fmt->color.glow.a);
PRINTF_APPEND_COLOR(glow2_colorstr, fmt->color.glow2.r, fmt->color.glow2.g,
PRINTF_APPEND_COLOR(secondary_glow_colorstr, fmt->color.glow2.r, fmt->color.glow2.g,
fmt->color.glow2.b, fmt->color.glow2.a);
PRINTF_APPEND_COLOR(backing_colorstr, fmt->color.backing.r, fmt->color.backing.g,
@ -3496,12 +3514,12 @@ _format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
else
PRINTF_APPEND_STR(stylestr, style_value_str_1);
PRINTF_APPEND_INT(tabstopsstr, fmt->tabstops);
PRINTF_APPEND_INT(linesizestr, fmt->linesize);
PRINTF_APPEND_PERCENT_FLOAT(linerelsizestr, (fmt->linerelsize*100));
PRINTF_APPEND_INT(linegapstr, fmt->linegap);
PRINTF_APPEND_PERCENT_FLOAT(linerelgapstr, (fmt->linerelgap*100));
PRINTF_APPEND_PERCENT_FLOAT(linefillstr, (fmt->linefill*100));
PRINTF_APPEND_INT(tab_stopsstr, fmt->tabstops);
PRINTF_APPEND_INT(line_sizestr, fmt->linesize);
PRINTF_APPEND_PERCENT_FLOAT(line_rel_sizestr, (fmt->linerelsize*100));
PRINTF_APPEND_INT(line_gapstr, fmt->linegap);
PRINTF_APPEND_PERCENT_FLOAT(line_rel_gapstr, (fmt->linerelgap*100));
PRINTF_APPEND_PERCENT_FLOAT(line_fillstr, (fmt->linefill*100));
PRINTF_APPEND_FLOAT(ellipsisstr, fmt->ellipsis);
PRINTF_APPEND_STR(passwordstr, (fmt->password == 0 ? "off" : "on"));

View File

@ -4896,7 +4896,7 @@ EFL_START_TEST(efl_canvas_textblock_style)
// from functions
fail_if(!strstr(style, "font_weight=extrabold"));
fail_if(!strstr(style, "tabstops=20"));
fail_if(!strstr(style, "tab_stops=20"));
fail_if(!strstr(style, "color=rgba(144,225,53,255)"));
fail_if(!strstr(style, "password=off"));
efl_text_password_set(txt, EINA_TRUE);