forked from enlightenment/efl
gfx_filter: add efl_style_gfx_filter
Also, rename the format string to 'gfx_filterstr' to match the other strings. Update the filter test to use this property.
This commit is contained in:
parent
8f6415143c
commit
3edf4985a4
|
@ -517,7 +517,6 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
|||
"blur { 6, ox = 1, oy = 1, src = a, color = '#004' }"
|
||||
"blur { 3, ox = 1, oy = 1, color = 'black' }"
|
||||
"blend { color = 'lime' }";
|
||||
Eina_Strbuf *buf;
|
||||
|
||||
o = code = efl_add(EFL_UI_TEXT_EDITABLE_CLASS, win,
|
||||
efl_gfx_size_hint_weight_set(efl_added, 1.0, 1.0),
|
||||
|
@ -526,12 +525,8 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
|||
efl_event_callback_add(o, EFL_UI_TEXT_EVENT_CHANGED_USER, _code_changed, win);
|
||||
|
||||
// Insert filter code inside style string: DEFAULT='blah blah <here>'
|
||||
buf = eina_strbuf_new();
|
||||
eina_strbuf_append(buf, efl_canvas_text_style_get(o, NULL));
|
||||
eina_strbuf_insert(buf, " gfx_filter=code", eina_strbuf_length_get(buf) - 1);
|
||||
efl_gfx_filter_program_set(o, code_filter, "code");
|
||||
efl_canvas_text_style_set(o, NULL, eina_strbuf_string_get(buf));
|
||||
eina_strbuf_free(buf);
|
||||
efl_text_style_gfx_filter_set(o, "code");
|
||||
|
||||
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
|
||||
// Efl.Ui.Text doesn't seem to trigger the proper events during edit
|
||||
|
|
|
@ -253,5 +253,17 @@ interface Efl.Text.Style {
|
|||
a: ubyte;
|
||||
}
|
||||
}
|
||||
|
||||
@property gfx_filter
|
||||
{
|
||||
[[Program that applies a special filter
|
||||
|
||||
See @Efl.Gfx.Filter.
|
||||
]]
|
||||
values
|
||||
{
|
||||
code: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,6 +290,7 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format, Efl.Text.Cursor, Efl.Text.Annota
|
|||
Efl.Text.Style.shadow_color { get; set; }
|
||||
Efl.Text.Style.glow_color { get; set; }
|
||||
Efl.Text.Style.glow2_color { get; set; }
|
||||
Efl.Text.Style.gfx_filter { get; set; }
|
||||
Efl.Text.Format.format_ellipsis { get; set; }
|
||||
Efl.Text.Format.format_wrap { get; set; }
|
||||
Efl.Text.Format.format_multiline { get; set; }
|
||||
|
|
|
@ -608,6 +608,7 @@ struct _Evas_Object_Textblock
|
|||
Eina_Stringshare *font_source;
|
||||
Eina_Stringshare *font_fallbacks;
|
||||
Eina_Stringshare *font_lang;
|
||||
Eina_Stringshare *gfx_filter_name;
|
||||
unsigned int font_weight;
|
||||
unsigned int font_slant;
|
||||
unsigned int font_width;
|
||||
|
@ -1345,7 +1346,7 @@ static const char *replacement_charstr = NULL;
|
|||
static const char *underline_dash_widthstr = NULL;
|
||||
static const char *underline_dash_gapstr = NULL;
|
||||
static const char *underline_heightstr = NULL;
|
||||
static const char *gfx_filter = NULL;
|
||||
static const char *gfx_filterstr = NULL;
|
||||
|
||||
/**
|
||||
* @page evas_textblock_style_page Evas Textblock Style Options
|
||||
|
@ -1451,7 +1452,7 @@ _format_command_init(void)
|
|||
underline_dash_widthstr = eina_stringshare_add("underline_dash_width");
|
||||
underline_dash_gapstr = eina_stringshare_add("underline_dash_gap");
|
||||
underline_heightstr = eina_stringshare_add("underline_height");
|
||||
gfx_filter = eina_stringshare_add("gfx_filter"); // FIXME: bg, fg filters
|
||||
gfx_filterstr = eina_stringshare_add("gfx_filter"); // FIXME: bg, fg filters
|
||||
}
|
||||
format_refcount++;
|
||||
}
|
||||
|
@ -1506,7 +1507,7 @@ _format_command_shutdown(void)
|
|||
eina_stringshare_del(underline_dash_widthstr);
|
||||
eina_stringshare_del(underline_dash_gapstr);
|
||||
eina_stringshare_del(underline_heightstr);
|
||||
eina_stringshare_del(gfx_filter);
|
||||
eina_stringshare_del(gfx_filterstr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2596,7 +2597,7 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
|
|||
fmt->underline_height = atof(param);
|
||||
if (fmt->underline_height <= 0.0) fmt->underline_height = 1.0;
|
||||
}
|
||||
else if (cmd == gfx_filter)
|
||||
else if (cmd == gfx_filterstr)
|
||||
{
|
||||
/**
|
||||
* @page evas_textblock_style_page Evas Textblock Style Options
|
||||
|
@ -3365,6 +3366,15 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
|
|||
fmt->font.font = evas_font_load(evas_obj->layer->evas->evas, fmt->font.fdesc,
|
||||
fmt->font.source, (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale));
|
||||
}
|
||||
if (_FMT_INFO(gfx_filter_name))
|
||||
{
|
||||
if (!fmt->gfx_filter)
|
||||
{
|
||||
fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Filter));
|
||||
eina_stringshare_replace(&fmt->gfx_filter->name,
|
||||
_FMT_INFO(gfx_filter_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fmt;
|
||||
|
@ -15268,6 +15278,35 @@ _efl_canvas_text_efl_text_style_glow2_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_
|
|||
_FMT_COLOR_RET(glow2);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_style_gfx_filter_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED,
|
||||
const char *gfx_filter_name)
|
||||
{
|
||||
Eina_Stringshare *ngfx_filter_name;
|
||||
|
||||
if (_FMT_INFO(gfx_filter_name) != gfx_filter_name)
|
||||
{
|
||||
ngfx_filter_name = eina_stringshare_add(gfx_filter_name);
|
||||
if (_FMT_INFO(gfx_filter_name) == ngfx_filter_name)
|
||||
{
|
||||
/* Already stringshared here, unref */
|
||||
eina_stringshare_del(ngfx_filter_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set immediately, load style_gfx_filter_name later
|
||||
_FMT_INFO(gfx_filter_name) = ngfx_filter_name;
|
||||
_canvas_text_format_changed(obj, o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
_efl_canvas_text_efl_text_style_gfx_filter_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
|
||||
{
|
||||
return _FMT(gfx_filter->name);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_canvas_text_efl_text_format_format_ellipsis_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue