Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2020-01-03 12:43:27 +09:00
commit 5739920ba7
45 changed files with 726 additions and 250 deletions

View File

@ -165,7 +165,8 @@ struct pack_event_info_and_call_visitor
if (regular.is_struct())
{
return as_generator(
indent << "IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));\n"
indent << "Contract.Requires(e != null, nameof(e));\n"
<< indent << "IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));\n"
<< indent << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
).generate(sink, attributes::unused, *context);
}
@ -192,7 +193,8 @@ struct pack_event_info_and_call_visitor
auto str_accept_func = [&](std::string const& conversion)
{
return as_generator(
indent << "IntPtr info = Eina.StringConversion.ManagedStringToNativeUtf8Alloc(" << conversion << ");\n"
indent << "Contract.Requires(e != null, nameof(e));\n"
<< indent << "IntPtr info = Eina.StringConversion.ManagedStringToNativeUtf8Alloc(" << conversion << ");\n"
<< indent << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Eina.MemoryNative.Free(p));\n"
).generate(sink, attributes::unused, *context);
};
@ -210,7 +212,8 @@ struct pack_event_info_and_call_visitor
auto value_accept_func = [&](std::string const& conversion)
{
return as_generator(
indent << "IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(" << conversion << ");\n"
indent << "Contract.Requires(e != null, nameof(e));\n"
<< indent << "IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(" << conversion << ");\n"
<< indent << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
).generate(sink, attributes::unused, *context);
};
@ -223,7 +226,9 @@ struct pack_event_info_and_call_visitor
bool operator()(grammar::attributes::klass_name const&) const
{
auto const& indent = current_indentation(*context);
return as_generator(indent << "IntPtr info = e.arg.NativeHandle;\n"
return as_generator(
indent << "Contract.Requires(e != null, nameof(e));\n"
<< indent << "IntPtr info = e.arg.NativeHandle;\n"
<< "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", IntPtr.Zero, null);\n"
).generate(sink, attributes::unused, *context);
}
@ -233,7 +238,9 @@ struct pack_event_info_and_call_visitor
if ((type.outer.base_type == "iterator") || (type.outer.base_type == "accessor"))
return true;
return as_generator(indent << "IntPtr info = e.arg.Handle;\n"
return as_generator(
indent << "Contract.Requires(e != null, nameof(e));\n"
<< indent << "IntPtr info = e.arg.Handle;\n"
<< "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", IntPtr.Zero, null);\n"
).generate(sink, attributes::unused, *context);
}

View File

@ -305,6 +305,7 @@ struct property_extension_method_definition_generator
if (!as_generator(scope_tab << "public static Efl.BindableProperty<" << type(true) << "> " << managed_name << "<T>(this Efl.BindablePart<T> part, Efl.Csharp.ExtensionTag<"
<< name_helpers::klass_full_concrete_or_interface_name(cls)
<< ", T>magic = null) where T : " << name_helpers::klass_full_concrete_or_interface_name(cls) << " {\n"
<< scope_tab << scope_tab << "Contract.Requires(part != null, nameof(part));\n"
<< scope_tab << scope_tab << "return new Efl.BindableProperty<" << type(true) << ">(part.PartName, \"" << property.name << "\", part.Binder);\n"
<< scope_tab << "}\n\n"
).generate(sink, std::make_tuple(prop_type, prop_type), context))

View File

@ -693,10 +693,10 @@ struct convert_in_variable_generator
}
else if (param.type.c_type == "Eina_Binbuf *" || param.type.c_type == "const Eina_Binbuf *")
{
auto var_name = in_variable_name(param.param_name);
if (!as_generator(
"var " << string << " = " << escape_keyword(param.param_name) << ".Handle;\n"
).generate(sink, var_name, context))
"Contract.Requires(" << string << " != null, nameof(" << string << "));\n"
<< scope_tab(2) << "var " << string << " = " << string << ".Handle;\n"
).generate(sink, std::make_tuple(escape_keyword(param.param_name), escape_keyword(param.param_name), in_variable_name(param.param_name), escape_keyword(param.param_name)), context))
return false;
if (param.type.has_own)
{
@ -710,10 +710,10 @@ struct convert_in_variable_generator
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type);
if (!complex || complex->subtypes.size() != 2)
return false;
auto var_name = in_variable_name(param.param_name);
if (!as_generator(
"var " << string << " = " << escape_keyword(param.param_name) << ".Handle;\n"
).generate(sink, var_name, context))
"Contract.Requires(" << string << " != null, nameof(" << string << "));\n"
<< scope_tab(2) << "var " << string << " = " << string << ".Handle;\n"
).generate(sink, std::make_tuple(escape_keyword(param.param_name), escape_keyword(param.param_name), in_variable_name(param.param_name), escape_keyword(param.param_name)), context))
return false;
if (param.type.has_own && !as_generator(
escape_keyword(param.param_name) << ".SetOwn(false);\n"
@ -736,10 +736,12 @@ struct convert_in_variable_generator
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type);
if (!complex)
return false;
auto var_name = in_variable_name(param.param_name);
if (!as_generator(
"var " << string << " = " << escape_keyword(param.param_name) << ".Handle;\n"
).generate(sink, var_name, context))
"Contract.Requires(" << string << " != null, nameof(" << string << "));\n"
<< "var " << string << " = " << string << ".Handle;\n"
).generate(sink, std::make_tuple(escape_keyword(param.param_name), escape_keyword(param.param_name),
in_variable_name(param.param_name), escape_keyword(param.param_name))
, context))
return false;
if (param.type.has_own && !as_generator(
escape_keyword(param.param_name) << ".Own = false;\n"
@ -777,8 +779,9 @@ struct convert_in_variable_generator
else if (param.type.c_type == "Eina_Value")
{
return as_generator(
"var " << string << " = " << string << ".GetNative();\n"
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.param_name), context);
"Contract.Requires(" << string << " != null, nameof(" << string << "));\n"
"var " << string << " = " << string << ".GetNative();\n"
).generate(sink, std::make_tuple(param.param_name, param.param_name, in_variable_name(param.param_name), param.param_name), context);
}
return true;
}

View File

@ -172,7 +172,8 @@ run(options_type const& opts)
"using System.Linq;\n"
"using System.Threading;\n"
"using System.ComponentModel;\n"
"using System.Diagnostics.CodeAnalysis;\n")
"using System.Diagnostics.CodeAnalysis;\n"
"using System.Diagnostics.Contracts;\n")
.generate(iterator, efl::eolian::grammar::attributes::unused, efl::eolian::grammar::context_null()))
{
throw std::runtime_error("Failed to generate file preamble");

View File

@ -3146,6 +3146,44 @@ EAPI void edje_object_perspective_set(Evas_Object *obj, Edje_Perspective *ps);
*/
EAPI const Edje_Perspective *edje_object_perspective_get(const Evas_Object *obj);
/**
* @brief Sets Edje text class for edje file (if loaded)
*
* This function sets the text class for All Edje Objects created from Edje file.
* (if edje file loaded before)
*
* @param[in] file edje file path
* @param[in] text_class The text class name
* @param[in] font Font name
* @param[in] size Font Size
*
* @return @c true, on success or @c false, on error
*/
EAPI Eina_Bool edje_file_text_class_set(const char *file, const char *text_class, const char *font, Evas_Font_Size size);
/**
* @brief Delete the file text class.
*
* This function deletes any values at the file level for the specified
* file and text class.
*
* @param[in] text_class The text class to be deleted.
*/
EAPI Eina_Bool edje_file_text_class_del(const char *file, const char *text_class);
/**
* @brief Gets font and font size from edje file if loaded.
*
* This function gets the font and the font size from the file text class.
*
* @param[in] text_class The text class name
* @param[out] font Font name
* @param[out] size Font Size
*
* @return @c true, on success or @c false, on error
*/
EAPI Eina_Bool edje_file_text_class_get(const char *file, const char * text_class, const char **font, Evas_Font_Size *size);
/**
* @}
*/

View File

@ -600,8 +600,13 @@ _edje_file_open(const Eina_File *f, int *error_ret, time_t mtime, Eina_Bool coll
edf->text_hash = eina_hash_string_small_new(NULL);
EINA_LIST_FOREACH(edf->text_classes, l, tc)
if (tc->name)
eina_hash_direct_add(edf->text_hash, tc->name, tc);
{
if (tc->name)
eina_hash_direct_add(edf->text_hash, tc->name, tc);
if (tc->font)
tc->font = eina_stringshare_add(tc->font);
}
edf->size_hash = eina_hash_string_small_new(NULL);
EINA_LIST_FOREACH(edf->size_classes, l, sc)
@ -713,7 +718,7 @@ _edje_file_cache_trash_pop(const Eina_File *file)
return NULL;
}
static inline Edje_File*
Edje_File*
_edje_file_cache_find(const Eina_File *file)
{
Edje_File *edf;

View File

@ -2103,6 +2103,7 @@ _edje_file_del(Edje *ed)
_edje_text_part_on_del(ed, ep);
_edje_color_class_on_del(ed, ep);
}
_edje_object_textblock_styles_cache_cleanup(ed);
_edje_cache_coll_unref(ed->file, ed->collection);
ed->collection = NULL;

View File

@ -1733,6 +1733,7 @@ struct _Edje
Eina_List *groups;
Eina_Hash *styles;
Edje_Perspective *persp;
Ecore_Animator *animator;
@ -2827,14 +2828,17 @@ void _edje_message_del (Edje *ed);
Evas_Textblock_Style * _edje_textblock_style_get(Edje *ed, const char *style);
void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep);
void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt);
void _edje_object_textblock_style_all_update_text_class(Edje *ed, const char *text_class);
void _edje_object_textblock_styles_cache_cleanup(Edje *ed);
// Edje File level textblock style api
void _edje_file_textblock_style_all_update(Edje_File *ed);
void _edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *text_class);
void _edje_file_textblock_styles_all_update_text_class(Edje *ed, const char *text_class);
void _edje_file_textblock_style_parse_and_fix(Edje_File *edf);
void _edje_file_textblock_style_cleanup(Edje_File *edf);
Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed);
Edje_File *_edje_file_cache_find(const Eina_File *file);
void _edje_cache_coll_clean(Edje_File *edf);
void _edje_cache_coll_flush(Edje_File *edf);
void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc);

View File

@ -504,7 +504,12 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object
}
else if (obs == _edje_text_class_member)
{
_edje_file_textblock_style_all_update_text_class(ed->file, key);
if (data == ed)
// Object level update
_edje_object_textblock_style_all_update_text_class(ed, key);
else if ((data == ed->file) || // File level update will pass ed->file
(!data)) // Global update will pass NULL
_edje_file_textblock_styles_all_update_text_class(ed, key);
#ifdef EDJE_CALC_CACHE
ed->text_part_change = EINA_TRUE;
#endif

View File

@ -1,5 +1,72 @@
#include "edje_private.h"
void _edje_textblock_style_update(Edje *ed, Edje_Style *stl);
static Edje_Style *
_edje_textblock_style_copy(Edje_Style *stl)
{
Edje_Style *new_stl;
new_stl = calloc(1, sizeof(Edje_Style));
if (!new_stl) return NULL;
new_stl->style = evas_textblock_style_new();
evas_textblock_style_set(new_stl->style, NULL);
// just keep a reference.
new_stl->tags = stl->tags;
new_stl->name = stl->name;
new_stl->cache = EINA_FALSE;
return new_stl;
}
static void
_edje_object_textblock_styles_cache_style_free(void *data)
{
Edje_Style *obj_stl = data;
if (!obj_stl) return;
if (obj_stl->style) evas_textblock_style_free(obj_stl->style);
free(obj_stl);
}
static Edje_Style *
_edje_object_textblock_styles_cache_add(Edje *ed, Edje_Style *stl)
{
Edje_Style *obj_stl = eina_hash_find(ed->styles, stl->name);
// Find the style in the object cache
if (!obj_stl)
{
obj_stl = _edje_textblock_style_copy(stl);
if (obj_stl)
{
if (!ed->styles) ed->styles = eina_hash_stringshared_new(_edje_object_textblock_styles_cache_style_free);
eina_hash_direct_add(ed->styles, obj_stl->name, obj_stl);
_edje_textblock_style_update(ed, obj_stl);
}
}
return obj_stl;
}
void
_edje_object_textblock_styles_cache_cleanup(Edje *ed)
{
if (!ed || !ed->styles) return;
eina_hash_free(ed->styles);
ed->styles = NULL;
}
static Edje_Style *
_edje_object_textblock_styles_cache_get(Edje *ed, const char *stl)
{
// Find the style in the object cache
return eina_hash_find(ed->styles, stl);
}
static int
_edje_font_is_embedded(Edje_File *edf, const char *font)
{
@ -230,26 +297,6 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl)
eina_strbuf_free(txt);
}
/*
* mark all the styles in the Edje_File dirty (except readonly styles)so that
* subsequent request to style will update before giving the style.
* Note: this will enable lazy style computation (only when some
* widget request for new style it will get computed).
*
* @param ed The edje containing styles which need to be updated
*/
void
_edje_file_textblock_style_all_update(Edje_File *edf)
{
Eina_List *l;
Edje_Style *stl;
if (!edf) return;
EINA_LIST_FOREACH(edf->styles, l, stl)
if (stl && !stl->readonly) stl->cache = EINA_FALSE;
}
static inline Edje_Style *
_edje_textblock_style_search(Edje *ed, const char *style)
{
@ -371,9 +418,18 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt)
Evas_Textblock_Style *
_edje_textblock_style_get(Edje *ed, const char *style)
{
Edje_Style *stl;
if (!style) return NULL;
Edje_Style *stl = _edje_textblock_style_search(ed, style);
// First search in Edje_Object styles list
stl = _edje_object_textblock_styles_cache_get(ed, style);
if (!stl)
{
// If not found in Edje_Object search in Edje_File styles list
stl = _edje_textblock_style_search(ed, style);
}
if (!stl) return NULL;
@ -387,19 +443,21 @@ _edje_textblock_style_get(Edje *ed, const char *style)
return stl->style;
}
/*
* Finds all the styles having text class tag as text_class and
* updates them.
*/
void
_edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *text_class)
static void
_edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class, Eina_Bool is_object_level)
{
Eina_List *l, *ll;
Eina_List *ll, *l;
Edje_Style *stl;
Edje_Style *obj_stl;
Edje_File *edf;
if (!edf) return;
if (!ed) return;
if (!ed->file) return;
if (!text_class) return;
edf = ed->file;
// check if there is styles in file that uses this text_class
EINA_LIST_FOREACH(edf->styles, l, stl)
{
Edje_Style_Tag *tag;
@ -412,15 +470,49 @@ _edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *tex
if (!strcmp(tag->text_class, text_class))
{
// just mark it dirty so the next request
// for this style will trigger recomputation.
stl->cache = EINA_FALSE;
if (is_object_level)
{
obj_stl = _edje_object_textblock_styles_cache_get(ed, stl->name);
if (obj_stl)
// If already in Edje styles just make it dirty
obj_stl->cache = EINA_FALSE;
else
// create a copy from it if it's not exists
_edje_object_textblock_styles_cache_add(ed, stl);
}
else
{
// just mark it dirty so the next request
// for this style will trigger recomputation.
stl->cache = EINA_FALSE;
}
// don't need to continue searching
break;
}
}
}
}
/*
* Finds all the styles having text class tag as text_class and
* updates them in object level.
*/
void
_edje_object_textblock_style_all_update_text_class(Edje *ed, const char *text_class)
{
_edje_textblock_style_all_update_text_class(ed, text_class, EINA_TRUE);
}
/*
* Finds all the styles having text class tag as text_class and
* updates them in file level.
*/
void
_edje_file_textblock_styles_all_update_text_class(Edje *ed, const char *text_class)
{
_edje_textblock_style_all_update_text_class(ed, text_class, EINA_FALSE);
}
/* When we get to here the edje file had been read into memory
* the name of the style is established as well as the name and
* data for the tags. This function will create the Evas_Style

View File

@ -1336,6 +1336,140 @@ _edje_text_class_list_foreach(const Eina_Hash *hash EINA_UNUSED, const void *key
return EINA_TRUE;
}
static Edje_File *
_edje_file_find(const char *file)
{
char *tmp = NULL;
Eina_File *f = NULL;
Edje_File *edf = NULL;
if (!file) return NULL;
tmp = eina_vpath_resolve(file);
if (!tmp) return NULL;
f = eina_file_open(tmp, EINA_FALSE);
if (tmp) free(tmp);
if (!f) return NULL;
edf = _edje_file_cache_find(f);
eina_file_close(f);
return edf;
}
EAPI Eina_Bool
edje_file_text_class_get(const char *file, const char * text_class, const char **font, Evas_Font_Size *size)
{
Edje_Text_Class *tc = NULL;
Edje_File *edf = NULL;
Eina_Bool ret = EINA_FALSE;
if (font) *font = NULL;
if (size) *size = 0;
if ((!file) || (!text_class)) return ret;
if ((!font) && (!size)) return ret; // No need to go deep
edf = _edje_file_find(file);
if (!edf) return ret;
tc = eina_hash_find(edf->text_hash, text_class);
if (!tc) goto end;
if (font) *font = tc->font;
if (size) *size = tc->size;
ret = EINA_TRUE;
end:
_edje_cache_file_unref(edf);
return ret;
}
EAPI Eina_Bool
edje_file_text_class_del(const char *file, const char *text_class)
{
Edje_Text_Class *tc = NULL;
Edje_File *edf = NULL;
Eina_Bool ret = EINA_FALSE;
if ((!file) || (!text_class)) return ret;
edf = _edje_file_find(file);
if (!edf) return ret;
tc = eina_hash_find(edf->text_hash, text_class);
if (!tc) goto end;
eina_hash_del(edf->text_hash, text_class, tc);
eina_stringshare_del(tc->name);
eina_stringshare_del(tc->font);
free(tc);
/* Tell all members of the text class to recalc */
efl_observable_observers_update(_edje_text_class_member, text_class, edf);
ret = EINA_TRUE;
end:
_edje_cache_file_unref(edf);
return ret;
}
EAPI Eina_Bool
edje_file_text_class_set(const char *file, const char *text_class, const char *font, Evas_Font_Size size)
{
Edje_File *edf = NULL;
Edje_Text_Class *tc = NULL;
Eina_Bool ret = EINA_FALSE;
if ((!file) || (!text_class)) return ret;
edf = _edje_file_find(file);
if (!edf) return ret;
// update text_class properties, or create new text_class if not found
if (edf->text_hash) tc = eina_hash_find(edf->text_hash, text_class);
if (!tc)
{
/* Create new text class */
tc = calloc(1, sizeof(Edje_Text_Class));
if (!tc) goto error_end;
tc->name = eina_stringshare_add(text_class);
if (!tc->name)
{
free(tc);
goto error_end;
}
if (!edf->text_hash) edf->text_hash = eina_hash_string_small_new(NULL);
eina_hash_direct_add(edf->text_hash, text_class, tc);
tc->font = eina_stringshare_add(font);
tc->size = size;
}
else
{
/* Match and the same, return */
if (((tc->font && font) && !strcmp(tc->font, font)) &&
(tc->size == size))
goto success_end;
/* Update the class found */
eina_stringshare_replace(&tc->font, font);
tc->size = size;
}
/* Tell all members of the text class to recalc */
efl_observable_observers_update(_edje_text_class_member, text_class, edf);
success_end:
ret = EINA_TRUE;
error_end:
_edje_cache_file_unref(edf);
return ret;
}
EAPI Eina_Bool
edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size)
{
@ -1401,7 +1535,7 @@ _efl_canvas_layout_efl_gfx_text_class_text_class_set(Eo *obj EINA_UNUSED, Edje *
text_class, font, size);
}
efl_observer_update(obj, _edje_text_class_member, text_class, NULL);
efl_observer_update(obj, _edje_text_class_member, text_class, ed);
return EINA_TRUE;
}
@ -1460,7 +1594,7 @@ _efl_canvas_layout_efl_gfx_text_class_text_class_del(Eo *obj EINA_UNUSED, Edje *
efl_gfx_text_class_del(rp->typedata.swallow->swallowed_object, text_class);
}
efl_observer_update(obj, _edje_text_class_member, text_class, NULL);
efl_observer_update(obj, _edje_text_class_member, text_class, ed);
}
typedef struct _Edje_File_Text_Class_Iterator Edje_File_Text_Class_Iterator;
@ -5828,24 +5962,28 @@ _edje_color_class_on_del(Edje *ed, Edje_Part *ep)
Edje_Text_Class *
_edje_text_class_find(Edje *ed, const char *text_class)
{
Edje_Text_Class *tc;
Edje_Text_Class *tc = NULL;
if ((!ed) || (!text_class)) return NULL;
if (!text_class) return NULL;
if (!ed)
{
/* If ed object is NULL, then look through the global scope only */
return eina_hash_find(_edje_text_class_hash, text_class);
}
/* first look through the object scope */
tc = eina_hash_find(ed->text_classes, text_class);
if (tc) return tc;
/* next look through the global scope */
tc = eina_hash_find(_edje_text_class_hash, text_class);
if (tc) return tc;
if (!tc)
tc = eina_hash_find(_edje_text_class_hash, text_class);
/* finally, look through the file scope */
if (ed->file)
if (!tc && ed->file)
tc = eina_hash_find(ed->file->text_hash, text_class);
if (tc) return tc;
return NULL;
return tc;
}
static Eina_Bool

View File

@ -11,7 +11,7 @@ enum @beta Efl.Canvas.Layout_Part_Text_Expand
}
class @beta Efl.Canvas.Layout_Part_Text extends Efl.Canvas.Layout_Part implements Efl.Text,
Efl.Text_Markup, Efl.Text_Format, Efl.Text.Font.Properties, Efl.Text_Style
Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font_Properties, Efl.Text_Style
{
[[Represents a TEXT part of a layout
@ -38,8 +38,8 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text.Font.Properties, Efl.Text_Style
Efl.Text_Markup.markup { get; set; }
Efl.Text_Format.ellipsis { set; get; }
Efl.Text_Format.wrap { set; get; }
Efl.Text.Font.Properties.font_family { set; get; }
Efl.Text.Font.Properties.font_size { set; get; }
Efl.Text_Font_Properties.font_family { set; get; }
Efl.Text_Font_Properties.font_size { set; get; }
Efl.Text_Style.text_color { set; get; }
Efl.Text_Style.text_background_type { set; get; }
Efl.Text_Style.text_background_color { set; get;}

View File

@ -36,9 +36,6 @@ enum @beta Efl.Text_Font_Slant {
italic, [[Italic font slant.]]
}
/* FIXME: It needs to support "normal" option for non-color bitmap font.
For supporting "normal" option, S/W glyph drawing engine should be updated.
*/
enum @beta Efl.Text_Font_Bitmap_Scalable {
[[Scalable of bitmap fonts.
]]
@ -46,7 +43,7 @@ enum @beta Efl.Text_Font_Bitmap_Scalable {
color = (1 << 0), [[Enable scalable feature for color bitmap fonts.]]
}
interface @beta Efl.Text.Font.Properties {
interface @beta Efl.Text_Font_Properties {
[[Font settings for text.
]]
c_prefix: efl_text;

View File

@ -1,6 +1,6 @@
import efl_text_types;
interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text.Font.Properties,
interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text_Font_Properties,
Efl.Text_Format, Efl.Text_Style
{
[[Interface for interactive (editable) text inputs (text entries).

View File

@ -146,6 +146,7 @@ typedef struct {
Fast_Accessor size_accessor;
Efl_Gfx_Entity *sizer;
unsigned int start_id, end_id;
Eina_Bool allow_manual_deselection : 1;
} Efl_Ui_Collection_Data;
static Eina_Bool register_item(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Item *item);
@ -360,6 +361,8 @@ _efl_ui_collection_efl_object_constructor(Eo *obj, Efl_Ui_Collection_Data *pd EI
{
Eo *o;
efl_ui_selectable_allow_manual_deselection_set(obj, EINA_TRUE);
pd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL;
_fast_accessor_init(&pd->obj_accessor, &pd->items);
@ -1087,7 +1090,7 @@ _efl_ui_collection_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Collection_Data *pd
}
else
{
_item_scroll_internal(obj, pd, new_obj, .0, EINA_TRUE);
_item_scroll_internal(obj, pd, efl_provider_find(new_obj, EFL_UI_ITEM_CLASS), .0, EINA_TRUE);
}
return new_obj;
@ -1176,6 +1179,19 @@ _efl_ui_collection_efl_ui_single_selectable_fallback_selection_get(const Eo *obj
return pd->fallback;
}
EOLIAN static void
_efl_ui_collection_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd, Eina_Bool allow_manual_deselection)
{
pd->allow_manual_deselection = !!allow_manual_deselection;
}
EOLIAN static Eina_Bool
_efl_ui_collection_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd)
{
return pd->allow_manual_deselection;
}
#include "efl_ui_collection.eo.c"
#define ITEM_IS_OUTSIDE_VISIBLE(id) id < collection_pd->start_id || id > collection_pd->end_id

View File

@ -97,6 +97,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements
Efl.Ui.Multi_Selectable_Object_Range.range_select;
Efl.Ui.Multi_Selectable_Object_Range.range_unselect;
Efl.Ui.Single_Selectable.fallback_selection {get; set;}
Efl.Ui.Single_Selectable.allow_manual_deselection {get; set;}
}
}

View File

@ -1459,9 +1459,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
info.position = efl_text_cursor_position_get(cur);
info.length = eina_unicode_utf8_get_len(string);
efl_event_freeze(obj);
efl_text_cursor_text_insert(cur, string);
efl_event_thaw(obj);
changed_user = EINA_TRUE;
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;

View File

@ -63,7 +63,6 @@ _efl_ui_internal_text_scroller_efl_object_constructor(Eo *obj,
Efl_Ui_Internal_Text_Scroller_Data *sd EINA_UNUSED)
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
//EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, psd, NULL);
efl_ui_scrollbar_bar_mode_set(obj,
EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF);
@ -138,7 +137,6 @@ _efl_ui_internal_text_scroller_efl_object_finalize(Eo *obj,
efl_ui_scrollbar_bar_mode_set(obj,
EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF);
efl_content_set(obj, sd->text_table);
return obj;
}
@ -170,16 +168,15 @@ _efl_ui_internal_text_scroller_scroller_mode_set(Eo *obj,
Efl_Ui_Internal_Text_Scroller_Data *sd,
Efl_Ui_Text_Scroller_Mode mode)
{
EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, psd);
sd->mode = mode;
if (mode == EFL_UI_TEXT_SCROLLER_MODE_MULTILINE)
{
efl_ui_scrollbar_bar_mode_set(psd->smanager,
efl_ui_scrollbar_bar_mode_set(obj,
EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO);
}
else // default (single-line)
{
efl_ui_scrollbar_bar_mode_set(psd->smanager,
efl_ui_scrollbar_bar_mode_set(obj,
EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF);
}
}

View File

@ -96,7 +96,10 @@ _item_unpressed(void *data, const Efl_Event *ev EINA_UNUSED)
m = _fetch_state(pd->container);
if (pd->selected)
efl_ui_selectable_selected_set(obj, EINA_FALSE);
{
if (efl_ui_selectable_allow_manual_deselection_get(pd->container))
efl_ui_selectable_selected_set(obj, EINA_FALSE);
}
else if (m != EFL_UI_SELECT_MODE_NONE)
efl_ui_selectable_selected_set(obj, EINA_TRUE);
}

View File

@ -16,6 +16,18 @@ typedef struct {
Eina_Bool in_value_change;
} Efl_Ui_Radio_Group_Impl_Data;
EOLIAN static void
_efl_ui_radio_group_impl_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Group_Impl_Data *pd EINA_UNUSED, Eina_Bool allow_manual_deselection EINA_UNUSED)
{
if (allow_manual_deselection == EINA_FALSE)
ERR("This is right now not supported.");
}
EOLIAN static Eina_Bool
_efl_ui_radio_group_impl_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Group_Impl_Data *pd EINA_UNUSED)
{
return EINA_FALSE;
}
EOLIAN static void
_efl_ui_radio_group_impl_efl_ui_single_selectable_fallback_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Group_Impl_Data *pd, Efl_Ui_Selectable *fallback)

View File

@ -12,5 +12,6 @@ class Efl.Ui.Radio_Group_Impl extends Efl.Object implements Efl.Ui.Radio_Group
Efl.Ui.Radio_Group.unregister;
Efl.Ui.Single_Selectable.last_selected {get;}
Efl.Ui.Single_Selectable.fallback_selection {set; get;}
Efl.Ui.Single_Selectable.allow_manual_deselection {set; get;}
}
}

View File

@ -30,6 +30,12 @@ interface Efl.Ui.Single_Selectable {
fallback : Efl.Ui.Selectable;
}
}
@property allow_manual_deselection {
[[This controlls if a selected item can be deselected due to clicking]]
values {
allow_manual_deselection : bool; [[$true if clicking while selected results in a state change to unselected]]
}
}
}
events {
selection_changed : void; [[Emitted when there is a change in the selection state. This event will collect all

View File

@ -24,7 +24,7 @@
//when a item is pressed but not released, this time passes by
//until another step is added or removed from the current value.
//given in seconds
#define REPEAT_INTERVAL 0.85
#define REPEAT_INTERVAL 0.2
static const char PART_NAME_ENTRY[] = "entry";
static const char PART_NAME_DEC_BUTTON[] = "dec_button";

View File

@ -65,7 +65,6 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp
pd->alpha_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, obj);
efl_animation_alpha_set(pd->alpha_anim, 0.0, 1.0);
efl_animation_duration_set(pd->alpha_anim, 0.5);
efl_animation_final_state_keep_set(pd->alpha_anim, EINA_TRUE);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
@ -144,6 +143,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_
{
efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _hide_object_cb, obj);
efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _running_cb, obj);
efl_gfx_stack_above(pd->content[1], pd->content[0]); //Stack the "to content" above the "from content"
}
}
else

View File

@ -26,6 +26,19 @@ _efl_ui_tab_bar_efl_ui_single_selectable_fallback_selection_set(Eo *obj EINA_UNU
efl_ui_selectable_selected_set(pd->fallback_selection, EINA_TRUE);
}
EOLIAN static void
_efl_ui_tab_bar_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *pd, Eina_Bool allow_manual_deselection)
{
pd->allow_manual_deselection = !!allow_manual_deselection;
}
EOLIAN static Eina_Bool
_efl_ui_tab_bar_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *pd)
{
return pd->allow_manual_deselection;
}
EOLIAN static Efl_Ui_Selectable*
_efl_ui_tab_bar_efl_ui_single_selectable_fallback_selection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *pd)
{

View File

@ -15,6 +15,7 @@ class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base
Efl.Object.destructor;
Efl.Ui.Single_Selectable.last_selected {get;}
Efl.Ui.Single_Selectable.fallback_selection {get; set;}
Efl.Ui.Single_Selectable.allow_manual_deselection {get; set;}
Efl.Pack.pack;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;

View File

@ -8,6 +8,7 @@ struct _Efl_Ui_Tab_Bar_Data
Efl_Ui_Box *bx;
Efl_Ui_Item *selected, *fallback_selection;
Eina_Bool in_value_change;
Eina_Bool allow_manual_deselection : 1;
};
#define EFL_UI_TAB_BAR_DATA_GET(o, sd) \

View File

@ -816,24 +816,10 @@ _efl_ui_textbox_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Textbox_Data *s
if (sd->scroll)
{
if (!efl_text_multiline_get(obj))
{
efl_ui_internal_text_scroller_mode_set(sd->scroller,
EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
}
else
{
efl_ui_internal_text_scroller_mode_set(sd->scroller,
EFL_UI_TEXT_SCROLLER_MODE_MULTILINE);
}
efl_canvas_group_calculate(sd->scroller);
min = efl_gfx_hint_size_min_get(sd->scroller);
if (!efl_text_multiline_get(obj))
{
efl_ui_internal_text_scroller_mode_set(sd->scroller,
EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
edje_object_size_min_calc(wd->resize_obj, &edmin.w, &edmin.h);
min.w = edmin.w;
min.h = edmin.h;
@ -2137,6 +2123,26 @@ _efl_ui_textbox_efl_object_destructor(Eo *obj, Efl_Ui_Textbox_Data *sd)
efl_destructor(efl_super(obj, MY_CLASS));
}
EOLIAN static void
_efl_ui_textbox_efl_text_format_multiline_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled)
{
enabled = !!enabled;
if (efl_text_multiline_get(obj) == enabled) return;
efl_text_multiline_set(sd->text_obj, enabled);
if (sd->scroller)
{
if (enabled)
{
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_MULTILINE);
}
else
{
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
}
}
}
EOLIAN static void
_efl_ui_textbox_efl_text_format_password_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool password)
{
@ -2429,7 +2435,7 @@ _efl_ui_textbox_cnp_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd)
}
EOLIAN static void
_efl_ui_textbox_scrollable_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool scroll)
_efl_ui_textbox_scrollable_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool scroll)
{
if (sd->scroll == scroll) return;
sd->scroll = scroll;
@ -2440,7 +2446,12 @@ _efl_ui_textbox_scrollable_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Ein
sd->scroller = efl_add(EFL_UI_INTERNAL_TEXT_SCROLLER_CLASS, obj,
efl_ui_internal_text_scroller_initialize(efl_added,
sd->text_obj, sd->text_table));
efl_ui_scrollbar_bar_mode_set(sd->scroller, EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO);
if (efl_text_multiline_get(obj))
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_MULTILINE);
else
efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->scroller);
efl_canvas_object_clipper_set(sd->cursor,
efl_ui_internal_text_scroller_viewport_clip_get(sd->scroller));
@ -3711,11 +3722,11 @@ _part_is_efl_ui_text_part(const Eo *obj EINA_UNUSED, const char *part)
//FIXME
//ELM_PART_OVERRIDE_PARTIAL(efl_ui_text, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data, _part_is_efl_ui_text_part)
EOLIAN static Efl_Object *
_efl_ui_textbox_efl_part_part_get(const Eo *obj, Efl_Ui_Textbox_Data *priv EINA_UNUSED, const char *part)
_efl_ui_textbox_efl_part_part_get(const Eo *obj, Efl_Ui_Textbox_Data *priv EINA_UNUSED, const char *part)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
if (_part_is_efl_ui_text_part(obj, part)) return ELM_PART_IMPLEMENT(EFL_UI_TEXT_PART_CLASS, obj, part);
return efl_part_get(efl_super(obj, EFL_UI_TEXTBOX_CLASS), part);
return efl_part_get(efl_super(obj, EFL_UI_TEXTBOX_CLASS), part);
}
//FIXME

View File

@ -103,6 +103,7 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click
Efl.Ui.Widget.interest_region { get; }
Efl.Ui.Widget.disabled {set;}
Efl.Text_Format.password {set;}
Efl.Text_Format.multiline {set;}
//Efl.Ui.Widget.widget_sub_object_del;
//Elm.Interface_Scrollable.policy { set; }
//Elm.Interface_Scrollable.bounce_allow { set; }

View File

@ -70,6 +70,8 @@ elm_animation_view_frame_get(const Efl_Ui_Vg_Animation *obj)
EAPI Eina_Bool
elm_animation_view_play(Efl_Ui_Vg_Animation *obj)
{
double speed = efl_player_playback_speed_get(obj);
efl_player_playback_speed_set(obj, speed < 0 ? speed * -1 : speed);
return efl_player_playing_set(obj, EINA_TRUE);
}
@ -77,7 +79,7 @@ EAPI Eina_Bool
elm_animation_view_play_back(Efl_Ui_Vg_Animation *obj)
{
double speed = efl_player_playback_speed_get(obj);
efl_player_playback_speed_set(obj, speed < 0 ? speed * -1 : speed);
efl_player_playback_speed_set(obj, speed > 0 ? speed * -1 : speed);
return efl_player_playing_set(obj, EINA_TRUE);
}

View File

@ -48,7 +48,7 @@ class Efl.Canvas.Animation_Scale extends Efl.Canvas.Animation
values {
from_scale: Eina.Vector2; [[Initial scale value.]]
to_scale: Eina.Vector2; [[Ending scale value.]]
pivot_point: Eina.Position2D; [[Position of the pivot point relative to the canvas.]]
pivot_point: Eina.Position2D; [[Position of the pivot point relative to the canvas. If $null the target passed to @Efl.Canvas.Animation.animation_apply is used as pivot element]]
}
}
}

View File

@ -1,7 +1,7 @@
import efl_text_types;
class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
Efl.Canvas.Filter.Internal, Efl.Text.Font.Properties,
Efl.Canvas.Filter.Internal, Efl.Text_Font_Properties,
Efl.Text_Style, Efl.Text_Format,
Efl.Text_Markup, Efl.Ui.I18n
{
@ -9,7 +9,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
if you need user interaction consider the classes in $[Efl.Ui].
Note: No text will be rendered until a font, a font size and a font color are specified.
This can be accomplished using @Efl.Text.Font.Properties.font_family, @Efl.Text.Font.Properties.font_size and
This can be accomplished using @Efl.Text_Font_Properties.font_family, @Efl.Text_Font_Properties.font_size and
@Efl.Text_Style.text_color.
Alternatively, @.style_apply can be used providing the attributes $font, $font_size and $color.
]]
@ -92,7 +92,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
[[Applies several style attributes at once using a formatting string.
Given style attributes override previous values, leaving other attributes unaffected.
This is akin to setting individual style attributes using properties like
@Efl.Text.Font.Properties.font_slant or @Efl.Text_Format.wrap, for example.
@Efl.Text_Font_Properties.font_slant or @Efl.Text_Format.wrap, for example.
The formatting string is a whitespace-separated list of $[attribute=value] pairs.
@ -101,43 +101,43 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
- $font: Name of the font to use.
Default value is empty, meaning that no text will be rendered.
Requires $font_size and $font_color.
See @Efl.Text.Font.Properties.font_family.
See @Efl.Text_Font_Properties.font_family.
- $font_fallbacks: Comma-delimited list of fonts to try if finding the primary font fails.
Example: $[font_fallbacks=consolas,courier,monospace].
Default value is empty.
See @Efl.Text.Font.Properties.font_fallbacks.
See @Efl.Text_Font_Properties.font_fallbacks.
- $font_size: Height of font, in points.
Default value is 0.
Requires $font and $font_color.
See @Efl.Text.Font.Properties.font_size.
See @Efl.Text_Font_Properties.font_size.
- $font_source: Path to the file containing the font to use.
Example: $[font_source=/usr/share/fonts/Sans.ttf].
Default value is empty.
See @Efl.Text.Font.Properties.font_source.
See @Efl.Text_Font_Properties.font_source.
- $font_weight: Thickness of the font. The value must be one of: $normal, $thin, $ultralight, $extralight,
$light, $book, $medium, $semibold, $bold, $ultrabold, $extrabold, $black and $extrablack.
Default value is $normal.
See @Efl.Text.Font.Properties.font_weight.
See @Efl.Text_Font_Properties.font_weight.
- $font_style: Style of the font. The value must be one of: $normal, $oblique and $italic.
Default value is $normal.
See @Efl.Text.Font.Properties.font_slant.
See @Efl.Text_Font_Properties.font_slant.
- $font_width: How wide the font is, relative to its height. The value must be one of:
$normal, $ultracondensed, $extracondensed, $condensed, $semicondensed, $semiexpanded, $expanded,
$extraexpanded and $ultraexpanded.
Default value is $normal.
See @Efl.Text.Font.Properties.font_weight.
See @Efl.Text_Font_Properties.font_weight.
- $lang: A 2-letter ISO 639-1 language code, $auto (to use the system locale setting) or $none (to disable
language support).
Example: $[lang=he].
Default value is empty.
See @Efl.Text.Font.Properties.font_lang.
See @Efl.Text_Font_Properties.font_lang.
- $color: Color code for the text (See bottom for the complete list of supported codes).
Default value is $[rgba(0,0,0,0)] meaning that no text will be rendered.
@ -340,7 +340,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
@property all_styles {
[[A string representing the complete set of attributes applied to this text object.
This includes the default attributes plus any additional style applied with @.style_apply
or individual style properties like @Efl.Text.Font.Properties.font_slant or @Efl.Text_Format.wrap.
or individual style properties like @Efl.Text_Font_Properties.font_slant or @Efl.Text_Format.wrap.
See @.style_apply for the description of all attributes.
]]
@ -455,15 +455,15 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
Efl.Canvas.Filter.Internal.filter_dirty;
Efl.Canvas.Filter.Internal.filter_input_render;
Efl.Canvas.Filter.Internal.filter_state_prepare;
Efl.Text.Font.Properties.font_family { get; set; }
Efl.Text.Font.Properties.font_size { get; set; }
Efl.Text.Font.Properties.font_source { get; set; }
Efl.Text.Font.Properties.font_fallbacks { get; set; }
Efl.Text.Font.Properties.font_lang { get; set; }
Efl.Text.Font.Properties.font_weight { get; set; }
Efl.Text.Font.Properties.font_slant { get; set; }
Efl.Text.Font.Properties.font_width { get; set; }
Efl.Text.Font.Properties.font_bitmap_scalable { get; set; }
Efl.Text_Font_Properties.font_family { get; set; }
Efl.Text_Font_Properties.font_size { get; set; }
Efl.Text_Font_Properties.font_source { get; set; }
Efl.Text_Font_Properties.font_fallbacks { get; set; }
Efl.Text_Font_Properties.font_lang { get; set; }
Efl.Text_Font_Properties.font_weight { get; set; }
Efl.Text_Font_Properties.font_slant { get; set; }
Efl.Text_Font_Properties.font_width { get; set; }
Efl.Text_Font_Properties.font_bitmap_scalable { get; set; }
Efl.Text_Style.text_color { get; set; }
Efl.Text_Style.text_background_type { get; set; }
Efl.Text_Style.text_background_color { get; set; }

View File

@ -246,7 +246,8 @@ _cursor_text_append(Efl_Text_Cursor_Handle *cur,
const char *off = text;
int len = 0;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0);
evas_object_async_block(obj);
while (*off)
@ -412,7 +413,8 @@ _efl_text_cursor_range_delete(Eo *obj EINA_UNUSED, Efl_Text_Cursor_Data *pd, Efl
EAPI void
efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle)
{
Efl_Text_Cursor_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN(pd);
if (handle == pd->handle)
return;
@ -429,7 +431,8 @@ efl_text_cursor_handle_set(Eo *obj, Efl_Text_Cursor_Handle *handle)
EAPI Efl_Text_Cursor_Handle *
efl_text_cursor_handle_get(const Eo *obj)
{
Efl_Text_Cursor_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Text_Cursor_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL);
return pd->handle;
}

View File

@ -121,7 +121,8 @@ efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation
Efl_Text_Cursor_Handle cur;
Eo *eo_obj = annotation->obj;
Evas_Object_Protected_Data *obj_data = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Object_Protected_Data *obj_data = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
EINA_SAFETY_ON_NULL_RETURN_VAL(obj_data, EINA_FALSE);
evas_object_async_block(obj_data);
_evas_textblock_relayout_if_needed(eo_obj);

View File

@ -872,3 +872,10 @@ evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Prot
}
}
void
evas_object_callbacks_shutdown(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
{
if (obj->animator_ref > 0)
efl_event_callback_del(obj->layer->evas->evas, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
obj->animator_ref = 0;
}

View File

@ -1179,7 +1179,7 @@ _efl_canvas_object_efl_object_destructor(Eo *eo_obj, Evas_Object_Protected_Data
end:
evas_object_event_callback_all_del(eo_obj);
evas_object_event_callback_cleanup(eo_obj);
evas_object_callbacks_shutdown(eo_obj, obj);
efl_destructor(efl_super(eo_obj, MY_CLASS));
}

View File

@ -410,6 +410,8 @@ _evas_text_font_reload(Eo *eo_obj, Evas_Text_Data *o)
Eina_Bool source_invisible = EINA_FALSE;
Eina_List *was = NULL;
if (o->cur.size == 0 || (!o->cur.font && !o->cur.source)) return ;
if (!(obj->layer->evas->is_frozen))
{
pass = evas_event_passes_through(eo_obj, obj);

View File

@ -8524,7 +8524,7 @@ static void
_evas_object_textblock_text_markup_prepend(Eo *eo_obj,
Efl_Text_Cursor_Handle *cur, const char *text)
{
if (!cur) return;
if (!cur || !text || !*text) return;
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
TB_HEAD();
@ -8533,140 +8533,138 @@ _evas_object_textblock_text_markup_prepend(Eo *eo_obj,
* this should be done once, when markup_prepend finished */
o->pause_change = EINA_TRUE;
if (text)
char *s, *p;
char *tag_start, *tag_end, *esc_start, *esc_end;
tag_start = tag_end = esc_start = esc_end = NULL;
p = (char *)text;
s = p;
/* This loop goes through all of the mark up text until it finds format
* tags, escape sequences or the terminating NULL. When it finds either
* of those, it appends the text found up until that point to the textblock
* proccesses whatever found. It repeats itself until the terminating
* NULL is reached. */
for (;;)
{
char *s, *p;
char *tag_start, *tag_end, *esc_start, *esc_end;
tag_start = tag_end = esc_start = esc_end = NULL;
p = (char *)text;
s = p;
/* This loop goes through all of the mark up text until it finds format
* tags, escape sequences or the terminating NULL. When it finds either
* of those, it appends the text found up until that point to the textblock
* proccesses whatever found. It repeats itself until the terminating
* NULL is reached. */
for (;;)
size_t text_len;
/* If we got to the end of string or just finished/started tag
* or escape sequence handling. */
if ((*p == 0) ||
(tag_end) || (esc_end) ||
(tag_start) || (esc_start))
{
size_t text_len;
/* If we got to the end of string or just finished/started tag
* or escape sequence handling. */
if ((*p == 0) ||
(tag_end) || (esc_end) ||
(tag_start) || (esc_start))
if (tag_end)
{
if (tag_end)
{
/* If we reached to a tag ending, analyze the tag */
char *ttag;
size_t ttag_len = tag_end - tag_start;
/* If we reached to a tag ending, analyze the tag */
char *ttag;
size_t ttag_len = tag_end - tag_start;
ttag = malloc(ttag_len + 1);
if (ttag)
{
memcpy(ttag, tag_start, ttag_len);
ttag[ttag_len] = 0;
evas_textblock_cursor_format_prepend(cur, ttag);
free(ttag);
}
tag_start = tag_end = NULL;
}
else if (esc_end)
ttag = malloc(ttag_len + 1);
if (ttag)
{
_prepend_escaped_char(cur, esc_start, esc_end + 1);
esc_start = esc_end = NULL;
memcpy(ttag, tag_start, ttag_len);
ttag[ttag_len] = 0;
evas_textblock_cursor_format_prepend(cur, ttag);
free(ttag);
}
else if (*p == 0 && esc_start) /* escape start with no end, append it as text */
{
_prepend_text_run(cur, esc_start, p);
esc_start = esc_end = NULL;
s = NULL;
}
else if (*p == 0)
{
_prepend_text_run(cur, s, p);
s = NULL;
}
if (*p == 0)
break;
tag_start = tag_end = NULL;
}
if (*p == '<')
else if (esc_end)
{
if (esc_start) /* escape start with no end, append it as text */
{
_prepend_text_run(cur, esc_start, p);
esc_start = esc_end = NULL;
s = NULL;
}
if (!esc_start)
{
/* Append the text prior to this to the textblock and mark
* the start of the tag */
tag_start = p;
tag_end = NULL;
_prepend_text_run(cur, s, p);
s = NULL;
}
_prepend_escaped_char(cur, esc_start, esc_end + 1);
esc_start = esc_end = NULL;
}
else if (*p == '>')
else if (*p == 0 && esc_start) /* escape start with no end, append it as text */
{
if (tag_start)
{
tag_end = p + 1;
s = p + 1;
}
_prepend_text_run(cur, esc_start, p);
esc_start = esc_end = NULL;
s = NULL;
}
else if (*p == '&')
else if (*p == 0)
{
if (esc_start) /* escape start with no end, append it as text */
{
_prepend_text_run(cur, esc_start, p);
esc_start = esc_end = NULL;
s = NULL;
}
if (!tag_start)
{
/* Append the text prior to this to the textblock and mark
* the start of the escape sequence */
esc_start = p;
esc_end = NULL;
_prepend_text_run(cur, s, p);
s = NULL;
}
}
else if (*p == ';')
{
if (esc_start)
{
esc_end = p;
s = p + 1;
}
}
/* Unicode object replacement char */
else if (!strncmp(_REPLACEMENT_CHAR_UTF8, p,
text_len = strlen(_REPLACEMENT_CHAR_UTF8)) ||
!strncmp(_NEWLINE_UTF8, p,
text_len = strlen(_NEWLINE_UTF8)) ||
!strncmp(_TAB_UTF8, p,
text_len = strlen(_TAB_UTF8)) ||
!strncmp(_PARAGRAPH_SEPARATOR_UTF8, p,
text_len = strlen(_PARAGRAPH_SEPARATOR_UTF8)))
{
/*FIXME: currently just remove them, maybe do something
* fancier in the future, atm it breaks if this char
* is inside <> */
_prepend_text_run(cur, s, p);
/* it's also advanced later in this loop need +text_len
in total*/
p += text_len - 1;
s = p + 1; /* One after the end of the replacement char */
s = NULL;
}
p++;
if (*p == 0)
break;
}
if (*p == '<')
{
if (esc_start) /* escape start with no end, append it as text */
{
_prepend_text_run(cur, esc_start, p);
esc_start = esc_end = NULL;
s = NULL;
}
if (!esc_start)
{
/* Append the text prior to this to the textblock and mark
* the start of the tag */
tag_start = p;
tag_end = NULL;
_prepend_text_run(cur, s, p);
s = NULL;
}
}
else if (*p == '>')
{
if (tag_start)
{
tag_end = p + 1;
s = p + 1;
}
}
else if (*p == '&')
{
if (esc_start) /* escape start with no end, append it as text */
{
_prepend_text_run(cur, esc_start, p);
esc_start = esc_end = NULL;
s = NULL;
}
if (!tag_start)
{
/* Append the text prior to this to the textblock and mark
* the start of the escape sequence */
esc_start = p;
esc_end = NULL;
_prepend_text_run(cur, s, p);
s = NULL;
}
}
else if (*p == ';')
{
if (esc_start)
{
esc_end = p;
s = p + 1;
}
}
/* Unicode object replacement char */
else if (!strncmp(_REPLACEMENT_CHAR_UTF8, p,
text_len = strlen(_REPLACEMENT_CHAR_UTF8)) ||
!strncmp(_NEWLINE_UTF8, p,
text_len = strlen(_NEWLINE_UTF8)) ||
!strncmp(_TAB_UTF8, p,
text_len = strlen(_TAB_UTF8)) ||
!strncmp(_PARAGRAPH_SEPARATOR_UTF8, p,
text_len = strlen(_PARAGRAPH_SEPARATOR_UTF8)))
{
/*FIXME: currently just remove them, maybe do something
* fancier in the future, atm it breaks if this char
* is inside <> */
_prepend_text_run(cur, s, p);
/* it's also advanced later in this loop need +text_len
in total*/
p += text_len - 1;
s = p + 1; /* One after the end of the replacement char */
}
p++;
}
o->pause_change = EINA_FALSE;
efl_event_callback_call(cur->obj, EFL_CANVAS_TEXTBLOCK_EVENT_CHANGED, NULL);
_evas_textblock_changed(o, eo_obj);
}

View File

@ -1623,6 +1623,7 @@ void evas_event_callback_call(Evas *e, Evas_Callback_Type type, void *event_info
void evas_object_callbacks_finalized(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj);
void evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array);
void evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array);
void evas_object_callbacks_shutdown(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj);
void evas_object_event_callback_call(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Callback_Type type, void *event_info, int event_id, const Efl_Event_Description *efl_event_desc);
Eina_List *evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y);

View File

@ -3,8 +3,6 @@
#include "../gl_common/evas_gl_define.h"
#include "../software_generic/evas_native_common.h"
#include <wayland-client.h>
#ifdef HAVE_DLSYM
# include <dlfcn.h> /* dlopen,dlclose,etc */
#else

View File

@ -17,6 +17,7 @@ using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
namespace EinaTestData
{
@ -95,6 +96,8 @@ public static class BaseData
[ CallerLineNumber ] int line = 0,
[ CallerFilePath ] string file = null,
[ CallerMemberName ] string member = null) {
Contract.Requires(a != null, nameof(a));
Contract.Requires(b != null, nameof(b));
Test.Assert(a.Length == b.Length, "Different lenght", line, file, member);
for (int i = 0; i < a.Length; ++i)
{

View File

@ -5,6 +5,7 @@
#define EFL_LAYOUT_CALC_PROTECTED
#include <Efl_Ui.h>
#include "efl_ui_suite.h"
#include "Evas_Legacy.h"
static void
increment_int_changed(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
@ -153,6 +154,30 @@ EFL_START_TEST(text_scroll_mode)
}
EFL_END_TEST
EFL_START_TEST(text_change_event)
{
Eo *txt;
Eo *win = win_add();
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
efl_text_set(txt, "Hello");
int i_changed = 0;
efl_event_callback_add(txt, EFL_UI_TEXTBOX_EVENT_CHANGED, increment_int_changed, &i_changed);
efl_gfx_entity_visible_set(txt, EINA_TRUE);
Evas *e = evas_object_evas_get(txt);
efl_ui_focus_util_focus(txt);
evas_event_feed_key_down(e, "s", "s", "s", "s", time(NULL), NULL);
ecore_main_loop_iterate();
ck_assert_str_eq(efl_text_get(txt),"Hellos");
ck_assert_int_eq(i_changed,1);
ecore_main_loop_iterate();
efl_del(txt);
efl_del(win);
}
EFL_END_TEST
void efl_ui_test_text(TCase *tc)
{
tcase_add_test(tc, text_cnp);
@ -160,4 +185,5 @@ void efl_ui_test_text(TCase *tc)
tcase_add_test(tc, text_selection);
tcase_add_test(tc, text_user_change);
tcase_add_test(tc, text_scroll_mode);
tcase_add_test(tc, text_change_event);
}

View File

@ -518,6 +518,78 @@ EFL_START_TEST(elm_entry_file_get_set)
}
EFL_END_TEST
EFL_START_TEST(elm_entry_test_text_class)
{
Evas_Object *win, *entry1, *entry2, *entry3, *entry4;
const char *filename = NULL;
int w1 = 0, h1 = 0, w2 = 0, h2 = 0, w3 = 0, h3 = 0;
const char *font;
int font_size;
win = win_add(NULL, "entry", ELM_WIN_BASIC);
entry1 = elm_entry_add(win);
entry2 = elm_entry_add(win);
entry3 = elm_entry_add(win);
elm_object_text_set(entry1, "hello");
elm_object_text_set(entry2, "hello");
elm_object_text_set(entry3, "hello");
edje_object_file_get(elm_layout_edje_get(entry1), &filename, NULL);
ck_assert(filename != NULL);
ck_assert(edje_file_text_class_set(filename, "entry_text", "Serif:Style=Bold", 24));
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry1), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 24);
ck_assert_str_eq(font, "Serif:Style=Bold");
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry2), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 24);
ck_assert_str_eq(font, "Serif:Style=Bold");
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry3), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 24);
ck_assert_str_eq(font, "Serif:Style=Bold");
evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry1), &w1, &h1);
evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry2), &w2, &h2);
evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry3), &w3, &h3);
ck_assert_int_eq(w1, w2);
ck_assert_int_eq(h1, h2);
ck_assert_int_eq(w2, w3);
ck_assert_int_eq(h2, h3);
ck_assert(edje_object_text_class_set(elm_layout_edje_get(entry1), "entry_text", "Sans", 50));
ck_assert(edje_object_text_class_set(elm_layout_edje_get(entry2), "entry_text", "Serif", 20));
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry1), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 50);
ck_assert_str_eq(font, "Sans");
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry2), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 20);
ck_assert_str_eq(font, "Serif");
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry3), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 24);
ck_assert_str_eq(font, "Serif:Style=Bold");
evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry1), &w1, &h1);
evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry2), &w2, &h2);
evas_object_textblock_size_formatted_get(elm_entry_textblock_get(entry3), &w3, &h3);
ck_assert_int_ne(w1, w2);
ck_assert_int_ne(h1, h2);
ck_assert_int_ne(w2, w3);
ck_assert_int_ne(h2, h3);
entry4 = elm_entry_add(win);
elm_object_text_set(entry4, "hello");
ck_assert(edje_object_text_class_get(elm_layout_edje_get(entry4), "entry_text", &font, &font_size));
ck_assert_int_eq(font_size, 24);
ck_assert_str_eq(font, "Serif:Style=Bold");
}
EFL_END_TEST
void elm_test_entry(TCase *tc)
{
tcase_add_test(tc, elm_entry_legacy_type_check);
@ -535,4 +607,5 @@ void elm_test_entry(TCase *tc)
tcase_add_test(tc, elm_entry_text_set);
tcase_add_test(tc, elm_entry_magnifier);
tcase_add_test(tc, elm_entry_file_get_set);
tcase_add_test(tc, elm_entry_test_text_class);
}

View File

@ -124,6 +124,10 @@ EFL_START_TEST (range_display_value_events)
changed = EINA_FALSE;
min_reached = EINA_FALSE;
max_reached = EINA_FALSE;
efl_event_callback_del(widget, EFL_UI_RANGE_EVENT_CHANGED, _set_flag, &changed);
efl_event_callback_del(widget, EFL_UI_RANGE_EVENT_MIN_REACHED, _set_flag, &min_reached);
efl_event_callback_del(widget, EFL_UI_RANGE_EVENT_MAX_REACHED, _set_flag, &max_reached);
}
EFL_END_TEST

View File

@ -4530,7 +4530,12 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
efl_text_set(txt, "");
efl_text_set(txt, "");
efl_text_cursor_text_insert(cursor1, "aa");
ck_assert_int_eq(changed_emit, 3);
ck_assert_int_eq(changed_emit, 4);
efl_text_markup_set(txt, "Hello<br/>Word");
efl_text_markup_set(txt, "Hello<br/>Word");
efl_text_cursor_markup_insert(cursor1, "aa");
ck_assert_int_eq(changed_emit, 6);
efl_text_set(txt, "");
ck_assert(!efl_text_cursor_move(cur_obj, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT));
@ -4549,7 +4554,7 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
ck_assert(!efl_text_cursor_move(cur_obj, EFL_TEXT_CURSOR_MOVE_TYPE_LAST));
ck_assert_int_eq(efl_text_cursor_position_get(cur_obj), 0);
ck_assert_int_eq(changed_emit, 4);
ck_assert_int_eq(changed_emit, 7);
efl_text_markup_set(txt, "Hello World<ps/>This is EFL<br/>Enlightenment");
ck_assert(efl_text_cursor_move(cur_obj, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT));