2003-06-23 19:33:04 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
2012-05-09 22:37:38 -07:00
|
|
|
typedef struct _Edje_Table_Items Edje_Table_Items;
|
|
|
|
struct _Edje_Table_Items
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Evas_Object *child;
|
|
|
|
const char *part;
|
2012-05-09 22:37:38 -07:00
|
|
|
unsigned short col;
|
|
|
|
unsigned short row;
|
|
|
|
unsigned short colspan;
|
|
|
|
unsigned short rowspan;
|
|
|
|
};
|
|
|
|
|
2012-05-14 04:18:45 -07:00
|
|
|
typedef struct _Edje_Drag_Items Edje_Drag_Items;
|
|
|
|
struct _Edje_Drag_Items
|
|
|
|
{
|
|
|
|
const char *part;
|
2015-06-08 11:43:00 -07:00
|
|
|
FLOAT_T x, y, w, h;
|
|
|
|
struct
|
|
|
|
{
|
2012-05-14 04:18:45 -07:00
|
|
|
FLOAT_T x, y;
|
|
|
|
} step;
|
2015-06-08 11:43:00 -07:00
|
|
|
struct
|
|
|
|
{
|
2012-05-14 04:18:45 -07:00
|
|
|
FLOAT_T x, y;
|
|
|
|
} page;
|
|
|
|
};
|
|
|
|
|
2013-11-03 18:28:29 -08:00
|
|
|
void _edje_file_add(Edje *ed, const Eina_File *f);
|
2013-08-09 04:49:52 -07:00
|
|
|
|
2012-09-04 04:27:43 -07:00
|
|
|
/* START - Nested part support */
|
|
|
|
#define _edje_smart_nested_type "Evas_Smart_Nested"
|
|
|
|
typedef struct _Edje_Nested_Support Edje_Nested_Support;
|
2015-06-08 11:43:00 -07:00
|
|
|
struct _Edje_Nested_Support /* We builed nested-parts list using this struct */
|
|
|
|
{
|
|
|
|
Evas_Object *o; /* Smart object containing nested children */
|
2012-09-04 04:27:43 -07:00
|
|
|
unsigned char nested_children_count; /* Number of nested children */
|
|
|
|
};
|
|
|
|
|
|
|
|
Evas_Smart *
|
|
|
|
_edje_smart_nested_smart_class_new(void)
|
|
|
|
{
|
|
|
|
static Evas_Smart_Class _sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("EdjeNested");
|
|
|
|
static const Evas_Smart_Class *class = NULL;
|
|
|
|
static Evas_Smart *smart;
|
|
|
|
|
|
|
|
if (smart)
|
|
|
|
return smart;
|
|
|
|
|
|
|
|
class = &_sc;
|
|
|
|
smart = evas_smart_class_new(class);
|
|
|
|
return smart;
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
edje_smart_nested_add(Evas *evas)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
return evas_object_smart_add(evas, _edje_smart_nested_smart_class_new());
|
2012-09-04 04:27:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* END - Nested part support */
|
|
|
|
|
2004-03-26 01:10:05 -08:00
|
|
|
#ifdef EDJE_PROGRAM_CACHE
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
|
2004-03-26 01:10:05 -08:00
|
|
|
#endif
|
2015-06-08 11:43:00 -07:00
|
|
|
static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it);
|
|
|
|
static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source);
|
2003-07-19 19:08:47 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
static Eina_Hash *_edje_object_collect(Edje *ed);
|
2012-05-18 07:37:21 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
static int _sort_defined_boxes(const void *a, const void *b);
|
2007-03-16 14:37:57 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/************************** API Routines **************************/
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN const char *
|
|
|
|
_efl_canvas_layout_efl_file_file_get(Eo *obj EINA_UNUSED, Edje *ed)
|
2012-10-21 03:46:58 -07:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
return ed->path;
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN const char *
|
|
|
|
_efl_canvas_layout_efl_file_group_get(Eo *obj EINA_UNUSED, Edje *ed)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
return ed->group;
|
|
|
|
}
|
2017-10-04 21:00:56 -07:00
|
|
|
|
2019-03-04 10:36:57 -08:00
|
|
|
EOLIAN Eina_Error
|
2019-02-27 10:17:09 -08:00
|
|
|
_efl_canvas_layout_layout_load_error_get(const Eo *obj EINA_UNUSED, Edje *ed)
|
|
|
|
{
|
2017-05-25 18:29:05 -07:00
|
|
|
switch (ed->load_error)
|
|
|
|
{
|
2018-04-19 04:26:59 -07:00
|
|
|
case EDJE_LOAD_ERROR_NONE: return EFL_GFX_IMAGE_LOAD_ERROR_NONE;
|
|
|
|
case EDJE_LOAD_ERROR_GENERIC: return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
|
|
|
|
case EDJE_LOAD_ERROR_DOES_NOT_EXIST: return EFL_GFX_IMAGE_LOAD_ERROR_DOES_NOT_EXIST;
|
|
|
|
case EDJE_LOAD_ERROR_PERMISSION_DENIED: return EFL_GFX_IMAGE_LOAD_ERROR_PERMISSION_DENIED;
|
|
|
|
case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: return EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
case EDJE_LOAD_ERROR_CORRUPT_FILE: return EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
case EDJE_LOAD_ERROR_UNKNOWN_FORMAT: return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT;
|
|
|
|
case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: return EFL_GFX_IMAGE_LOAD_ERROR_INCOMPATIBLE_FILE;
|
|
|
|
case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: return EFL_GFX_IMAGE_LOAD_ERROR_UNKNOWN_COLLECTION;
|
|
|
|
case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: return EFL_GFX_IMAGE_LOAD_ERROR_RECURSIVE_REFERENCE;
|
2019-02-27 10:17:09 -08:00
|
|
|
default: break;
|
2017-05-25 18:29:05 -07:00
|
|
|
}
|
2019-02-27 10:17:09 -08:00
|
|
|
return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
|
2017-05-25 18:29:05 -07:00
|
|
|
}
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
EAPI const char *
|
2010-09-22 06:27:09 -07:00
|
|
|
edje_load_error_str(Edje_Load_Error error)
|
2008-12-21 10:39:36 -08:00
|
|
|
{
|
|
|
|
switch (error)
|
|
|
|
{
|
|
|
|
case EDJE_LOAD_ERROR_NONE:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "No Error";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_GENERIC:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Generic Error";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_DOES_NOT_EXIST:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "File Does Not Exist";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_PERMISSION_DENIED:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Permission Denied";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Resource Allocation Failed";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_CORRUPT_FILE:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Corrupt File";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_UNKNOWN_FORMAT:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Unknown Format";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Incompatible File";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Unknown Collection";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Recursive Reference";
|
|
|
|
|
2008-12-21 10:39:36 -08:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
return "Unknown Error";
|
2008-12-21 10:39:36 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2013-10-31 18:58:33 -07:00
|
|
|
edje_mmap_collection_list(Eina_File *f)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *lst = NULL;
|
2007-05-26 22:28:07 -07:00
|
|
|
Edje_File *edf;
|
|
|
|
int error_ret = 0;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2013-08-09 04:49:52 -07:00
|
|
|
if (!f) return NULL;
|
|
|
|
edf = _edje_cache_file_coll_open(f, NULL, &error_ret, NULL, NULL);
|
2010-08-21 06:52:25 -07:00
|
|
|
if (edf)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
Eina_Iterator *i;
|
|
|
|
const char *key;
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
i = eina_hash_iterator_key_new(edf->collection);
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
EINA_ITERATOR_FOREACH(i, key)
|
2015-06-08 11:43:00 -07:00
|
|
|
lst = eina_list_append(lst, eina_stringshare_add(key));
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
eina_iterator_free(i);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
_edje_cache_file_unref(edf);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
return lst;
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_file_collection_list(const char *file)
|
|
|
|
{
|
|
|
|
Eina_File *f;
|
2019-08-20 07:15:28 -07:00
|
|
|
Eina_List *lst = NULL;
|
2018-02-22 14:55:55 -08:00
|
|
|
char *tmp;
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
if ((!file) || (!*file)) return NULL;
|
2018-02-22 14:55:55 -08:00
|
|
|
tmp = eina_vpath_resolve(file);
|
|
|
|
f = eina_file_open(tmp, EINA_FALSE);
|
2019-08-20 07:15:28 -07:00
|
|
|
if (!f) goto err;
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
lst = edje_mmap_collection_list(f);
|
|
|
|
|
2019-08-20 16:32:38 -07:00
|
|
|
eina_file_close(f); // close matching open OK
|
2019-08-20 07:15:28 -07:00
|
|
|
err:
|
2018-02-22 14:55:55 -08:00
|
|
|
free(tmp);
|
2007-05-26 22:28:07 -07:00
|
|
|
return lst;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2008-10-22 04:34:42 -07:00
|
|
|
edje_file_collection_list_free(Eina_List *lst)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
while (lst)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
if (eina_list_data_get(lst)) eina_stringshare_del(eina_list_data_get(lst));
|
2013-07-17 22:47:14 -07:00
|
|
|
lst = eina_list_remove(lst, eina_list_data_get(lst));
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
EAPI void
|
|
|
|
edje_mmap_collection_list_free(Eina_List *lst)
|
|
|
|
{
|
|
|
|
edje_file_collection_list_free(lst);
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
2013-10-31 18:58:33 -07:00
|
|
|
edje_mmap_group_exists(Eina_File *f, const char *glob)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
Edje_File *edf;
|
|
|
|
int error_ret = 0;
|
2010-06-28 06:56:30 -07:00
|
|
|
Eina_Bool succeed = EINA_FALSE;
|
2010-12-05 23:49:00 -08:00
|
|
|
Eina_Bool is_glob = EINA_FALSE;
|
|
|
|
const char *p;
|
2010-09-10 04:25:15 -07:00
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
if ((!f) || (!glob))
|
2015-06-08 11:43:00 -07:00
|
|
|
return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2013-08-09 04:49:52 -07:00
|
|
|
edf = _edje_cache_file_coll_open(f, NULL, &error_ret, NULL, NULL);
|
2013-10-31 18:58:33 -07:00
|
|
|
if (!edf) return EINA_FALSE;
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
for (p = glob; *p; p++)
|
2010-09-10 04:25:15 -07:00
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
if ((*p == '*') || (*p == '?') || (*p == '['))
|
|
|
|
{
|
|
|
|
is_glob = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2010-12-05 23:49:00 -08:00
|
|
|
}
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
if (is_glob)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!edf->collection_patterns)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
|
|
|
Eina_Iterator *i;
|
|
|
|
Eina_List *l = NULL;
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
i = eina_hash_iterator_data_new(edf->collection);
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
EINA_ITERATOR_FOREACH(i, ce)
|
|
|
|
l = eina_list_append(l, ce);
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
eina_iterator_free(i);
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
edf->collection_patterns = edje_match_collection_dir_init(l);
|
|
|
|
eina_list_free(l);
|
|
|
|
}
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
succeed = edje_match_collection_dir_exec(edf->collection_patterns, glob);
|
|
|
|
if (edf->collection_patterns)
|
|
|
|
{
|
|
|
|
edje_match_patterns_free(edf->collection_patterns);
|
|
|
|
edf->collection_patterns = NULL;
|
|
|
|
}
|
2010-12-05 23:49:00 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (eina_hash_find(edf->collection, glob)) succeed = EINA_TRUE;
|
2010-09-10 04:25:15 -07:00
|
|
|
}
|
|
|
|
_edje_cache_file_unref(edf);
|
2011-06-22 08:59:15 -07:00
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
DBG("edje_file_group_exists: '%s', '%s': %i.", eina_file_filename_get(f), glob, succeed);
|
2011-06-22 08:59:15 -07:00
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
return succeed;
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
2016-07-08 10:13:14 -07:00
|
|
|
EAPI Eina_Bool
|
2020-03-19 02:47:36 -07:00
|
|
|
edje_mmap_3d_has(Eina_File *f EINA_UNUSED, const char *group EINA_UNUSED)
|
2016-07-08 10:13:14 -07:00
|
|
|
{
|
2020-03-19 02:47:36 -07:00
|
|
|
return EINA_FALSE;
|
2016-07-08 10:13:14 -07:00
|
|
|
}
|
|
|
|
|
2015-03-31 14:23:32 -07:00
|
|
|
typedef struct _Edje_File_Iterator Edje_File_Iterator;
|
|
|
|
struct _Edje_File_Iterator
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Eina_Iterator iterator;
|
2015-03-31 14:23:32 -07:00
|
|
|
|
|
|
|
Eina_Iterator *it;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_file_iterator_next(Eina_Iterator *it, void **data)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_File_Iterator *et = (void *)it;
|
2015-03-31 14:23:32 -07:00
|
|
|
Edje_File *edf = NULL;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!eina_iterator_next(et->it, (void **)&edf))
|
2015-03-31 14:23:32 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
*data = edf->f;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
_edje_file_iterator_container(Eina_Iterator *it EINA_UNUSED)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_file_iterator_free(Eina_Iterator *it)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_File_Iterator *et = (void *)it;
|
2015-03-31 14:23:32 -07:00
|
|
|
|
|
|
|
EINA_MAGIC_SET(&et->iterator, 0);
|
|
|
|
eina_iterator_free(et->it);
|
|
|
|
free(et);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Iterator *
|
|
|
|
edje_file_iterator_new(void)
|
|
|
|
{
|
|
|
|
Edje_File_Iterator *it;
|
|
|
|
|
|
|
|
it = calloc(1, sizeof (Edje_File_Iterator));
|
|
|
|
if (!it) return NULL;
|
|
|
|
|
|
|
|
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
|
|
|
|
it->it = eina_hash_iterator_data_new(_edje_file_hash);
|
|
|
|
|
|
|
|
it->iterator.version = EINA_ITERATOR_VERSION;
|
|
|
|
it->iterator.next = _edje_file_iterator_next;
|
|
|
|
it->iterator.get_container = _edje_file_iterator_container;
|
|
|
|
it->iterator.free = _edje_file_iterator_free;
|
|
|
|
|
|
|
|
return &it->iterator;
|
|
|
|
}
|
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_file_group_exists(const char *file, const char *glob)
|
|
|
|
{
|
|
|
|
Eina_File *f;
|
2019-08-20 07:15:28 -07:00
|
|
|
Eina_Bool result = EINA_FALSE;
|
|
|
|
char *tmp;
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
if ((!file) || (!*file) || (!glob))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2019-08-20 07:15:28 -07:00
|
|
|
tmp = eina_vpath_resolve(file);
|
|
|
|
f = eina_file_open(tmp, EINA_FALSE);
|
|
|
|
if (!f) goto err;
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
result = edje_mmap_group_exists(f, glob);
|
|
|
|
|
2019-08-20 16:32:38 -07:00
|
|
|
eina_file_close(f); // close matching open OK
|
2019-08-20 07:15:28 -07:00
|
|
|
err:
|
|
|
|
free(tmp);
|
2013-10-31 18:58:33 -07:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
EAPI char *
|
2013-11-03 18:28:29 -08:00
|
|
|
edje_mmap_data_get(const Eina_File *f, const char *key)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
Edje_File *edf;
|
|
|
|
char *str = NULL;
|
|
|
|
int error_ret = 0;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
if (!key) return NULL;
|
|
|
|
|
|
|
|
edf = _edje_cache_file_coll_open(f, NULL, &error_ret, NULL, NULL);
|
|
|
|
if (edf)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
str = (char *)edje_string_get(eina_hash_find(edf->data, key));
|
2013-08-09 04:49:52 -07:00
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
if (str) str = strdup(str);
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
_edje_cache_file_unref(edf);
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI char *
|
|
|
|
edje_file_data_get(const char *file, const char *key)
|
|
|
|
{
|
|
|
|
Eina_File *f;
|
2019-08-20 07:15:28 -07:00
|
|
|
char *str = NULL, *tmp;
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2013-10-31 18:58:33 -07:00
|
|
|
if (!key) return NULL;
|
|
|
|
|
2019-08-20 07:15:28 -07:00
|
|
|
tmp = eina_vpath_resolve(file);
|
2019-08-20 16:32:38 -07:00
|
|
|
f = eina_file_open(tmp, EINA_FALSE);
|
2014-01-04 17:58:08 -08:00
|
|
|
if (!f)
|
|
|
|
{
|
2014-01-05 02:30:34 -08:00
|
|
|
ERR("File [%s] can not be opened.", file);
|
2019-08-20 07:15:28 -07:00
|
|
|
goto err;
|
2014-01-04 17:58:08 -08:00
|
|
|
}
|
2013-10-31 18:58:33 -07:00
|
|
|
str = edje_mmap_data_get(f, key);
|
2019-08-20 16:32:38 -07:00
|
|
|
eina_file_close(f); // close matching open OK
|
2019-08-20 07:15:28 -07:00
|
|
|
err:
|
|
|
|
free(tmp);
|
2013-08-09 04:49:52 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2010-01-19 12:14:14 -08:00
|
|
|
void
|
2013-02-13 19:36:13 -08:00
|
|
|
_edje_programs_patterns_clean(Edje_Part_Collection *edc)
|
2008-02-26 12:12:00 -08:00
|
|
|
{
|
2013-02-13 19:36:13 -08:00
|
|
|
_edje_signals_sources_patterns_clean(&edc->patterns.programs);
|
2008-11-10 08:37:52 -08:00
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
eina_rbtree_delete(edc->patterns.programs.exact_match,
|
2013-07-17 22:47:14 -07:00
|
|
|
EINA_RBTREE_FREE_CB(edje_match_signal_source_free),
|
|
|
|
NULL);
|
2013-02-13 19:36:13 -08:00
|
|
|
edc->patterns.programs.exact_match = NULL;
|
2008-11-10 08:37:52 -08:00
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
free(edc->patterns.programs.u.programs.globing);
|
|
|
|
edc->patterns.programs.u.programs.globing = NULL;
|
2008-02-26 12:12:00 -08:00
|
|
|
}
|
|
|
|
|
2016-05-17 05:21:39 -07:00
|
|
|
void
|
|
|
|
_evas_object_viewport_del(void *data, Evas *_evas EINA_UNUSED, Evas_Object *eo EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Eo* viewport = (Eo*) data;
|
|
|
|
evas_object_del(viewport);
|
|
|
|
}
|
|
|
|
|
2012-12-05 11:30:00 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_physics_world_update_cb(void *data, EPhysics_World *world EINA_UNUSED, void *event_info EINA_UNUSED)
|
2012-12-05 11:30:00 -08:00
|
|
|
{
|
|
|
|
Edje *edje = data;
|
2016-08-01 03:04:42 -07:00
|
|
|
if (EPH_LOAD()) _edje_recalc_do(edje);
|
2012-12-05 11:30:00 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-12-07 15:10:34 -08:00
|
|
|
Eina_Bool
|
|
|
|
_edje_part_allowed_seat_find(Edje_Real_Part *rp, const char *seat_name)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < rp->part->allowed_seats_count; i++)
|
|
|
|
{
|
|
|
|
name = rp->part->allowed_seats[i]->name;
|
|
|
|
if (!strcmp(seat_name, name))
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* It goes throught the list of registered seats and
|
|
|
|
* set event filters for each of these seats. */
|
|
|
|
static void
|
|
|
|
_edje_part_seat_filter_apply(Edje *ed, Edje_Real_Part *rp)
|
|
|
|
{
|
|
|
|
Edje_Seat *seat;
|
|
|
|
Eina_List *l;
|
|
|
|
Eina_Bool found;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->seats, l, seat)
|
|
|
|
{
|
|
|
|
found = _edje_part_allowed_seat_find(rp, seat->name);
|
|
|
|
efl_input_seat_event_filter_set(rp->object, seat->device, found);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* It goes throught the list of all edje parts and
|
|
|
|
* set event filters for each of these parts. Should be called when
|
|
|
|
* a new seat is added.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
_edje_seat_event_filter_apply(Edje *ed, Edje_Seat *seat)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
unsigned short i;
|
|
|
|
Eina_Bool found;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (!rp->part->allowed_seats)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
found = _edje_part_allowed_seat_find(rp, seat->name);
|
|
|
|
efl_input_seat_event_filter_set(rp->object, seat->device, found);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
static void
|
|
|
|
_edje_device_add(Edje *ed, Efl_Input_Device *dev)
|
|
|
|
{
|
|
|
|
Edje_Seat *s, *seat = NULL;
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
char sig[256];
|
|
|
|
Eina_List *l;
|
|
|
|
|
2016-12-06 09:06:38 -08:00
|
|
|
if (ed->collection && ed->collection->use_custom_seat_names)
|
2017-06-07 01:36:50 -07:00
|
|
|
name = eina_stringshare_add(efl_name_get(dev));
|
2016-12-06 09:06:38 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ed->seats_count++;
|
|
|
|
name = eina_stringshare_printf("seat%i", ed->seats_count);
|
|
|
|
}
|
2016-11-30 13:52:14 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(name);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->seats, l, s)
|
|
|
|
{
|
|
|
|
if (s->name != name)
|
|
|
|
continue;
|
|
|
|
seat = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!seat)
|
|
|
|
{
|
|
|
|
seat = calloc(1, sizeof(Edje_Seat));
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(seat, seat_err);
|
|
|
|
ed->seats = eina_list_append(ed->seats, seat);
|
|
|
|
seat->name = eina_stringshare_ref(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
seat->device = dev;
|
|
|
|
snprintf(sig, sizeof(sig), "seat,added,%s,%s", seat->name,
|
2017-06-07 01:36:50 -07:00
|
|
|
efl_name_get(dev));
|
2016-11-30 13:52:14 -08:00
|
|
|
_edje_emit(ed, sig, "");
|
2016-12-07 15:10:34 -08:00
|
|
|
_edje_seat_event_filter_apply(ed, seat);
|
2016-11-30 13:52:14 -08:00
|
|
|
|
|
|
|
seat_err:
|
|
|
|
eina_stringshare_del(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_device_added_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Input_Device *dev = event->info;
|
|
|
|
Edje *ed = data;
|
|
|
|
|
2017-06-11 22:56:36 -07:00
|
|
|
if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_TYPE_SEAT)
|
2016-11-30 13:52:14 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
_edje_device_add(ed, dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_device_removed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Input_Device *dev = event->info;
|
|
|
|
Edje_Seat *s, *seat = NULL;
|
|
|
|
Edje *ed = data;
|
|
|
|
char sig[256];
|
|
|
|
Eina_List *l;
|
|
|
|
|
2017-06-11 22:56:36 -07:00
|
|
|
if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_TYPE_SEAT)
|
2016-11-30 13:52:14 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->seats, l, s)
|
|
|
|
{
|
|
|
|
if (s->device != dev)
|
|
|
|
continue;
|
|
|
|
seat = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* It shouldn't happen. New seats are always registered. */
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(seat);
|
|
|
|
|
|
|
|
seat->device = NULL;
|
|
|
|
snprintf(sig, sizeof(sig), "seat,removed,%s", seat->name);
|
|
|
|
_edje_emit(ed, sig, "");
|
|
|
|
}
|
|
|
|
|
2016-12-06 09:06:38 -08:00
|
|
|
static void
|
|
|
|
_edje_device_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Input_Device *dev = event->info;
|
|
|
|
Edje_Seat *s, *seat = NULL;
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
Edje *ed = data;
|
|
|
|
char sig[256];
|
|
|
|
Eina_List *l;
|
|
|
|
|
2017-06-11 22:56:36 -07:00
|
|
|
if (efl_input_device_type_get(dev) != EFL_INPUT_DEVICE_TYPE_SEAT)
|
2016-12-06 09:06:38 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->seats, l, s)
|
|
|
|
{
|
|
|
|
if (s->device != dev)
|
|
|
|
continue;
|
|
|
|
seat = s;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* not registered seat */
|
|
|
|
if (!seat)
|
|
|
|
return;
|
|
|
|
|
2017-06-07 01:36:50 -07:00
|
|
|
name = efl_name_get(dev);
|
2016-12-06 09:06:38 -08:00
|
|
|
if (!name)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* no name changes */
|
|
|
|
if (eina_streq(seat->name, name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* check if device name was changed to match name used on EDC */
|
|
|
|
EINA_LIST_FOREACH(ed->seats, l, s)
|
|
|
|
{
|
|
|
|
if (eina_streq(s->name, name))
|
|
|
|
{
|
|
|
|
if (s->device == dev)
|
|
|
|
continue;
|
|
|
|
if (s->device)
|
|
|
|
{
|
|
|
|
WRN("Two seats were detected with the same name: %s.\n"
|
|
|
|
"Fix it or focus will misbehave", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* merge seats */
|
|
|
|
s->device = dev;
|
|
|
|
if (seat->focused_part)
|
|
|
|
s->focused_part = seat->focused_part;
|
|
|
|
|
|
|
|
ed->seats = eina_list_remove(ed->seats, seat);
|
|
|
|
eina_stringshare_del(seat->name);
|
|
|
|
free(seat);
|
|
|
|
|
2016-12-07 15:10:34 -08:00
|
|
|
_edje_seat_event_filter_apply(ed, s);
|
|
|
|
|
2016-12-06 09:06:38 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(sig, sizeof(sig), "seat,renamed,%s,%s", seat->name, name);
|
|
|
|
eina_stringshare_replace(&seat->name, name);
|
|
|
|
_edje_emit(ed, sig, "");
|
2016-12-07 15:10:34 -08:00
|
|
|
_edje_seat_event_filter_apply(ed, seat);
|
2016-12-06 09:06:38 -08:00
|
|
|
}
|
|
|
|
|
2019-10-31 06:17:40 -07:00
|
|
|
static void _edje_device_canvas_del(void *data, const Efl_Event *event);
|
|
|
|
|
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(edje_device_callbacks,
|
|
|
|
{ EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED, _edje_device_added_cb },
|
|
|
|
{ EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED, _edje_device_removed_cb },
|
|
|
|
{ EFL_EVENT_DEL, _edje_device_canvas_del });
|
|
|
|
|
|
|
|
EFL_CALLBACKS_ARRAY_DEFINE(edje_device_custom_callbacks,
|
|
|
|
{ EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED, _edje_device_changed_cb },
|
|
|
|
{ EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED, _edje_device_added_cb },
|
|
|
|
{ EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED, _edje_device_removed_cb },
|
|
|
|
{ EFL_EVENT_DEL, _edje_device_canvas_del });
|
|
|
|
|
2018-03-20 09:46:51 -07:00
|
|
|
static void
|
|
|
|
_edje_device_canvas_del(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Edje *ed = data;
|
|
|
|
|
|
|
|
if (ed->collection && ed->collection->use_custom_seat_names)
|
2019-10-31 06:17:40 -07:00
|
|
|
efl_event_callback_array_del(event->object, edje_device_custom_callbacks(), ed);
|
|
|
|
else
|
|
|
|
efl_event_callback_array_del(event->object, edje_device_callbacks(), ed);
|
2018-03-20 09:46:51 -07:00
|
|
|
}
|
|
|
|
|
2019-10-31 06:17:46 -07:00
|
|
|
void
|
2016-11-30 13:52:14 -08:00
|
|
|
_edje_devices_add(Edje *ed, Evas *tev)
|
|
|
|
{
|
|
|
|
const Eina_List *devices, *l;
|
|
|
|
Efl_Input_Device *dev;
|
|
|
|
|
2019-10-31 06:17:46 -07:00
|
|
|
ed->need_seat = EINA_TRUE;
|
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
devices = evas_device_list(tev, NULL);
|
|
|
|
EINA_LIST_FOREACH(devices, l, dev)
|
|
|
|
{
|
2017-06-11 22:56:36 -07:00
|
|
|
if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_TYPE_SEAT)
|
2016-11-30 13:52:14 -08:00
|
|
|
_edje_device_add(ed, dev);
|
|
|
|
}
|
2016-12-06 09:06:38 -08:00
|
|
|
|
|
|
|
if (ed->collection && ed->collection->use_custom_seat_names)
|
2019-10-31 06:17:40 -07:00
|
|
|
efl_event_callback_array_add(tev, edje_device_custom_callbacks(), ed);
|
|
|
|
else
|
|
|
|
efl_event_callback_array_add(tev, edje_device_callbacks(), ed);
|
2016-11-30 13:52:14 -08:00
|
|
|
}
|
|
|
|
|
2019-08-28 00:23:55 -07:00
|
|
|
static inline void
|
|
|
|
_edje_process_colorclass(Edje *ed)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int k;
|
|
|
|
|
|
|
|
ep = ed->collection->parts[i];
|
|
|
|
|
|
|
|
/* Register any color classes in this parts descriptions. */
|
|
|
|
if ((ep->default_desc) && (ep->default_desc->color_class))
|
|
|
|
efl_observable_observer_add(_edje_color_class_member, ep->default_desc->color_class, ed->obj);
|
|
|
|
|
|
|
|
for (k = 0; k < ep->other.desc_count; k++)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *desc;
|
|
|
|
|
|
|
|
desc = ep->other.desc[k];
|
|
|
|
|
|
|
|
if (desc->color_class)
|
|
|
|
efl_observable_observer_add(_edje_color_class_member, desc->color_class, ed->obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_edje_process_sizeclass(Edje *ed)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int k;
|
|
|
|
|
|
|
|
ep = ed->collection->parts[i];
|
|
|
|
|
|
|
|
/* Register any size classes in this parts descriptions. */
|
|
|
|
if ((ep->default_desc) && (ep->default_desc->size_class))
|
|
|
|
efl_observable_observer_add(_edje_size_class_member, ep->default_desc->size_class, ed->obj);
|
|
|
|
|
|
|
|
for (k = 0; k < ep->other.desc_count; k++)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *desc;
|
|
|
|
|
|
|
|
desc = ep->other.desc[k];
|
|
|
|
|
|
|
|
if (desc->size_class)
|
|
|
|
efl_observable_observer_add(_edje_size_class_member, desc->size_class, ed->obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-15 17:26:16 -07:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2019-08-28 00:23:55 -07:00
|
|
|
static inline void
|
|
|
|
_edje_process_physics(Edje *ed)
|
|
|
|
{
|
|
|
|
if (EPH_LOAD())
|
|
|
|
{
|
|
|
|
EPH_CALL(ephysics_init)();
|
|
|
|
ed->world = EPH_CALL(ephysics_world_new)();
|
|
|
|
EPH_CALL(ephysics_world_event_callback_add)
|
|
|
|
(ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE,
|
|
|
|
_edje_physics_world_update_cb, ed);
|
|
|
|
EPH_CALL(ephysics_world_rate_set)
|
|
|
|
(ed->world, ed->collection->physics.world.rate);
|
|
|
|
EPH_CALL(ephysics_world_gravity_set)
|
|
|
|
(ed->world, ed->collection->physics.world.gravity.x,
|
|
|
|
ed->collection->physics.world.gravity.y,
|
|
|
|
ed->collection->physics.world.gravity.z);
|
|
|
|
}
|
|
|
|
}
|
2019-09-15 17:26:16 -07:00
|
|
|
#endif
|
2019-08-28 00:23:55 -07:00
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
Eina_Error
|
2013-11-03 18:28:29 -08:00
|
|
|
_edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2011-09-22 00:19:50 -07:00
|
|
|
Evas *tev;
|
2011-12-16 02:17:55 -08:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Eina_List *textblocks = NULL;
|
|
|
|
Eina_List *sources = NULL;
|
|
|
|
Eina_List *externals = NULL;
|
2019-07-10 11:24:48 -07:00
|
|
|
Eina_Hash *collect = NULL;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int n;
|
2012-09-11 00:30:22 -07:00
|
|
|
Eina_Array parts;
|
2007-05-26 22:28:07 -07:00
|
|
|
int group_path_started = 0;
|
2012-09-04 04:27:43 -07:00
|
|
|
Evas_Object *nested_smart = NULL;
|
2015-05-13 09:08:04 -07:00
|
|
|
char lang[PATH_MAX];
|
2019-07-10 11:24:53 -07:00
|
|
|
Eina_Bool had_file;
|
2019-05-29 06:15:06 -07:00
|
|
|
Eina_Hash *part_match = NULL;
|
2012-09-04 04:27:43 -07:00
|
|
|
|
|
|
|
/* Get data pointer of top-of-stack */
|
|
|
|
int idx = eina_array_count(nested) - 1;
|
|
|
|
Edje_Nested_Support *st_nested = (idx >= 0) ? eina_array_data_get(nested, idx) : NULL;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
ed = _edje_fetch(obj);
|
2019-02-27 10:17:09 -08:00
|
|
|
if (!ed) return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
|
2008-08-14 11:04:43 -07:00
|
|
|
if (!group) group = "";
|
2013-08-09 04:49:52 -07:00
|
|
|
if ((ed->file) && (ed->file->f == file) &&
|
|
|
|
(ed->group) && (!strcmp(group, ed->group)))
|
2012-05-09 00:30:59 -07:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
return 0;
|
2012-05-09 00:30:59 -07:00
|
|
|
}
|
2019-07-10 11:24:53 -07:00
|
|
|
had_file = !!ed->file;
|
2007-03-16 14:37:57 -07:00
|
|
|
|
2011-09-22 00:19:50 -07:00
|
|
|
tev = evas_object_evas_get(obj);
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_freeze(tev);
|
2012-05-18 07:37:21 -07:00
|
|
|
|
|
|
|
collect = _edje_object_collect(ed);
|
2019-05-29 06:15:06 -07:00
|
|
|
if (collect)
|
|
|
|
part_match = eina_hash_string_superfast_new(NULL);
|
2007-03-16 14:37:57 -07:00
|
|
|
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
|
2012-05-09 00:30:59 -07:00
|
|
|
|
2012-11-28 14:38:47 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
/* clear physics world / shutdown ephysics */
|
2016-08-01 03:04:42 -07:00
|
|
|
if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world))
|
2012-11-28 14:38:47 -08:00
|
|
|
{
|
2016-08-01 03:04:42 -07:00
|
|
|
if (EPH_LOAD())
|
|
|
|
{
|
|
|
|
EPH_CALL(ephysics_world_del)(ed->world);
|
|
|
|
EPH_CALL(ephysics_shutdown)();
|
|
|
|
}
|
2012-11-28 14:38:47 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
_edje_file_del(ed);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-08-09 04:49:52 -07:00
|
|
|
eina_stringshare_replace(&ed->path, file ? eina_file_filename_get(file) : NULL);
|
2011-09-22 00:19:50 -07:00
|
|
|
eina_stringshare_replace(&ed->group, group);
|
|
|
|
|
2011-06-06 10:29:07 -07:00
|
|
|
ed->parent = eina_stringshare_add(parent);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2003-10-19 23:10:09 -07:00
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
2013-08-09 04:49:52 -07:00
|
|
|
_edje_file_add(ed, file);
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->block_break = EINA_FALSE;
|
2009-11-24 09:55:11 -08:00
|
|
|
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2010-02-17 15:43:31 -08:00
|
|
|
ed->has_entries = EINA_FALSE;
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
if (ed->collection)
|
|
|
|
{
|
2016-07-03 22:59:59 -07:00
|
|
|
if (ed->collection->parts_count > 0xffff)
|
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
_edje_file_del(ed);
|
2019-02-27 10:17:09 -08:00
|
|
|
return EFL_GFX_IMAGE_LOAD_ERROR_CORRUPT_FILE;
|
2016-07-03 22:59:59 -07:00
|
|
|
}
|
2012-09-11 00:30:22 -07:00
|
|
|
eina_array_step_set(&parts, sizeof (Eina_Array), 8);
|
|
|
|
|
|
|
|
if (ed->collection->prop.orientation != EDJE_ORIENTATION_AUTO)
|
2011-02-01 05:26:49 -08:00
|
|
|
ed->is_rtl = (ed->collection->prop.orientation ==
|
2011-09-22 00:19:50 -07:00
|
|
|
EDJE_ORIENTATION_RTL);
|
2011-02-01 05:26:49 -08:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
ed->groups = eina_list_append(ed->groups, ed);
|
|
|
|
|
2014-11-24 22:09:00 -08:00
|
|
|
if (ed->collection->lua_script_only)
|
2013-07-17 22:47:14 -07:00
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
|
|
|
_edje_lua_script_only_init(ed);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned int i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2012-11-28 14:38:47 -08:00
|
|
|
if (ed->collection->physics_enabled)
|
2019-09-15 17:26:16 -07:00
|
|
|
{
|
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
_edje_process_physics(ed);
|
|
|
|
#else
|
|
|
|
ERR("Edje compiled without support to physics.");
|
|
|
|
#endif
|
|
|
|
}
|
2012-11-28 14:38:47 -08:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
/* handle multiseat stuff */
|
2019-10-31 06:17:46 -07:00
|
|
|
if (ed->collection->need_seat || ed->need_seat)
|
|
|
|
_edje_devices_add(ed, tev);
|
2016-11-30 13:52:14 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* colorclass stuff */
|
2019-08-28 00:23:55 -07:00
|
|
|
_edje_process_colorclass(ed);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2015-12-07 19:15:48 -08:00
|
|
|
/* sizeclass stuff */
|
2019-08-28 00:23:55 -07:00
|
|
|
_edje_process_sizeclass(ed);
|
2015-12-07 19:15:48 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* build real parts */
|
|
|
|
for (n = 0; n < ed->collection->parts_count; n++)
|
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
|
|
|
Eina_Bool memerr = EINA_FALSE;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
ep = ed->collection->parts[n];
|
2019-05-29 06:15:06 -07:00
|
|
|
if (part_match)
|
|
|
|
eina_hash_add(part_match, ep->name, (void*)1);
|
2012-09-04 04:27:43 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->nested_children_count) /* Add object to nested parts list */
|
|
|
|
{
|
2012-09-04 04:27:43 -07:00
|
|
|
st_nested = malloc(sizeof(*st_nested));
|
|
|
|
nested_smart = st_nested->o = edje_smart_nested_add(tev);
|
|
|
|
|
|
|
|
/* We add 1 to children_count because the parent
|
|
|
|
object is added to smart obj children as well */
|
|
|
|
st_nested->nested_children_count =
|
2015-06-08 11:43:00 -07:00
|
|
|
ep->nested_children_count + 1;
|
2012-09-04 04:27:43 -07:00
|
|
|
|
|
|
|
evas_object_show(st_nested->o);
|
|
|
|
|
|
|
|
eina_array_push(nested, st_nested);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2012-09-04 04:27:43 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
|
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
/* FIXME: destroy all allocated ressource, need to have a common exit point */
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
goto on_error;
|
|
|
|
}
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
memset(rp, 0, sizeof (Edje_Real_Part));
|
2009-08-14 10:19:42 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if ((ep->dragable.x != 0) || (ep->dragable.y != 0))
|
|
|
|
{
|
|
|
|
rp->drag = calloc(1, sizeof (Edje_Real_Part_Drag));
|
|
|
|
if (!rp->drag)
|
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
goto on_error;
|
|
|
|
}
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
rp->drag->step.x = FROM_INT(ep->dragable.step_x);
|
|
|
|
rp->drag->step.y = FROM_INT(ep->dragable.step_y);
|
|
|
|
}
|
|
|
|
// allow part type specific data - this keeps real_part smaller
|
|
|
|
switch (ep->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
|
|
|
rp->type = EDJE_RP_TYPE_TEXT;
|
|
|
|
rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text));
|
|
|
|
if (!rp->typedata.text) memerr = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
|
|
|
rp->type = EDJE_RP_TYPE_SWALLOW;
|
|
|
|
rp->typedata.swallow = calloc(1, sizeof(Edje_Real_Part_Swallow));
|
|
|
|
if (!rp->typedata.swallow) memerr = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
rp->type = EDJE_RP_TYPE_CONTAINER;
|
|
|
|
rp->typedata.container = calloc(1, sizeof(Edje_Real_Part_Container));
|
|
|
|
if (!rp->typedata.container) memerr = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
|
edje: add json file support feature
Summary:
It also starts to support following new edc properties.
This is backported patch from Tizen 5.0
1. frame
desc { "default"
vector {
frame: 0.5; // 0.0 ~ 1.0
}
}
2. actions
program { "vector_animation";
// VG_ANIM_PLAY, VG_ANIM_PLAY_BACK, VG_ANIM_LOOP,
// VG_ANIM_STOP, VG_ANIM_PAUSE, VG_ANIM_RESUME
action: VG_ANIM_PLAY;
target: "your_vector_part";
}
@feature
Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
- Fix to remove Efl.Canvas.Animation_Player on edje
Test Plan:
{F3840540}
{F3840542}
{F3840543}
make and test attached file
edje_cc -beta -id ./ json_edc.edc json.edj
gcc -o test test_edc.c -g `pkg-config --cflags --libs evas elementary rlottie`
./test
Reviewers: Hermet, Jaehyun_Cho, id213sin
Reviewed By: Hermet
Subscribers: segfaultxavi, raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11228
2020-02-17 01:59:09 -08:00
|
|
|
case EDJE_PART_TYPE_VECTOR:
|
|
|
|
rp->type = EDJE_RP_TYPE_VECTOR;
|
|
|
|
rp->typedata.vector = calloc(1, sizeof(Edje_Real_Part_Vector));
|
2020-02-25 23:52:38 -08:00
|
|
|
if (!rp->typedata.vector)
|
|
|
|
memerr = EINA_TRUE;
|
|
|
|
else
|
|
|
|
rp->typedata.vector->current_id = -1;
|
edje: add json file support feature
Summary:
It also starts to support following new edc properties.
This is backported patch from Tizen 5.0
1. frame
desc { "default"
vector {
frame: 0.5; // 0.0 ~ 1.0
}
}
2. actions
program { "vector_animation";
// VG_ANIM_PLAY, VG_ANIM_PLAY_BACK, VG_ANIM_LOOP,
// VG_ANIM_STOP, VG_ANIM_PAUSE, VG_ANIM_RESUME
action: VG_ANIM_PLAY;
target: "your_vector_part";
}
@feature
Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
- Fix to remove Efl.Canvas.Animation_Player on edje
Test Plan:
{F3840540}
{F3840542}
{F3840543}
make and test attached file
edje_cc -beta -id ./ json_edc.edc json.edj
gcc -o test test_edc.c -g `pkg-config --cflags --libs evas elementary rlottie`
./test
Reviewers: Hermet, Jaehyun_Cho, id213sin
Reviewed By: Hermet
Subscribers: segfaultxavi, raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11228
2020-02-17 01:59:09 -08:00
|
|
|
break;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (memerr)
|
|
|
|
{
|
|
|
|
if (rp->drag) free(rp->drag);
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2019-02-27 10:17:09 -08:00
|
|
|
return EFL_GFX_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_ref(ed);
|
|
|
|
rp->part = ep;
|
|
|
|
eina_array_push(&parts, rp);
|
|
|
|
rp->param1.description =
|
|
|
|
_edje_part_description_find(ed, rp, "default", 0.0, EINA_TRUE);
|
|
|
|
rp->chosen_description = rp->param1.description;
|
|
|
|
if (!rp->param1.description)
|
|
|
|
ERR("no default part description for '%s'!",
|
|
|
|
rp->part->name);
|
|
|
|
|
|
|
|
switch (ep->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_rectangle_add(ed->base.evas);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2016-06-08 11:26:07 -07:00
|
|
|
case EDJE_PART_TYPE_VECTOR:
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_vg_add(ed->base.evas);
|
2016-06-08 11:26:07 -07:00
|
|
|
break;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
case EDJE_PART_TYPE_PROXY:
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_image_add(ed->base.evas);
|
2015-10-01 04:27:36 -07:00
|
|
|
break;
|
|
|
|
|
2015-08-05 06:58:01 -07:00
|
|
|
case EDJE_PART_TYPE_SNAPSHOT:
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_image_filled_add(ed->base.evas);
|
2015-10-01 04:27:36 -07:00
|
|
|
evas_object_image_snapshot_set(rp->object, EINA_TRUE);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
2017-11-10 19:10:32 -08:00
|
|
|
_edje_text_part_on_add(ed, rp);
|
|
|
|
rp->object = evas_object_text_add(ed->base.evas);
|
|
|
|
evas_object_text_font_source_set(rp->object, ed->path);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
sources = eina_list_append(sources, rp);
|
|
|
|
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
// fallthrough intentional
|
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
|
|
|
if (ep->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
externals = eina_list_append(externals, rp);
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_rectangle_add(ed->base.evas);
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
|
|
_edje_callbacks_focus_add(rp->object, ed, rp);
|
|
|
|
break;
|
|
|
|
|
2017-11-10 19:10:32 -08:00
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
|
|
|
_edje_textblock_styles_add(ed, rp);
|
|
|
|
textblocks = eina_list_append(textblocks, rp);
|
|
|
|
rp->object = evas_object_textblock_add(ed->base.evas);
|
|
|
|
break;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
sources = eina_list_append(sources, rp);
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_box_add(ed->base.evas);
|
2015-06-08 11:43:00 -07:00
|
|
|
rp->typedata.container->anim = _edje_box_layout_anim_new(rp->object);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
sources = eina_list_append(sources, rp);
|
2017-09-05 23:14:07 -07:00
|
|
|
rp->object = evas_object_table_add(ed->base.evas);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_GRADIENT:
|
2017-12-22 03:18:46 -08:00
|
|
|
ERR("YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !",
|
2015-06-08 11:43:00 -07:00
|
|
|
ep->name, group, eina_file_filename_get(file));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_SPACER:
|
|
|
|
rp->object = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR("wrong part type %i!", ep->type);
|
|
|
|
break;
|
|
|
|
}
|
2012-09-04 04:27:43 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (rp->object)
|
|
|
|
{
|
|
|
|
if (nested_smart) /* Update this pointer to father object only
|
|
|
|
this will make smart object size == father sz */
|
|
|
|
{
|
|
|
|
rp->nested_smart = nested_smart;
|
|
|
|
nested_smart = NULL;
|
|
|
|
}
|
2012-09-04 04:27:43 -07:00
|
|
|
|
2016-12-07 15:10:34 -08:00
|
|
|
if (ep->allowed_seats)
|
|
|
|
_edje_part_seat_filter_apply(ed, rp);
|
|
|
|
|
2015-05-12 01:37:01 -07:00
|
|
|
if (ep->no_render)
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_no_render_set(rp->object, 1);
|
2015-05-12 01:37:01 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (st_nested && st_nested->nested_children_count) /* Add this to list of children */
|
|
|
|
{
|
|
|
|
evas_object_smart_member_add(rp->object,
|
|
|
|
st_nested->o);
|
2012-09-04 04:27:43 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
st_nested->nested_children_count--;
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* No more nested children for this obj */
|
|
|
|
while (st_nested && (st_nested->nested_children_count == 0))
|
2012-09-04 04:27:43 -07:00
|
|
|
{
|
|
|
|
/* Loop to add smart counter as child */
|
|
|
|
Evas_Object *p_obj = st_nested->o;
|
|
|
|
|
|
|
|
st_nested = eina_array_pop(nested);
|
|
|
|
free(st_nested);
|
|
|
|
|
|
|
|
/* Check for parent in stack */
|
|
|
|
idx = eina_array_count(nested) - 1;
|
2015-06-08 11:43:00 -07:00
|
|
|
st_nested = (idx >= 0) ? eina_array_data_get(nested, idx) : NULL;
|
2012-09-04 04:27:43 -07:00
|
|
|
|
|
|
|
if (st_nested)
|
|
|
|
{
|
|
|
|
st_nested->nested_children_count--;
|
|
|
|
evas_object_smart_member_add(p_obj, st_nested->o);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_smart_member_add(p_obj, ed->obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_smart_member_add(rp->object, ed->obj);
|
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
// evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
2017-02-07 15:08:19 -08:00
|
|
|
rp->mouse_events = ep->mouse_events;
|
|
|
|
rp->repeat_events = ep->repeat_events;
|
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP && ep->type != EDJE_PART_TYPE_EXTERNAL)
|
2012-09-11 06:14:51 -07:00
|
|
|
{
|
2017-02-07 15:08:19 -08:00
|
|
|
if (rp->mouse_events)
|
2013-07-17 22:47:14 -07:00
|
|
|
{
|
|
|
|
_edje_callbacks_add(rp->object, ed, rp);
|
2017-02-07 15:08:19 -08:00
|
|
|
if (rp->repeat_events)
|
|
|
|
evas_object_repeat_events_set(rp->object, rp->repeat_events);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
|
|
|
|
evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
|
|
|
|
}
|
|
|
|
else
|
2012-09-11 06:14:51 -07:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_anti_alias_set(rp->object, ep->anti_alias);
|
|
|
|
efl_canvas_object_precise_is_inside_set(rp->object, ep->precise_is_inside);
|
2013-03-21 23:29:33 -07:00
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
if (rp->part->clip_to_id < 0)
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_object_clip_set(rp->object, ed->base.clipper);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
|
|
|
|
ed->table_parts_size = n;
|
|
|
|
/* FIXME: check malloc return */
|
|
|
|
n = eina_array_count(&parts) - 1;
|
|
|
|
while ((rp = eina_array_pop(&parts)))
|
|
|
|
{
|
|
|
|
ed->table_parts[n] = rp;
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
Edje_Real_Part *clip_to = NULL;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may
|
2013-07-17 22:47:14 -07:00
|
|
|
be able to remove this when all theme are correctly rewritten. */
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
if (rp->param1.description->rel1.id_x >= 0)
|
|
|
|
rp->param1.description->rel1.id_x %= ed->table_parts_size;
|
|
|
|
if (rp->param1.description->rel1.id_y >= 0)
|
|
|
|
rp->param1.description->rel1.id_y %= ed->table_parts_size;
|
|
|
|
if (rp->param1.description->rel2.id_x >= 0)
|
|
|
|
rp->param1.description->rel2.id_x %= ed->table_parts_size;
|
|
|
|
if (rp->param1.description->rel2.id_y >= 0)
|
|
|
|
rp->param1.description->rel2.id_y %= ed->table_parts_size;
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
if (rp->param1.description && (rp->param1.description->clip_to_id >= 0))
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
{
|
|
|
|
clip_to = ed->table_parts[rp->param1.description->clip_to_id % ed->table_parts_size];
|
|
|
|
ed->has_state_clip = EINA_TRUE;
|
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
else if (rp->part->clip_to_id >= 0)
|
|
|
|
clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
|
|
|
|
if (clip_to && clip_to->object && rp->object)
|
|
|
|
{
|
|
|
|
evas_object_pass_events_set(clip_to->object, 1);
|
|
|
|
evas_object_pointer_mode_set(clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
|
|
evas_object_clip_set(rp->object, clip_to->object);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (rp->drag)
|
|
|
|
{
|
|
|
|
if (rp->part->dragable.confine_id >= 0)
|
|
|
|
rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
|
|
|
|
if (rp->part->dragable.threshold_id >= 0)
|
|
|
|
rp->drag->threshold = ed->table_parts[rp->part->dragable.threshold_id % ed->table_parts_size];
|
|
|
|
}
|
2011-06-06 06:10:54 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(rp->typedata.swallow))
|
|
|
|
{
|
|
|
|
rp->typedata.swallow->swallow_params.min.w = 0;
|
|
|
|
rp->typedata.swallow->swallow_params.min.h = 0;
|
|
|
|
rp->typedata.swallow->swallow_params.max.w = -1;
|
|
|
|
rp->typedata.swallow->swallow_params.max.h = -1;
|
|
|
|
}
|
2011-02-24 06:41:08 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT
|
|
|
|
|| rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *text;
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
text = (Edje_Part_Description_Text *)rp->param1.description;
|
2016-07-11 08:19:01 -07:00
|
|
|
if (text)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2016-07-11 08:19:01 -07:00
|
|
|
if (ed->file->feature_ver < 1)
|
|
|
|
{
|
|
|
|
text->text.id_source = -1;
|
|
|
|
text->text.id_text_source = -1;
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2016-07-11 08:19:01 -07:00
|
|
|
if ((rp->type == EDJE_RP_TYPE_TEXT) &&
|
|
|
|
(rp->typedata.text))
|
|
|
|
{
|
|
|
|
if (text->text.id_source >= 0)
|
|
|
|
{
|
|
|
|
rp->typedata.text->source =
|
|
|
|
ed->table_parts[text->text.id_source % ed->table_parts_size];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (text->text.id_text_source >= 0)
|
|
|
|
{
|
|
|
|
rp->typedata.text->text_source =
|
|
|
|
ed->table_parts[text->text.id_text_source % ed->table_parts_size];
|
|
|
|
}
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2016-07-11 08:19:01 -07:00
|
|
|
|
2018-06-20 09:24:05 -07:00
|
|
|
if ((rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
|
|
|
|
rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
_edje_entry_real_part_init(ed, rp);
|
|
|
|
if (!ed->has_entries)
|
|
|
|
ed->has_entries = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-02-23 05:39:19 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_ref(ed);
|
|
|
|
_edje_block(ed);
|
|
|
|
_edje_util_freeze(ed);
|
|
|
|
_edje_var_init(ed);
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
rp = ed->table_parts[i];
|
2019-07-19 12:43:21 -07:00
|
|
|
/* SPACER parts do not have objects */
|
|
|
|
if (rp->object) evas_object_show(rp->object);
|
2015-06-08 11:43:00 -07:00
|
|
|
if (_edje_block_break(ed)) break;
|
|
|
|
if (rp->drag)
|
|
|
|
{
|
|
|
|
if (rp->part->dragable.x < 0) rp->drag->val.x = FROM_DOUBLE(1.0);
|
|
|
|
if (rp->part->dragable.y < 0) rp->drag->val.x = FROM_DOUBLE(1.0);
|
|
|
|
_edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ed->recalc_call = EINA_TRUE;
|
|
|
|
ed->dirty = EINA_TRUE;
|
2013-07-17 22:47:14 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2015-06-08 11:43:00 -07:00
|
|
|
ed->all_part_change = EINA_TRUE;
|
2013-07-17 22:47:14 -07:00
|
|
|
#endif
|
2017-09-05 23:14:07 -07:00
|
|
|
if ((evas_object_clipees_has(ed->base.clipper)) &&
|
2015-06-08 11:43:00 -07:00
|
|
|
(evas_object_visible_get(obj)))
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_object_show(ed->base.clipper);
|
2013-03-21 23:29:33 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* instantiate 'internal swallows' */
|
|
|
|
EINA_LIST_FREE(externals, rp)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_External *external;
|
|
|
|
Evas_Object *child_obj;
|
|
|
|
|
|
|
|
external = (Edje_Part_Description_External *)rp->part->default_desc;
|
|
|
|
child_obj = _edje_external_type_add(rp->part->source,
|
|
|
|
evas_object_evas_get(ed->obj), ed->obj,
|
|
|
|
external->external_params, rp->part->name);
|
|
|
|
if (child_obj)
|
|
|
|
{
|
|
|
|
_edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE);
|
|
|
|
rp->param1.external_params = _edje_external_params_parse(child_obj,
|
|
|
|
external->external_params);
|
|
|
|
_edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
|
|
|
|
}
|
|
|
|
}
|
2011-09-22 00:19:50 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
EINA_LIST_FREE(sources, rp)
|
|
|
|
{
|
|
|
|
/* XXX: curr_item and pack_it don't require to be NULL since
|
|
|
|
* XXX: they are just used when source != NULL and type == BOX,
|
|
|
|
* XXX: and they're always set in this case, but GCC fails to
|
|
|
|
* XXX: notice that, so let's shut it up
|
|
|
|
*/
|
|
|
|
Edje_Pack_Element **curr_item = NULL;
|
|
|
|
unsigned int item_count = 0;
|
|
|
|
Edje_Pack_Element *pack_it = NULL;
|
|
|
|
const char *source = NULL;
|
|
|
|
|
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
source = rp->part->source;
|
|
|
|
break;
|
2013-03-21 23:29:33 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
if (rp->part->items)
|
|
|
|
{
|
|
|
|
curr_item = rp->part->items;
|
|
|
|
item_count = rp->part->items_count;
|
|
|
|
if (item_count > 0)
|
|
|
|
{
|
|
|
|
pack_it = *curr_item;
|
|
|
|
source = pack_it->source;
|
|
|
|
item_count--;
|
|
|
|
curr_item++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-03-21 23:29:33 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
default:
|
|
|
|
/* This list should only be filled by group, box or table, nothing else. */
|
|
|
|
abort();
|
|
|
|
}
|
2013-03-21 23:29:33 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
while (source)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *child_obj;
|
|
|
|
Edje_Pack_Element pack_it_copy;
|
|
|
|
const char *group_path_entry = eina_stringshare_add(source);
|
|
|
|
const char *data;
|
2009-08-11 03:06:37 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!group_path)
|
|
|
|
{
|
|
|
|
group_path = eina_list_append(NULL, eina_stringshare_add(group));
|
|
|
|
group_path_started = 1;
|
|
|
|
}
|
|
|
|
/* make sure that this group isn't already in the tree of parents */
|
|
|
|
EINA_LIST_FOREACH(group_path, l, data)
|
|
|
|
{
|
|
|
|
if (data == group_path_entry)
|
|
|
|
{
|
|
|
|
ERR("recursive loop group '%s' already included inside part '%s' of group '%s' from file '%s'",
|
|
|
|
group_path_entry, rp->part->name, group, eina_file_filename_get(file));
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE;
|
|
|
|
eina_stringshare_del(group_path_entry);
|
|
|
|
goto on_error;
|
|
|
|
}
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (pack_it)
|
|
|
|
{
|
|
|
|
pack_it_copy = *pack_it;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memset(&pack_it_copy, 0, sizeof (pack_it_copy));
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
do
|
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
Eina_Error load_error;
|
2017-09-05 23:14:07 -07:00
|
|
|
child_obj = edje_object_add(ed->base.evas);
|
2017-02-07 13:41:20 -08:00
|
|
|
edje_object_mirrored_set(child_obj, edje_object_mirrored_get(ed->obj));
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
group_path = eina_list_append(group_path, group_path_entry);
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP)
|
|
|
|
{
|
|
|
|
_edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE);
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
load_error = _edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested);
|
|
|
|
if (load_error)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'",
|
|
|
|
rp->part->name, group_path_entry, eina_file_filename_get(file), source);
|
|
|
|
ed->load_error = edje_object_load_error_get(child_obj);
|
|
|
|
evas_object_del(child_obj);
|
|
|
|
eina_stringshare_del(group_path_entry);
|
|
|
|
goto on_error;
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
group_path = eina_list_remove(group_path, group_path_entry);
|
2011-09-22 00:19:50 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
edje_object_propagate_callback_add(child_obj,
|
|
|
|
_cb_signal_repeat,
|
|
|
|
obj);
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP)
|
|
|
|
{
|
|
|
|
Edje *edg = _edje_fetch(child_obj);
|
|
|
|
ed->groups = eina_list_append(ed->groups, edg);
|
|
|
|
evas_object_data_set(child_obj, "\377 edje.part_obj", rp);
|
|
|
|
_edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE);
|
|
|
|
_edje_subobj_register(ed, child_obj);
|
|
|
|
source = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((rp->type == EDJE_RP_TYPE_CONTAINER) &&
|
|
|
|
(rp->typedata.container))
|
|
|
|
{
|
|
|
|
Eina_Strbuf *buf = NULL;
|
|
|
|
const char *name = pack_it_copy.name;
|
|
|
|
|
|
|
|
pack_it->parent = rp;
|
|
|
|
|
|
|
|
_edje_object_pack_item_hints_set(child_obj, &pack_it_copy);
|
|
|
|
|
|
|
|
if (pack_it->spread.h > 1 && pack_it->spread.w >= 1)
|
|
|
|
{
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
if (name)
|
|
|
|
eina_strbuf_append_printf(buf, "%s{%i,%i}", name, pack_it_copy.col, pack_it_copy.row);
|
|
|
|
else
|
|
|
|
eina_strbuf_append_printf(buf, "%i,%i", pack_it_copy.col, pack_it_copy.row);
|
|
|
|
name = eina_strbuf_string_get(buf);
|
|
|
|
}
|
|
|
|
if (name) evas_object_name_set(child_obj, name);
|
|
|
|
if (buf) eina_strbuf_free(buf);
|
|
|
|
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_BOX)
|
|
|
|
{
|
|
|
|
_edje_real_part_box_append(ed, rp, child_obj);
|
|
|
|
evas_object_data_set(child_obj, "\377 edje.box_item", pack_it);
|
|
|
|
}
|
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_TABLE)
|
|
|
|
{
|
|
|
|
_edje_real_part_table_pack(ed, rp, child_obj,
|
|
|
|
pack_it_copy.col, pack_it_copy.row,
|
|
|
|
pack_it_copy.colspan, pack_it_copy.rowspan);
|
|
|
|
evas_object_data_set(child_obj, "\377 edje.table_item", pack_it);
|
|
|
|
}
|
|
|
|
_edje_subobj_register(ed, child_obj);
|
|
|
|
evas_object_show(child_obj);
|
|
|
|
rp->typedata.container->items = eina_list_append(rp->typedata.container->items, child_obj);
|
|
|
|
}
|
|
|
|
}
|
2012-05-09 22:37:38 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
pack_it_copy.spread.w--;
|
|
|
|
pack_it_copy.col++;
|
|
|
|
if (pack_it_copy.spread.w < 1 && pack_it)
|
|
|
|
{
|
|
|
|
pack_it_copy.col = pack_it->col;
|
|
|
|
pack_it_copy.row++;
|
|
|
|
pack_it_copy.spread.h--;
|
|
|
|
pack_it_copy.spread.w = pack_it->spread.w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (pack_it_copy.spread.h > 0);
|
2012-06-13 18:20:26 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
eina_stringshare_del(group_path_entry);
|
2012-05-09 22:37:38 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if ((rp->type == EDJE_RP_TYPE_CONTAINER) &&
|
|
|
|
(rp->typedata.container))
|
|
|
|
{
|
|
|
|
if (item_count > 0)
|
|
|
|
{
|
|
|
|
pack_it = *curr_item;
|
|
|
|
source = pack_it->source;
|
|
|
|
curr_item++;
|
|
|
|
item_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
source = NULL;
|
|
|
|
curr_item = NULL;
|
|
|
|
pack_it = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-14 04:18:45 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (group_path_started)
|
|
|
|
{
|
|
|
|
const char *str;
|
2011-12-16 02:17:55 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
EINA_LIST_FREE(group_path, str)
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
2011-12-16 02:17:55 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* reswallow any swallows that existed before setting the file */
|
|
|
|
if (collect)
|
|
|
|
{
|
|
|
|
Edje_User_Defined *eud;
|
|
|
|
Eina_List *boxes = NULL;
|
2019-07-10 11:24:48 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_List *l, *ll;
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
it = eina_hash_iterator_data_new(collect);
|
|
|
|
EINA_ITERATOR_FOREACH(it, l)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
EINA_LIST_FOREACH(l, ll, eud)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
Evas_Object *child = NULL;
|
|
|
|
|
|
|
|
if (!eina_hash_find(part_match, eud->part))
|
2018-11-06 06:52:53 -08:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
/* part no longer exists */
|
|
|
|
switch (eud->type)
|
|
|
|
{
|
|
|
|
case EDJE_USER_SWALLOW:
|
|
|
|
child = eud->u.swallow.child;
|
|
|
|
break;
|
|
|
|
case EDJE_USER_BOX_PACK:
|
|
|
|
child = eud->u.box.child;
|
|
|
|
break;
|
|
|
|
case EDJE_USER_TABLE_PACK:
|
|
|
|
child = eud->u.table.child;
|
|
|
|
break;
|
|
|
|
case EDJE_USER_STRING:
|
2019-07-10 11:24:55 -07:00
|
|
|
eina_stringshare_del(eud->u.string.text);
|
|
|
|
/* string has extra ref in this case */
|
|
|
|
if (!had_file)
|
|
|
|
eina_stringshare_del(eud->u.string.text);
|
|
|
|
break;
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_DRAG_STEP:
|
|
|
|
case EDJE_USER_DRAG_PAGE:
|
|
|
|
case EDJE_USER_DRAG_VALUE:
|
|
|
|
case EDJE_USER_DRAG_SIZE:
|
2019-07-10 11:24:55 -07:00
|
|
|
break;
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_TEXT_STYLE:
|
2019-07-10 11:24:55 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Text_Prop *prop;
|
|
|
|
EINA_LIST_FREE(eud->u.text_style.props, prop)
|
|
|
|
free(prop);
|
|
|
|
}
|
|
|
|
break;
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_TEXT_EXPAND:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (child)
|
|
|
|
{
|
|
|
|
WRN("Container part '%s' no longer exists, hiding previously-contained child object", eud->part);
|
|
|
|
evas_object_hide(child);
|
|
|
|
}
|
2018-11-06 06:52:53 -08:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
else
|
2018-11-06 06:52:53 -08:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
switch (eud->type)
|
2019-05-29 06:15:06 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_SWALLOW:
|
|
|
|
edje_object_part_swallow(obj, eud->part, eud->u.swallow.child);
|
|
|
|
child = eud->u.swallow.child;
|
2019-05-29 06:15:06 -07:00
|
|
|
break;
|
2019-07-10 11:24:48 -07:00
|
|
|
|
|
|
|
case EDJE_USER_BOX_PACK:
|
|
|
|
boxes = eina_list_append(boxes, eud);
|
|
|
|
eud = NULL;
|
2019-05-29 06:15:06 -07:00
|
|
|
break;
|
2019-07-10 11:24:48 -07:00
|
|
|
|
|
|
|
case EDJE_USER_TABLE_PACK:
|
|
|
|
edje_object_part_table_pack(obj, eud->part, eud->u.table.child,
|
|
|
|
eud->u.table.col, eud->u.table.row,
|
|
|
|
eud->u.table.colspan, eud->u.table.rowspan);
|
|
|
|
child = eud->u.table.child;
|
2019-05-29 06:15:06 -07:00
|
|
|
break;
|
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_DRAG_STEP:
|
|
|
|
edje_object_part_drag_step_set(obj, eud->part,
|
|
|
|
eud->u.drag_position.x,
|
|
|
|
eud->u.drag_position.y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_USER_DRAG_PAGE:
|
|
|
|
edje_object_part_drag_page_set(obj, eud->part,
|
|
|
|
eud->u.drag_position.x,
|
|
|
|
eud->u.drag_position.y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_USER_DRAG_VALUE:
|
|
|
|
edje_object_part_drag_value_set(obj, eud->part,
|
|
|
|
eud->u.drag_position.x,
|
|
|
|
eud->u.drag_position.y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_USER_DRAG_SIZE:
|
|
|
|
edje_object_part_drag_size_set(obj, eud->part,
|
|
|
|
eud->u.drag_size.w,
|
|
|
|
eud->u.drag_size.h);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_USER_STRING:
|
|
|
|
switch (eud->u.string.type)
|
2019-05-29 06:15:06 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_TEXT_TYPE_NORMAL:
|
2019-07-10 11:24:51 -07:00
|
|
|
efl_text_set(efl_part(obj, eud->part), eud->u.string.text);
|
|
|
|
break;
|
|
|
|
case EDJE_TEXT_TYPE_MARKUP:
|
|
|
|
efl_text_markup_set(efl_part(obj, eud->part), eud->u.string.text);
|
2019-07-10 11:24:48 -07:00
|
|
|
break;
|
|
|
|
case EDJE_TEXT_TYPE_ESCAPED:
|
|
|
|
edje_object_part_text_escaped_set(obj, eud->part, eud->u.string.text);
|
|
|
|
break;
|
|
|
|
case EDJE_TEXT_TYPE_UNESCAPED:
|
|
|
|
edje_object_part_text_unescaped_set(obj, eud->part, eud->u.string.text);
|
|
|
|
break;
|
2019-05-29 06:15:06 -07:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
eina_stringshare_del(eud->u.string.text);
|
2019-07-10 11:24:53 -07:00
|
|
|
/* string has extra ref in this case */
|
|
|
|
if (!had_file)
|
|
|
|
eina_stringshare_del(eud->u.string.text);
|
2019-07-10 11:24:48 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_USER_TEXT_STYLE:
|
|
|
|
{
|
|
|
|
Edje_Part_Text_Prop *prop;
|
|
|
|
EINA_LIST_FREE(eud->u.text_style.props, prop)
|
|
|
|
{
|
|
|
|
_canvas_layout_user_text_apply(eud, obj,
|
|
|
|
prop);
|
|
|
|
free(prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDJE_USER_TEXT_EXPAND:
|
|
|
|
{
|
|
|
|
efl_canvas_layout_part_text_expand_set(
|
|
|
|
efl_part(obj, eud->part),
|
|
|
|
eud->u.text_expand.expand);
|
|
|
|
}
|
|
|
|
break;
|
2019-05-29 06:15:06 -07:00
|
|
|
}
|
2018-11-06 06:52:53 -08:00
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
eina_iterator_free(it);
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
boxes = eina_list_sort(boxes, -1, _sort_defined_boxes);
|
|
|
|
EINA_LIST_FREE(boxes, eud)
|
2019-07-10 11:24:48 -07:00
|
|
|
edje_object_part_box_append(obj, eud->part, eud->u.box.child);
|
2019-05-29 06:15:06 -07:00
|
|
|
eina_hash_free(part_match);
|
2019-07-10 11:24:48 -07:00
|
|
|
eina_hash_free(collect);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2016-07-10 21:46:21 -07:00
|
|
|
if (_edje_language)
|
|
|
|
snprintf(lang, sizeof(lang), "edje,language,%s", _edje_language);
|
|
|
|
else
|
|
|
|
snprintf(lang, sizeof(lang), "edje,language,%s", "none");
|
2015-06-08 11:43:00 -07:00
|
|
|
edje_object_signal_emit(obj, lang, "edje");
|
|
|
|
|
|
|
|
if (edje_object_mirrored_get(obj))
|
|
|
|
edje_object_signal_emit(obj, "edje,state,rtl", "edje");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(obj, "edje,state,ltr", "edje");
|
|
|
|
|
|
|
|
_edje_recalc(ed);
|
|
|
|
_edje_util_thaw(ed);
|
|
|
|
_edje_unblock(ed);
|
|
|
|
_edje_unref(ed);
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
|
|
|
_edje_emit(ed, "load", NULL);
|
|
|
|
|
|
|
|
/* instantiate 'internal textblock style' */
|
|
|
|
EINA_LIST_FREE(textblocks, rp)
|
|
|
|
if (rp->part->default_desc)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *text;
|
2019-08-28 19:35:24 -07:00
|
|
|
Evas_Textblock_Style *style = NULL;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
text = (Edje_Part_Description_Text *)rp->part->default_desc;
|
2019-08-28 19:35:24 -07:00
|
|
|
style = _edje_textblock_style_get(ed, edje_string_get(&text->text.style));
|
|
|
|
|
|
|
|
if (evas_object_textblock_style_get(rp->object) != style)
|
|
|
|
evas_object_textblock_style_set(rp->object, style);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
2010-02-17 15:43:31 -08:00
|
|
|
_edje_entry_init(ed);
|
2012-09-11 00:30:22 -07:00
|
|
|
eina_array_flush(&parts);
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2019-02-27 10:17:09 -08:00
|
|
|
return 0;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2019-02-27 10:17:09 -08:00
|
|
|
return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
|
2012-09-11 00:30:22 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
on_error:
|
2012-12-11 09:38:20 -08:00
|
|
|
eina_list_free(textblocks);
|
|
|
|
eina_list_free(externals);
|
|
|
|
eina_list_free(sources);
|
2012-09-11 00:30:22 -07:00
|
|
|
eina_array_flush(&parts);
|
2014-03-18 07:00:14 -07:00
|
|
|
_edje_util_thaw(ed);
|
2012-09-11 00:30:22 -07:00
|
|
|
_edje_unblock(ed);
|
|
|
|
_edje_unref(ed);
|
|
|
|
_edje_file_del(ed);
|
|
|
|
if (group_path_started)
|
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(group_path, path)
|
2015-06-08 11:43:00 -07:00
|
|
|
eina_stringshare_del(path);
|
2012-09-11 00:30:22 -07:00
|
|
|
}
|
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2019-02-27 10:17:09 -08:00
|
|
|
return EFL_GFX_IMAGE_LOAD_ERROR_GENERIC;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-11-03 18:28:29 -08:00
|
|
|
_edje_file_add(Edje *ed, const Eina_File *f)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!_edje_edd_edje_file) return;
|
2013-08-09 04:49:52 -07:00
|
|
|
if (!f)
|
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-07-03 22:59:59 -07:00
|
|
|
int err = 0;
|
|
|
|
|
|
|
|
ed->file = _edje_cache_file_coll_open(f, ed->group, &(err),
|
|
|
|
&(ed->collection), ed);
|
|
|
|
ed->load_error = (unsigned short)err;
|
2013-08-09 04:49:52 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2005-04-03 04:43:00 -07:00
|
|
|
if (!ed->collection)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
if (ed->file)
|
|
|
|
{
|
|
|
|
_edje_cache_file_unref(ed->file);
|
|
|
|
ed->file = NULL;
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
static int
|
|
|
|
_sort_defined_boxes(const void *a, const void *b)
|
2012-05-09 22:37:38 -07:00
|
|
|
{
|
2012-05-18 07:37:21 -07:00
|
|
|
const Edje_User_Defined *euda = a;
|
|
|
|
const Edje_User_Defined *eudb = b;
|
2012-05-09 22:37:38 -07:00
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
if (euda->part - eudb->part != 0)
|
|
|
|
return euda->part - eudb->part;
|
|
|
|
return euda->u.box.index - eudb->u.box.index;
|
2012-05-09 22:37:38 -07:00
|
|
|
}
|
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
static Eina_Hash *
|
2012-05-18 07:37:21 -07:00
|
|
|
_edje_object_collect(Edje *ed)
|
2012-05-09 22:37:38 -07:00
|
|
|
{
|
2012-05-18 07:37:21 -07:00
|
|
|
Edje_User_Defined *eud;
|
2019-07-10 11:24:48 -07:00
|
|
|
Eina_Hash *collect;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
Eina_Iterator *it;
|
2012-05-09 22:37:38 -07:00
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
collect = ed->user_defined;
|
|
|
|
ed->user_defined = NULL;
|
2012-05-09 22:37:38 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
it = eina_hash_iterator_data_new(collect);
|
|
|
|
EINA_ITERATOR_FOREACH(it, l)
|
2012-05-14 04:18:45 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
EINA_LIST_FOREACH(l, ll, eud)
|
2012-05-18 07:37:21 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
switch (eud->type)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_STRING:
|
|
|
|
eud->u.string.text = eina_stringshare_ref(eud->u.string.text);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_USER_BOX_PACK:
|
|
|
|
if (eud->u.box.index == -1)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
Edje_User_Defined *search;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Eina_List *children;
|
|
|
|
Eina_List *ls;
|
|
|
|
Evas_Object *child;
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(&ed, eud->part);
|
|
|
|
if (rp)
|
|
|
|
{
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) continue;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
children = evas_object_box_children_get(rp->object);
|
|
|
|
EINA_LIST_FREE(children, child)
|
|
|
|
if (!evas_object_data_get(child, "\377 edje.box_item"))
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
EINA_LIST_FOREACH(l, ls, search)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
if (search->type == EDJE_USER_BOX_PACK &&
|
|
|
|
search->u.box.child == child &&
|
|
|
|
search->part == eud->part /* beauty of stringshare ! */)
|
|
|
|
{
|
|
|
|
search->u.box.index = idx++;
|
|
|
|
break;
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
_edje_real_part_box_remove(eud->ed, rp, child);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_TABLE_PACK:
|
2013-07-17 22:47:14 -07:00
|
|
|
{
|
2019-07-10 11:24:48 -07:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(&ed, eud->part);
|
|
|
|
if (rp)
|
|
|
|
{
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TABLE) continue;
|
|
|
|
_edje_real_part_table_unpack(eud->ed, rp, eud->u.table.child);
|
|
|
|
}
|
|
|
|
break;
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_SWALLOW:
|
|
|
|
edje_object_part_unswallow(NULL, eud->u.swallow.child);
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_TEXT_STYLE:
|
|
|
|
_canvas_layout_user_text_collect(ed, eud);
|
|
|
|
break;
|
2018-11-06 06:52:53 -08:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
case EDJE_USER_DRAG_STEP:
|
|
|
|
case EDJE_USER_DRAG_PAGE:
|
|
|
|
case EDJE_USER_DRAG_VALUE:
|
|
|
|
case EDJE_USER_DRAG_SIZE:
|
|
|
|
case EDJE_USER_TEXT_EXPAND:
|
|
|
|
break;
|
|
|
|
}
|
2012-05-18 07:37:21 -07:00
|
|
|
}
|
2012-05-14 04:18:45 -07:00
|
|
|
}
|
2019-07-10 11:24:48 -07:00
|
|
|
eina_iterator_free(it);
|
2012-05-14 04:18:45 -07:00
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
return collect;
|
2012-05-14 04:18:45 -07:00
|
|
|
}
|
|
|
|
|
2018-03-20 10:18:50 -07:00
|
|
|
void
|
|
|
|
_edje_file_callbacks_del(Edje *ed, Evas *e)
|
|
|
|
{
|
|
|
|
Evas *tev = e;
|
|
|
|
|
|
|
|
if (!tev) tev = evas_object_evas_get(ed->obj);
|
|
|
|
if (ed->collection && ed->collection->use_custom_seat_names)
|
2019-10-31 06:17:40 -07:00
|
|
|
efl_event_callback_array_del(tev, edje_device_custom_callbacks(), ed);
|
|
|
|
else
|
|
|
|
efl_event_callback_array_del(tev, edje_device_callbacks(), ed);
|
2018-03-20 10:18:50 -07:00
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
void
|
|
|
|
_edje_file_del(Edje *ed)
|
|
|
|
{
|
2012-06-12 09:29:11 -07:00
|
|
|
Evas *tev = NULL;
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2018-03-20 08:06:47 -07:00
|
|
|
if (ed->obj && (!efl_invalidated_get(ed->obj)))
|
|
|
|
tev = evas_object_evas_get(ed->obj);
|
2012-05-18 07:37:21 -07:00
|
|
|
|
2012-08-28 22:50:14 -07:00
|
|
|
ed->groups = eina_list_free(ed->groups);
|
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
if (tev)
|
|
|
|
{
|
2018-03-20 10:18:50 -07:00
|
|
|
_edje_file_callbacks_del(ed, tev);
|
2016-11-30 13:52:14 -08:00
|
|
|
evas_event_freeze(tev);
|
|
|
|
}
|
|
|
|
|
2010-02-14 22:40:58 -08:00
|
|
|
if (ed->freeze_calc)
|
|
|
|
{
|
2014-03-18 07:00:14 -07:00
|
|
|
_edje_util_freeze_calc_list = eina_list_remove(_edje_util_freeze_calc_list, ed);
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->freeze_calc = EINA_FALSE;
|
2014-03-18 07:00:14 -07:00
|
|
|
_edje_util_freeze_calc_count--;
|
2010-02-14 22:40:58 -08:00
|
|
|
}
|
2010-02-17 15:43:31 -08:00
|
|
|
_edje_entry_shutdown(ed);
|
2004-06-30 20:46:05 -07:00
|
|
|
_edje_message_del(ed);
|
2003-08-25 17:16:49 -07:00
|
|
|
_edje_block_violate(ed);
|
2004-03-30 02:30:35 -08:00
|
|
|
_edje_var_shutdown(ed);
|
2011-05-27 03:32:53 -07:00
|
|
|
if (!((ed->file) && (ed->collection)))
|
|
|
|
{
|
2012-06-12 09:29:11 -07:00
|
|
|
if (tev)
|
|
|
|
{
|
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
|
|
|
}
|
2011-05-27 03:32:53 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-06-12 20:10:18 -07:00
|
|
|
|
2019-07-10 11:24:48 -07:00
|
|
|
eina_hash_free(ed->user_defined);
|
|
|
|
ed->user_defined = NULL;
|
2012-06-12 20:10:18 -07:00
|
|
|
|
2007-05-26 16:57:21 -07:00
|
|
|
if (ed->table_parts)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2012-12-11 06:09:03 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
Evas_Object *face_obj;
|
|
|
|
#endif
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
rp = ed->table_parts[i];
|
2016-08-04 02:28:49 -07:00
|
|
|
if (!rp) continue;
|
2012-12-11 06:09:03 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
EINA_LIST_FREE(rp->body_faces, face_obj)
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_del(face_obj);
|
2012-12-11 06:09:03 -08:00
|
|
|
#endif
|
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_real_part_shutdown(ed, rp);
|
2012-12-19 12:09:41 -08:00
|
|
|
|
2016-08-04 02:28:49 -07:00
|
|
|
if (rp->custom)
|
|
|
|
{
|
|
|
|
// xxx: lua2
|
|
|
|
_edje_collection_free_part_description_clean(rp->part->type,
|
|
|
|
rp->custom->description,
|
|
|
|
ed->file->free_strings);
|
|
|
|
free(rp->custom->description);
|
|
|
|
rp->custom->description = NULL;
|
|
|
|
}
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type == EDJE_RP_TYPE_CONTAINER) &&
|
|
|
|
(rp->typedata.container))
|
|
|
|
{
|
|
|
|
if (rp->typedata.container->items)
|
|
|
|
{
|
|
|
|
/* evas_box/table handles deletion of objects */
|
|
|
|
rp->typedata.container->items = eina_list_free(rp->typedata.container->items);
|
|
|
|
}
|
|
|
|
if (rp->typedata.container->anim)
|
|
|
|
{
|
|
|
|
_edje_box_layout_free_data(rp->typedata.container->anim);
|
|
|
|
rp->typedata.container->anim = NULL;
|
|
|
|
}
|
|
|
|
free(rp->typedata.container);
|
2016-08-04 02:19:42 -07:00
|
|
|
rp->typedata.container = NULL;
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
|
|
|
else if ((rp->type == EDJE_RP_TYPE_TEXT) &&
|
|
|
|
(rp->typedata.text))
|
|
|
|
{
|
2014-02-04 22:36:05 -08:00
|
|
|
eina_stringshare_del(rp->typedata.text->text);
|
|
|
|
eina_stringshare_del(rp->typedata.text->font);
|
|
|
|
eina_stringshare_del(rp->typedata.text->cache.in_str);
|
|
|
|
eina_stringshare_del(rp->typedata.text->cache.out_str);
|
2012-09-11 06:14:51 -07:00
|
|
|
free(rp->typedata.text);
|
2016-08-04 02:19:42 -07:00
|
|
|
rp->typedata.text = NULL;
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
|
|
|
else if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(rp->typedata.swallow))
|
2010-09-28 17:28:54 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
if (rp->typedata.swallow->swallowed_object)
|
|
|
|
{
|
|
|
|
/* Objects swallowed by the app do not get deleted,
|
2013-07-17 22:47:14 -07:00
|
|
|
but those internally swallowed (GROUP type) do. */
|
2012-09-11 06:14:51 -07:00
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
2014-01-10 02:54:01 -08:00
|
|
|
_edje_external_parsed_params_free(rp->typedata.swallow->swallowed_object, rp->param1.external_params);
|
|
|
|
if (rp->param2)
|
|
|
|
_edje_external_parsed_params_free(rp->typedata.swallow->swallowed_object, rp->param2->external_params);
|
2017-06-05 13:41:01 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
// fallthrough intentional
|
2012-09-11 06:14:51 -07:00
|
|
|
case EDJE_PART_TYPE_GROUP:
|
2014-01-10 02:54:01 -08:00
|
|
|
evas_object_del(rp->typedata.swallow->swallowed_object);
|
2019-01-09 09:53:10 -08:00
|
|
|
rp->typedata.swallow->swallowed_object = NULL;
|
2012-09-11 06:14:51 -07:00
|
|
|
default:
|
2014-01-10 02:54:01 -08:00
|
|
|
break;
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
2013-04-08 04:03:43 -07:00
|
|
|
_edje_real_part_swallow_clear(ed, rp);
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
|
|
|
free(rp->typedata.swallow);
|
2016-08-04 02:19:42 -07:00
|
|
|
rp->typedata.swallow = NULL;
|
2010-09-28 17:28:54 -07:00
|
|
|
}
|
edje: add json file support feature
Summary:
It also starts to support following new edc properties.
This is backported patch from Tizen 5.0
1. frame
desc { "default"
vector {
frame: 0.5; // 0.0 ~ 1.0
}
}
2. actions
program { "vector_animation";
// VG_ANIM_PLAY, VG_ANIM_PLAY_BACK, VG_ANIM_LOOP,
// VG_ANIM_STOP, VG_ANIM_PAUSE, VG_ANIM_RESUME
action: VG_ANIM_PLAY;
target: "your_vector_part";
}
@feature
Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
- Fix to remove Efl.Canvas.Animation_Player on edje
Test Plan:
{F3840540}
{F3840542}
{F3840543}
make and test attached file
edje_cc -beta -id ./ json_edc.edc json.edj
gcc -o test test_edc.c -g `pkg-config --cflags --libs evas elementary rlottie`
./test
Reviewers: Hermet, Jaehyun_Cho, id213sin
Reviewed By: Hermet
Subscribers: segfaultxavi, raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11228
2020-02-17 01:59:09 -08:00
|
|
|
else if ((rp->type == EDJE_RP_TYPE_VECTOR) &&
|
|
|
|
(rp->typedata.vector))
|
|
|
|
{
|
|
|
|
if (rp->typedata.vector->anim)
|
2020-05-25 22:37:10 -07:00
|
|
|
{
|
|
|
|
efl_canvas_object_animation_stop(rp->object);
|
|
|
|
efl_del(rp->typedata.vector->anim);
|
|
|
|
}
|
2020-03-09 23:42:12 -07:00
|
|
|
if (rp->typedata.vector->lottie_virtual_file)
|
|
|
|
eina_file_close(rp->typedata.vector->lottie_virtual_file);
|
|
|
|
if (rp->typedata.vector->lottie_data)
|
|
|
|
free(rp->typedata.vector->lottie_data);
|
edje: add json file support feature
Summary:
It also starts to support following new edc properties.
This is backported patch from Tizen 5.0
1. frame
desc { "default"
vector {
frame: 0.5; // 0.0 ~ 1.0
}
}
2. actions
program { "vector_animation";
// VG_ANIM_PLAY, VG_ANIM_PLAY_BACK, VG_ANIM_LOOP,
// VG_ANIM_STOP, VG_ANIM_PAUSE, VG_ANIM_RESUME
action: VG_ANIM_PLAY;
target: "your_vector_part";
}
@feature
Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
- Fix to remove Efl.Canvas.Animation_Player on edje
Test Plan:
{F3840540}
{F3840542}
{F3840543}
make and test attached file
edje_cc -beta -id ./ json_edc.edc json.edj
gcc -o test test_edc.c -g `pkg-config --cflags --libs evas elementary rlottie`
./test
Reviewers: Hermet, Jaehyun_Cho, id213sin
Reviewed By: Hermet
Subscribers: segfaultxavi, raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11228
2020-02-17 01:59:09 -08:00
|
|
|
|
|
|
|
free(rp->typedata.vector);
|
|
|
|
rp->typedata.vector = NULL;
|
|
|
|
}
|
2004-10-29 10:56:12 -07:00
|
|
|
|
2020-05-25 22:37:10 -07:00
|
|
|
if (rp->object)
|
|
|
|
{
|
|
|
|
_edje_callbacks_focus_del(rp->object, ed);
|
|
|
|
_edje_callbacks_del(rp->object, ed);
|
|
|
|
evas_object_del(rp->object);
|
|
|
|
rp->object = NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
/* Cleanup optional part. */
|
|
|
|
free(rp->drag);
|
2016-08-04 02:28:49 -07:00
|
|
|
rp->drag = NULL;
|
2013-07-17 22:47:14 -07:00
|
|
|
free(rp->param1.set);
|
2016-08-04 02:28:49 -07:00
|
|
|
rp->param1.set = NULL;
|
2009-08-11 06:07:46 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (rp->param2)
|
|
|
|
{
|
|
|
|
free(rp->param2->set);
|
2016-08-04 02:28:49 -07:00
|
|
|
rp->param2->set = NULL;
|
2016-08-14 06:30:32 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
_edje_calc_params_clear(&(rp->param2->p));
|
2013-03-12 22:30:21 -07:00
|
|
|
#endif
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
|
|
|
eina_mempool_free(_edje_real_part_state_mp, rp->param2);
|
2010-06-01 06:31:07 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (rp->custom)
|
|
|
|
{
|
|
|
|
free(rp->custom->set);
|
2016-08-04 02:28:49 -07:00
|
|
|
rp->custom->set = NULL;
|
2016-08-14 06:30:32 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
_edje_calc_params_clear(&(rp->custom->p));
|
2013-03-12 22:30:21 -07:00
|
|
|
#endif
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
|
|
|
eina_mempool_free(_edje_real_part_state_mp, rp->custom);
|
|
|
|
|
2014-02-10 22:03:01 -08:00
|
|
|
if (rp->current)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
_edje_calc_params_clear(rp->current);
|
2014-02-10 22:03:01 -08:00
|
|
|
#endif
|
|
|
|
free(rp->current);
|
|
|
|
rp->current = NULL;
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
_edje_unref(ed);
|
2016-08-14 06:30:32 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
_edje_calc_params_clear(&(rp->param1.p));
|
2013-03-12 22:30:21 -07:00
|
|
|
#endif
|
2013-07-17 22:47:14 -07:00
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
2016-08-04 02:28:49 -07:00
|
|
|
ed->table_parts[i] = NULL;
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2008-12-08 06:23:26 -08:00
|
|
|
if ((ed->file) && (ed->collection))
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int i;
|
2008-12-08 06:23:26 -08:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
|
|
|
{
|
|
|
|
ep = ed->collection->parts[i];
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2015-02-24 09:26:18 -08:00
|
|
|
_edje_textblock_styles_del(ed, ep);
|
2013-07-17 22:47:14 -07:00
|
|
|
_edje_text_part_on_del(ed, ep);
|
|
|
|
_edje_color_class_on_del(ed, ep);
|
|
|
|
}
|
2020-01-02 01:11:06 -08:00
|
|
|
_edje_object_textblock_styles_cache_cleanup(ed);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
_edje_cache_coll_unref(ed->file, ed->collection);
|
|
|
|
ed->collection = NULL;
|
2008-12-08 06:23:26 -08:00
|
|
|
}
|
2008-03-01 18:34:23 -08:00
|
|
|
if (ed->file)
|
|
|
|
{
|
2012-05-09 02:16:52 -07:00
|
|
|
_edje_cache_file_unref(ed->file);
|
2013-07-17 22:47:14 -07:00
|
|
|
ed->file = NULL;
|
2008-03-01 18:34:23 -08:00
|
|
|
}
|
2016-01-25 16:29:36 -08:00
|
|
|
|
|
|
|
// Cleanup all animator
|
2003-06-23 19:33:04 -07:00
|
|
|
if (ed->actions)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
Edje_Running_Program *runp;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
EINA_LIST_FREE(ed->actions, runp)
|
2016-01-25 16:29:36 -08:00
|
|
|
free(runp);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2019-02-21 12:50:35 -08:00
|
|
|
efl_event_callback_del(ed->obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _edje_timer_cb, ed);
|
2016-02-04 21:02:29 -08:00
|
|
|
ecore_animator_del(ed->animator);
|
2016-02-24 08:52:56 -08:00
|
|
|
ed->animator = NULL;
|
2016-01-25 16:29:36 -08:00
|
|
|
|
2003-06-27 21:20:41 -07:00
|
|
|
if (ed->pending_actions)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
Edje_Pending_Program *pp;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
EINA_LIST_FREE(ed->pending_actions, pp)
|
|
|
|
{
|
|
|
|
ecore_timer_del(pp->timer);
|
2017-02-03 23:48:55 -08:00
|
|
|
pp->timer = NULL;
|
2013-07-17 22:47:14 -07:00
|
|
|
free(pp);
|
|
|
|
}
|
2003-06-27 21:20:41 -07:00
|
|
|
}
|
2012-05-18 07:37:21 -07:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
if (ed->seats)
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
{
|
2016-11-30 13:52:14 -08:00
|
|
|
Edje_Seat *seat;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
EINA_LIST_FREE(ed->seats, seat)
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
{
|
2016-11-30 13:52:14 -08:00
|
|
|
eina_stringshare_del(seat->name);
|
|
|
|
free(seat);
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
}
|
2017-09-18 09:33:42 -07:00
|
|
|
ed->seats_count = 0;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
}
|
|
|
|
|
2011-11-17 23:18:19 -08:00
|
|
|
if (ed->L) _edje_lua2_script_shutdown(ed);
|
2015-06-08 11:43:00 -07:00
|
|
|
while (ed->subobjs)
|
|
|
|
_edje_subobj_unregister(ed, ed->subobjs->data);
|
2004-04-01 07:32:17 -08:00
|
|
|
if (ed->table_parts) free(ed->table_parts);
|
|
|
|
ed->table_parts = NULL;
|
|
|
|
ed->table_parts_size = 0;
|
2012-06-12 09:29:11 -07:00
|
|
|
if (tev)
|
|
|
|
{
|
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2007-03-06 04:03:34 -08:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
void
|
|
|
|
_edje_file_free(Edje_File *edf)
|
|
|
|
{
|
2016-02-04 22:55:46 -08:00
|
|
|
Edje_Color_Tree_Node *ectn;
|
2009-08-11 03:06:37 -07:00
|
|
|
Edje_Color_Class *ecc;
|
2015-12-23 22:55:17 -08:00
|
|
|
Edje_Text_Class *etc;
|
2015-12-07 19:15:48 -08:00
|
|
|
Edje_Size_Class *esc;
|
2009-08-11 03:06:37 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define HASH_FREE(Hash) \
|
|
|
|
if (Hash) eina_hash_free(Hash); \
|
|
|
|
Hash = NULL;
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
/* Clean cache before cleaning memory pool */
|
|
|
|
if (edf->collection_cache) _edje_cache_coll_flush(edf);
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
HASH_FREE(edf->fonts);
|
|
|
|
HASH_FREE(edf->collection);
|
|
|
|
HASH_FREE(edf->data);
|
2018-02-26 15:54:38 -08:00
|
|
|
HASH_FREE(edf->image_id_hash);
|
|
|
|
|
|
|
|
if (edf->requires_count)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < edf->requires_count; i++)
|
|
|
|
eina_stringshare_del(edf->requires[i]);
|
|
|
|
free(edf->requires);
|
|
|
|
}
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2003-07-07 00:55:18 -07:00
|
|
|
if (edf->image_dir)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
unsigned int i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (edf->free_strings)
|
|
|
|
{
|
|
|
|
for (i = 0; i < edf->image_dir->entries_count; ++i)
|
|
|
|
eina_stringshare_del(edf->image_dir->entries[i].entry);
|
2020-05-26 20:32:11 -07:00
|
|
|
|
|
|
|
for (i = 0; i < edf->image_dir->vectors_count; ++i)
|
|
|
|
eina_stringshare_del(edf->image_dir->vectors[i].entry);
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
2010-06-29 06:48:03 -07:00
|
|
|
|
2014-02-09 17:40:08 -08:00
|
|
|
/* Sets have been added after edje received eet dictionary support */
|
2013-07-17 22:47:14 -07:00
|
|
|
for (i = 0; i < edf->image_dir->sets_count; ++i)
|
|
|
|
{
|
|
|
|
Edje_Image_Directory_Set_Entry *se;
|
2010-06-29 06:48:03 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
EINA_LIST_FREE(edf->image_dir->sets[i].entries, se)
|
2015-06-08 11:43:00 -07:00
|
|
|
free(se);
|
2013-07-17 22:47:14 -07:00
|
|
|
}
|
2010-06-29 06:48:03 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
free(edf->image_dir->entries);
|
|
|
|
free(edf->image_dir->sets);
|
2020-05-26 20:32:11 -07:00
|
|
|
free(edf->image_dir->vectors);
|
2013-07-17 22:47:14 -07:00
|
|
|
free(edf->image_dir);
|
2003-07-07 00:55:18 -07:00
|
|
|
}
|
2011-11-04 05:18:13 -07:00
|
|
|
if (edf->sound_dir)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (edf->free_strings)
|
|
|
|
{
|
|
|
|
for (i = 0; i < edf->sound_dir->samples_count; ++i)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(edf->sound_dir->samples[i].name);
|
|
|
|
eina_stringshare_del(edf->sound_dir->samples[i].snd_src);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < edf->sound_dir->tones_count; ++i)
|
|
|
|
eina_stringshare_del(edf->sound_dir->tones[i].name);
|
|
|
|
}
|
|
|
|
free(edf->sound_dir->samples);
|
|
|
|
free(edf->sound_dir->tones);
|
|
|
|
free(edf->sound_dir);
|
|
|
|
}
|
2006-01-10 19:19:46 -08:00
|
|
|
|
2014-03-19 21:00:20 -07:00
|
|
|
if (edf->vibration_dir)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (edf->free_strings)
|
|
|
|
{
|
|
|
|
for (i = 0; i < edf->vibration_dir->samples_count; ++i)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(edf->vibration_dir->samples[i].name);
|
|
|
|
eina_stringshare_del(edf->vibration_dir->samples[i].src);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(edf->vibration_dir->samples);
|
|
|
|
free(edf->vibration_dir);
|
|
|
|
}
|
|
|
|
|
2020-05-26 20:31:35 -07:00
|
|
|
if (edf->filter_dir)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (edf->free_strings)
|
|
|
|
{
|
|
|
|
for (i = 0; i < edf->filter_dir->filters_count; ++i)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(edf->filter_dir->filters[i].name);
|
|
|
|
eina_stringshare_del(edf->filter_dir->filters[i].script);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(edf->filter_dir->filters);
|
|
|
|
free(edf->filter_dir);
|
|
|
|
}
|
|
|
|
|
2015-05-13 09:08:04 -07:00
|
|
|
if (edf->mo_dir)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
if (edf->free_strings)
|
|
|
|
{
|
|
|
|
for (i = 0; i < edf->mo_dir->mo_entries_count; ++i)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(edf->mo_dir->mo_entries[i].locale);
|
|
|
|
eina_stringshare_del(edf->mo_dir->mo_entries[i].mo_src);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(edf->mo_dir->mo_entries);
|
|
|
|
free(edf->mo_dir);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2015-05-13 09:08:04 -07:00
|
|
|
|
2010-08-12 08:05:56 -07:00
|
|
|
if (edf->external_dir)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
if (edf->external_dir->entries) free(edf->external_dir->entries);
|
|
|
|
free(edf->external_dir);
|
2010-08-12 08:05:56 -07:00
|
|
|
}
|
|
|
|
|
2016-02-04 22:55:46 -08:00
|
|
|
eina_hash_free(edf->color_tree_hash);
|
|
|
|
EINA_LIST_FREE(edf->color_tree, ectn)
|
|
|
|
{
|
|
|
|
if (edf->free_strings && ectn->name) eina_stringshare_del(ectn->name);
|
|
|
|
eina_list_free(ectn->color_classes);
|
|
|
|
free(ectn);
|
|
|
|
}
|
|
|
|
|
2012-08-09 01:27:04 -07:00
|
|
|
eina_hash_free(edf->color_hash);
|
2009-08-11 03:06:37 -07:00
|
|
|
EINA_LIST_FREE(edf->color_classes, ecc)
|
2006-01-10 19:19:46 -08:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name);
|
2015-03-07 10:38:57 -08:00
|
|
|
if (edf->free_strings) eina_stringshare_del(ecc->desc);
|
2013-07-17 22:47:14 -07:00
|
|
|
free(ecc);
|
2006-01-10 19:19:46 -08:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2015-12-23 22:55:17 -08:00
|
|
|
eina_hash_free(edf->text_hash);
|
|
|
|
EINA_LIST_FREE(edf->text_classes, etc)
|
|
|
|
{
|
|
|
|
if (edf->free_strings)
|
|
|
|
{
|
|
|
|
if (etc->name) eina_stringshare_del(etc->name);
|
|
|
|
if (etc->font) eina_stringshare_del(etc->font);
|
|
|
|
}
|
|
|
|
free(etc);
|
|
|
|
}
|
|
|
|
|
2015-12-07 19:15:48 -08:00
|
|
|
eina_hash_free(edf->size_hash);
|
|
|
|
EINA_LIST_FREE(edf->size_classes, esc)
|
|
|
|
{
|
|
|
|
if (edf->free_strings && esc->name) eina_stringshare_del(esc->name);
|
|
|
|
free(esc);
|
|
|
|
}
|
|
|
|
|
2010-06-28 10:18:47 -07:00
|
|
|
if (edf->collection_patterns) edje_match_patterns_free(edf->collection_patterns);
|
2008-10-15 07:11:11 -07:00
|
|
|
if (edf->path) eina_stringshare_del(edf->path);
|
|
|
|
if (edf->free_strings && edf->compiler) eina_stringshare_del(edf->compiler);
|
2018-02-26 13:21:44 -08:00
|
|
|
if (edf->free_strings) eina_stringshare_del(edf->id);
|
2019-08-12 16:18:39 -07:00
|
|
|
eina_hash_free(edf->style_hash);
|
2019-08-29 07:07:25 -07:00
|
|
|
_edje_file_textblock_style_cleanup(edf);
|
2008-02-29 22:38:09 -08:00
|
|
|
if (edf->ef) eet_close(edf->ef);
|
2019-08-20 16:32:38 -07:00
|
|
|
if (edf->f) eina_file_close(edf->f); // close matching open (in _edje_file_open) OK
|
2003-07-07 00:55:18 -07:00
|
|
|
free(edf);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
static void
|
|
|
|
_edje_program_free(Edje_Program *pr, Eina_Bool free_strings)
|
|
|
|
{
|
|
|
|
Edje_Program_Target *prt;
|
|
|
|
Edje_Program_After *pa;
|
|
|
|
|
|
|
|
if (free_strings)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
if (pr->name) eina_stringshare_del(pr->name);
|
|
|
|
if (pr->signal) eina_stringshare_del(pr->signal);
|
|
|
|
if (pr->source) eina_stringshare_del(pr->source);
|
|
|
|
if (pr->filter.part) eina_stringshare_del(pr->filter.part);
|
|
|
|
if (pr->filter.state) eina_stringshare_del(pr->filter.state);
|
|
|
|
if (pr->state) eina_stringshare_del(pr->state);
|
|
|
|
if (pr->state2) eina_stringshare_del(pr->state2);
|
|
|
|
if (pr->sample_name) eina_stringshare_del(pr->sample_name);
|
|
|
|
if (pr->tone_name) eina_stringshare_del(pr->tone_name);
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
if (pr->seat) eina_stringshare_del(pr->seat);
|
2010-08-04 07:25:40 -07:00
|
|
|
}
|
|
|
|
EINA_LIST_FREE(pr->targets, prt)
|
2015-06-08 11:43:00 -07:00
|
|
|
free(prt);
|
2010-08-04 07:25:40 -07:00
|
|
|
EINA_LIST_FREE(pr->after, pa)
|
2015-06-08 11:43:00 -07:00
|
|
|
free(pa);
|
2010-08-04 07:25:40 -07:00
|
|
|
free(pr);
|
|
|
|
}
|
|
|
|
|
2005-04-03 04:43:00 -07:00
|
|
|
void
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collection_Directory_Entry *ce)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2009-08-11 03:06:37 -07:00
|
|
|
|
2010-06-03 23:45:46 -07:00
|
|
|
_edje_embryo_script_shutdown(ec);
|
2010-08-04 07:25:40 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define EDJE_LOAD_PROGRAM_FREE(Array, Ec, It, FreeStrings) \
|
|
|
|
for (It = 0; It < Ec->programs.Array##_count; ++It) \
|
|
|
|
_edje_program_free(Ec->programs.Array[It], FreeStrings); \
|
|
|
|
free(Ec->programs.Array);
|
2010-08-04 07:25:40 -07:00
|
|
|
|
|
|
|
EDJE_LOAD_PROGRAM_FREE(fnmatch, ec, i, edf->free_strings);
|
|
|
|
EDJE_LOAD_PROGRAM_FREE(strcmp, ec, i, edf->free_strings);
|
|
|
|
EDJE_LOAD_PROGRAM_FREE(strncmp, ec, i, edf->free_strings);
|
|
|
|
EDJE_LOAD_PROGRAM_FREE(strrncmp, ec, i, edf->free_strings);
|
|
|
|
EDJE_LOAD_PROGRAM_FREE(nocmp, ec, i, edf->free_strings);
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
for (i = 0; i < ec->parts_count; ++i)
|
2003-07-19 19:08:47 -07:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int j;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
ep = ec->parts[i];
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
if (edf->free_strings && ep->name) eina_stringshare_del(ep->name);
|
|
|
|
if (ep->default_desc)
|
|
|
|
{
|
|
|
|
_edje_collection_free_part_description_clean(ep->type, ep->default_desc, edf->free_strings);
|
|
|
|
ep->default_desc = NULL;
|
|
|
|
}
|
|
|
|
for (j = 0; j < ep->other.desc_count; ++j)
|
|
|
|
_edje_collection_free_part_description_clean(ep->type, ep->other.desc[j], edf->free_strings);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
free(ep->other.desc);
|
2011-02-01 05:26:49 -08:00
|
|
|
/* Alloc for RTL objects in edje_calc.c:_edje_part_description_find() */
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->other.desc_rtl)
|
2011-02-01 05:26:49 -08:00
|
|
|
free(ep->other.desc_rtl);
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
for (j = 0; j < ep->items_count; ++j)
|
|
|
|
free(ep->items[j]);
|
2013-07-17 22:47:14 -07:00
|
|
|
free(ep->items);
|
2016-12-07 15:10:34 -08:00
|
|
|
|
|
|
|
for (j = 0; j < ep->allowed_seats_count; ++j)
|
|
|
|
{
|
|
|
|
if (edf->free_strings)
|
|
|
|
eina_stringshare_del(ep->allowed_seats[j]->name);
|
|
|
|
free(ep->allowed_seats[j]);
|
|
|
|
}
|
|
|
|
free(ep->allowed_seats);
|
2013-07-17 22:47:14 -07:00
|
|
|
// technically need this - but we ASSUME we use "one_big" so everything gets
|
|
|
|
// freed in one go lower down when we del the mempool... but what if pool goes
|
|
|
|
// "over"?
|
2016-08-20 19:14:28 -07:00
|
|
|
eina_mempool_free(ce->mp->mp.part, ep);
|
2004-06-30 20:46:05 -07:00
|
|
|
}
|
2010-08-12 05:58:54 -07:00
|
|
|
free(ec->parts);
|
|
|
|
ec->parts = NULL;
|
|
|
|
|
2010-08-12 08:05:56 -07:00
|
|
|
if (ec->data)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_String *es;
|
2010-08-12 08:05:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
it = eina_hash_iterator_data_new(ec->data);
|
|
|
|
EINA_ITERATOR_FOREACH(it, es)
|
2015-06-08 11:43:00 -07:00
|
|
|
free(es);
|
2013-07-17 22:47:14 -07:00
|
|
|
eina_iterator_free(it);
|
2010-08-12 08:05:56 -07:00
|
|
|
|
2013-07-17 22:47:14 -07:00
|
|
|
eina_hash_free(ec->data);
|
2010-08-12 08:05:56 -07:00
|
|
|
}
|
2004-03-26 01:10:05 -08:00
|
|
|
#ifdef EDJE_PROGRAM_CACHE
|
2008-12-15 13:00:19 -08:00
|
|
|
if (ec->prog_cache.no_matches) eina_hash_free(ec->prog_cache.no_matches);
|
2003-07-19 19:08:47 -07:00
|
|
|
if (ec->prog_cache.matches)
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
eina_hash_foreach(ec->prog_cache.matches,
|
|
|
|
_edje_collection_free_prog_cache_matches_free_cb,
|
|
|
|
NULL);
|
|
|
|
eina_hash_free(ec->prog_cache.matches);
|
2003-07-19 19:08:47 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
#endif
|
2013-02-13 19:36:13 -08:00
|
|
|
_edje_programs_patterns_clean(ec);
|
|
|
|
if (ec->patterns.table_programs) free(ec->patterns.table_programs);
|
|
|
|
ec->patterns.table_programs = NULL;
|
|
|
|
ec->patterns.table_programs_size = 0;
|
|
|
|
|
2005-04-27 01:11:58 -07:00
|
|
|
if (ec->script) embryo_program_free(ec->script);
|
2010-04-06 04:26:32 -07:00
|
|
|
_edje_lua2_script_unload(ec);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2020-05-26 22:55:44 -07:00
|
|
|
if (ec->limits.parts) free(ec->limits.parts);
|
|
|
|
|
2012-08-06 23:20:35 -07:00
|
|
|
eina_hash_free(ec->alias);
|
|
|
|
eina_hash_free(ec->aliased);
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
/* Destroy all part and description. */
|
2012-12-05 23:54:54 -08:00
|
|
|
edje_cache_emp_free(ce);
|
2003-07-19 19:08:47 -07:00
|
|
|
free(ec);
|
|
|
|
}
|
|
|
|
|
2008-03-06 09:52:59 -08:00
|
|
|
void
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_collection_free_part_description_clean(int type, Edje_Part_Description_Common *desc, Eina_Bool free_strings)
|
2003-07-19 19:08:47 -07:00
|
|
|
{
|
2013-07-18 04:08:56 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (free_strings && desc->color_class) eina_stringshare_del(desc->color_class);
|
2013-07-18 04:08:56 -07:00
|
|
|
//clean the map colors
|
|
|
|
if (desc->map.colors)
|
|
|
|
{
|
2013-07-18 04:34:02 -07:00
|
|
|
for (i = 0; i < desc->map.colors_count; i++)
|
2013-07-18 04:08:56 -07:00
|
|
|
free(desc->map.colors[i]);
|
|
|
|
free(desc->map.colors);
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Description_Image *img;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
img = (Edje_Part_Description_Image *)desc;
|
|
|
|
|
|
|
|
for (i = 0; i < img->image.tweens_count; ++i)
|
|
|
|
free(img->image.tweens[i]);
|
|
|
|
free(img->image.tweens);
|
|
|
|
break;
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Description_External *external;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
external = (Edje_Part_Description_External *)desc;
|
|
|
|
|
|
|
|
if (external->external_params)
|
|
|
|
_edje_external_params_free(external->external_params, free_strings);
|
|
|
|
break;
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
2015-06-08 11:43:00 -07:00
|
|
|
if (free_strings)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *text;
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
text = (Edje_Part_Description_Text *)desc;
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
eina_stringshare_del(text->text.text.str);
|
|
|
|
eina_stringshare_del(text->text.domain);
|
|
|
|
eina_stringshare_del(text->text.text_class);
|
|
|
|
eina_stringshare_del(text->text.style.str);
|
|
|
|
eina_stringshare_del(text->text.font.str);
|
|
|
|
}
|
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_collection_free_part_description_free(int type,
|
2013-07-17 22:47:14 -07:00
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce,
|
|
|
|
Eina_Bool free_strings)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2016-08-20 19:14:28 -07:00
|
|
|
#define FREE_POOL(Type, Ce, Desc) \
|
|
|
|
case EDJE_PART_TYPE_##Type: eina_mempool_free(ce->mp->mp.Type, Desc); \
|
|
|
|
ce->count.Type--; \
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
_edje_collection_free_part_description_clean(type, desc, free_strings);
|
|
|
|
|
|
|
|
switch (type)
|
2008-02-29 22:38:09 -08:00
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
FREE_POOL(RECTANGLE, ce, desc);
|
|
|
|
FREE_POOL(TEXT, ce, desc);
|
|
|
|
FREE_POOL(IMAGE, ce, desc);
|
|
|
|
FREE_POOL(PROXY, ce, desc);
|
|
|
|
FREE_POOL(SWALLOW, ce, desc);
|
|
|
|
FREE_POOL(TEXTBLOCK, ce, desc);
|
|
|
|
FREE_POOL(GROUP, ce, desc);
|
|
|
|
FREE_POOL(BOX, ce, desc);
|
|
|
|
FREE_POOL(TABLE, ce, desc);
|
|
|
|
FREE_POOL(EXTERNAL, ce, desc);
|
2015-08-05 06:58:01 -07:00
|
|
|
FREE_POOL(SNAPSHOT, ce, desc);
|
|
|
|
FREE_POOL(SPACER, ce, desc);
|
2008-02-29 22:38:09 -08:00
|
|
|
}
|
2003-07-19 19:08:47 -07:00
|
|
|
}
|
|
|
|
|
2004-03-26 01:10:05 -08:00
|
|
|
#ifdef EDJE_PROGRAM_CACHE
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
|
2003-07-19 19:08:47 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
eina_list_free((Eina_List *)data);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-12-05 19:08:17 -08:00
|
|
|
key = NULL;
|
2003-10-18 19:11:06 -07:00
|
|
|
hash = NULL;
|
|
|
|
fdata = NULL;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2004-03-26 01:10:05 -08:00
|
|
|
#endif
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
static void
|
|
|
|
_edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it)
|
|
|
|
{
|
|
|
|
Evas_Coord w = 0, h = 0, minw, minh;
|
2013-04-11 19:23:55 -07:00
|
|
|
Evas_Aspect_Control mode = EVAS_ASPECT_CONTROL_NONE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
minw = it->min.w;
|
|
|
|
minh = it->min.h;
|
|
|
|
|
|
|
|
if ((minw <= 0) && (minh <= 0))
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
edje_object_size_min_get(obj, &w, &h);
|
|
|
|
if ((w <= 0) && (h <= 0))
|
|
|
|
edje_object_size_min_calc(obj, &w, &h);
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-17 22:47:14 -07:00
|
|
|
w = minw;
|
|
|
|
h = minh;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
if (((minw <= 0) && (minh <= 0)) && ((w > 0) || (h > 0)))
|
|
|
|
evas_object_size_hint_min_set(obj, w, h);
|
|
|
|
else
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
|
|
|
|
evas_object_size_hint_request_set(obj, it->prefer.w, it->prefer.h);
|
|
|
|
evas_object_size_hint_max_set(obj, it->max.w, it->max.h);
|
|
|
|
evas_object_size_hint_padding_set(obj, it->padding.l, it->padding.r, it->padding.t, it->padding.b);
|
2012-05-16 03:37:44 -07:00
|
|
|
evas_object_size_hint_align_set(obj, TO_DOUBLE(it->align.x), TO_DOUBLE(it->align.y));
|
|
|
|
evas_object_size_hint_weight_set(obj, TO_DOUBLE(it->weight.x), TO_DOUBLE(it->weight.y));
|
2013-04-11 19:23:55 -07:00
|
|
|
|
|
|
|
switch (it->aspect.mode)
|
|
|
|
{
|
|
|
|
case EDJE_ASPECT_CONTROL_NONE: mode = EVAS_ASPECT_CONTROL_NONE; break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2013-04-11 19:23:55 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_NEITHER: mode = EVAS_ASPECT_CONTROL_NEITHER; break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2013-04-11 19:23:55 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_HORIZONTAL: mode = EVAS_ASPECT_CONTROL_HORIZONTAL; break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2013-04-11 19:23:55 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_VERTICAL: mode = EVAS_ASPECT_CONTROL_VERTICAL; break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2013-04-11 19:23:55 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_BOTH: mode = EVAS_ASPECT_CONTROL_BOTH; break;
|
|
|
|
}
|
|
|
|
evas_object_size_hint_aspect_set(obj, mode, it->aspect.w, it->aspect.h);
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
evas_object_resize(obj, w, h);
|
|
|
|
}
|
|
|
|
|
2015-03-06 10:16:06 -08:00
|
|
|
const char *
|
2010-10-12 06:26:18 -07:00
|
|
|
_edje_find_alias(Eina_Hash *aliased, char *src, int *length)
|
|
|
|
{
|
|
|
|
const char *alias;
|
|
|
|
char *search;
|
|
|
|
|
|
|
|
*length = strlen(src);
|
|
|
|
if (*length == 0) return NULL;
|
|
|
|
|
|
|
|
alias = eina_hash_find(aliased, src);
|
|
|
|
if (alias) return alias;
|
|
|
|
|
|
|
|
search = strrchr(src, EDJE_PART_PATH_SEPARATOR);
|
|
|
|
if (search == NULL) return NULL;
|
|
|
|
|
|
|
|
*search = '\0';
|
|
|
|
alias = _edje_find_alias(aliased, src, length);
|
|
|
|
*search = EDJE_PART_PATH_SEPARATOR;
|
|
|
|
|
|
|
|
return alias;
|
|
|
|
}
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
static void
|
2011-08-18 03:59:34 -07:00
|
|
|
_cb_signal_repeat(void *data, Evas_Object *obj, const char *sig, const char *source)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2011-02-24 06:41:08 -08:00
|
|
|
Edje_Pack_Element *pack_it;
|
2015-06-08 11:43:00 -07:00
|
|
|
Evas_Object *parent;
|
|
|
|
Edje *ed;
|
|
|
|
Edje *ed_parent;
|
|
|
|
char new_src[4096]; /* XXX is this max reasonable? */
|
|
|
|
size_t length_parent = 0;
|
|
|
|
size_t length_index = 0;
|
|
|
|
size_t length_source;
|
|
|
|
int i = 0;
|
|
|
|
const char *alias = NULL;
|
|
|
|
const char *name = NULL;
|
2011-11-18 19:24:37 -08:00
|
|
|
Edje_Message_Signal emsg;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
parent = data;
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return;
|
2011-02-24 06:41:08 -08:00
|
|
|
|
|
|
|
pack_it = evas_object_data_get(obj, "\377 edje.box_item");
|
|
|
|
if (!pack_it) pack_it = evas_object_data_get(obj, "\377 edje.table_item");
|
2013-03-21 23:29:33 -07:00
|
|
|
name = evas_object_name_get(obj);
|
|
|
|
|
2011-02-24 06:41:08 -08:00
|
|
|
if (pack_it)
|
|
|
|
{
|
2013-03-21 23:29:33 -07:00
|
|
|
if (!name) name = pack_it->name;
|
|
|
|
if (!name)
|
2011-02-24 06:41:08 -08:00
|
|
|
{
|
2013-07-31 19:22:52 -07:00
|
|
|
Eina_Iterator *it = NULL;
|
2011-02-24 06:41:08 -08:00
|
|
|
Evas_Object *o;
|
|
|
|
|
|
|
|
if (pack_it->parent->part->type == EDJE_PART_TYPE_BOX)
|
|
|
|
{
|
2013-07-31 19:22:52 -07:00
|
|
|
it = evas_object_box_iterator_new(pack_it->parent->object);
|
2011-02-24 06:41:08 -08:00
|
|
|
}
|
|
|
|
else if (pack_it->parent->part->type == EDJE_PART_TYPE_TABLE)
|
|
|
|
{
|
2013-07-31 19:22:52 -07:00
|
|
|
it = evas_object_table_iterator_new(pack_it->parent->object);
|
2011-02-24 06:41:08 -08:00
|
|
|
}
|
|
|
|
|
2013-07-31 19:22:52 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, o)
|
2011-02-24 06:41:08 -08:00
|
|
|
{
|
|
|
|
if (o == obj) break;
|
|
|
|
i++;
|
|
|
|
}
|
2013-07-31 19:22:52 -07:00
|
|
|
eina_iterator_free(it);
|
2011-02-24 06:41:08 -08:00
|
|
|
|
|
|
|
length_index = 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-21 23:29:33 -07:00
|
|
|
length_index = strlen(name) + 2;
|
2011-02-24 06:41:08 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-10 01:58:19 -07:00
|
|
|
/* Replace snprint("%s%c%s") == memcpy + *new_src + memcat */
|
2008-08-01 18:33:39 -07:00
|
|
|
if (ed->parent)
|
|
|
|
length_parent = strlen(ed->parent);
|
2008-04-10 01:58:19 -07:00
|
|
|
length_source = strlen(source);
|
2011-02-24 06:41:08 -08:00
|
|
|
if (length_source + length_parent + 2 + length_index > sizeof(new_src))
|
2008-11-14 09:35:05 -08:00
|
|
|
return;
|
2008-04-10 01:58:19 -07:00
|
|
|
|
2008-08-01 18:33:39 -07:00
|
|
|
if (ed->parent)
|
|
|
|
memcpy(new_src, ed->parent, length_parent);
|
2011-02-24 06:41:08 -08:00
|
|
|
if (ed->parent && length_index)
|
|
|
|
{
|
|
|
|
new_src[length_parent++] = EDJE_PART_PATH_SEPARATOR_INDEXL;
|
2016-04-25 20:27:50 -07:00
|
|
|
if ((pack_it->parent->part->type == EDJE_PART_TYPE_BOX) ||
|
|
|
|
(!name && (pack_it->parent->part->type == EDJE_PART_TYPE_TABLE)))
|
2011-02-24 06:41:08 -08:00
|
|
|
length_parent += eina_convert_itoa(i, new_src + length_parent);
|
2017-06-08 01:25:08 -07:00
|
|
|
else if (name)
|
2011-02-24 06:41:08 -08:00
|
|
|
{
|
2013-03-22 04:10:39 -07:00
|
|
|
memcpy(new_src + length_parent, name, length_index - 2);
|
2011-02-24 06:41:08 -08:00
|
|
|
length_parent += length_index - 2;
|
|
|
|
}
|
|
|
|
new_src[length_parent++] = EDJE_PART_PATH_SEPARATOR_INDEXR;
|
|
|
|
}
|
|
|
|
|
2008-04-10 01:58:19 -07:00
|
|
|
new_src[length_parent] = EDJE_PART_PATH_SEPARATOR;
|
|
|
|
memcpy(new_src + length_parent + 1, source, length_source + 1);
|
|
|
|
|
2010-10-12 06:26:18 -07:00
|
|
|
/* Handle alias renaming */
|
|
|
|
ed_parent = _edje_fetch(parent);
|
|
|
|
if (ed_parent && ed_parent->collection && ed_parent->collection->aliased)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
alias = _edje_find_alias(ed_parent->collection->aliased, new_src, &length);
|
|
|
|
|
|
|
|
if (alias)
|
|
|
|
{
|
|
|
|
int origin;
|
|
|
|
|
|
|
|
/* Add back the end of the source */
|
|
|
|
origin = strlen(new_src);
|
2015-06-08 11:43:00 -07:00
|
|
|
length++; /* Remove the trailing ':' from the count */
|
2010-10-12 06:26:18 -07:00
|
|
|
if (origin > length)
|
|
|
|
{
|
|
|
|
char *tmp;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t alias_length;
|
2010-10-12 06:26:18 -07:00
|
|
|
|
|
|
|
alias_length = strlen(alias);
|
|
|
|
tmp = alloca(alias_length + origin - length + 2);
|
|
|
|
memcpy(tmp, alias, alias_length);
|
|
|
|
tmp[alias_length] = EDJE_PART_PATH_SEPARATOR;
|
|
|
|
memcpy(tmp + alias_length + 1, new_src + length, origin - length + 1);
|
|
|
|
|
|
|
|
alias = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-07-17 22:47:14 -07:00
|
|
|
|
2011-11-18 19:24:37 -08:00
|
|
|
emsg.sig = sig;
|
|
|
|
emsg.src = alias ? alias : new_src;
|
|
|
|
emsg.data = NULL;
|
2012-06-21 03:23:42 -07:00
|
|
|
if (ed_parent)
|
2014-03-18 07:00:14 -07:00
|
|
|
_edje_util_message_send(ed_parent, EDJE_QUEUE_SCRIPT,
|
2015-06-08 11:43:00 -07:00
|
|
|
EDJE_MESSAGE_SIGNAL, 0, &emsg);
|
2014-05-26 09:25:07 -07:00
|
|
|
}
|