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
|
|
|
|
{
|
|
|
|
Evas_Object *child;
|
|
|
|
const char *part;
|
|
|
|
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;
|
|
|
|
FLOAT_T x, y, w, h;
|
|
|
|
struct {
|
|
|
|
FLOAT_T x, y;
|
|
|
|
} step;
|
|
|
|
struct {
|
|
|
|
FLOAT_T x, y;
|
|
|
|
} page;
|
|
|
|
};
|
|
|
|
|
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
|
2008-11-23 21:15:15 -08:00
|
|
|
static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it);
|
2007-05-26 22:28:07 -07:00
|
|
|
static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source);
|
2003-07-19 19:08:47 -07:00
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
static Eina_List *_edje_object_collect(Edje *ed);
|
|
|
|
|
|
|
|
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 **************************/
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
2008-08-14 11:04:43 -07:00
|
|
|
edje_object_file_set(Evas_Object *obj, const char *file, const char *group)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2011-02-01 05:26:49 -08:00
|
|
|
Eina_Bool ret;
|
2010-04-08 12:21:54 -07:00
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed)
|
|
|
|
return EINA_FALSE;
|
2011-02-01 05:26:49 -08:00
|
|
|
ret = ed->api->file_set(obj, file, group);
|
|
|
|
_edje_object_orientation_inform(obj);
|
|
|
|
return ret;
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_file_get(const Evas_Object *obj, const char **file, const char **group)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed)
|
|
|
|
{
|
|
|
|
if (file) *file = NULL;
|
2008-08-14 11:04:43 -07:00
|
|
|
if (group) *group = NULL;
|
2007-05-26 22:28:07 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (file) *file = ed->path;
|
2008-08-14 11:04:43 -07:00
|
|
|
if (group) *group = ed->group;
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
2010-09-22 06:27:09 -07:00
|
|
|
EAPI Edje_Load_Error
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_load_error_get(const Evas_Object *obj)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return EDJE_LOAD_ERROR_NONE;
|
|
|
|
return ed->load_error;
|
|
|
|
}
|
|
|
|
|
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:
|
|
|
|
return "No Error";
|
|
|
|
case EDJE_LOAD_ERROR_GENERIC:
|
|
|
|
return "Generic Error";
|
|
|
|
case EDJE_LOAD_ERROR_DOES_NOT_EXIST:
|
|
|
|
return "File Does Not Exist";
|
|
|
|
case EDJE_LOAD_ERROR_PERMISSION_DENIED:
|
|
|
|
return "Permission Denied";
|
|
|
|
case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
|
|
|
|
return "Resource Allocation Failed";
|
|
|
|
case EDJE_LOAD_ERROR_CORRUPT_FILE:
|
|
|
|
return "Corrupt File";
|
|
|
|
case EDJE_LOAD_ERROR_UNKNOWN_FORMAT:
|
|
|
|
return "Unknown Format";
|
|
|
|
case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE:
|
|
|
|
return "Incompatible File";
|
|
|
|
case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION:
|
|
|
|
return "Unknown Collection";
|
|
|
|
case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE:
|
|
|
|
return "Recursive Reference";
|
|
|
|
default:
|
|
|
|
return "Unknown Error";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2007-05-26 22:28:07 -07:00
|
|
|
edje_file_collection_list(const char *file)
|
|
|
|
{
|
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;
|
|
|
|
|
|
|
|
if ((!file) || (!*file)) return NULL;
|
2012-05-09 02:16:52 -07:00
|
|
|
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL, NULL);
|
2010-08-21 06:52:25 -07:00
|
|
|
if (edf)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2010-06-28 06:56:30 -07:00
|
|
|
Eina_Iterator *i;
|
|
|
|
const char *key;
|
|
|
|
|
|
|
|
i = eina_hash_iterator_key_new(edf->collection);
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(i, key)
|
|
|
|
lst = eina_list_append(lst, eina_stringshare_add(key));
|
|
|
|
|
|
|
|
eina_iterator_free(i);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
|
|
|
_edje_cache_file_unref(edf);
|
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));
|
|
|
|
lst = eina_list_remove(lst, eina_list_data_get(lst));
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
2007-05-26 22:28:07 -07:00
|
|
|
edje_file_group_exists(const char *file, const char *glob)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2012-03-26 05:44:33 -07:00
|
|
|
if ((!file) || (!*file) || (!glob))
|
2010-09-10 04:25:15 -07:00
|
|
|
return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2012-05-09 02:16:52 -07:00
|
|
|
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL, NULL);
|
2010-09-10 04:25:15 -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
|
|
|
{
|
2010-12-05 23:49:00 -08:00
|
|
|
if ((*p == '*') || (*p == '?') || (*p == '['))
|
|
|
|
{
|
|
|
|
is_glob = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
if (is_glob)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
i = eina_hash_iterator_data_new(edf->collection);
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
EINA_ITERATOR_FOREACH(i, ce)
|
|
|
|
l = eina_list_append(l, ce);
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
eina_iterator_free(i);
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08:00
|
|
|
edf->collection_patterns = edje_match_collection_dir_init(l);
|
|
|
|
eina_list_free(l);
|
|
|
|
}
|
2012-01-23 08:39:37 -08:00
|
|
|
|
2010-12-05 23:49:00 -08: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
|
|
|
|
INF("edje_file_group_exists: '%s', '%s': %i\n", file, glob, succeed);
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
return succeed;
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EAPI char *
|
|
|
|
edje_file_data_get(const char *file, const char *key)
|
|
|
|
{
|
|
|
|
Edje_File *edf;
|
|
|
|
char *str = NULL;
|
|
|
|
int error_ret = 0;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
if (key)
|
|
|
|
{
|
2012-05-09 02:16:52 -07:00
|
|
|
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL, NULL);
|
2010-08-21 06:52:25 -07:00
|
|
|
if (edf)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
str = (char*) edje_string_get(eina_hash_find(edf->data, key));
|
2010-06-28 06:56:30 -07:00
|
|
|
|
|
|
|
if (str) str = strdup(str);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_cache_file_unref(edf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2010-01-19 12:14:14 -08:00
|
|
|
void
|
2008-02-26 12:12:00 -08:00
|
|
|
_edje_programs_patterns_clean(Edje *ed)
|
|
|
|
{
|
|
|
|
_edje_signals_sources_patterns_clean(&ed->patterns.programs);
|
2008-11-10 08:37:52 -08:00
|
|
|
|
|
|
|
eina_rbtree_delete(ed->patterns.programs.exact_match,
|
|
|
|
EINA_RBTREE_FREE_CB(edje_match_signal_source_free),
|
|
|
|
NULL);
|
|
|
|
ed->patterns.programs.exact_match = NULL;
|
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
free(ed->patterns.programs.u.programs.globing);
|
|
|
|
ed->patterns.programs.u.programs.globing = NULL;
|
2008-02-26 12:12:00 -08:00
|
|
|
}
|
|
|
|
|
2010-01-19 12:14:14 -08:00
|
|
|
void
|
2008-02-26 12:12:00 -08:00
|
|
|
_edje_programs_patterns_init(Edje *ed)
|
|
|
|
{
|
|
|
|
Edje_Signals_Sources_Patterns *ssp = &ed->patterns.programs;
|
2010-08-04 07:25:40 -07:00
|
|
|
Edje_Program **all;
|
|
|
|
unsigned int i, j;
|
2008-02-26 12:12:00 -08:00
|
|
|
|
|
|
|
if (ssp->signals_patterns)
|
|
|
|
return;
|
|
|
|
|
2012-02-14 10:07:44 -08:00
|
|
|
if (getenv("EDJE_DUMP_PROGRAMS"))
|
|
|
|
{
|
|
|
|
INF("Group '%s' programs:", ed->group);
|
|
|
|
#define EDJE_DUMP_PROGRAM(Section) \
|
|
|
|
for (i = 0; i < ed->collection->programs.Section##_count; i++) \
|
|
|
|
INF(#Section" for ('%s', '%s')", ed->collection->programs.Section[i]->signal, ed->collection->programs.Section[i]->source);
|
|
|
|
|
|
|
|
EDJE_DUMP_PROGRAM(strcmp);
|
|
|
|
EDJE_DUMP_PROGRAM(strncmp);
|
|
|
|
EDJE_DUMP_PROGRAM(strrncmp);
|
|
|
|
EDJE_DUMP_PROGRAM(fnmatch);
|
|
|
|
EDJE_DUMP_PROGRAM(nocmp);
|
|
|
|
}
|
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
edje_match_program_hash_build(ed->collection->programs.strcmp,
|
|
|
|
ed->collection->programs.strcmp_count,
|
|
|
|
&ssp->exact_match);
|
|
|
|
|
|
|
|
j = ed->collection->programs.strncmp_count
|
|
|
|
+ ed->collection->programs.strrncmp_count
|
|
|
|
+ ed->collection->programs.fnmatch_count
|
|
|
|
+ ed->collection->programs.nocmp_count;
|
|
|
|
if (j == 0) return ;
|
|
|
|
|
|
|
|
all = malloc(sizeof (Edje_Program *) * j);
|
|
|
|
if (!all) return ;
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
/* FIXME: Build specialized data type for each case */
|
|
|
|
#define EDJE_LOAD_PROGRAMS_ADD(Array, Ed, It, Git, All) \
|
|
|
|
for (It = 0; It < Ed->collection->programs.Array##_count; ++It, ++Git) \
|
|
|
|
All[Git] = Ed->collection->programs.Array[It];
|
|
|
|
|
|
|
|
EDJE_LOAD_PROGRAMS_ADD(fnmatch, ed, i, j, all);
|
|
|
|
EDJE_LOAD_PROGRAMS_ADD(strncmp, ed, i, j, all);
|
|
|
|
EDJE_LOAD_PROGRAMS_ADD(strrncmp, ed, i, j, all);
|
|
|
|
/* FIXME: Do a special pass for that one */
|
|
|
|
EDJE_LOAD_PROGRAMS_ADD(nocmp, ed, i, j, all);
|
|
|
|
|
|
|
|
ssp->u.programs.globing = all;
|
|
|
|
ssp->u.programs.count = j;
|
|
|
|
ssp->signals_patterns = edje_match_programs_signal_init(all, j);
|
|
|
|
ssp->sources_patterns = edje_match_programs_source_init(all, j);
|
2008-02-26 12:12:00 -08:00
|
|
|
}
|
|
|
|
|
2010-04-08 12:21:54 -07:00
|
|
|
int
|
2011-06-06 10:29:07 -07:00
|
|
|
_edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path)
|
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;
|
2012-05-18 07:37:21 -07:00
|
|
|
Eina_List *collect = NULL;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int n;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *parts = NULL;
|
2007-05-26 22:28:07 -07:00
|
|
|
int group_path_started = 0;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
ed = _edje_fetch(obj);
|
2003-09-29 13:43:37 -07:00
|
|
|
if (!ed) return 0;
|
2003-06-23 19:33:04 -07:00
|
|
|
if (!file) file = "";
|
2008-08-14 11:04:43 -07:00
|
|
|
if (!group) group = "";
|
2003-06-23 19:33:04 -07:00
|
|
|
if (((ed->path) && (!strcmp(file, ed->path))) &&
|
2012-05-09 00:30:59 -07:00
|
|
|
(ed->group) && (!strcmp(group, ed->group)) &&
|
|
|
|
ed->file)
|
|
|
|
{
|
|
|
|
struct stat st;
|
|
|
|
|
|
|
|
if (stat(file, &st) != 0)
|
|
|
|
return 1;
|
|
|
|
if (st.st_mtime == ed->file->mtime)
|
|
|
|
return 1;
|
|
|
|
}
|
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);
|
2007-03-16 14:37:57 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
|
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
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
_edje_file_del(ed);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2011-09-22 00:19:50 -07:00
|
|
|
eina_stringshare_replace(&ed->path, file);
|
|
|
|
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;
|
2009-11-24 09:55:11 -08:00
|
|
|
_edje_file_add(ed);
|
2012-01-19 18:57:02 -08:00
|
|
|
ed->block_break = 0;
|
2009-11-24 09:55:11 -08:00
|
|
|
|
2009-11-24 13:08:52 -08:00
|
|
|
if (ed->file && ed->file->external_dir)
|
2009-11-24 09:55:11 -08:00
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
2009-11-24 09:55:11 -08:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
for (i = 0; i < ed->file->external_dir->entries_count; ++i)
|
|
|
|
edje_module_load(ed->file->external_dir->entries[i].entry);
|
2009-11-24 09:55:11 -08:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2006-03-27 23:45:54 -08:00
|
|
|
_edje_textblock_styles_add(ed);
|
|
|
|
_edje_textblock_style_all_update(ed);
|
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)
|
|
|
|
{
|
2011-02-01 05:26:49 -08:00
|
|
|
if (ed->collection->prop.orientation != EDJE_ORIENTATION_AUTO)
|
|
|
|
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
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
if (ed->collection->script_only)
|
2008-05-30 07:27:56 -07:00
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
|
|
|
_edje_script_only_init(ed);
|
|
|
|
}
|
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
|
|
|
else if (ed->collection->lua_script_only)
|
|
|
|
{
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
|
|
|
_edje_lua_script_only_init(ed);
|
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
else
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
/* colorclass stuff */
|
2010-08-12 05:58:54 -07:00
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
2004-01-22 18:13:42 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int k;
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
ep = ed->collection->parts[i];
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
/* Register any color classes in this parts descriptions. */
|
2010-07-29 05:02:36 -07:00
|
|
|
if ((ep->default_desc) && (ep->default_desc->color_class))
|
|
|
|
_edje_color_class_member_add(ed, ep->default_desc->color_class);
|
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
for (k = 0; k < ep->other.desc_count; k++)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *desc;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
desc = ep->other.desc[k];
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
if (desc->color_class)
|
|
|
|
_edje_color_class_member_add(ed, desc->color_class);
|
|
|
|
}
|
2004-07-14 02:59:29 -07:00
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
/* build real parts */
|
2010-07-29 05:02:36 -07:00
|
|
|
for (n = 0; n < ed->collection->parts_count; n++)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2008-05-30 04:20:49 -07:00
|
|
|
Edje_Part *ep;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
ep = ed->collection->parts[n];
|
2009-08-14 10:19:42 -07:00
|
|
|
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
|
2008-05-30 04:20:49 -07:00
|
|
|
if (!rp)
|
2004-07-14 02:59:29 -07:00
|
|
|
{
|
2011-12-16 02:17:55 -08:00
|
|
|
/* FIXME: destroy all allocated ressource, need to have a common exit point */
|
2008-05-30 04:20:49 -07:00
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2008-05-30 04:20:49 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
memset(rp, 0, sizeof (Edje_Real_Part));
|
|
|
|
|
2009-08-11 05:47: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;
|
2011-12-16 01:49:21 -08:00
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
|
|
|
return 0;
|
2009-08-11 05:47:00 -07:00
|
|
|
}
|
|
|
|
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->step.x = FROM_INT(ep->dragable.step_x);
|
|
|
|
rp->drag->step.y = FROM_INT(ep->dragable.step_y);
|
2009-08-11 05:47:00 -07:00
|
|
|
}
|
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
rp->edje = ed;
|
|
|
|
_edje_ref(rp->edje);
|
|
|
|
rp->part = ep;
|
2008-10-22 04:34:42 -07:00
|
|
|
parts = eina_list_append(parts, rp);
|
2011-09-22 00:19:50 -07:00
|
|
|
rp->param1.description =
|
|
|
|
_edje_part_description_find(ed, rp, "default", 0.0);
|
2008-05-30 04:20:49 -07:00
|
|
|
rp->chosen_description = rp->param1.description;
|
|
|
|
if (!rp->param1.description)
|
2012-06-03 19:57:15 -07:00
|
|
|
ERR("no default part description for '%s'!",
|
|
|
|
rp->part->name);
|
2009-08-11 02:45:06 -07:00
|
|
|
|
|
|
|
switch (ep->type)
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2009-08-11 02:45:06 -07:00
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_rectangle_add(ed->base.evas);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
2011-03-11 09:46:29 -08:00
|
|
|
case EDJE_PART_TYPE_PROXY:
|
2009-08-11 02:45:06 -07:00
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_image_add(ed->base.evas);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
_edje_text_part_on_add(ed, rp);
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_text_add(ed->base.evas);
|
2009-08-11 02:45:06 -07:00
|
|
|
evas_object_text_font_source_set(rp->object, ed->path);
|
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
2011-12-16 02:17:55 -08:00
|
|
|
sources = eina_list_append(sources, rp);
|
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
2009-10-26 18:08:19 -07:00
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
2011-12-16 02:17:55 -08:00
|
|
|
if (ep->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
externals = eina_list_append(externals, rp);
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_rectangle_add(ed->base.evas);
|
2009-08-11 02:45:06 -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);
|
2010-02-23 05:39:19 -08:00
|
|
|
_edje_callbacks_focus_add(rp->object, ed, rp);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
2011-12-16 02:17:55 -08:00
|
|
|
textblocks = eina_list_append(textblocks, rp);
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_textblock_add(ed->base.evas);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
2011-12-16 02:17:55 -08:00
|
|
|
sources = eina_list_append(sources, rp);
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_box_add(ed->base.evas);
|
2010-09-28 17:28:54 -07:00
|
|
|
rp->anim = _edje_box_layout_anim_new(rp->object);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
2011-12-16 02:17:55 -08:00
|
|
|
sources = eina_list_append(sources, rp);
|
2011-03-24 20:21:07 -07:00
|
|
|
rp->object = evas_object_table_add(ed->base.evas);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
2010-07-13 08:47:19 -07:00
|
|
|
case EDJE_PART_TYPE_GRADIENT:
|
2010-10-07 17:24:22 -07:00
|
|
|
ERR("SPANK ! SPANK ! SPANK ! YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !",
|
2010-07-13 08:47:19 -07:00
|
|
|
ep->name, group, file);
|
2012-06-03 19:57:15 -07:00
|
|
|
break;
|
2012-06-12 20:21:31 -07:00
|
|
|
case EDJE_PART_TYPE_SPACER:
|
2012-06-03 19:57:15 -07:00
|
|
|
rp->object = NULL;
|
|
|
|
break;
|
2009-08-11 02:45:06 -07:00
|
|
|
default:
|
2010-03-25 11:05:42 -07:00
|
|
|
ERR("wrong part type %i!", ep->type);
|
2009-08-11 02:45:06 -07:00
|
|
|
break;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
2009-08-11 02:45:06 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
if (rp->object)
|
|
|
|
{
|
|
|
|
evas_object_smart_member_add(rp->object, ed->obj);
|
|
|
|
// evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
2010-03-04 06:44:20 -08:00
|
|
|
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP && ep->type != EDJE_PART_TYPE_EXTERNAL)
|
2007-07-24 07:20:07 -07:00
|
|
|
{
|
2008-05-30 04:20:49 -07:00
|
|
|
if (ep->mouse_events)
|
|
|
|
{
|
|
|
|
_edje_callbacks_add(rp->object, ed, rp);
|
|
|
|
if (ep->repeat_events)
|
|
|
|
evas_object_repeat_events_set(rp->object, 1);
|
|
|
|
|
|
|
|
if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
|
|
|
|
evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
|
|
}
|
|
|
|
if (ep->precise_is_inside)
|
|
|
|
evas_object_precise_is_inside_set(rp->object, 1);
|
2007-07-24 07:20:07 -07:00
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
if (rp->part->clip_to_id < 0)
|
2011-03-24 20:21:07 -07:00
|
|
|
evas_object_clip_set(rp->object, ed->base.clipper);
|
2004-07-14 02:59:29 -07:00
|
|
|
}
|
2007-05-26 16:57:21 -07:00
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
if (n > 0)
|
2007-05-26 16:57:21 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
|
|
|
|
ed->table_parts_size = n;
|
|
|
|
/* FIXME: check malloc return */
|
|
|
|
n = 0;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(parts, l, rp)
|
2003-06-26 07:04:31 -07:00
|
|
|
{
|
2008-05-30 04:20:49 -07:00
|
|
|
ed->table_parts[n] = rp;
|
|
|
|
n++;
|
2003-06-26 07:04:31 -07:00
|
|
|
}
|
2008-10-22 04:34:42 -07:00
|
|
|
eina_list_free(parts);
|
2008-05-30 04:20:49 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2005-07-26 06:59:03 -07:00
|
|
|
{
|
2008-05-30 04:20:49 -07:00
|
|
|
rp = ed->table_parts[i];
|
2010-09-16 08:49:56 -07:00
|
|
|
if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may
|
|
|
|
be able to remove this when all theme are correctly rewritten. */
|
|
|
|
{
|
|
|
|
if (rp->param1.description->rel1.id_x >= 0)
|
|
|
|
rp->param1.rel1_to_x = ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
|
|
|
|
if (rp->param1.description->rel1.id_y >= 0)
|
|
|
|
rp->param1.rel1_to_y = ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
|
|
|
|
if (rp->param1.description->rel2.id_x >= 0)
|
|
|
|
rp->param1.rel2_to_x = ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
|
|
|
|
if (rp->param1.description->rel2.id_y >= 0)
|
|
|
|
rp->param1.rel2_to_y = ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
|
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
if (rp->part->clip_to_id >= 0)
|
|
|
|
{
|
|
|
|
rp->clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
|
2012-06-03 19:57:15 -07:00
|
|
|
if (rp->clip_to &&
|
|
|
|
rp->clip_to->object &&
|
|
|
|
rp->object)
|
2008-05-30 04:20:49 -07:00
|
|
|
{
|
|
|
|
evas_object_pass_events_set(rp->clip_to->object, 1);
|
|
|
|
evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
|
|
evas_object_clip_set(rp->object, rp->clip_to->object);
|
|
|
|
}
|
|
|
|
}
|
2009-08-11 05:47:00 -07:00
|
|
|
if (rp->drag)
|
2008-05-30 04:20:49 -07:00
|
|
|
{
|
2009-08-11 05:47:00 -07:00
|
|
|
if (rp->part->dragable.confine_id >= 0)
|
|
|
|
rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
|
2009-08-11 07:55:26 -07:00
|
|
|
}
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2009-08-11 07:55:26 -07:00
|
|
|
/* replay events for dragable */
|
2010-07-16 06:58:35 -07:00
|
|
|
if (rp->part->dragable.event_id >= 0)
|
2009-08-11 07:55:26 -07:00
|
|
|
{
|
|
|
|
rp->events_to =
|
2010-07-16 06:58:35 -07:00
|
|
|
ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
|
2009-08-11 07:55:26 -07:00
|
|
|
/* events_to may be used only with dragable */
|
|
|
|
if (!rp->events_to->part->dragable.x &&
|
|
|
|
!rp->events_to->part->dragable.y)
|
|
|
|
rp->events_to = NULL;
|
2008-05-30 04:20:49 -07:00
|
|
|
}
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
rp->swallow_params.min.w = 0;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->swallow_params.min.h = 0;
|
2008-05-30 04:20:49 -07:00
|
|
|
rp->swallow_params.max.w = -1;
|
|
|
|
rp->swallow_params.max.h = -1;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT
|
|
|
|
|| rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
2008-05-30 04:20:49 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *text;
|
|
|
|
|
|
|
|
text = (Edje_Part_Description_Text *) rp->param1.description;
|
|
|
|
|
|
|
|
if (ed->file->feature_ver < 1)
|
|
|
|
{
|
|
|
|
text->text.id_source = -1;
|
|
|
|
text->text.id_text_source = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (text->text.id_source >= 0)
|
|
|
|
rp->text.source = ed->table_parts[text->text.id_source % ed->table_parts_size];
|
|
|
|
if (text->text.id_text_source >= 0)
|
|
|
|
rp->text.text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size];
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
_edje_entry_real_part_init(rp);
|
|
|
|
if (!ed->has_entries)
|
|
|
|
ed->has_entries = EINA_TRUE;
|
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
}
|
2005-07-26 06:59:03 -07:00
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
_edje_programs_patterns_init(ed);
|
2010-08-04 07:25:40 -07:00
|
|
|
|
|
|
|
n = ed->collection->programs.fnmatch_count +
|
|
|
|
ed->collection->programs.strcmp_count +
|
|
|
|
ed->collection->programs.strncmp_count +
|
|
|
|
ed->collection->programs.strrncmp_count +
|
|
|
|
ed->collection->programs.nocmp_count;
|
2008-05-30 04:20:49 -07:00
|
|
|
if (n > 0)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Edje_Program *pr;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
ed->table_programs = malloc(sizeof(Edje_Program *) * n);
|
2010-08-04 07:25:40 -07:00
|
|
|
if (ed->table_programs)
|
2004-10-12 20:43:42 -07:00
|
|
|
{
|
2010-08-04 07:25:40 -07:00
|
|
|
ed->table_programs_size = n;
|
|
|
|
|
|
|
|
#define EDJE_LOAD_BUILD_TABLE(Array, Ed, It, Tmp) \
|
|
|
|
for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
|
|
|
|
{ \
|
|
|
|
Tmp = Ed->collection->programs.Array[It]; \
|
|
|
|
Ed->table_programs[Tmp->id] = Tmp; \
|
|
|
|
}
|
|
|
|
|
|
|
|
EDJE_LOAD_BUILD_TABLE(fnmatch, ed, i, pr);
|
|
|
|
EDJE_LOAD_BUILD_TABLE(strcmp, ed, i, pr);
|
|
|
|
EDJE_LOAD_BUILD_TABLE(strncmp, ed, i, pr);
|
|
|
|
EDJE_LOAD_BUILD_TABLE(strrncmp, ed, i, pr);
|
|
|
|
EDJE_LOAD_BUILD_TABLE(nocmp, ed, i, pr);
|
2004-10-12 20:43:42 -07:00
|
|
|
}
|
2004-04-01 07:32:17 -08:00
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
_edje_ref(ed);
|
|
|
|
_edje_block(ed);
|
|
|
|
_edje_freeze(ed);
|
2010-06-03 23:45:46 -07:00
|
|
|
// if (ed->collection->script) _edje_embryo_script_init(ed);
|
2008-05-30 04:20:49 -07:00
|
|
|
_edje_var_init(ed);
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2004-04-01 07:32:17 -08:00
|
|
|
{
|
2008-05-30 04:20:49 -07:00
|
|
|
rp = ed->table_parts[i];
|
|
|
|
evas_object_show(rp->object);
|
|
|
|
if (_edje_block_break(ed)) break;
|
2009-08-11 05:47:00 -07:00
|
|
|
if (rp->drag)
|
|
|
|
{
|
2009-12-09 07:44:54 -08:00
|
|
|
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);
|
2009-08-11 05:47:00 -07:00
|
|
|
_edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
|
|
|
|
}
|
2003-06-24 19:29:25 -07:00
|
|
|
}
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2008-05-30 04:20:49 -07:00
|
|
|
ed->dirty = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2011-03-24 20:21:07 -07:00
|
|
|
if ((evas_object_clipees_get(ed->base.clipper)) &&
|
2008-05-30 04:20:49 -07:00
|
|
|
(evas_object_visible_get(obj)))
|
2011-03-24 20:21:07 -07:00
|
|
|
evas_object_show(ed->base.clipper);
|
2011-12-16 02:17:55 -08:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
/* instantiate 'internal swallows' */
|
2011-12-16 02:17:55 -08:00
|
|
|
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(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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FREE(sources, rp)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2008-12-05 19:08:17 -08:00
|
|
|
/* 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
|
|
|
|
*/
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Pack_Element **curr_item = NULL;
|
|
|
|
unsigned int item_count = 0;
|
2008-12-05 19:08:17 -08:00
|
|
|
Edje_Pack_Element *pack_it = NULL;
|
2008-11-23 21:15:15 -08:00
|
|
|
const char *source = NULL;
|
2009-08-11 03:06:37 -07:00
|
|
|
|
|
|
|
switch (rp->part->type)
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2009-08-11 03:06:37 -07:00
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
source = rp->part->source;
|
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
if (rp->part->items)
|
|
|
|
{
|
|
|
|
curr_item = rp->part->items;
|
2010-07-29 05:02:36 -07:00
|
|
|
item_count = rp->part->items_count;
|
|
|
|
if (item_count > 0)
|
|
|
|
{
|
|
|
|
pack_it = *curr_item;
|
|
|
|
source = pack_it->source;
|
|
|
|
item_count--;
|
|
|
|
curr_item++;
|
|
|
|
}
|
2009-08-11 03:06:37 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2011-12-16 02:17:55 -08:00
|
|
|
/* This list should only be filled by group, box or table, nothing else. */
|
|
|
|
abort();
|
2009-08-11 03:06:37 -07:00
|
|
|
continue;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
2009-08-11 03:06:37 -07:00
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
while (source)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2008-05-30 04:20:49 -07:00
|
|
|
Evas_Object *child_obj;
|
2008-11-23 21:15:15 -08:00
|
|
|
const char *group_path_entry = eina_stringshare_add(source);
|
2008-10-22 04:34:42 -07:00
|
|
|
const char *data;
|
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
if (!group_path)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
group_path = eina_list_append(NULL, eina_stringshare_add(group));
|
2008-05-30 04:20:49 -07:00
|
|
|
group_path_started = 1;
|
|
|
|
}
|
|
|
|
/* make sure that this group isn't already in the tree of parents */
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(group_path, l, data)
|
2008-05-30 04:20:49 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
if (data == group_path_entry)
|
2008-05-30 04:20:49 -07:00
|
|
|
{
|
2011-12-19 08:00:06 -08:00
|
|
|
ERR("recursive loop group '%s' already included inside part '%s' of group '%s' from file '%s'",
|
|
|
|
group_path_entry, rp->part->name, group, file);
|
2011-12-16 02:17:55 -08:00
|
|
|
textblocks = eina_list_free(textblocks);
|
|
|
|
externals = eina_list_free(externals);
|
|
|
|
sources = eina_list_free(sources);
|
2008-05-30 04:20:49 -07:00
|
|
|
_edje_thaw(ed);
|
|
|
|
_edje_unblock(ed);
|
|
|
|
_edje_unref(ed);
|
|
|
|
_edje_file_del(ed);
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(group_path_entry);
|
2008-05-30 04:20:49 -07:00
|
|
|
if (group_path_started)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
eina_stringshare_del(eina_list_data_get(group_path));
|
|
|
|
eina_list_free(group_path);
|
2008-05-30 04:20:49 -07:00
|
|
|
}
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE;
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2008-05-30 04:20:49 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2011-12-16 02:17:55 -08:00
|
|
|
|
2011-03-24 20:21:07 -07:00
|
|
|
child_obj = edje_object_add(ed->base.evas);
|
2008-10-22 04:34:42 -07:00
|
|
|
group_path = eina_list_append(group_path, group_path_entry);
|
2011-06-06 06:10:54 -07:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP)
|
|
|
|
{
|
2011-06-07 00:43:32 -07:00
|
|
|
_edje_real_part_swallow(rp, child_obj, EINA_FALSE);
|
2011-06-06 06:10:54 -07:00
|
|
|
}
|
|
|
|
|
2011-06-06 10:29:07 -07:00
|
|
|
if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path))
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2011-12-19 08:00:06 -08:00
|
|
|
ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'",
|
|
|
|
rp->part->name, group_path_entry, file, source);
|
2011-12-16 02:17:55 -08:00
|
|
|
textblocks = eina_list_free(textblocks);
|
|
|
|
externals = eina_list_free(externals);
|
|
|
|
sources = eina_list_free(sources);
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_thaw(ed);
|
|
|
|
_edje_unblock(ed);
|
|
|
|
_edje_unref(ed);
|
|
|
|
_edje_file_del(ed);
|
2011-12-16 02:17:55 -08:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
if (group_path_started)
|
|
|
|
{
|
2008-05-30 04:20:49 -07:00
|
|
|
while (group_path)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
eina_stringshare_del(eina_list_data_get(group_path));
|
|
|
|
group_path = eina_list_remove_list(group_path, group_path);
|
2008-05-30 04:20:49 -07:00
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
2008-05-30 04:20:49 -07:00
|
|
|
ed->load_error = edje_object_load_error_get(child_obj);
|
2011-11-18 20:16:32 -08:00
|
|
|
evas_object_del(child_obj);
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2007-05-26 22:28:07 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2011-02-24 06:41:08 -08:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
group_path = eina_list_remove(group_path, group_path_entry);
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(group_path_entry);
|
2010-02-23 05:39:19 -08:00
|
|
|
|
2011-11-24 03:51:11 -08:00
|
|
|
edje_object_propagate_callback_add(child_obj,
|
|
|
|
_cb_signal_repeat,
|
|
|
|
obj);
|
2008-11-23 21:15:15 -08:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP)
|
|
|
|
{
|
2011-06-07 00:43:32 -07:00
|
|
|
_edje_real_part_swallow(rp, child_obj, EINA_TRUE);
|
2011-11-18 20:23:27 -08:00
|
|
|
_edje_subobj_register(ed, child_obj);
|
2008-11-23 21:15:15 -08:00
|
|
|
source = NULL;
|
|
|
|
}
|
2008-12-17 18:43:20 -08:00
|
|
|
else
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2011-02-24 06:41:08 -08:00
|
|
|
pack_it->parent = rp;
|
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
_edje_object_pack_item_hints_set(child_obj, pack_it);
|
|
|
|
if (pack_it->name)
|
2011-02-24 06:41:08 -08:00
|
|
|
evas_object_name_set(child_obj, pack_it->name);
|
|
|
|
|
2008-12-17 18:43:20 -08:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_BOX)
|
|
|
|
{
|
|
|
|
_edje_real_part_box_append(rp, child_obj);
|
|
|
|
evas_object_data_set(child_obj, "\377 edje.box_item", pack_it);
|
|
|
|
}
|
2011-11-17 23:18:19 -08:00
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_TABLE)
|
2008-12-17 18:43:20 -08:00
|
|
|
{
|
|
|
|
_edje_real_part_table_pack(rp, child_obj, pack_it->col, pack_it->row, pack_it->colspan, pack_it->rowspan);
|
|
|
|
evas_object_data_set(child_obj, "\377 edje.table_item", pack_it);
|
|
|
|
}
|
2011-11-18 20:23:27 -08:00
|
|
|
_edje_subobj_register(ed, child_obj);
|
|
|
|
evas_object_show(child_obj);
|
2008-11-23 21:15:15 -08:00
|
|
|
rp->items = eina_list_append(rp->items, child_obj);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
if (item_count > 0)
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
pack_it = *curr_item;
|
2008-11-23 21:15:15 -08:00
|
|
|
source = pack_it->source;
|
2010-07-29 05:02:36 -07:00
|
|
|
curr_item++;
|
|
|
|
item_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
source = NULL;
|
|
|
|
curr_item = NULL;
|
|
|
|
pack_it = NULL;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
}
|
2011-09-22 00:19:50 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
if (group_path_started)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2009-08-11 03:06:37 -07:00
|
|
|
const char *str;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(group_path, str)
|
|
|
|
eina_stringshare_del(str);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
2011-09-22 00:19:50 -07:00
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
/* reswallow any swallows that existed before setting the file */
|
2012-05-18 07:37:21 -07:00
|
|
|
if (collect)
|
2012-05-09 22:37:38 -07:00
|
|
|
{
|
2012-05-18 07:37:21 -07:00
|
|
|
Edje_User_Defined *eud;
|
|
|
|
Eina_List *boxes = NULL;
|
2012-05-09 22:37:38 -07:00
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
EINA_LIST_FREE(collect, eud)
|
2012-05-09 22:37:38 -07:00
|
|
|
{
|
2012-06-13 18:20:26 -07:00
|
|
|
Evas_Object *child = NULL;
|
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
switch (eud->type)
|
|
|
|
{
|
|
|
|
case EDJE_USER_SWALLOW:
|
|
|
|
edje_object_part_swallow(obj, eud->part, eud->u.swallow.child);
|
2012-06-13 18:20:26 -07:00
|
|
|
child = eud->u.swallow.child;
|
2012-05-18 07:37:21 -07:00
|
|
|
break;
|
|
|
|
case EDJE_USER_BOX_PACK:
|
|
|
|
boxes = eina_list_append(boxes, eud);
|
|
|
|
eud = NULL;
|
|
|
|
break;
|
|
|
|
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);
|
2012-06-13 18:20:26 -07:00
|
|
|
child = eud->u.table.child;
|
2012-05-18 07:37:21 -07:00
|
|
|
break;
|
|
|
|
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:
|
|
|
|
edje_object_part_text_set(obj, eud->part, eud->u.string.text);
|
|
|
|
eina_stringshare_del(eud->u.string.text);
|
|
|
|
break;
|
|
|
|
}
|
2012-06-13 18:20:26 -07:00
|
|
|
if (eud) _edje_user_definition_remove(eud, child);
|
2012-05-09 22:37:38 -07:00
|
|
|
}
|
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
boxes = eina_list_sort(boxes, -1, _sort_defined_boxes);
|
|
|
|
EINA_LIST_FREE(boxes, eud)
|
2012-05-14 04:18:45 -07:00
|
|
|
{
|
2012-05-18 07:37:21 -07:00
|
|
|
edje_object_part_box_append(obj, eud->part, eud->u.box.child);
|
2012-06-13 18:20:26 -07:00
|
|
|
_edje_user_definition_remove(eud, eud->u.box.child);
|
2012-05-14 04:18:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
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");
|
|
|
|
|
2008-05-30 04:20:49 -07:00
|
|
|
_edje_recalc(ed);
|
|
|
|
_edje_thaw(ed);
|
|
|
|
_edje_unblock(ed);
|
|
|
|
_edje_unref(ed);
|
2008-05-30 07:27:56 -07:00
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
|
|
|
_edje_emit(ed, "load", NULL);
|
2011-12-16 02:17:55 -08:00
|
|
|
|
|
|
|
/* instantiate 'internal textblock style' */
|
|
|
|
EINA_LIST_FREE(textblocks, rp)
|
|
|
|
if (rp->part->default_desc)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *text;
|
|
|
|
Edje_Style *stl = NULL;
|
|
|
|
const char *style;
|
|
|
|
|
|
|
|
text = (Edje_Part_Description_Text *) rp->part->default_desc;
|
|
|
|
style = edje_string_get(&text->text.style);
|
|
|
|
if (style)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
|
|
|
{
|
|
|
|
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
|
|
|
stl = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (stl)
|
|
|
|
{
|
|
|
|
if (evas_object_textblock_style_get(rp->object) != stl->style)
|
|
|
|
evas_object_textblock_style_set(rp->object, stl->style);
|
|
|
|
}
|
|
|
|
}
|
2007-03-16 14:37:57 -07:00
|
|
|
}
|
2010-02-17 15:43:31 -08:00
|
|
|
_edje_entry_init(ed);
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2003-09-29 13:43:37 -07:00
|
|
|
return 1;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2003-10-19 23:10:09 -07:00
|
|
|
else
|
2011-05-27 03:32:53 -07:00
|
|
|
{
|
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
|
|
|
return 0;
|
|
|
|
}
|
2003-10-19 23:10:09 -07:00
|
|
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
2010-02-17 15:43:31 -08:00
|
|
|
_edje_entry_init(ed);
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2003-10-19 23:10:09 -07:00
|
|
|
return 1;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_file_add(Edje *ed)
|
|
|
|
{
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!_edje_edd_edje_file) return;
|
2008-08-14 11:04:43 -07:00
|
|
|
ed->file = _edje_cache_file_coll_open(ed->path, ed->group,
|
2007-09-08 11:31:56 -07:00
|
|
|
&(ed->load_error),
|
2012-05-09 02:16:52 -07:00
|
|
|
&(ed->collection),
|
|
|
|
ed);
|
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
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
if (ed->file)
|
2003-06-26 07:04:31 -07:00
|
|
|
{
|
2005-10-05 01:38:04 -07:00
|
|
|
_edje_cache_file_unref(ed->file);
|
2003-06-26 07:04:31 -07:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_List *
|
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;
|
|
|
|
Eina_List *collect;
|
|
|
|
Eina_List *l;
|
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
|
|
|
|
2012-05-18 07:37:21 -07:00
|
|
|
EINA_LIST_FOREACH(collect, l, eud)
|
2012-05-14 04:18:45 -07:00
|
|
|
{
|
2012-05-18 07:37:21 -07:00
|
|
|
switch (eud->type)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
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->part->type != EDJE_PART_TYPE_BOX) continue ;
|
|
|
|
|
|
|
|
children = evas_object_box_children_get(rp->object);
|
|
|
|
EINA_LIST_FREE(children, child)
|
|
|
|
if (!evas_object_data_get(child, "\377 edje.box_item"))
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(l, ls, search)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_edje_real_part_box_remove(rp, child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDJE_USER_TABLE_PACK:
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, eud->part);
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TABLE) continue ;
|
|
|
|
|
|
|
|
_edje_real_part_table_unpack(rp, eud->u.table.child);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_USER_SWALLOW:
|
|
|
|
edje_object_part_unswallow(NULL, eud->u.swallow.child);
|
|
|
|
break;
|
|
|
|
case EDJE_USER_DRAG_STEP:
|
|
|
|
case EDJE_USER_DRAG_PAGE:
|
|
|
|
case EDJE_USER_DRAG_VALUE:
|
|
|
|
case EDJE_USER_DRAG_SIZE:
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
void
|
|
|
|
_edje_file_del(Edje *ed)
|
|
|
|
{
|
2012-05-18 07:37:21 -07:00
|
|
|
Edje_User_Defined *eud;
|
2012-06-12 09:29:11 -07:00
|
|
|
Evas *tev = NULL;
|
|
|
|
|
|
|
|
if (ed->obj) tev = evas_object_evas_get(ed->obj);
|
2012-05-18 07:37:21 -07:00
|
|
|
|
2012-06-12 09:29:11 -07:00
|
|
|
if (tev) evas_event_freeze(tev);
|
2010-02-14 22:40:58 -08:00
|
|
|
if (ed->freeze_calc)
|
|
|
|
{
|
|
|
|
_edje_freeze_calc_list = eina_list_remove(_edje_freeze_calc_list, ed);
|
|
|
|
ed->freeze_calc = 0;
|
|
|
|
_edje_freeze_calc_count--;
|
|
|
|
}
|
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);
|
2008-02-26 12:12:00 -08:00
|
|
|
_edje_programs_patterns_clean(ed);
|
2010-06-03 23:45:46 -07:00
|
|
|
// if (ed->collection)
|
|
|
|
// {
|
|
|
|
// if (ed->collection->script) _edje_embryo_script_shutdown(ed);
|
|
|
|
// }
|
2008-02-26 10:41:44 -08:00
|
|
|
|
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
|
|
|
|
|
|
|
while (ed->user_defined)
|
|
|
|
{
|
|
|
|
eud = eina_list_data_get(ed->user_defined);
|
|
|
|
_edje_user_definition_free(eud);
|
|
|
|
}
|
|
|
|
|
2007-05-26 16:57:21 -07:00
|
|
|
if (ed->table_parts)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2007-05-26 16:57:21 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2007-05-26 16:57:21 -07:00
|
|
|
rp = ed->table_parts[i];
|
2008-10-13 02:19:04 -07:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_real_part_shutdown(rp);
|
2004-12-02 01:21:22 -08:00
|
|
|
if (rp->object)
|
|
|
|
{
|
2010-02-23 05:39:19 -08:00
|
|
|
_edje_callbacks_del(rp->object, ed);
|
|
|
|
_edje_callbacks_focus_del(rp->object, ed);
|
2004-12-02 01:21:22 -08:00
|
|
|
evas_object_del(rp->object);
|
|
|
|
}
|
2003-07-20 05:37:49 -07:00
|
|
|
if (rp->swallowed_object)
|
|
|
|
{
|
2009-11-09 15:47:42 -08:00
|
|
|
_edje_real_part_swallow_clear(rp);
|
2008-03-24 01:22:01 -07:00
|
|
|
/* Objects swallowed by the app do not get deleted,
|
2008-02-22 02:42:50 -08:00
|
|
|
but those internally swallowed (GROUP type) do. */
|
2009-10-31 11:07:08 -07:00
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
|
|
|
_edje_external_parsed_params_free(rp->swallowed_object, rp->param1.external_params);
|
|
|
|
if (rp->param2)
|
|
|
|
_edje_external_parsed_params_free(rp->swallowed_object, rp->param2->external_params);
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
evas_object_del(rp->swallowed_object);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-09-12 10:42:21 -07:00
|
|
|
rp->swallowed_object = NULL;
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
2008-11-23 21:15:15 -08:00
|
|
|
if (rp->items)
|
|
|
|
{
|
2009-08-11 03:06:37 -07:00
|
|
|
/* evas_box/table handles deletion of objects */
|
|
|
|
rp->items = eina_list_free(rp->items);
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
2010-09-28 17:28:54 -07:00
|
|
|
if (rp->anim)
|
|
|
|
{
|
|
|
|
_edje_box_layout_free_data(rp->anim);
|
|
|
|
rp->anim = NULL;
|
|
|
|
}
|
2008-10-15 07:11:11 -07:00
|
|
|
if (rp->text.text) eina_stringshare_del(rp->text.text);
|
|
|
|
if (rp->text.font) eina_stringshare_del(rp->text.font);
|
|
|
|
if (rp->text.cache.in_str) eina_stringshare_del(rp->text.cache.in_str);
|
|
|
|
if (rp->text.cache.out_str) eina_stringshare_del(rp->text.cache.out_str);
|
2004-10-29 10:56:12 -07:00
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
if (rp->custom)
|
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
|
|
|
{
|
2010-04-06 04:26:32 -07:00
|
|
|
// xxx: lua2
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_collection_free_part_description_clean(rp->part->type,
|
|
|
|
rp->custom->description,
|
|
|
|
ed->file->free_strings);
|
|
|
|
free(rp->custom->description);
|
|
|
|
rp->custom->description = NULL;
|
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
|
|
|
}
|
2004-10-29 10:56:12 -07:00
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
/* Cleanup optional part. */
|
2009-08-11 06:07:46 -07:00
|
|
|
free(rp->drag);
|
2010-06-01 06:31:07 -07:00
|
|
|
free(rp->param1.set);
|
2009-08-11 06:07:46 -07:00
|
|
|
|
2010-06-01 06:31:07 -07:00
|
|
|
if (rp->param2)
|
|
|
|
free(rp->param2->set);
|
2009-08-14 10:19:42 -07:00
|
|
|
eina_mempool_free(_edje_real_part_state_mp, rp->param2);
|
2010-06-01 06:31:07 -07:00
|
|
|
|
|
|
|
if (rp->custom)
|
|
|
|
free(rp->custom->set);
|
2009-08-14 10:19:42 -07:00
|
|
|
eina_mempool_free(_edje_real_part_state_mp, rp->custom);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_unref(rp->edje);
|
2009-08-14 10:19:42 -07:00
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
}
|
2008-12-08 06:23:26 -08:00
|
|
|
if ((ed->file) && (ed->collection))
|
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2008-12-08 06:23:26 -08:00
|
|
|
|
|
|
|
_edje_textblock_styles_del(ed);
|
2010-07-29 05:02:36 -07:00
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
2009-09-10 17:48:57 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
ep = ed->collection->parts[i];
|
|
|
|
|
|
|
|
_edje_text_part_on_del(ed, ep);
|
|
|
|
_edje_color_class_on_del(ed, ep);
|
2009-09-10 17:48:57 -07:00
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2008-12-08 06:23:26 -08:00
|
|
|
_edje_cache_coll_unref(ed->file, ed->collection);
|
|
|
|
ed->collection = NULL;
|
|
|
|
}
|
2008-03-01 18:34:23 -08:00
|
|
|
if (ed->file)
|
|
|
|
{
|
2012-05-09 02:16:52 -07:00
|
|
|
#ifdef HAVE_EIO
|
|
|
|
ed->file->edjes = eina_list_remove(ed->file->edjes, ed);
|
|
|
|
#endif
|
|
|
|
_edje_cache_file_unref(ed->file);
|
2008-03-01 18:34:23 -08:00
|
|
|
ed->file = NULL;
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
if (ed->actions)
|
|
|
|
{
|
2009-08-11 03:06:37 -07:00
|
|
|
Edje_Running_Program *runp;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2009-08-11 03:06:37 -07:00
|
|
|
EINA_LIST_FREE(ed->actions, runp)
|
|
|
|
{
|
2003-06-26 07:04:31 -07:00
|
|
|
_edje_anim_count--;
|
|
|
|
free(runp);
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2008-10-22 04:34:42 -07:00
|
|
|
_edje_animators = eina_list_remove(_edje_animators, ed);
|
2003-06-27 21:20:41 -07:00
|
|
|
if (ed->pending_actions)
|
|
|
|
{
|
2009-08-11 03:06:37 -07:00
|
|
|
Edje_Pending_Program *pp;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2009-08-11 03:06:37 -07:00
|
|
|
EINA_LIST_FREE(ed->pending_actions, pp)
|
|
|
|
{
|
2003-06-27 21:20:41 -07:00
|
|
|
ecore_timer_del(pp->timer);
|
|
|
|
free(pp);
|
|
|
|
}
|
|
|
|
}
|
2012-05-18 07:37:21 -07:00
|
|
|
|
2011-11-17 23:18:19 -08:00
|
|
|
if (ed->L) _edje_lua2_script_shutdown(ed);
|
2012-06-10 04:14:42 -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;
|
|
|
|
if (ed->table_programs) free(ed->table_programs);
|
|
|
|
ed->table_programs = NULL;
|
|
|
|
ed->table_programs_size = 0;
|
2010-12-06 05:50:51 -08:00
|
|
|
ed->focused_part = NULL;
|
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)
|
|
|
|
{
|
2009-08-11 03:06:37 -07:00
|
|
|
Edje_Color_Class *ecc;
|
2012-05-09 02:16:52 -07:00
|
|
|
#ifdef HAVE_EIO
|
|
|
|
Ecore_Event_Handler *event;
|
|
|
|
#endif
|
2009-08-11 03:06:37 -07:00
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
#define HASH_FREE(Hash) \
|
2010-08-09 10:34:03 -07:00
|
|
|
if (Hash) eina_hash_free(Hash); \
|
2010-06-28 06:56:30 -07:00
|
|
|
Hash = NULL;
|
|
|
|
|
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);
|
|
|
|
|
2003-07-07 00:55:18 -07:00
|
|
|
if (edf->image_dir)
|
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
if (edf->free_strings)
|
2009-08-11 03:06:37 -07:00
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
for (i = 0; i < edf->image_dir->entries_count; ++i)
|
|
|
|
eina_stringshare_del(edf->image_dir->entries[i].entry);
|
2003-07-07 00:55:18 -07:00
|
|
|
}
|
2010-06-29 06:48:03 -07:00
|
|
|
|
|
|
|
/* Sets have been added after edje received eet dictionnary support */
|
|
|
|
for (i = 0; i < edf->image_dir->sets_count; ++i)
|
|
|
|
{
|
|
|
|
Edje_Image_Directory_Set_Entry *se;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(edf->image_dir->sets[i].entries, se)
|
|
|
|
free(se);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(edf->image_dir->entries);
|
|
|
|
free(edf->image_dir->sets);
|
2003-07-07 00:55:18 -07:00
|
|
|
free(edf->image_dir);
|
|
|
|
}
|
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
|
|
|
|
2010-08-12 08:05:56 -07:00
|
|
|
if (edf->external_dir)
|
|
|
|
{
|
|
|
|
if (edf->external_dir->entries) free(edf->external_dir->entries);
|
|
|
|
free(edf->external_dir);
|
|
|
|
}
|
|
|
|
|
2009-08-11 03:06:37 -07:00
|
|
|
EINA_LIST_FREE(edf->color_classes, ecc)
|
2006-01-10 19:19:46 -08:00
|
|
|
{
|
2008-10-15 07:11:11 -07:00
|
|
|
if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name);
|
2006-01-10 19:19:46 -08:00
|
|
|
free(ecc);
|
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2010-06-28 10:18:47 -07:00
|
|
|
if (edf->collection_patterns) edje_match_patterns_free(edf->collection_patterns);
|
2012-05-09 02:16:52 -07:00
|
|
|
#ifdef HAVE_EIO
|
|
|
|
if (edf->timeout) ecore_timer_del(edf->timeout);
|
|
|
|
EINA_LIST_FREE(edf->handlers, event)
|
|
|
|
ecore_event_handler_del(event);
|
|
|
|
eio_monitor_del(edf->monitor);
|
|
|
|
#endif
|
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);
|
2005-10-05 01:38:04 -07:00
|
|
|
_edje_textblock_style_cleanup(edf);
|
2008-02-29 22:38:09 -08:00
|
|
|
if (edf->ef) eet_close(edf->ef);
|
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)
|
|
|
|
{
|
|
|
|
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);
|
2011-11-04 05:18:13 -07:00
|
|
|
if (pr->sample_name) eina_stringshare_del(pr->sample_name);
|
|
|
|
if (pr->tone_name) eina_stringshare_del(pr->tone_name);
|
2010-08-04 07:25:40 -07:00
|
|
|
}
|
|
|
|
EINA_LIST_FREE(pr->targets, prt)
|
|
|
|
free(prt);
|
|
|
|
EINA_LIST_FREE(pr->after, pa)
|
|
|
|
free(pa);
|
|
|
|
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
|
|
|
|
|
|
|
#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);
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int j;
|
|
|
|
|
|
|
|
ep = ec->parts[i];
|
2003-11-24 23:22:19 -08:00
|
|
|
|
2008-10-15 07:11:11 -07:00
|
|
|
if (edf->free_strings && ep->name) eina_stringshare_del(ep->name);
|
2003-11-24 23:22:19 -08:00
|
|
|
if (ep->default_desc)
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_collection_free_part_description_clean(ep->type, ep->default_desc, edf->free_strings);
|
2003-11-24 23:22:19 -08:00
|
|
|
ep->default_desc = NULL;
|
|
|
|
}
|
2010-08-09 10:34:03 -07:00
|
|
|
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
|
|
|
|
2010-08-09 10:34:03 -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() */
|
|
|
|
if(ep->other.desc_rtl)
|
|
|
|
free(ep->other.desc_rtl);
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
free(ep->items);
|
2010-10-22 20:51:12 -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"?
|
|
|
|
eina_mempool_free(ce->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)
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_String *es;
|
|
|
|
|
|
|
|
it = eina_hash_iterator_data_new(ec->data);
|
|
|
|
EINA_ITERATOR_FOREACH(it, es)
|
|
|
|
free(es);
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
eina_hash_free(ec->data);
|
|
|
|
}
|
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)
|
|
|
|
{
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(ec->prog_cache.matches,
|
2007-09-08 11:31:56 -07:00
|
|
|
_edje_collection_free_prog_cache_matches_free_cb,
|
2003-07-29 19:58:22 -07:00
|
|
|
NULL);
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_free(ec->prog_cache.matches);
|
2003-07-19 19:08:47 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
#endif
|
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
|
|
|
|
|
|
|
/* Destroy all part and description. */
|
|
|
|
eina_mempool_del(ce->mp.RECTANGLE);
|
|
|
|
eina_mempool_del(ce->mp.TEXT);
|
|
|
|
eina_mempool_del(ce->mp.IMAGE);
|
2011-03-11 09:46:29 -08:00
|
|
|
eina_mempool_del(ce->mp.PROXY);
|
2010-07-29 05:02:36 -07:00
|
|
|
eina_mempool_del(ce->mp.SWALLOW);
|
|
|
|
eina_mempool_del(ce->mp.TEXTBLOCK);
|
|
|
|
eina_mempool_del(ce->mp.GROUP);
|
|
|
|
eina_mempool_del(ce->mp.BOX);
|
|
|
|
eina_mempool_del(ce->mp.TABLE);
|
|
|
|
eina_mempool_del(ce->mp.EXTERNAL);
|
2012-06-12 20:21:31 -07:00
|
|
|
eina_mempool_del(ce->mp.SPACER);
|
2010-07-29 05:02:36 -07:00
|
|
|
eina_mempool_del(ce->mp.part);
|
|
|
|
memset(&ce->mp, 0, sizeof (ce->mp));
|
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
eina_mempool_del(ce->mp_rtl.RECTANGLE);
|
|
|
|
eina_mempool_del(ce->mp_rtl.TEXT);
|
|
|
|
eina_mempool_del(ce->mp_rtl.IMAGE);
|
2011-03-11 09:46:29 -08:00
|
|
|
eina_mempool_del(ce->mp_rtl.PROXY);
|
2011-02-01 05:26:49 -08:00
|
|
|
eina_mempool_del(ce->mp_rtl.SWALLOW);
|
|
|
|
eina_mempool_del(ce->mp_rtl.TEXTBLOCK);
|
|
|
|
eina_mempool_del(ce->mp_rtl.GROUP);
|
|
|
|
eina_mempool_del(ce->mp_rtl.BOX);
|
|
|
|
eina_mempool_del(ce->mp_rtl.TABLE);
|
|
|
|
eina_mempool_del(ce->mp_rtl.EXTERNAL);
|
2012-06-12 20:21:31 -07:00
|
|
|
eina_mempool_del(ce->mp_rtl.SPACER);
|
2011-02-01 05:26:49 -08:00
|
|
|
memset(&ce->mp_rtl, 0, sizeof (ce->mp_rtl));
|
2003-07-19 19:08:47 -07:00
|
|
|
free(ec);
|
2010-07-29 05:02:36 -07:00
|
|
|
ce->ref = NULL;
|
2003-07-19 19:08:47 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
if (free_strings && desc->color_class) eina_stringshare_del(desc->color_class);
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Image *img;
|
2010-08-03 05:58:31 -07:00
|
|
|
unsigned int i;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
img = (Edje_Part_Description_Image *) desc;
|
|
|
|
|
2010-08-03 05:58:31 -07:00
|
|
|
for (i = 0; i < img->image.tweens_count; ++i)
|
|
|
|
free(img->image.tweens[i]);
|
2010-08-14 03:28:57 -07:00
|
|
|
free(img->image.tweens);
|
2010-08-03 05:58:31 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_External *external;
|
|
|
|
|
|
|
|
external = (Edje_Part_Description_External *) desc;
|
|
|
|
|
|
|
|
if (external->external_params)
|
|
|
|
_edje_external_params_free(external->external_params, free_strings);
|
2010-08-03 05:58:31 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
|
|
|
if (free_strings)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *text;
|
|
|
|
|
|
|
|
text = (Edje_Part_Description_Text *) desc;
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
if (text->text.text.str) eina_stringshare_del(text->text.text.str);
|
2010-07-29 05:02:36 -07:00
|
|
|
if (text->text.text_class) eina_stringshare_del(text->text.text_class);
|
2010-08-12 05:58:54 -07:00
|
|
|
if (text->text.style.str) eina_stringshare_del(text->text.style.str);
|
|
|
|
if (text->text.font.str) eina_stringshare_del(text->text.font.str);
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2010-08-03 05:58:31 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_collection_free_part_description_free(int type,
|
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce,
|
|
|
|
Eina_Bool free_strings)
|
|
|
|
{
|
|
|
|
#define FREE_POOL(Type, Ce, Desc) \
|
2010-08-06 12:16:43 -07:00
|
|
|
case EDJE_PART_TYPE_##Type: eina_mempool_free(Ce->mp.Type, Desc); \
|
|
|
|
ce->count.Type--; \
|
|
|
|
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
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
FREE_POOL(RECTANGLE, ce, desc);
|
|
|
|
FREE_POOL(TEXT, ce, desc);
|
|
|
|
FREE_POOL(IMAGE, ce, desc);
|
2011-03-11 09:46:29 -08:00
|
|
|
FREE_POOL(PROXY, ce, desc);
|
2010-07-29 05:02:36 -07:00
|
|
|
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);
|
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
|
|
|
|
_edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
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
|
|
|
}
|
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;
|
|
|
|
|
|
|
|
minw = it->min.w;
|
|
|
|
minh = it->min.h;
|
|
|
|
|
|
|
|
if ((minw <= 0) && (minh <= 0))
|
|
|
|
{
|
|
|
|
edje_object_size_min_get(obj, &w, &h);
|
|
|
|
if ((w <= 0) && (h <= 0))
|
|
|
|
edje_object_size_min_calc(obj, &w, &h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
w = minw;
|
|
|
|
h = minh;
|
|
|
|
}
|
|
|
|
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));
|
2008-11-23 21:15:15 -08:00
|
|
|
evas_object_size_hint_aspect_set(obj, it->aspect.mode, it->aspect.w, it->aspect.h);
|
|
|
|
|
|
|
|
evas_object_resize(obj, w, h);
|
|
|
|
}
|
|
|
|
|
2010-10-12 06:26:18 -07:00
|
|
|
static const char *
|
|
|
|
_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;
|
2008-04-10 01:58:19 -07:00
|
|
|
Evas_Object *parent;
|
|
|
|
Edje *ed;
|
2010-10-12 06:26:18 -07:00
|
|
|
Edje *ed_parent;
|
2008-04-10 01:58:19 -07:00
|
|
|
char new_src[4096]; /* XXX is this max reasonable? */
|
2009-10-25 05:17:05 -07:00
|
|
|
size_t length_parent = 0;
|
2011-02-24 06:41:08 -08:00
|
|
|
size_t length_index = 0;
|
2009-10-25 05:17:05 -07:00
|
|
|
size_t length_source;
|
2011-02-24 06:41:08 -08:00
|
|
|
int i = 0;
|
2010-10-12 06:26:18 -07:00
|
|
|
const char *alias = 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");
|
|
|
|
if (pack_it)
|
|
|
|
{
|
|
|
|
if (!pack_it->name)
|
|
|
|
{
|
|
|
|
Eina_List *child = NULL;
|
|
|
|
Evas_Object *o;
|
|
|
|
|
|
|
|
if (pack_it->parent->part->type == EDJE_PART_TYPE_BOX)
|
|
|
|
{
|
|
|
|
child = evas_object_box_children_get(pack_it->parent->object);
|
|
|
|
}
|
|
|
|
else if (pack_it->parent->part->type == EDJE_PART_TYPE_TABLE)
|
|
|
|
{
|
|
|
|
child = evas_object_table_children_get(pack_it->parent->object);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FREE(child, o)
|
|
|
|
{
|
|
|
|
if (o == obj) break;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_list_free(child);
|
|
|
|
|
|
|
|
length_index = 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length_index = strlen(pack_it->name) + 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
if (length_index == 12)
|
|
|
|
length_parent += eina_convert_itoa(i, new_src + length_parent);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(new_src + length_parent, pack_it->name, length_index);
|
|
|
|
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);
|
|
|
|
length ++; /* Remove the trailing ':' from the count */
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-11-18 19:24:37 -08:00
|
|
|
|
|
|
|
emsg.sig = sig;
|
|
|
|
emsg.src = alias ? alias : new_src;
|
|
|
|
emsg.data = NULL;
|
2011-11-24 03:51:11 -08:00
|
|
|
_edje_message_send(ed_parent, EDJE_QUEUE_SCRIPT,
|
|
|
|
EDJE_MESSAGE_SIGNAL, 0, &emsg);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|