summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJeahwan Kim <jae.hwan.kim@samsung.com>2010-09-08 08:58:46 +0900
committerJeahwan Kim <jae.hwan.kim@samsung.com>2010-09-08 08:58:46 +0900
commitdd10b404eaf7e5c7b6a65c90870087dfcb1c9703 (patch)
tree03c01e1fab81f50ec3ca4b1b8f87e9c405a43209 /src/lib
parentd41ea6401aa2a86b6783e3e56ff4cbe58a529453 (diff)
downloadedje-dd10b404eaf7e5c7b6a65c90870087dfcb1c9703.tar.gz
edje-dd10b404eaf7e5c7b6a65c90870087dfcb1c9703.tar.bz2
edje-dd10b404eaf7e5c7b6a65c90870087dfcb1c9703.zip
svn update: 51464 (latest:51480)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Edje.h6
-rw-r--r--src/lib/Edje_Edit.h135
-rw-r--r--src/lib/Makefile.am11
-rw-r--r--src/lib/edje_cache.c262
-rw-r--r--src/lib/edje_calc.c506
-rw-r--r--src/lib/edje_callbacks.c35
-rw-r--r--src/lib/edje_container.c4
-rw-r--r--src/lib/edje_container.h4
-rw-r--r--src/lib/edje_convert.c500
-rw-r--r--src/lib/edje_convert.h143
-rw-r--r--src/lib/edje_data.c764
-rw-r--r--src/lib/edje_edit.c4401
-rw-r--r--src/lib/edje_embryo.c646
-rw-r--r--src/lib/edje_entry.c458
-rw-r--r--src/lib/edje_external.c74
-rw-r--r--src/lib/edje_load.c620
-rw-r--r--src/lib/edje_lua.c601
-rw-r--r--src/lib/edje_lua2.c1837
-rw-r--r--src/lib/edje_lua_script_only.c67
-rw-r--r--src/lib/edje_main.c16
-rw-r--r--src/lib/edje_match.c126
-rw-r--r--src/lib/edje_message_queue.c25
-rw-r--r--src/lib/edje_module.c171
-rw-r--r--src/lib/edje_private.h615
-rw-r--r--src/lib/edje_program.c102
-rw-r--r--src/lib/edje_script_only.c4
-rw-r--r--src/lib/edje_smart.c9
-rw-r--r--src/lib/edje_text.c100
-rw-r--r--src/lib/edje_textblock_styles.c10
-rw-r--r--src/lib/edje_util.c400
-rw-r--r--src/lib/edje_var.c16
31 files changed, 7305 insertions, 5363 deletions
diff --git a/src/lib/Edje.h b/src/lib/Edje.h
index 809bf49..5f2afbc 100644
--- a/src/lib/Edje.h
+++ b/src/lib/Edje.h
@@ -38,8 +38,8 @@
extern "C" {
#endif
-#define EDJE_VERSION_MAJOR 0
-#define EDJE_VERSION_MINOR 9
+#define EDJE_VERSION_MAJOR 1
+#define EDJE_VERSION_MINOR 0
typedef struct _Edje_Version
{
@@ -384,6 +384,7 @@ struct _Edje_External_Type
void (*signal_emit) (void *data, Evas_Object *obj, const char *emission, const char *source); /**< Feed a signal emitted with emission originally set as part_name:signal to this object (without the "part_name:" prefix) */
Eina_Bool (*param_set) (void *data, Evas_Object *obj, const Edje_External_Param *param); /**< dynamically change a parameter of this external, called by scripts and user code. Returns @c EINA_TRUE on success */
Eina_Bool (*param_get) (void *data, const Evas_Object *obj, Edje_External_Param *param); /**< dynamically fetch a parameter of this external, called by scripts and user code. Returns @c EINA_TRUE on success. (Must check parameter name and type!) */
+ Evas_Object *(*content_get) (void *data, const Evas_Object *obj, const char *content); /**< dynamically fetch a sub object of this external, called by scripts and user code. Returns @c Evas_Object * on success. (Must check parameter name and type!) */
void *(*params_parse) (void *data, Evas_Object *obj, const Eina_List *params); /**< parses the list of parameters, converting into a friendly representation. Used with state_set() */
void (*params_free) (void *params); /**< free parameters parsed with params_parse() */
@@ -555,6 +556,7 @@ typedef void (*Edje_Message_Handler_Cb) (void *data, Evas_Object *obj, Edje_Mess
EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part);
EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param);
EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param);
+ EAPI Evas_Object *edje_object_part_external_content_get (const Evas_Object *obj, const char *part, const char *content);
EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param);
EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child);
diff --git a/src/lib/Edje_Edit.h b/src/lib/Edje_Edit.h
index 6f9d4bb..7b6f6a0 100644
--- a/src/lib/Edje_Edit.h
+++ b/src/lib/Edje_Edit.h
@@ -493,31 +493,6 @@ EAPI Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const char *name
//@}
-/** Add a new ttf font to the edje file.
- *
- * The newly created font will be available to all the groups in the edje,
- * not only the current one.
- *
- * @param obj Object being edited.
- * @param path Path to the font file to add into the Edje file.
- * @param alias Name with which the font will be referred inside the Edje,
- * can be NULL to use the filename.
- *
- * @return EINA_TRUE if the font got succesfully added, EINA_FALSE if not.
- */
-EAPI Eina_Bool edje_edit_font_add(Evas_Object *obj, const char *path, const char *alias);
-
-/** Remove a ttf font to the edje file.
- *
- * The font exists at the file level, it's not per object. So deleting it
- * will affect every group that is using it.
- *
- * @param obj Object being edited.
- * @param alias Name by which the file is identified in the Edje file.
- *
- * @return EINA_TRUE if succesful, EINA_FALSE otherwise.
- */
-EAPI Eina_Bool edje_edit_font_del(Evas_Object *obj, const char *alias);
/******************************************************************************/
/************************** TEXT STYLES *************************************/
@@ -757,6 +732,44 @@ EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part);
*/
EAPI Eina_Bool edje_edit_part_name_set(Evas_Object *obj, const char *part, const char *new_name);
+/** Get api's name of a part.
+ *
+ * @param obj Object being edited.
+ * @param part Name of the part.
+ *
+ * @return name of the api if succesful, NULL otherwise.
+ */
+EAPI const char * edje_edit_part_api_name_get(Evas_Object *obj, const char *part);
+
+/** Get api's description of a part.
+ *
+ * @param obj Object being edited.
+ * @param part Name of the part.
+ *
+ * @return description of the api if succesful, NULL otherwise.
+ */
+EAPI const char * edje_edit_part_api_description_get(Evas_Object *obj, const char *part);
+
+/** Set api's name of a part.
+ *
+ * @param obj Object being edited.
+ * @param part Name of the part.
+ * @param name New name for the api property.
+ *
+ * @return EINA_TRUE if succesful, EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_part_api_name_set(Evas_Object *obj, const char *part, const char *name);
+
+/** Set api's description of a part.
+ *
+ * @param obj Object being edited.
+ * @param part Name of part.
+ * @param description New description for the api property.
+ *
+ * @return EINA_TRUE if succesful, EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_part_api_description_set(Evas_Object *obj, const char *part, const char *description);
+
/** Get the type of a part.
*
* @param obj Object being edited.
@@ -904,11 +917,31 @@ EAPI Evas_Event_Flags edje_edit_part_ignore_flags_get(Evas_Object *obj, const ch
/** Set repeat_events for part.
*
- * @param obj Object bein edited.
- * @oaram part Part to set which event flags will be ignored
+ * @param obj Object being edited.
+ * @param part Part to set which event flags will be ignored
*/
EAPI void edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_Flags ignore_flags);
+/** Set scale property for the part.
+ *
+ * This property tells Edje that the given part should be scaled by the
+ * Edje scale factor.
+ *
+ * @param obj Object being edited.
+ * @param part Part to set scale for.
+ * @param scale Scale value to set.
+ */
+EAPI void edje_edit_part_scale_set(Evas_Object *obj, const char *part, Eina_Bool scale);
+
+/** Get scale for the part.
+ *
+ * @param obj Object being edited.
+ * @param part Part to get the scale value of.
+ *
+ * @return Whether scale is on (EINA_TRUE) or not.
+ */
+EAPI Eina_Bool edje_edit_part_scale_get(Evas_Object *obj, const char *part);
+
/** Get horizontal dragable state for part.
*
* @param obj Object being edited.
@@ -1081,8 +1114,10 @@ EAPI Eina_Bool edje_edit_state_name_set(Evas_Object *obj, const char *part, cons
* @param part Part to set the name of the new state.
* @param name Name for the new state (not including the state value).
* @param value The state value.
+ *
+ * @return EINA_TRUE if succesfully, EINA_FALSE otherwise.
*/
-EAPI void edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value);
+EAPI Eina_Bool edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value);
/** Delete the given part state from the edje.
*
@@ -1090,8 +1125,10 @@ EAPI void edje_edit_state_add(Evas_Object *obj, const char *part, const char *na
* @param part Part that contain state.
* @param state The current name of the state (not including the state value).
* @param value The state value.
+ *
+ * @return EINA_TRUE if succesfully, EINA_FALSE otherwise.
*/
-EAPI void edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value);
+EAPI Eina_Bool edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value);
/** Check if a part state with the given name exist.
*
@@ -3127,6 +3164,44 @@ EAPI Eina_Bool edje_edit_program_afters_clear(Evas_Object *obj, const char *prog
*/
EAPI const char * edje_edit_program_state_get(Evas_Object *obj, const char *prog);
+/** Get api's name of a program.
+ *
+ * @param obj Object being edited.
+ * @param prog Name of program.
+ *
+ * @return name of the api if succesful, NULL otherwise.
+ */
+EAPI const char * edje_edit_program_api_name_get(Evas_Object *obj, const char *prog);
+
+/** Get api's description of a program.
+ *
+ * @param obj Object being edited.
+ * @param prog Name of program.
+ *
+ * @return description of the api if succesful, NULL otherwise.
+ */
+EAPI const char * edje_edit_program_api_description_get(Evas_Object *obj, const char *prog);
+
+/** Set api's name of a program.
+ *
+ * @param obj Object being edited.
+ * @param prog Name of the part.
+ * @param name New name for the api property.
+ *
+ * @return EINA_TRUE if succesful, EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char *name);
+
+/** Set api's description of a program.
+ *
+ * @param obj Object being edited.
+ * @param prog Name of the program.
+ * @param description New description for the api property.
+ *
+ * @return EINA_TRUE if succesful, EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_api_description_set(Evas_Object *obj, const char *prog, const char *description);
+
/** Set the state for the given program
*
* In a STATE_SET action this is the name of state to set.
@@ -3251,6 +3326,8 @@ EAPI double edje_edit_program_transition_time_get(Evas_Object *obj, const char *
*/
EAPI Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds);
+EAPI const char * edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog);
+EAPI Eina_Bool edje_edit_program_filter_part_set(Evas_Object *obj, const char *prog, const char *filter_part);
//@}
/******************************************************************************/
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index bec0f28..b73c96f 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -16,7 +16,8 @@ AM_CPPFLAGS = \
lib_LTLIBRARIES = libedje.la
-include_HEADERS = Edje.h Edje_Edit.h
+includes_HEADERS = Edje.h Edje_Edit.h
+includesdir = $(includedir)/edje-@VMAJ@
base_sources = \
edje_calc.c \
@@ -55,9 +56,9 @@ edje_amalgamation.c: $(base_sources) Makefile
@echo "# include \"config.h\"" >> edje_amalgamation.c
@echo "#endif" >> edje_amalgamation.c
- @echo "#ifndef _WIN32" >> eina_amalgamation.c
- @echo "#define _GNU_SOURCE" >> eina_amalgamation.c
- @echo "#endif" >> eina_amalgamation.c
+ @echo "#ifndef _WIN32" >> edje_amalgamation.c
+ @echo "#define _GNU_SOURCE" >> edje_amalgamation.c
+ @echo "#endif" >> edje_amalgamation.c
@echo "#ifdef HAVE_ALLOCA_H" >> edje_amalgamation.c
@echo "# include <alloca.h>" >> edje_amalgamation.c
@@ -128,7 +129,7 @@ endif
libedje_la_LIBADD = @EDJE_LIBS@ @ECORE_IMF_LIBS@ @EVIL_LIBS@ -lm
libedje_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
-EXTRA_DIST = edje_private.h edje_container.h
+EXTRA_DIST = edje_private.h edje_container.h edje_convert.h
clean-local:
@rm -rf edje_amalgamation.c
diff --git a/src/lib/edje_cache.c b/src/lib/edje_cache.c
index f77a4c5..860fa6f 100644
--- a/src/lib/edje_cache.c
+++ b/src/lib/edje_cache.c
@@ -1,26 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-/* EDJE - EFL graphical design and layout library based on Evas
- * Copyright (C) 2008 Cedric Bail
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library;
- * if not, see <http://www.gnu.org/licenses/>.
- */
-
-
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -63,43 +40,78 @@ _edje_file_coll_open(Edje_File *edf, const char *coll)
{
Edje_Part_Collection *edc = NULL;
Edje_Part_Collection_Directory_Entry *ce;
- Eina_List *l = NULL;
int id = -1, size = 0;
+ Eina_List *l;
char buf[256];
+ char *buffer;
void *data;
- EINA_LIST_FOREACH(edf->collection_dir->entries, l, ce)
+ ce = eina_hash_find(edf->collection, coll);
+ if (!ce) return NULL;
+
+ if (ce->ref)
{
- if ((ce->entry) && (!strcmp(ce->entry, coll)))
+ ce->ref->references++;
+ return ce->ref;
+ }
+
+ EINA_LIST_FOREACH(edf->collection_cache, l, edc)
+ {
+ if (!strcmp(edc->part, coll))
{
- id = ce->id;
- break;
+ edc->references = 1;
+ ce->ref = edc;
+
+ edf->collection_cache = eina_list_remove_list(edf->collection_cache, l);
+ return ce->ref;
}
}
+
+ id = ce->id;
if (id < 0) return NULL;
- snprintf(buf, sizeof(buf), "collections/%i", id);
+#define INIT_EMP(Tp, Sz, Ce) \
+ buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
+ sprintf(buffer, "%s/%s", ce->entry, #Tp); \
+ Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \
+ _emp_##Tp = Ce->mp.Tp;
+
+ INIT_EMP(RECTANGLE, Edje_Part_Description_Common, ce);
+ INIT_EMP(TEXT, Edje_Part_Description_Text, ce);
+ INIT_EMP(IMAGE, Edje_Part_Description_Image, ce);
+ INIT_EMP(SWALLOW, Edje_Part_Description_Common, ce);
+ INIT_EMP(TEXTBLOCK, Edje_Part_Description_Text, ce);
+ INIT_EMP(GROUP, Edje_Part_Description_Common, ce);
+ INIT_EMP(BOX, Edje_Part_Description_Box, ce);
+ INIT_EMP(TABLE, Edje_Part_Description_Table, ce);
+ INIT_EMP(EXTERNAL, Edje_Part_Description_External, ce);
+ INIT_EMP(part, Edje_Part, ce);
+
+ snprintf(buf, sizeof(buf), "edje/collections/%i", id);
edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf);
if (!edc) return NULL;
- snprintf(buf, sizeof(buf), "scripts/%i", id);
+ edc->references = 1;
+ edc->part = ce->entry;
+
+ snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", id);
data = eet_read(edf->ef, buf, &size);
if (data)
{
edc->script = embryo_program_new(data, size);
- _edje_embryo_script_init(edc);
+ _edje_embryo_script_init(edc);
free(data);
}
- snprintf(buf, sizeof(buf), "lua_scripts/%i", id);
+ snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id);
data = eet_read(edf->ef, buf, &size);
if (data)
{
#ifdef LUA2
_edje_lua2_script_load(edc, data, size);
-#else
+#else
int err_code;
//printf("lua chunk size: %d\n", size);
@@ -114,50 +126,13 @@ _edje_file_coll_open(Edje_File *edf, const char *coll)
}
if (lua_pcall(_edje_lua_state_get(), 0, 0, 0))
ERR("lua call error: %s", lua_tostring(_edje_lua_state_get(), -1));
-#endif
+#endif
free(data);
}
-
- edc->part = eina_stringshare_add(coll);
- edc->references = 1;
- if (!edf->collection_hash)
- edf->collection_hash = eina_hash_string_small_new(NULL);
- eina_hash_add(edf->collection_hash, coll, edc);
- return edc;
-}
-
-static int
-_edje_font_hash(Edje_File *edf)
-{
- int count = 0;
-
- if (!edf->font_hash)
- edf->font_hash = eina_hash_string_small_new(NULL);
-
- if (edf->font_dir)
- {
- Eina_List *l;
- Edje_Font_Directory_Entry *fnt;
-
- EINA_LIST_FOREACH(edf->font_dir->entries, l, fnt)
- {
- int length;
- char *tmp;
-
- length = strlen(fnt->entry) + 7;
- tmp = alloca(length);
- snprintf(tmp, length, "fonts/%s", fnt->entry);
- fnt->path = eina_stringshare_add(tmp);
- if (edf->free_strings)
- eina_stringshare_del(fnt->entry);
- fnt->entry = fnt->path + 6;
- eina_hash_direct_add(edf->font_hash, fnt->entry, fnt);
+ ce->ref = edc;
- count++;
- }
- }
- return count;
+ return edc;
}
static Edje_File *
@@ -165,9 +140,7 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
{
Edje_File *edf;
Edje_Part_Collection *edc;
- Edje_Data *di;
Eet_File *ef;
- Eina_List *l;
struct stat st;
if (stat(file, &st) != 0)
@@ -182,7 +155,7 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
*error_ret = EDJE_LOAD_ERROR_UNKNOWN_FORMAT;
return NULL;
}
- edf = eet_data_read(ef, _edje_edd_edje_file, "edje_file");
+ edf = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
if (!edf)
{
*error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE;
@@ -190,8 +163,6 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
return NULL;
}
- edf->free_strings = eet_dictionary_get(ef) ? 0 : 1;
-
edf->ef = ef;
edf->mtime = st.st_mtime;
@@ -201,7 +172,7 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
_edje_file_free(edf);
return NULL;
}
- if (!edf->collection_dir)
+ if (!edf->collection)
{
*error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE;
_edje_file_free(edf);
@@ -211,14 +182,9 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
edf->path = eina_stringshare_add(file);
edf->references = 1;
+ /* This should be done at edje generation time */
_edje_textblock_style_parse_and_fix(edf);
- if (!edf->data_cache)
- edf->data_cache = eina_hash_string_small_new(NULL);
-
- EINA_LIST_FOREACH(edf->data, l, di)
- eina_hash_add(edf->data_cache, di->key, di->value);
-
if (coll)
{
edc = _edje_file_coll_open(edf, coll);
@@ -229,10 +195,6 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
if (edc_ret) *edc_ret = edc;
}
- edf->font_hash = NULL;
-
- _edje_font_hash(edf);
-
return edf;
}
@@ -319,48 +281,37 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
if (!coll) return edf;
- if (!edf->collection_hash)
- edf->collection_hash = eina_hash_string_small_new(NULL);
-
- edc = eina_hash_find(edf->collection_hash, coll);
- if (edc)
+ edc = _edje_file_coll_open(edf, coll);
+ if (!edc)
{
- edc->references++;
+ *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
}
else
{
- EINA_LIST_FOREACH(edf->collection_cache, l, edc)
+ if (!edc->checked)
{
- if (!strcmp(edc->part, coll))
- {
- edc->references = 1;
- edf->collection_cache = eina_list_remove_list(edf->collection_cache, l);
- eina_hash_add(edf->collection_hash, coll, edc);
- break;
- }
- edc = NULL;
- }
- }
- if (!edc)
- {
- edc = _edje_file_coll_open(edf, coll);
- if (!edc)
- {
- *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
- }
- else
- {
- EINA_LIST_FOREACH(edc->parts, l, ep)
+ unsigned int j;
+
+ for (j = 0; j < edc->parts_count; ++j)
{
Edje_Part *ep2;
+ ep = edc->parts[j];
+
/* Register any color classes in this parts descriptions. */
hist = NULL;
hist = eina_list_append(hist, ep);
ep2 = ep;
while (ep2->dragable.confine_id >= 0)
{
- ep2 = eina_list_nth(edc->parts, ep2->dragable.confine_id);
+ if (ep2->dragable.confine_id >= (int) edc->parts_count)
+ {
+ ERR("confine_to above limit. invalidating it.");
+ ep2->dragable.confine_id = -1;
+ break;
+ }
+
+ ep2 = edc->parts[ep2->dragable.confine_id];
if (eina_list_data_find(hist, ep2))
{
ERR("confine_to loops. invalidating loop.");
@@ -373,23 +324,29 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
hist = NULL;
hist = eina_list_append(hist, ep);
ep2 = ep;
- while (ep2->dragable.events_id >= 0)
+ while (ep2->dragable.event_id >= 0)
{
Edje_Part* prev;
+ if (ep2->dragable.event_id >= (int) edc->parts_count)
+ {
+ ERR("event_id above limit. invalidating it.");
+ ep2->dragable.event_id = -1;
+ break;
+ }
prev = ep2;
- ep2 = eina_list_nth(edc->parts, ep2->dragable.events_id);
+ ep2 = edc->parts[ep2->dragable.event_id];
if (!ep2->dragable.x && !ep2->dragable.y)
{
- prev->dragable.events_id = -1;
+ prev->dragable.event_id = -1;
break;
}
if (eina_list_data_find(hist, ep2))
{
ERR("events_to loops. invalidating loop.");
- ep2->dragable.events_id = -1;
+ ep2->dragable.event_id = -1;
break;
}
hist = eina_list_append(hist, ep2);
@@ -400,7 +357,14 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
ep2 = ep;
while (ep2->clip_to_id >= 0)
{
- ep2 = eina_list_nth(edc->parts, ep2->clip_to_id);
+ if (ep2->clip_to_id >= (int) edc->parts_count)
+ {
+ ERR("clip_to_id above limit. invalidating it.");
+ ep2->clip_to_id = -1;
+ break;
+ }
+
+ ep2 = edc->parts[ep2->clip_to_id];
if (eina_list_data_find(hist, ep2))
{
ERR("clip_to loops. invalidating loop.");
@@ -412,32 +376,28 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
eina_list_free(hist);
hist = NULL;
}
+ edc->checked = 1;
}
}
if (edc_ret) *edc_ret = edc;
- if (eina_hash_population(edf->collection_hash) == 0)
- {
- eina_hash_free(edf->collection_hash);
- edf->collection_hash = NULL;
- }
return edf;
}
void
_edje_cache_coll_clean(Edje_File *edf)
{
- int count;
-
- count = eina_list_count(edf->collection_cache);
- while ((edf->collection_cache) && (count > _edje_collection_cache_size))
+ while ((edf->collection_cache) &&
+ (eina_list_count(edf->collection_cache) > (unsigned int) _edje_collection_cache_size))
{
+ Edje_Part_Collection_Directory_Entry *ce;
Edje_Part_Collection *edc;
edc = eina_list_data_get(eina_list_last(edf->collection_cache));
edf->collection_cache = eina_list_remove_list(edf->collection_cache, eina_list_last(edf->collection_cache));
- _edje_collection_free(edf, edc);
- count = eina_list_count(edf->collection_cache);
+
+ ce = eina_hash_find(edf->collection, edc->part);
+ _edje_collection_free(edf, edc, ce);
}
}
@@ -446,27 +406,39 @@ _edje_cache_coll_flush(Edje_File *edf)
{
while (edf->collection_cache)
{
+ Edje_Part_Collection_Directory_Entry *ce;
Edje_Part_Collection *edc;
+ Eina_List *last;
- edc = eina_list_data_get(eina_list_last(edf->collection_cache));
- edf->collection_cache = eina_list_remove_list(edf->collection_cache, eina_list_last(edf->collection_cache));
- _edje_collection_free(edf, edc);
+ last = eina_list_last(edf->collection_cache);
+ edc = eina_list_data_get(last);
+ edf->collection_cache = eina_list_remove_list(edf->collection_cache,
+ last);
+
+ ce = eina_hash_find(edf->collection, edc->part);
+ _edje_collection_free(edf, edc, ce);
}
}
void
_edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc)
{
+ Edje_Part_Collection_Directory_Entry *ce;
+
edc->references--;
if (edc->references != 0) return;
- eina_hash_del(edf->collection_hash, edc->part, edc);
- if (eina_hash_population(edf->collection_hash) == 0)
+
+ ce = eina_hash_find(edf->collection, edc->part);
+ if (!ce)
+ {
+ ERR("Something is wrong with reference count of '%s'.", edc->part);
+ }
+ else if (ce->ref)
{
- eina_hash_free(edf->collection_hash);
- edf->collection_hash = NULL;
+ ce->ref = NULL;
+ edf->collection_cache = eina_list_prepend(edf->collection_cache, edc);
+ _edje_cache_coll_clean(edf);
}
- edf->collection_cache = eina_list_prepend(edf->collection_cache, edc);
- _edje_cache_coll_clean(edf);
}
static void
@@ -477,10 +449,12 @@ _edje_cache_file_clean(void)
count = eina_list_count(_edje_file_cache);
while ((_edje_file_cache) && (count > _edje_file_cache_size))
{
+ Eina_List *last;
Edje_File *edf;
- edf = eina_list_data_get(eina_list_last(_edje_file_cache));
- _edje_file_cache = eina_list_remove_list(_edje_file_cache, eina_list_last(_edje_file_cache));
+ last = eina_list_last(_edje_file_cache);
+ edf = eina_list_data_get(last);
+ _edje_file_cache = eina_list_remove_list(_edje_file_cache, last);
_edje_file_free(edf);
count = eina_list_count(_edje_file_cache);
}
diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c
index 692b716..2cc3f8c 100644
--- a/src/lib/edje_calc.c
+++ b/src/lib/edje_calc.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include <math.h>
@@ -12,7 +8,11 @@
#define FLAG_Y 0x02
#define FLAG_XY (FLAG_X | FLAG_Y)
-static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, Edje_Part_Description *desc, Edje_Part_Description *chosen_desc, Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y, Edje_Real_Part *confine_to, Edje_Calc_Params *params, int flags);
+static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
+ Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc,
+ Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
+ Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
+ Edje_Real_Part *confine_to, Edje_Calc_Params *params, int flags);
static void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags);
void
@@ -63,15 +63,15 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos)
#endif
}
-Edje_Part_Description *
+Edje_Part_Description_Common *
_edje_part_description_find(Edje *ed __UNUSED__, Edje_Real_Part *rp, const char *name,
double val)
{
Edje_Part *ep = rp->part;
- Edje_Part_Description *ret = NULL;
- Edje_Part_Description *d;
- Eina_List *l;
+ Edje_Part_Description_Common *ret = NULL;
+ Edje_Part_Description_Common *d;
double min_dst = 99999.0;
+ unsigned int i;
if (!strcmp(name, "default") && val == 0.0)
return ep->default_desc;
@@ -84,8 +84,10 @@ _edje_part_description_find(Edje *ed __UNUSED__, Edje_Real_Part *rp, const char
ret = ep->default_desc;
min_dst = ABS(ep->default_desc->state.value - val);
}
- EINA_LIST_FOREACH(ep->other_desc, l, d)
+ for (i = 0; i < ep->other.desc_count; ++i)
{
+ d = ep->other.desc[i];
+
if (!strcmp(d->state.name, name))
{
double dst;
@@ -105,9 +107,11 @@ _edje_part_description_find(Edje *ed __UNUSED__, Edje_Real_Part *rp, const char
void
_edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2)
{
- Edje_Part_Description *epd1;
- Edje_Part_Description *epd2 = NULL;
- Edje_Part_Description *chosen_desc;
+ Edje_Part_Description_Common *epd1;
+ Edje_Part_Description_Common *epd2 = NULL;
+ Edje_Part_Description_Common *chosen_desc;
+
+ Edje_Part_Description_Image *epdi;
if (!d1) d1 = "default";
@@ -118,8 +122,10 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl
if (d2)
epd2 = _edje_part_description_find(ed, ep, d2, v2);
+ epdi = (Edje_Part_Description_Image*) epd2;
+
/* There is an animation if both description are different or if description is an image with tweens */
- if (epd2 != NULL && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epd2->image.tween_list)))
+ if (epd2 != NULL && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epdi->image.tweens_count)))
{
if (!ep->param2)
{
@@ -159,9 +165,13 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl
if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
{
+ Edje_Part_Description_External *external;
+
+ external = (Edje_Part_Description_External*) ep->param1.description;
+
if (ep->param1.external_params)
_edje_external_parsed_params_free(ep->swallowed_object, ep->param1.external_params);
- ep->param1.external_params = _edje_external_params_parse(ep->swallowed_object, ep->param1.description->external_params);
+ ep->param1.external_params = _edje_external_params_parse(ep->swallowed_object, external->external_params);
}
if (ep->param2)
@@ -183,7 +193,15 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl
ep->param2->rel2_to_y = ed->table_parts[ep->param2->description->rel2.id_y % ed->table_parts_size];
if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
- ep->param2->external_params = _edje_external_params_parse(ep->swallowed_object, ep->param2->description->external_params);
+ {
+ Edje_Part_Description_External *external;
+
+ external = (Edje_Part_Description_External*) ep->param2->description;
+
+ if (ep->param2->external_params)
+ _edje_external_parsed_params_free(ep->swallowed_object, ep->param2->external_params);
+ ep->param2->external_params = _edje_external_params_parse(ep->swallowed_object, external->external_params);
+ }
}
if (ep->description_pos != 0.0)
@@ -228,7 +246,7 @@ _edje_recalc(Edje *ed)
void
_edje_recalc_do(Edje *ed)
{
- int i;
+ unsigned int i;
ed->postponed = 0;
evas_object_smart_need_recalculate_set(ed->obj, 0);
@@ -344,7 +362,7 @@ _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T y)
static void
_edje_part_recalc_single_rel(Edje *ed,
Edje_Real_Part *ep __UNUSED__,
- Edje_Part_Description *desc,
+ Edje_Part_Description_Common *desc,
Edje_Real_Part *rel1_to_x,
Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x,
@@ -404,7 +422,7 @@ _edje_part_recalc_single_rel(Edje *ed,
static void
_edje_part_recalc_single_aspect(Edje_Real_Part *ep,
- Edje_Part_Description *desc,
+ Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int *minw, int *minh,
int *maxw, int *maxh)
@@ -602,7 +620,7 @@ _edje_part_recalc_single_aspect(Edje_Real_Part *ep,
}
static void
-_edje_part_recalc_single_step(Edje_Part_Description *desc,
+_edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int flags)
{
@@ -644,7 +662,7 @@ static void
_edje_part_recalc_single_textblock(FLOAT_T sc,
Edje *ed,
Edje_Real_Part *ep,
- Edje_Part_Description *chosen_desc,
+ Edje_Part_Description_Text *chosen_desc,
Edje_Calc_Params *params,
int *minw, int *minh,
int *maxw, int *maxh)
@@ -655,31 +673,35 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
const char *text = "";
const char *style = "";
Edje_Style *stl = NULL;
+ const char *tmp;
Eina_List *l;
if (chosen_desc->text.id_source >= 0)
{
ep->text.source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
- if (ep->text.source->chosen_description->text.style)
- style = ep->text.source->chosen_description->text.style;
+
+ tmp = edje_string_get(&((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.style);
+ if (tmp) style = tmp;
}
else
{
ep->text.source = NULL;
- if (chosen_desc->text.style)
- style = chosen_desc->text.style;
+
+ tmp = edje_string_get(&chosen_desc->text.style);
+ if (tmp) style = tmp;
}
if (chosen_desc->text.id_text_source >= 0)
{
ep->text.text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
- text = ep->text.text_source->chosen_description->text.text;
+ text = edje_string_get(&((Edje_Part_Description_Text*)ep->text.text_source->chosen_description)->text.text);
+
if (ep->text.text_source->text.text) text = ep->text.text_source->text.text;
}
else
{
ep->text.text_source = NULL;
- text = chosen_desc->text.text;
+ text = edje_string_get(&chosen_desc->text.text);
if (ep->text.text) text = ep->text.text;
}
@@ -767,8 +789,8 @@ static void
_edje_part_recalc_single_text(FLOAT_T sc,
Edje *ed,
Edje_Real_Part *ep,
- Edje_Part_Description *desc,
- Edje_Part_Description *chosen_desc,
+ Edje_Part_Description_Text *desc,
+ Edje_Part_Description_Text *chosen_desc,
Edje_Calc_Params *params,
int *minw, int *minh,
int *maxw, int *maxh)
@@ -797,12 +819,12 @@ _edje_part_recalc_single_text(FLOAT_T sc,
ep->text.text_source = NULL;
if (ep->text.text_source)
- text = ep->text.text_source->chosen_description->text.text;
+ text = edje_string_get(&(((Edje_Part_Description_Text*)ep->text.text_source->chosen_description)->text.text));
else
- text = chosen_desc->text.text;
+ text = edje_string_get(&chosen_desc->text.text);
if (ep->text.source)
- font = _edje_text_class_font_get(ed, ep->text.source->chosen_description, &size, &sfont);
+ font = _edje_text_class_font_get(ed, ((Edje_Part_Description_Text*)ep->text.source->chosen_description), &size, &sfont);
else
font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
@@ -830,15 +852,17 @@ _edje_part_recalc_single_text(FLOAT_T sc,
if (!text) text = "";
/* check if the font is embedded in the .eet */
- if (ed->file->font_hash)
+ if (ed->file->fonts)
{
Edje_Font_Directory_Entry *fnt;
- fnt = eina_hash_find(ed->file->font_hash, font);
+ fnt = eina_hash_find(ed->file->fonts, font);
if (fnt)
{
- font = fnt->path;
+ int len = strlen(fnt->entry) + sizeof("edje/fonts/") + 1;
+ font = alloca(len);
+ sprintf((char *)font, "edje/fonts/%s", fnt->entry);
inlined_font = 1;
}
}
@@ -930,7 +954,7 @@ _edje_part_recalc_single_text(FLOAT_T sc,
}
static void
-_edje_part_recalc_single_min(Edje_Part_Description *desc,
+_edje_part_recalc_single_min(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int minw, int minh,
int flags)
@@ -960,7 +984,7 @@ _edje_part_recalc_single_min(Edje_Part_Description *desc,
}
static void
-_edje_part_recalc_single_max(Edje_Part_Description *desc,
+_edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
Edje_Calc_Params *params,
int maxw, int maxh,
int flags)
@@ -1099,102 +1123,47 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
static void
_edje_part_recalc_single_fill(Edje_Real_Part *ep,
- Edje_Part_Description *desc,
+ Edje_Part_Description_Spec_Image *desc,
Edje_Calc_Params *params,
int flags)
{
- if (ep->part->type == EDJE_PART_TYPE_GRADIENT && desc->gradient.use_rel && (!desc->gradient.type || !strcmp(desc->gradient.type, "linear")))
+ params->smooth = desc->fill.smooth;
+ if (flags & FLAG_X)
{
- int x2, y2;
- int dx, dy;
- int angle;
-
- params->type.common.fill.x = desc->gradient.rel1.offset_x
- + TO_INT(SCALE(desc->gradient.rel1.relative_x, params->w));
- params->type.common.fill.y = desc->gradient.rel1.offset_y
- + TO_INT((SCALE(desc->gradient.rel1.relative_y, params->h)));
-
- x2 = desc->gradient.rel2.offset_x
- + TO_INT(SCALE(desc->gradient.rel2.relative_x, params->w));
-
- y2 = desc->gradient.rel2.offset_y
- + TO_INT(SCALE(desc->gradient.rel2.relative_y, params->h));
-
- params->type.common.fill.w = 1; /* doesn't matter for linear grads */
-
- dy = y2 - params->type.common.fill.y;
- dx = x2 - params->type.common.fill.x;
- params->type.common.fill.h = TO_INT(SQRT(FROM_INT(dx * dx + dy * dy)));
-
- params->type.common.fill.spread = desc->fill.spread;
+ int fw;
- if (dx == 0 && dy == 0)
- {
- angle = 0;
- }
- else if (dx == 0)
- {
- if (dy > 0) angle = 0;
- else angle = 180;
- }
- else if (dy == 0)
- {
- if (dx > 0) angle = 270;
- else angle = 90;
- }
+ if (desc->fill.type == EDJE_FILL_TYPE_TILE)
+ evas_object_image_size_get(ep->object, &fw, NULL);
else
- {
- double m; /* FIXME: atan isn't available atm in eina fp implementation */
- m = (double)dx / (double)dy;
- angle = atan(m) * 180 / M_PI;
- if (dy < 0)
- angle = 180 - angle;
- else
- angle = 360 - angle;
- }
- params->type.common.fill.angle = angle;
+ fw = params->w;
+
+ params->type.common.fill.x = desc->fill.pos_abs_x
+ + TO_INT(SCALE(desc->fill.pos_rel_x, fw));
+ params->type.common.fill.w = desc->fill.abs_x
+ + TO_INT(SCALE(desc->fill.rel_x, fw));
}
- else
+ if (flags & FLAG_Y)
{
- params->smooth = desc->fill.smooth;
- if (flags & FLAG_X)
- {
- int fw;
-
- if (desc->fill.type == EDJE_FILL_TYPE_TILE)
- evas_object_image_size_get(ep->object, &fw, NULL);
- else
- fw = params->w;
+ int fh;
- params->type.common.fill.x = desc->fill.pos_abs_x
- + TO_INT(SCALE(desc->fill.pos_rel_x, fw));
- params->type.common.fill.w = desc->fill.abs_x
- + TO_INT(SCALE(desc->fill.rel_x, fw));
- }
- if (flags & FLAG_Y)
- {
- int fh;
-
- if (desc->fill.type == EDJE_FILL_TYPE_TILE)
- evas_object_image_size_get(ep->object, NULL, &fh);
- else
- fh = params->h;
+ if (desc->fill.type == EDJE_FILL_TYPE_TILE)
+ evas_object_image_size_get(ep->object, NULL, &fh);
+ else
+ fh = params->h;
- params->type.common.fill.y = desc->fill.pos_abs_y
- + TO_INT(SCALE(desc->fill.pos_rel_y, fh));
- params->type.common.fill.h = desc->fill.abs_y
- + TO_INT(SCALE(desc->fill.rel_y, fh));
- }
- params->type.common.fill.angle = desc->fill.angle;
- params->type.common.fill.spread = desc->fill.spread;
+ params->type.common.fill.y = desc->fill.pos_abs_y
+ + TO_INT(SCALE(desc->fill.pos_rel_y, fh));
+ params->type.common.fill.h = desc->fill.abs_y
+ + TO_INT(SCALE(desc->fill.rel_y, fh));
}
-
+ params->type.common.fill.angle = desc->fill.angle;
+ params->type.common.fill.spread = desc->fill.spread;
}
static void
_edje_part_recalc_single_min_max(FLOAT_T sc,
Edje_Real_Part *ep,
- Edje_Part_Description *desc,
+ Edje_Part_Description_Common *desc,
int *minw, int *minh,
int *maxw, int *maxh,
int flags __UNUSED__)
@@ -1282,8 +1251,8 @@ _edje_part_recalc_single_min_max(FLOAT_T sc,
static void
_edje_part_recalc_single(Edje *ed,
Edje_Real_Part *ep,
- Edje_Part_Description *desc,
- Edje_Part_Description *chosen_desc,
+ Edje_Part_Description_Common *desc,
+ Edje_Part_Description_Common *chosen_desc,
Edje_Real_Part *rel1_to_x,
Edje_Real_Part *rel1_to_y,
Edje_Real_Part *rel2_to_x,
@@ -1314,9 +1283,9 @@ _edje_part_recalc_single(Edje *ed,
/* if we have text that wants to make the min size the text size... */
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
- _edje_part_recalc_single_textblock(sc, ed, ep, chosen_desc, params, &minw, &minh, &maxw, &maxh);
+ _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh);
else if (ep->part->type == EDJE_PART_TYPE_TEXT)
- _edje_part_recalc_single_text(sc, ed, ep, desc, chosen_desc, params, &minw, &minh, &maxw, &maxh);
+ _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh);
/* remember what our size is BEFORE we go limit it */
params->req.x = params->x;
@@ -1335,9 +1304,8 @@ _edje_part_recalc_single(Edje *ed,
_edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh, flags);
/* fill */
- if (ep->part->type == EDJE_PART_TYPE_IMAGE ||
- ep->part->type == EDJE_PART_TYPE_GRADIENT)
- _edje_part_recalc_single_fill(ep, desc, params, flags);
+ if (ep->part->type == EDJE_PART_TYPE_IMAGE)
+ _edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image, params, flags);
/* colors */
if ((desc->color_class) && (*desc->color_class))
@@ -1364,105 +1332,78 @@ _edje_part_recalc_single(Edje *ed,
switch (ep->part->type)
{
case EDJE_PART_TYPE_IMAGE:
- /* border */
- if (flags & FLAG_X)
- {
- params->type.common.spec.image.l = desc->border.l;
- params->type.common.spec.image.r = desc->border.r;
- }
- if (flags & FLAG_Y)
- {
- params->type.common.spec.image.t = desc->border.t;
- params->type.common.spec.image.b = desc->border.b;
- }
- break;
- case EDJE_PART_TYPE_GRADIENT:
- params->type.common.spec.gradient.id = desc->gradient.id;
- params->type.common.spec.gradient.type = desc->gradient.type;
- break;
+ {
+ Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) desc;
+
+ /* border */
+ if (flags & FLAG_X)
+ {
+ params->type.common.spec.image.l = img_desc->image.border.l;
+ params->type.common.spec.image.r = img_desc->image.border.r;
+ }
+ if (flags & FLAG_Y)
+ {
+ params->type.common.spec.image.t = img_desc->image.border.t;
+ params->type.common.spec.image.b = img_desc->image.border.b;
+ }
+ break;
+ }
case EDJE_PART_TYPE_TEXT:
case EDJE_PART_TYPE_TEXTBLOCK:
- /* text.align */
- if (flags & FLAG_X)
- {
- params->type.text.align.x = desc->text.align.x;
- }
- if (flags & FLAG_Y)
- {
- params->type.text.align.y = desc->text.align.y;
- }
- params->type.text.elipsis = desc->text.elipsis;
-
- /* text colors */
- if (cc)
- {
- params->type.text.color2.r = (((int)cc->r2 + 1) * desc->color2.r) >> 8;
- params->type.text.color2.g = (((int)cc->g2 + 1) * desc->color2.g) >> 8;
- params->type.text.color2.b = (((int)cc->b2 + 1) * desc->color2.b) >> 8;
- params->type.text.color2.a = (((int)cc->a2 + 1) * desc->color2.a) >> 8;
- params->type.text.color3.r = (((int)cc->r3 + 1) * desc->color3.r) >> 8;
- params->type.text.color3.g = (((int)cc->g3 + 1) * desc->color3.g) >> 8;
- params->type.text.color3.b = (((int)cc->b3 + 1) * desc->color3.b) >> 8;
- params->type.text.color3.a = (((int)cc->a3 + 1) * desc->color3.a) >> 8;
- }
- else
- {
- params->type.text.color2.r = desc->color2.r;
- params->type.text.color2.g = desc->color2.g;
- params->type.text.color2.b = desc->color2.b;
- params->type.text.color2.a = desc->color2.a;
- params->type.text.color3.r = desc->color3.r;
- params->type.text.color3.g = desc->color3.g;
- params->type.text.color3.b = desc->color3.b;
- params->type.text.color3.a = desc->color3.a;
- }
- break;
+ {
+ Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text*) chosen_desc;
+
+ /* text.align */
+ if (flags & FLAG_X)
+ {
+ params->type.text.align.x = text_desc->text.align.x;
+ }
+ if (flags & FLAG_Y)
+ {
+ params->type.text.align.y = text_desc->text.align.y;
+ }
+ params->type.text.elipsis = text_desc->text.elipsis;
+
+ /* text colors */
+ if (cc)
+ {
+ params->type.text.color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
+ params->type.text.color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
+ params->type.text.color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
+ params->type.text.color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
+ params->type.text.color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
+ params->type.text.color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
+ params->type.text.color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
+ params->type.text.color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
+ }
+ else
+ {
+ params->type.text.color2.r = text_desc->common.color2.r;
+ params->type.text.color2.g = text_desc->common.color2.g;
+ params->type.text.color2.b = text_desc->common.color2.b;
+ params->type.text.color2.a = text_desc->common.color2.a;
+ params->type.text.color3.r = text_desc->text.color3.r;
+ params->type.text.color3.g = text_desc->text.color3.g;
+ params->type.text.color3.b = text_desc->text.color3.b;
+ params->type.text.color3.a = text_desc->text.color3.a;
+ }
+ break;
+ }
case EDJE_PART_TYPE_RECTANGLE:
case EDJE_PART_TYPE_BOX:
case EDJE_PART_TYPE_TABLE:
case EDJE_PART_TYPE_SWALLOW:
case EDJE_PART_TYPE_GROUP:
break;
+ case EDJE_PART_TYPE_GRADIENT:
+ /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */
+ abort();
+ break;
}
}
static void
-_edje_gradient_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc __UNUSED__)
-{
- evas_object_gradient_fill_angle_set(ep->object, p3->type.common.fill.angle);
- evas_object_gradient_fill_spread_set(ep->object, p3->type.common.fill.spread);
- evas_object_gradient_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y,
- p3->type.common.fill.w, p3->type.common.fill.h);
-
- if (p3->type.common.spec.gradient.type && p3->type.common.spec.gradient.type[0])
- evas_object_gradient_type_set(ep->object, p3->type.common.spec.gradient.type, NULL);
-
- if (ed->file->spectrum_dir && ed->file->spectrum_dir->entries &&
- p3->type.common.spec.gradient.id != ep->gradient_id)
- {
- Edje_Spectrum_Directory_Entry *se;
- Edje_Spectrum_Color *sc;
- Eina_List *l;
-
- se = eina_list_nth(ed->file->spectrum_dir->entries, p3->type.common.spec.gradient.id);
- if (se)
- {
- evas_object_gradient_clear(ep->object);
- EINA_LIST_FOREACH(se->color_list, l, sc)
- {
- evas_object_gradient_color_stop_add(ep->object, sc->r,
- sc->g, sc->b, 255,
- sc->d);
- evas_object_gradient_alpha_stop_add(ep->object,
- sc->a, sc->d);
- }
- ep->gradient_id = p3->type.common.spec.gradient.id;
- }
- }
-}
-
-static void
-_edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc)
+_edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Box *chosen_desc)
{
Evas_Object_Box_Layout layout;
void (*free_data)(void *data);
@@ -1499,7 +1440,10 @@ _edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params
}
static void
-_edje_table_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params *p3 __UNUSED__, Edje_Part_Description *chosen_desc)
+_edje_table_recalc_apply(Edje *ed __UNUSED__,
+ Edje_Real_Part *ep,
+ Edje_Calc_Params *p3 __UNUSED__,
+ Edje_Part_Description_Table *chosen_desc)
{
evas_object_table_homogeneous_set(ep->object, chosen_desc->table.homogeneous);
evas_object_table_align_set(ep->object, TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y));
@@ -1512,7 +1456,7 @@ _edje_table_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Para
}
static int
-_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part_Description *st, Edje_Part_Image_Id *imid)
+_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part_Description_Image *st, Edje_Part_Image_Id *imid)
{
Edje_Image_Directory_Set_Entry *entry;
Edje_Image_Directory_Set *set = NULL;
@@ -1549,7 +1493,7 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part
}
if (!set)
- set = eina_list_nth(ed->file->image_dir->sets, id);
+ set = ed->file->image_dir->sets + id;
EINA_LIST_FOREACH(set->entries, l, entry)
{
@@ -1576,7 +1520,7 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part
}
static void
-_edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc, FLOAT_T pos)
+_edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Image *chosen_desc, FLOAT_T pos)
{
int image_id;
int image_count, image_num;
@@ -1587,27 +1531,29 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
evas_object_image_fill_set(ep->object, p3->type.common.fill.x, p3->type.common.fill.y,
p3->type.common.fill.w, p3->type.common.fill.h);
evas_object_image_smooth_scale_set(ep->object, p3->smooth);
- if (chosen_desc->border.scale)
+ if (chosen_desc->image.border.scale)
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
else
evas_object_image_border_scale_set(ep->object, 1.0);
evas_object_image_border_set(ep->object, p3->type.common.spec.image.l, p3->type.common.spec.image.r,
p3->type.common.spec.image.t, p3->type.common.spec.image.b);
- if (chosen_desc->border.no_fill == 0)
+ if (chosen_desc->image.border.no_fill == 0)
evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_DEFAULT);
- else if (chosen_desc->border.no_fill == 1)
+ else if (chosen_desc->image.border.no_fill == 1)
evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_NONE);
- else if (chosen_desc->border.no_fill == 2)
+ else if (chosen_desc->image.border.no_fill == 2)
evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_SOLID);
image_id = _edje_image_find(ep->object, ed,
- &ep->param1.set, ep->param1.description, NULL);
+ &ep->param1.set,
+ (Edje_Part_Description_Image*) ep->param1.description,
+ NULL);
if (image_id < 0)
{
Edje_Image_Directory_Entry *ie;
if (!ed->file->image_dir) ie = NULL;
- else ie = eina_list_nth(ed->file->image_dir->entries, (-image_id) - 1);
+ else ie = ed->file->image_dir->entries + (-image_id) - 1;
if ((ie) &&
(ie->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
(ie->entry))
@@ -1619,7 +1565,7 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
{
image_count = 2;
if (ep->param2)
- image_count += eina_list_count(ep->param2->description->image.tween_list);
+ image_count += ((Edje_Part_Description_Image*) ep->param2->description)->image.tweens_count;
image_num = TO_INT(MUL(pos, SUB(FROM_INT(image_count),
FROM_DOUBLE(0.5))));
if (image_num > (image_count - 1))
@@ -1627,7 +1573,8 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
if (image_num == 0)
{
image_id = _edje_image_find(ep->object, ed,
- &ep->param1.set, ep->param1.description,
+ &ep->param1.set,
+ (Edje_Part_Description_Image*) ep->param1.description,
NULL);
}
else
@@ -1636,15 +1583,15 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
if (image_num == (image_count - 1))
{
image_id = _edje_image_find(ep->object, ed,
- &ep->param2->set, ep->param2->description,
+ &ep->param2->set,
+ (Edje_Part_Description_Image*) ep->param2->description,
NULL);
}
else
{
Edje_Part_Image_Id *imid;
- imid = eina_list_nth(ep->param2->description->image.tween_list,
- image_num - 1);
+ imid = ((Edje_Part_Description_Image*) ep->param2->description)->image.tweens[image_num - 1];
image_id = _edje_image_find(ep->object, ed, NULL, NULL, imid);
}
}
@@ -1660,8 +1607,8 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
{
char buf[1024];
- /* Replace snprint("images/%i") == memcpy + itoa */
-#define IMAGES "images/"
+ /* Replace snprint("edje/images/%i") == memcpy + itoa */
+#define IMAGES "edje/images/"
memcpy(buf, IMAGES, strlen(IMAGES));
eina_convert_itoa(image_id, buf + strlen(IMAGES)); /* No need to check length as 2³² need only 10 characteres. */
@@ -1709,11 +1656,18 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
Edje_Calc_Params lp1, lp2;
#endif
Edje_Calc_Params *p1, *pf;
- Edje_Part_Description *chosen_desc;
+ Edje_Part_Description_Common *chosen_desc;
Edje_Real_Part *confine_to = NULL;
FLOAT_T pos = ZERO;
Edje_Calc_Params lp3;
+ /* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */
+ if (ep->part->type == EDJE_PART_TYPE_GRADIENT)
+ {
+ ERR("GRADIENT spotted during recalc ! That should never happen ! Send your edje file to devel ml.");
+ return;
+ }
+
if ((ep->calculated & FLAG_XY) == FLAG_XY)
{
return;
@@ -1961,24 +1915,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
switch (part_type)
{
case EDJE_PART_TYPE_IMAGE:
- case EDJE_PART_TYPE_GRADIENT:
p3->type.common.fill.x = INTP(p1->type.common.fill.x, p2->type.common.fill.x, pos);
p3->type.common.fill.y = INTP(p1->type.common.fill.y, p2->type.common.fill.y, pos);
p3->type.common.fill.w = INTP(p1->type.common.fill.w, p2->type.common.fill.w, pos);
p3->type.common.fill.h = INTP(p1->type.common.fill.h, p2->type.common.fill.h, pos);
- if (part_type == EDJE_PART_TYPE_GRADIENT)
- {
- p3->type.common.fill.angle = INTP(p1->type.common.fill.angle, p2->type.common.fill.angle, pos);
- p3->type.common.fill.spread = (beginning_pos) ? p1->type.common.fill.spread : p2->type.common.fill.spread;
- p3->type.common.spec.gradient = (beginning_pos) ? p1->type.common.spec.gradient : p2->type.common.spec.gradient;
- }
- else
- {
- p3->type.common.spec.image.l = INTP(p1->type.common.spec.image.l, p2->type.common.spec.image.l, pos);
- p3->type.common.spec.image.r = INTP(p1->type.common.spec.image.r, p2->type.common.spec.image.r, pos);
- p3->type.common.spec.image.t = INTP(p1->type.common.spec.image.t, p2->type.common.spec.image.t, pos);
- p3->type.common.spec.image.b = INTP(p1->type.common.spec.image.b, p2->type.common.spec.image.b, pos);
- }
+ p3->type.common.spec.image.l = INTP(p1->type.common.spec.image.l, p2->type.common.spec.image.l, pos);
+ p3->type.common.spec.image.r = INTP(p1->type.common.spec.image.r, p2->type.common.spec.image.r, pos);
+ p3->type.common.spec.image.t = INTP(p1->type.common.spec.image.t, p2->type.common.spec.image.t, pos);
+ p3->type.common.spec.image.b = INTP(p1->type.common.spec.image.b, p2->type.common.spec.image.b, pos);
break;
case EDJE_PART_TYPE_TEXT:
p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos);
@@ -2029,11 +1973,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
switch (ep->part->type)
{
case EDJE_PART_TYPE_IMAGE:
- evas_object_image_scale_hint_set(ep->object,
- chosen_desc->image.scale_hint);
+ {
+ Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) chosen_desc;
+
+ evas_object_image_scale_hint_set(ep->object,
+ img_desc->image.scale_hint);
+ }
case EDJE_PART_TYPE_RECTANGLE:
case EDJE_PART_TYPE_TEXTBLOCK:
- case EDJE_PART_TYPE_GRADIENT:
case EDJE_PART_TYPE_BOX:
case EDJE_PART_TYPE_TABLE:
evas_object_color_set(ep->object,
@@ -2060,25 +2007,26 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
case EDJE_PART_TYPE_TEXT:
/* This is correctly handle in _edje_text_recalc_apply at the moment. */
break;
+ case EDJE_PART_TYPE_GRADIENT:
+ /* FIXME: definitivly remove this code when we switch to new format. */
+ abort();
+ break;
}
/* Some object need special recalc. */
switch (ep->part->type)
{
case EDJE_PART_TYPE_TEXT:
- _edje_text_recalc_apply(ed, ep, pf, chosen_desc);
+ _edje_text_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc);
break;
case EDJE_PART_TYPE_IMAGE:
- _edje_image_recalc_apply(ed, ep, pf, chosen_desc, pos);
- break;
- case EDJE_PART_TYPE_GRADIENT:
- _edje_gradient_recalc_apply(ed, ep, pf, chosen_desc);
+ _edje_image_recalc_apply(ed, ep, pf, (Edje_Part_Description_Image*) chosen_desc, pos);
break;
case EDJE_PART_TYPE_BOX:
- _edje_box_recalc_apply(ed, ep, pf, chosen_desc);
+ _edje_box_recalc_apply(ed, ep, pf, (Edje_Part_Description_Box*) chosen_desc);
break;
case EDJE_PART_TYPE_TABLE:
- _edje_table_recalc_apply(ed, ep, pf, chosen_desc);
+ _edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table*) chosen_desc);
break;
case EDJE_PART_TYPE_EXTERNAL:
case EDJE_PART_TYPE_RECTANGLE:
@@ -2087,6 +2035,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
case EDJE_PART_TYPE_TEXTBLOCK:
/* Nothing special to do for this type of object. */
break;
+ case EDJE_PART_TYPE_GRADIENT:
+ /* FIXME: definitivly remove this code when we switch to new format. */
+ abort();
+ break;
}
if (ep->swallowed_object)
@@ -2115,7 +2067,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
Evas_Map *map;
Evas_Coord cx, cy, cz;
double rx, ry, rz;
- Edje_Part_Description *desc1, *desc2;
+ Edje_Part_Description_Common *desc1, *desc2;
desc1 = ep->param1.description;
desc2 = NULL;
@@ -2147,7 +2099,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
(desc1->map.rot.id_center >= 0) &&
(desc1->map.rot.id_center != ep->part->id))
{
- Evas_Coord cx1, cy1, cz1, cx2, cy2, cz2;
+ Evas_Coord cx1 = 0, cy1 = 0, cz1 = 0, cx2 = 0, cy2 = 0, cz2 = 0;
Edje_Real_Part *ep2 =
ed->table_parts[desc1->map.rot.id_center %
ed->table_parts_size];
@@ -2213,14 +2165,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
(desc2->map.id_light >= 0) &&
(desc2->map.id_light != ep->part->id)))
{
- Evas_Coord lx, ly, lz;
- int lr, lg, lb, lar, lag, lab;
- Evas_Coord lx1, ly1, lz1;
- int lr1, lg1, lb1, lar1, lag1, lab1, do1;
- Evas_Coord lx2, ly2, lz2;
- int lr2, lg2, lb2, lar2, lag2, lab2, do2;
-
- do1 = do2 = 0;
+ Evas_Coord lx = 0, ly = 0, lz = 0;
+ int lr = 0, lg = 0, lb = 0, lar = 0, lag = 0, lab = 0;
+ Evas_Coord lx1 = 0, ly1 = 0, lz1 = 0;
+ int lr1 = 0, lg1 = 0, lb1 = 0, lar1 = 0, lag1 = 0, lab1 = 0, do1 = 0;
+ Evas_Coord lx2 = 0, ly2 = 0, lz2 = 0;
+ int lr2 = 0, lg2 = 0, lb2 = 0, lar2 = 0, lag2 = 0, lab2 = 0, do2 = 0;
if ((desc1) &&
(desc1->map.id_light >= 0) &&
@@ -2232,7 +2182,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
// get light part
if (ep2)
{
- Edje_Part_Description *ep2desc1, *ep2desc2;
+ Edje_Part_Description_Common *ep2desc1, *ep2desc2;
FLOAT_T ep2pos;
do1 = 1;
@@ -2249,7 +2199,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
// if light is transitioning - interpolate it
if ((ep2pos != ZERO) && (ep2desc2))
{
- lz1 = ep2desc1->persp.zplane +
+ lz1 = ep2desc1->persp.zplane +
TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane -
ep2desc1->persp.zplane));
lr1 = ep2desc1->color.r +
@@ -2293,7 +2243,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
// get light part
if (ep2)
{
- Edje_Part_Description *ep2desc1, *ep2desc2;
+ Edje_Part_Description_Common *ep2desc1, *ep2desc2;
FLOAT_T ep2pos;
do2 = 1;
@@ -2310,7 +2260,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
// if light is transitioning - interpolate it
if ((ep2pos != ZERO) && (ep2desc2))
{
- lz2 = ep2desc1->persp.zplane +
+ lz2 = ep2desc1->persp.zplane +
TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane -
ep2desc1->persp.zplane));
lr2 = ep2desc1->color.r +
@@ -2377,12 +2327,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
// calculate perspective point
if (chosen_desc->map.persp_on)
{
- Evas_Coord px, py, zplane, foc;
- Evas_Coord px1, py1, zplane1, foc1;
- Evas_Coord px2, py2, zplane2, foc2;
- int do1, do2;
-
- do1 = do2 = 0;
+ Evas_Coord px = 0, py = 0, zplane = 0, foc = 0;
+ Evas_Coord px1 = 0, py1 = 0, zplane1 = 0, foc1 = 0;
+ Evas_Coord px2 = 0, py2 = 0, zplane2 = 0, foc2 = 0;
+ int do1 = 0, do2 = 0;
// default perspective point
px = ed->x + (ed->w / 2);
@@ -2398,7 +2346,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
ed->table_parts_size];
if (ep2)
{
- Edje_Part_Description *ep2desc1, *ep2desc2;
+ Edje_Part_Description_Common *ep2desc1, *ep2desc2;
FLOAT_T ep2pos;
do1 = 1;
@@ -2413,10 +2361,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
py1 = ed->y + ep2->y + (ep2->h / 2);
if ((ep2pos != ZERO) && (ep2desc2))
{
- zplane1 = ep2desc1->persp.zplane +
+ zplane1 = ep2desc1->persp.zplane +
TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane -
ep2desc1->persp.zplane));
- foc1 = ep2desc1->persp.focal +
+ foc1 = ep2desc1->persp.focal +
TO_INT(SCALE(ep2pos, ep2desc2->persp.focal -
ep2desc1->persp.focal));
}
@@ -2436,7 +2384,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
ed->table_parts_size];
if (ep2)
{
- Edje_Part_Description *ep2desc1, *ep2desc2;
+ Edje_Part_Description_Common *ep2desc1, *ep2desc2;
FLOAT_T ep2pos;
do2 = 1;
@@ -2451,10 +2399,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
py2 = ed->y + ep2->y + (ep2->h / 2);
if ((ep2pos != ZERO) && (ep2desc2))
{
- zplane2 = ep2desc1->persp.zplane +
+ zplane2 = ep2desc1->persp.zplane +
TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane -
ep2desc1->persp.zplane));
- foc2 = ep2desc1->persp.focal +
+ foc2 = ep2desc1->persp.focal +
TO_INT(SCALE(ep2pos, ep2desc2->persp.focal -
ep2desc1->persp.focal));
}
diff --git a/src/lib/edje_callbacks.c b/src/lib/edje_callbacks.c
index ffc281d..4966688 100644
--- a/src/lib/edje_callbacks.c
+++ b/src/lib/edje_callbacks.c
@@ -1,11 +1,7 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "edje_private.h"
static void
-_edje_hold_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_hold_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Hold *ev;
Edje *ed;
@@ -24,7 +20,7 @@ _edje_hold_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
}
static void
-_edje_focus_in_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_focus_in_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
{
Edje *ed;
Edje_Real_Part *rp;
@@ -40,7 +36,7 @@ _edje_focus_in_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_in
}
static void
-_edje_focus_out_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_focus_out_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
{
Edje *ed;
Edje_Real_Part *rp;
@@ -56,7 +52,7 @@ _edje_focus_out_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_i
}
static void
-_edje_mouse_in_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_mouse_in_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_In *ev;
Edje *ed;
@@ -74,7 +70,7 @@ _edje_mouse_in_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_in
}
static void
-_edje_mouse_out_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_mouse_out_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Out *ev;
Edje *ed;
@@ -92,7 +88,7 @@ _edje_mouse_out_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_i
}
static void
-_edje_mouse_down_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_mouse_down_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev;
Edje *ed;
@@ -208,7 +204,7 @@ _edje_mouse_down_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_
}
static void
-_edje_mouse_up_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_mouse_up_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Up *ev;
Edje *ed;
@@ -276,7 +272,7 @@ _edje_mouse_up_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_in
}
static void
-_edje_mouse_move_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_mouse_move_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *ev;
Edje *ed;
@@ -355,7 +351,7 @@ _edje_mouse_move_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_
}
static void
-_edje_mouse_wheel_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+_edje_mouse_wheel_signal_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Wheel *ev;
Edje *ed;
@@ -375,8 +371,8 @@ _edje_mouse_wheel_signal_cb(void *data, Evas * e, Evas_Object * obj, void *event
e = NULL;
}
-int
-_edje_timer_cb(void *data)
+Eina_Bool
+_edje_timer_cb(void *data __UNUSED__)
{
double t;
Eina_List *l;
@@ -445,13 +441,12 @@ _edje_timer_cb(void *data)
_edje_thaw(ed);
_edje_unref(ed);
}
- if (_edje_anim_count > 0) return 1;
+ if (_edje_anim_count > 0) return ECORE_CALLBACK_RENEW;
_edje_timer = NULL;
- return 0;
- data = NULL;
+ return ECORE_CALLBACK_CANCEL;
}
-int
+Eina_Bool
_edje_pending_timer_cb(void *data)
{
Edje_Pending_Program *pp;
@@ -460,7 +455,7 @@ _edje_pending_timer_cb(void *data)
pp->edje->pending_actions = eina_list_remove(pp->edje->pending_actions, pp);
_edje_program_run(pp->edje, pp->program, 1, "", "");
free(pp);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
void
diff --git a/src/lib/edje_container.c b/src/lib/edje_container.c
index 6a6795d..8297d12 100644
--- a/src/lib/edje_container.c
+++ b/src/lib/edje_container.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "edje_private.h"
#include "edje_container.h"
diff --git a/src/lib/edje_container.h b/src/lib/edje_container.h
index b2b154e..0fba62c 100644
--- a/src/lib/edje_container.h
+++ b/src/lib/edje_container.h
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "edje_private.h"
diff --git a/src/lib/edje_convert.c b/src/lib/edje_convert.c
new file mode 100644
index 0000000..58dccc2
--- /dev/null
+++ b/src/lib/edje_convert.c
@@ -0,0 +1,500 @@
+#include "edje_private.h"
+
+static const Edje_File *_current_edje_file = NULL;
+
+const Edje_File *
+_edje_file_get(void)
+{
+ return _current_edje_file;
+}
+
+void
+_edje_file_set(const Edje_File *edf)
+{
+ _current_edje_file = edf;
+}
+
+static void
+_edje_font_string_free(void *data)
+{
+ Edje_Font_Directory_Entry *fe = data;
+
+ eina_stringshare_del(fe->path);
+ free(fe);
+}
+
+static void
+_edje_collection_string_free(void *data)
+{
+ Edje_Part_Collection_Directory_Entry *ce = data;
+
+ eina_stringshare_del(ce->entry);
+
+ if (ce->ref)
+ {
+ Edje_File *edf;
+
+ edf = (Edje_File*) _edje_file_get();
+
+ if (!edf->warning)
+ ERR("EDJE ERROR:\n"
+ "\n"
+ "Naughty Programmer - spank spank!\n"
+ "\n"
+ "This program as probably called edje_shutdown() with active Edje objects\n"
+ "still around.\n This can cause problems as both Evas and Edje retain\n"
+ "references to the objects. you should shut down all canvases and objects\n"
+ "before calling edje_shutdown().\n"
+ "The following errors are the edje object files and parts that are still\n"
+ "hanging around, with their reference counts");
+
+ edf->warning = 1;
+ ERR("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) ",
+ edf->path, edf->references,
+ ce->ref->part, ce->ref->references);
+
+ _edje_collection_free(edf, ce->ref, ce);
+ }
+
+ free(ce);
+}
+
+static Eina_Bool
+_edje_file_convert_external(Edje_File *edf, Old_Edje_File *oedf)
+{
+ Edje_External_Directory_Entry *ede;
+ unsigned int max;
+ unsigned int i = 0;
+
+ edf->external_dir = calloc(1, sizeof (Edje_External_Directory));
+ if (!edf->external_dir) return EINA_FALSE;
+ if (!oedf->external_dir) return EINA_TRUE;
+
+ max = eina_list_count(oedf->external_dir->entries);
+ edf->external_dir->entries = calloc(1, sizeof (Edje_External_Directory_Entry) * max);
+ edf->external_dir->entries_count = max;
+
+ if (!edf->external_dir->entries && max)
+ return EINA_FALSE;
+
+ EINA_LIST_FREE(oedf->external_dir->entries, ede)
+ {
+ edf->external_dir->entries[i++].entry = ede->entry;
+ free(ede);
+ }
+
+ free(oedf->external_dir);
+ oedf->external_dir = NULL;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf)
+{
+ Edje_Image_Directory_Entry *de;
+ Edje_Image_Directory_Set *ds;
+ Eina_List *l;
+ int max;
+
+ edf->image_dir = calloc(1, sizeof (Edje_Image_Directory));
+ if (!edf->image_dir) return EINA_FALSE;
+ if (!oedf->image_dir) return EINA_TRUE;
+
+ max = -1;
+ EINA_LIST_FOREACH(oedf->image_dir->entries, l, de)
+ if (max < de->id)
+ max = de->id;
+
+ edf->image_dir->entries = calloc(1, sizeof (Edje_Image_Directory_Entry) * (max + 1));
+ edf->image_dir->entries_count = max + 1;
+
+ if (!edf->image_dir->entries && edf->image_dir->entries_count)
+ return EINA_FALSE;
+
+ EINA_LIST_FREE(oedf->image_dir->entries, de)
+ {
+ memcpy(edf->image_dir->entries + de->id,
+ de,
+ sizeof (Edje_Image_Directory_Entry));
+ free(de);
+ }
+
+ max = -1;
+ EINA_LIST_FOREACH(oedf->image_dir->sets, l, ds)
+ if (max < ds->id)
+ max = ds->id;
+
+ edf->image_dir->sets = calloc(1, sizeof (Edje_Image_Directory_Set) * (max + 1));
+ edf->image_dir->sets_count = max + 1;
+
+ if (!edf->image_dir->sets && edf->image_dir->sets_count)
+ {
+ free(edf->image_dir->entries);
+ edf->image_dir->entries = NULL;
+ return EINA_FALSE;
+ }
+
+ EINA_LIST_FREE(oedf->image_dir->sets, ds)
+ {
+ memcpy(edf->image_dir->sets + ds->id,
+ ds,
+ sizeof (Edje_Image_Directory_Set));
+ free(ds);
+ }
+
+ return EINA_TRUE;
+}
+
+Edje_File *
+_edje_file_convert(Eet_File *file, Old_Edje_File *oedf)
+{
+ Edje_Part_Collection_Directory_Entry *ce;
+ Edje_Font_Directory_Entry *fnt;
+ Edje_File *edf;
+ Eina_List *l;
+ Edje_Data *ed;
+
+ edf = calloc(1, sizeof (Edje_File));
+ if (!edf) return NULL;
+
+ edf->free_strings = eet_dictionary_get(file) ? 0 : 1;
+
+ if (edf->free_strings)
+ {
+ edf->fonts = eina_hash_string_small_new(_edje_font_string_free);
+ edf->collection = eina_hash_string_small_new(_edje_collection_string_free);
+ edf->data = eina_hash_string_small_new((Eina_Free_Cb) eina_stringshare_del);
+ }
+ else
+ {
+ edf->fonts = eina_hash_string_small_new(free);
+ edf->collection = eina_hash_string_small_new(free);
+ edf->data = eina_hash_string_small_new(NULL);
+ }
+
+ if (!edf->fonts || !edf->collection || !edf->data)
+ goto on_error;
+
+ EINA_LIST_FREE(oedf->data, ed)
+ {
+ eina_hash_direct_add(edf->data, ed->key, ed->value);
+ free(ed);
+ }
+
+ EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce)
+ if (ce->entry)
+ eina_hash_direct_add(edf->collection, ce->entry, ce);
+
+ if (oedf->font_dir)
+ EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt)
+ {
+ char *tmp;
+ int length;
+
+ length = strlen(fnt->entry) + 7;
+ tmp = alloca(length);
+
+ snprintf(tmp, length, "fonts/%s", fnt->entry);
+ fnt->path = eina_stringshare_add(tmp);
+ if (edf->free_strings)
+ eina_stringshare_del(fnt->entry);
+ fnt->entry = fnt->path + 6;
+
+ eina_hash_direct_add(edf->fonts, fnt->entry, fnt);
+ }
+
+ if (!_edje_file_convert_images(edf, oedf))
+ goto on_error;
+
+ if (!_edje_file_convert_external(edf, oedf))
+ goto on_error;
+
+ edf->oef = oedf;
+ edf->styles = oedf->styles;
+ edf->color_classes = oedf->color_classes;
+ edf->version = oedf->version;
+ edf->feature_ver = oedf->feature_ver;
+ edf->compiler = oedf->compiler;
+
+ edf->dangling = EINA_FALSE;
+ edf->warning = EINA_FALSE;
+
+ /* Below you will find all memory structure that could be cleaned when under
+ memory pressure */
+ edf->collection_cache = NULL;
+ edf->collection_patterns = NULL;
+
+ return edf;
+
+ on_error:
+ eina_hash_free(edf->fonts);
+ eina_hash_free(edf->collection);
+ eina_hash_free(edf->data);
+ free(edf->image_dir);
+ free(edf->external_dir);
+ free(edf);
+ return NULL;
+}
+
+static void
+_edje_collection_program_add(Edje_Program ***array,
+ unsigned int *count,
+ Edje_Program *add)
+{
+ Edje_Program **tmp;
+
+ tmp = realloc(*array, sizeof (Edje_Program*) * (*count + 1));
+ if (!tmp) return ;
+
+ tmp[(*count)++] = add;
+ *array = tmp;
+}
+
+Edje_Part_Collection *
+_edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc)
+{
+ Edje_Part_Collection_Directory_Entry *ce;
+ Edje_Part_Collection *edc;
+ Old_Edje_Part *part;
+ Edje_Program *pg;
+ Edje_Data *di;
+ Eina_List *l;
+ unsigned int k;
+
+ ce = eina_hash_find(file->collection, oedc->part);
+
+ /* Count each type part and their respective state */
+ EINA_LIST_FOREACH(oedc->parts, l, part)
+ {
+ int *count;
+ int dummy = 0;
+
+
+ switch (part->type)
+ {
+#define CSP(Tp, Ce) \
+ case EDJE_PART_TYPE_##Tp : \
+ count = &Ce->count.Tp; \
+ break;
+
+ CSP(RECTANGLE, ce);
+ CSP(TEXT, ce);
+ CSP(IMAGE, ce);
+ CSP(SWALLOW, ce);
+ CSP(TEXTBLOCK, ce);
+ CSP(GROUP, ce);
+ CSP(BOX, ce);
+ CSP(TABLE, ce);
+ CSP(EXTERNAL, ce);
+ default:
+ count = &dummy;
+ break;
+ }
+
+ *count += eina_list_count(part->other_desc) + 1;
+ }
+ ce->count.part = eina_list_count(oedc->parts);
+
+#define CONVERT_EMN(Tp, Sz, Ce) \
+ Ce->mp.Tp = eina_mempool_add("one_big", #Tp, NULL, sizeof (Sz), Ce->count.Tp);
+
+ CONVERT_EMN(RECTANGLE, Edje_Part_Description_Common, ce);
+ CONVERT_EMN(TEXT, Edje_Part_Description_Text, ce);
+ CONVERT_EMN(IMAGE, Edje_Part_Description_Image, ce);
+ CONVERT_EMN(SWALLOW, Edje_Part_Description_Common, ce);
+ CONVERT_EMN(TEXTBLOCK, Edje_Part_Description_Text, ce);
+ CONVERT_EMN(GROUP, Edje_Part_Description_Common, ce);
+ CONVERT_EMN(BOX, Edje_Part_Description_Box, ce);
+ CONVERT_EMN(TABLE, Edje_Part_Description_Table, ce);
+ CONVERT_EMN(EXTERNAL, Edje_Part_Description_External, ce);
+ CONVERT_EMN(part, Edje_Part, ce);
+
+ /* Change structure layout */
+ edc = calloc(1, sizeof (Edje_Part_Collection));
+ if (!edc) return NULL;
+ ce->ref = edc;
+
+ EINA_LIST_FREE(oedc->programs, pg)
+ {
+ if (!pg->signal && !pg->source)
+ _edje_collection_program_add(&edc->programs.nocmp,
+ &edc->programs.nocmp_count,
+ pg);
+ else if (pg->signal && strpbrk(pg->signal, "*?[\\") == NULL
+ && pg->source && strpbrk(pg->source, "*?[\\") == NULL)
+ _edje_collection_program_add(&edc->programs.strcmp,
+ &edc->programs.strcmp_count,
+ pg);
+ else if (pg->signal && edje_program_is_strncmp(pg->signal)
+ && pg->source && edje_program_is_strncmp(pg->source))
+ _edje_collection_program_add(&edc->programs.strncmp,
+ &edc->programs.strncmp_count,
+ pg);
+ else if (pg->signal && edje_program_is_strrncmp(pg->signal)
+ && pg->source && edje_program_is_strrncmp(pg->source))
+ _edje_collection_program_add(&edc->programs.strrncmp,
+ &edc->programs.strrncmp_count,
+ pg);
+ else
+ _edje_collection_program_add(&edc->programs.fnmatch,
+ &edc->programs.fnmatch_count,
+ pg);
+ }
+
+ edc->data = eina_hash_string_small_new(NULL);
+ EINA_LIST_FREE(oedc->data, di)
+ {
+ eina_hash_direct_add(edc->data, di->key, di->value);
+ free(di);
+ }
+
+ edc->parts_count = eina_list_count(oedc->parts);
+ edc->parts = calloc(edc->parts_count, sizeof (Edje_Part *));
+ k = 0;
+
+ EINA_LIST_FREE(oedc->parts, part)
+ {
+ Old_Edje_Part_Description *oepd;
+ Edje_Pack_Element *elm;
+ Edje_Part *replacement;
+ unsigned int i;
+
+ replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part));
+
+ replacement->name = part->name;
+ replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc);
+
+ replacement->other_count = eina_list_count(part->other_desc);
+ replacement->other_desc = calloc(replacement->other_count, sizeof (Edje_Part_Description_Common*));
+
+ i = 0;
+ EINA_LIST_FREE(part->other_desc, oepd)
+ replacement->other_desc[i++] = _edje_description_convert(part->type, ce, oepd);
+
+ replacement->source = part->source;
+ replacement->source2 = part->source2;
+ replacement->source3 = part->source3;
+ replacement->source4 = part->source4;
+ replacement->source5 = part->source5;
+ replacement->source6 = part->source6;
+ replacement->id = part->id;
+ replacement->clip_to_id = part->clip_to_id;
+ replacement->dragable = part->dragable;
+ replacement->items_count = eina_list_count(part->items);
+ replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element*));
+
+ i = 0;
+ EINA_LIST_FREE(part->items, elm)
+ replacement->items[i++] = elm;
+
+ replacement->type = part->type;
+ replacement->effect = part->effect;
+ replacement->mouse_events = part->mouse_events;
+ replacement->repeat_events = part->repeat_events;
+ replacement->ignore_flags = part->ignore_flags;
+ replacement->scale = part->scale;
+ replacement->precise_is_inside = part->precise_is_inside;
+ replacement->use_alternate_font_metrics = part->use_alternate_font_metrics;
+ replacement->pointer_mode = part->pointer_mode;
+ replacement->entry_mode = part->entry_mode;
+ replacement->select_mode = part->select_mode;
+ replacement->multiline = part->multiline;
+ replacement->api = part->api;
+
+ edc->parts[k++] = replacement;
+
+ free(part);
+ }
+
+ edc->id = oedc->id;
+ edc->alias = oedc->alias;
+ edc->prop.min = oedc->prop.min;
+ edc->prop.max = oedc->prop.max;
+ edc->script = oedc->script;
+ edc->part = oedc->part;
+ edc->script_only = oedc->script_only;
+ edc->lua_script_only = oedc->lua_script_only;
+ edc->checked = oedc->checked;
+
+ free(oedc);
+
+ return edc;
+}
+
+Edje_Part_Description_Common*
+_edje_description_convert(int type,
+ Edje_Part_Collection_Directory_Entry *ce,
+ Old_Edje_Part_Description *oed)
+{
+ Edje_Part_Description_Common *result = NULL;
+
+ switch (type)
+ {
+ case EDJE_PART_TYPE_RECTANGLE:
+ result = eina_mempool_malloc(ce->mp.RECTANGLE,
+ sizeof (Edje_Part_Description_Common));
+ break;
+ case EDJE_PART_TYPE_SWALLOW:
+ result = eina_mempool_malloc(ce->mp.SWALLOW,
+ sizeof (Edje_Part_Description_Common));
+ break;
+ case EDJE_PART_TYPE_GROUP:
+ result = eina_mempool_malloc(ce->mp.GROUP,
+ sizeof (Edje_Part_Description_Common));
+ break;
+
+ case EDJE_PART_TYPE_IMAGE:
+ {
+ Edje_Part_Description_Image *img;
+ Edje_Part_Image_Id *id;
+ unsigned int i = 0;
+
+ img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image));
+
+ img->image.tweens_count = eina_list_count(oed->image.tween_list);
+ img->image.tweens = calloc(img->image.tweens_count,
+ sizeof (Edje_Part_Image_Id*));
+ if (img->image.tweens_count > 0 && !img->image.tweens)
+ {
+ eina_mempool_free(ce->mp.IMAGE, img);
+ return NULL;
+ }
+
+ EINA_LIST_FREE(oed->image.tween_list, id)
+ img->image.tweens[i++] = id;
+
+ img->image.id = oed->image.id;
+ img->image.scale_hint = oed->image.scale_hint;
+ img->image.set = oed->image.set;
+
+ img->image.border = oed->image.border;
+ img->image.fill = oed->image.fill;
+
+ result = &img->common;
+ break;
+ }
+
+#define CONVERT_ALLOC_POOL(Short, Type, Name) \
+ case EDJE_PART_TYPE_##Short: \
+ { \
+ Edje_Part_Description_##Type *Name; \
+ \
+ Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \
+ Name->Name = oed->Name; \
+ result = &Name->common; \
+ break; \
+ }
+
+ CONVERT_ALLOC_POOL(TEXT, Text, text);
+ CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text);
+ CONVERT_ALLOC_POOL(BOX, Box, box);
+ CONVERT_ALLOC_POOL(TABLE, Table, table);
+ CONVERT_ALLOC_POOL(EXTERNAL, External, external_params);
+ }
+
+ *result = oed->common;
+
+ free(oed);
+ return result;
+}
diff --git a/src/lib/edje_convert.h b/src/lib/edje_convert.h
new file mode 100644
index 0000000..fcc2781
--- /dev/null
+++ b/src/lib/edje_convert.h
@@ -0,0 +1,143 @@
+#ifndef EDJE_CONVERT_H__
+# define EDJE_CONVERT_H__
+
+typedef struct _Old_Edje_Image_Directory Old_Edje_Image_Directory;
+typedef struct _Old_Edje_Font_Directory Old_Edje_Font_Directory;
+typedef struct _Old_Edje_External_Directory Old_Edje_External_Directory;
+typedef struct _Old_Edje_Part Old_Edje_Part;
+typedef struct _Old_Edje_Part_Collection Old_Edje_Part_Collection;
+typedef struct _Old_Edje_Part_Description Old_Edje_Part_Description;
+typedef struct _Old_Edje_Part_Description_Spec_Image Old_Edje_Part_Description_Spec_Image;
+typedef struct _Edje_Data Edje_Data;
+
+struct _Edje_Data
+{
+ const char *key;
+ char *value;
+};
+
+/*----------*/
+
+struct _Old_Edje_Font_Directory
+{
+ Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
+};
+
+struct _Old_Edje_Image_Directory
+{
+ Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
+ Eina_List *sets; /* a list of Edje_Image_Directory_Set */
+};
+
+struct _Old_Edje_External_Directory
+{
+ Eina_List *entries; /* a list of Edje_External_Directory_Entry */
+};
+
+struct _Old_Edje_File
+{
+ const char *path;
+ time_t mtime;
+
+ Old_Edje_External_Directory *external_dir;
+ Old_Edje_Font_Directory *font_dir;
+ Old_Edje_Image_Directory *image_dir;
+ Edje_Part_Collection_Directory *collection_dir;
+ Eina_List *data;
+ Eina_List *styles;
+ Eina_List *color_classes;
+
+ const char *compiler;
+ int version;
+ int feature_ver;
+};
+
+struct _Old_Edje_Part_Collection
+{
+ Eina_List *programs; /* a list of Edje_Program */
+ Eina_List *parts; /* a list of Edje_Part */
+ Eina_List *data;
+
+ int id; /* the collection id */
+
+ Eina_Hash *alias; /* aliasing part*/
+
+ struct {
+ Edje_Size min, max;
+ } prop;
+
+ int references;
+#ifdef EDJE_PROGRAM_CACHE
+ struct {
+ Eina_Hash *no_matches;
+ Eina_Hash *matches;
+ } prog_cache;
+#endif
+
+ Embryo_Program *script; /* all the embryo script code for this group */
+ const char *part;
+
+ unsigned char script_only;
+
+ unsigned char lua_script_only;
+
+ unsigned char checked : 1;
+};
+
+struct _Old_Edje_Part
+{
+ const char *name; /* the name if any of the part */
+ Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
+ Eina_List *other_desc; /* other possible descriptors */
+ const char *source, *source2, *source3, *source4, *source5, *source6;
+ int id; /* its id number */
+ int clip_to_id; /* the part id to clip this one to */
+ Edje_Part_Dragable dragable;
+ Eina_List *items; /* packed items for box and table */
+ unsigned char type; /* what type (image, rect, text) */
+ unsigned char effect; /* 0 = plain... */
+ unsigned char mouse_events; /* it will affect/respond to mouse events */
+ unsigned char repeat_events; /* it will repeat events to objects below */
+ Evas_Event_Flags ignore_flags;
+ unsigned char scale; /* should certain properties scale with edje scale factor? */
+ unsigned char precise_is_inside;
+ unsigned char use_alternate_font_metrics;
+ unsigned char pointer_mode;
+ unsigned char entry_mode;
+ unsigned char select_mode;
+ unsigned char multiline;
+ Edje_Part_Api api;
+};
+
+struct _Old_Edje_Part_Description_Spec_Image
+{
+ Eina_List *tween_list; /* list of Edje_Part_Image_Id */
+ int id; /* the image id to use */
+ int scale_hint; /* evas scale hint */
+ Eina_Bool set; /* if image condition it's content */
+
+ Edje_Part_Description_Spec_Border border;
+ Edje_Part_Description_Spec_Fill fill;
+};
+
+struct _Old_Edje_Part_Description
+{
+ Edje_Part_Description_Common common;
+ Old_Edje_Part_Description_Spec_Image image;
+ Edje_Part_Description_Spec_Text text;
+ Edje_Part_Description_Spec_Box box;
+ Edje_Part_Description_Spec_Table table;
+
+ Eina_List *external_params; /* parameters for external objects */
+};
+
+Edje_File *_edje_file_convert(Eet_File *file, Old_Edje_File *oedf);
+Edje_Part_Collection *_edje_collection_convert(Edje_File *file,
+ Old_Edje_Part_Collection *oedc);
+Edje_Part_Description_Common *_edje_description_convert(int type,
+ Edje_Part_Collection_Directory_Entry *ce,
+ Old_Edje_Part_Description *oed);
+const Edje_File *_edje_file_get(void);
+void _edje_file_set(const Edje_File *edf);
+
+#endif
diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c
index 3b1465c..d4e647f 100644
--- a/src/lib/edje_data.c
+++ b/src/lib/edje_data.c
@@ -1,36 +1,82 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "edje_private.h"
EAPI Eet_Data_Descriptor *_edje_edd_edje_file = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_style = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_style_tag = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_color_class = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_data = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_external_directory = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_external_directory_entry = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_font_directory = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory_set = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory_set_entry = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_spectrum_directory = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_spectrum_directory_entry = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_spectrum_color = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_program = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_program_target = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_program_after = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_part_collection_directory = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_part_collection_directory_entry = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_pack_element = NULL;
EAPI Eet_Data_Descriptor *_edje_edd_edje_part_collection = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_part = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_part_description = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_part_image_id = NULL;
-EAPI Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL;
+
+Eet_Data_Descriptor *_edje_edd_edje_string = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_style = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_style_tag = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_color_class = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_external_directory = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_external_directory_entry = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_image_directory = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_image_directory_set = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_image_directory_set_entry = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_program = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_program_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_program_target = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_program_after = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_collection_directory_entry = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_pack_element = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_pack_element_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_variant = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_rectangle = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_swallow = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_group = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_image = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_text = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_textblock = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_box = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_table = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_external = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_variant_list = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_rectangle_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_swallow_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_group_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_image_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_text_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_textblock_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_box_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_table_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_description_external_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_image_id = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_part_image_id_pointer = NULL;
+Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL;
+
+#define EMP(Type, Minus) \
+ Eina_Mempool *_emp_##Type = NULL; \
+ \
+ static void * \
+ mem_alloc_##Minus(size_t size) \
+ { \
+ void *data; \
+ \
+ data = eina_mempool_malloc(_emp_##Type, size); \
+ memset(data, 0, size); \
+ \
+ return data; \
+ } \
+ \
+ static void \
+ mem_free_##Minus(void *data) \
+ { \
+ eina_mempool_free(_emp_##Type, data); \
+ }
+
+EMP(RECTANGLE, rectangle);
+EMP(TEXT, text);
+EMP(IMAGE, image);
+EMP(SWALLOW, swallow);
+EMP(TEXTBLOCK, textblock);
+EMP(GROUP, group);
+EMP(BOX, box);
+EMP(TABLE, table);
+EMP(EXTERNAL, external);
+EMP(part, part);
#define FREED(eed) \
if (eed) \
@@ -39,43 +85,144 @@ EAPI Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL;
(eed) = NULL; \
}
+struct {
+ Edje_Part_Type type;
+ const char *name;
+} variant_convertion[] = {
+ { EDJE_PART_TYPE_RECTANGLE, "rectangle" },
+ { EDJE_PART_TYPE_SWALLOW, "swallow" },
+ { EDJE_PART_TYPE_GROUP, "group" },
+ { EDJE_PART_TYPE_IMAGE, "image" },
+ { EDJE_PART_TYPE_TEXT, "text" },
+ { EDJE_PART_TYPE_TEXTBLOCK, "textblock" },
+ { EDJE_PART_TYPE_BOX, "box" },
+ { EDJE_PART_TYPE_TABLE, "table" },
+ { EDJE_PART_TYPE_EXTERNAL, "external" },
+};
+
+static const char *
+_edje_description_variant_type_get(const void *data, Eina_Bool *unknow __UNUSED__)
+{
+ const unsigned char *type;
+ unsigned int i;
+
+ type = data;
+
+ for (i = 0; i < (sizeof (variant_convertion) / sizeof (variant_convertion[0])); ++i)
+ if (*type == variant_convertion[i].type)
+ return variant_convertion[i].name;
+
+ return NULL;
+}
+
+static Eina_Bool
+_edje_description_variant_type_set(const char *type, void *data, Eina_Bool unknow __UNUSED__)
+{
+ unsigned char *dt;
+ unsigned int i;
+
+ dt = data;
+
+ for (i = 0; i < (sizeof (variant_convertion) / sizeof (variant_convertion[0])); ++i)
+ if (!strcmp(variant_convertion[i].name, type))
+ {
+ *dt = variant_convertion[i].type;
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
+
+static Eina_Hash *
+_edje_eina_hash_add_alloc(Eina_Hash *hash,
+ const char *key,
+ void *data)
+{
+ if (!hash)
+ hash = eina_hash_string_small_new(free);
+
+ if (!hash)
+ return NULL;
+
+ eina_hash_add(hash, key, data);
+ return hash;
+}
+
void
_edje_edd_shutdown(void)
{
FREED(_edje_edd_edje_file);
+ FREED(_edje_edd_edje_string);
FREED(_edje_edd_edje_style);
FREED(_edje_edd_edje_style_tag);
FREED(_edje_edd_edje_color_class);
- FREED(_edje_edd_edje_data);
FREED(_edje_edd_edje_external_directory);
FREED(_edje_edd_edje_external_directory_entry);
- FREED(_edje_edd_edje_font_directory);
FREED(_edje_edd_edje_font_directory_entry);
FREED(_edje_edd_edje_image_directory);
FREED(_edje_edd_edje_image_directory_entry);
- FREED(_edje_edd_edje_spectrum_directory);
- FREED(_edje_edd_edje_spectrum_directory_entry);
- FREED(_edje_edd_edje_spectrum_color);
FREED(_edje_edd_edje_program);
+ FREED(_edje_edd_edje_program_pointer);
FREED(_edje_edd_edje_program_target);
FREED(_edje_edd_edje_program_after);
- FREED(_edje_edd_edje_part_collection_directory);
FREED(_edje_edd_edje_part_collection_directory_entry);
FREED(_edje_edd_edje_pack_element);
+ FREED(_edje_edd_edje_pack_element_pointer);
FREED(_edje_edd_edje_part_collection);
FREED(_edje_edd_edje_part);
- FREED(_edje_edd_edje_part_description);
+ FREED(_edje_edd_edje_part_pointer);
+ FREED(_edje_edd_edje_part_description_variant);
+ FREED(_edje_edd_edje_part_description_rectangle);
+ FREED(_edje_edd_edje_part_description_swallow);
+ FREED(_edje_edd_edje_part_description_group);
+ FREED(_edje_edd_edje_part_description_image);
+ FREED(_edje_edd_edje_part_description_text);
+ FREED(_edje_edd_edje_part_description_textblock);
+ FREED(_edje_edd_edje_part_description_box);
+ FREED(_edje_edd_edje_part_description_table);
+ FREED(_edje_edd_edje_part_description_external);
+ FREED(_edje_edd_edje_part_description_variant_list);
+ FREED(_edje_edd_edje_part_description_rectangle_pointer);
+ FREED(_edje_edd_edje_part_description_swallow_pointer);
+ FREED(_edje_edd_edje_part_description_group_pointer);
+ FREED(_edje_edd_edje_part_description_image_pointer);
+ FREED(_edje_edd_edje_part_description_text_pointer);
+ FREED(_edje_edd_edje_part_description_textblock_pointer);
+ FREED(_edje_edd_edje_part_description_box_pointer);
+ FREED(_edje_edd_edje_part_description_table_pointer);
+ FREED(_edje_edd_edje_part_description_external_pointer);
FREED(_edje_edd_edje_part_image_id);
+ FREED(_edje_edd_edje_part_image_id_pointer);
FREED(_edje_edd_edje_external_param);
FREED(_edje_edd_edje_image_directory_set);
FREED(_edje_edd_edje_image_directory_set_entry);
}
+#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \
+ { \
+ typedef struct _Edje_##Type##_Pointer Edje_##Type##_Pointer; \
+ struct _Edje_##Type##_Pointer \
+ { \
+ Edje_##Type *pointer; \
+ }; \
+ \
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_##Type##_Pointer); \
+ _edje_edd_edje_##Name##_pointer = \
+ eet_data_descriptor_file_new(&eddc); \
+ EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_##Name##_pointer, Edje_##Type##_Pointer, "pointer", pointer, _edje_edd_edje_##Name); \
+ }
+
void
_edje_edd_init(void)
{
Eet_Data_Descriptor_Class eddc;
+ /* localisable string */
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_String);
+ _edje_edd_edje_string = eet_data_descriptor_file_new(&eddc);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_string, Edje_String, "str", str, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_string, Edje_String, "id", id, EET_T_UINT);
+
/* external directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory_Entry);
_edje_edd_edje_external_directory_entry =
@@ -85,7 +232,7 @@ _edje_edd_init(void)
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory);
_edje_edd_edje_external_directory =
eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_edje_external_directory_entry);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_edje_external_directory_entry);
/* font directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Font_Directory_Entry);
@@ -94,11 +241,6 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Font_Directory);
- _edje_edd_edje_font_directory =
- eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_font_directory, Edje_Font_Directory, "entries", entries, _edje_edd_edje_font_directory_entry);
-
/* image directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry);
_edje_edd_edje_image_directory_entry =
@@ -128,31 +270,8 @@ _edje_edd_init(void)
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory);
_edje_edd_edje_image_directory =
eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Edje_Image_Directory, "entries", entries, _edje_edd_edje_image_directory_entry);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Edje_Image_Directory, "sets", sets, _edje_edd_edje_image_directory_set);
-
- /* spectrum directory */
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Spectrum_Color);
- _edje_edd_edje_spectrum_color =
- eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_color, Edje_Spectrum_Color, "r", r, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_color, Edje_Spectrum_Color, "g", g, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_color, Edje_Spectrum_Color, "b", b, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_color, Edje_Spectrum_Color, "a", a, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_color, Edje_Spectrum_Color, "d", d, EET_T_INT);
-
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Spectrum_Directory_Entry);
- _edje_edd_edje_spectrum_directory_entry =
- eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_directory_entry, Edje_Spectrum_Directory_Entry, "entry", entry, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_directory_entry, Edje_Spectrum_Directory_Entry, "filename", filename, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_spectrum_directory_entry, Edje_Spectrum_Directory_Entry, "color_list", color_list, _edje_edd_edje_spectrum_color);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_spectrum_directory_entry, Edje_Spectrum_Directory_Entry, "id", id, EET_T_INT);
-
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Spectrum_Directory);
- _edje_edd_edje_spectrum_directory =
- eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_spectrum_directory, Edje_Spectrum_Directory, "entries", entries, _edje_edd_edje_spectrum_directory_entry);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_image_directory, Edje_Image_Directory, "entries", entries, _edje_edd_edje_image_directory_entry);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_image_directory, Edje_Image_Directory, "sets", sets, _edje_edd_edje_image_directory_set);
/* collection directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry);
@@ -160,18 +279,16 @@ _edje_edd_init(void)
eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "entry", entry, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "id", id, EET_T_INT);
-
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory);
- _edje_edd_edje_part_collection_directory =
- eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_collection_directory, Edje_Part_Collection_Directory, "entries", entries, _edje_edd_edje_part_collection_directory_entry);
-
- /* generic data attachment */
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Data);
- _edje_edd_edje_data =
- eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_data, Edje_Data, "key", key, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_data, Edje_Data, "value", value, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.RECTANGLE", count.RECTANGLE, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.TEXT", count.TEXT, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.IMAGE", count.IMAGE, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.SWALLOW", count.SWALLOW, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.TEXTBLOCK", count.TEXTBLOCK, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.GROUP", count.GROUP, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.BOX", count.BOX, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.TABLE", count.TABLE, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.EXTERNAL", count.EXTERNAL, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "count.part", count.part, EET_T_INT);
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style_Tag);
_edje_edd_edje_style_tag =
@@ -204,19 +321,18 @@ _edje_edd_init(void)
/* the main file directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File);
- _edje_edd_edje_file =
- eet_data_descriptor_file_new(&eddc);
+ eddc.func.hash_add = (void * (*)(void *, const char *, void *)) _edje_eina_hash_add_alloc;
+ _edje_edd_edje_file = eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "compiler", compiler, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "version", version, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "feature_ver", feature_ver, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory);
- EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "font_dir", font_dir, _edje_edd_edje_font_directory);
EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory);
- EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "spectrum_dir", spectrum_dir, _edje_edd_edje_spectrum_directory);
- EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "collection_dir", collection_dir, _edje_edd_edje_part_collection_directory);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_data);
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "styles", styles, _edje_edd_edje_style);
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "color_classes", color_classes, _edje_edd_edje_color_class);
+ EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_string);
+ EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "fonts", fonts, _edje_edd_edje_font_directory_entry);
+ EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "collection", collection, _edje_edd_edje_part_collection_directory_entry);
/* parts & programs - loaded induvidually */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_Target);
@@ -271,127 +387,304 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "d", d, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_param, Edje_External_Param, "s", s, EET_T_STRING);
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description);
- _edje_edd_edje_part_description =
+#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \
+ { \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", state.name, EET_T_STRING); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", state.value, EET_T_DOUBLE); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", visible, EET_T_CHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", align.x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", align.y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", fixed.w, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", fixed.h, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", min.w, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", min.h, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", max.w, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", max.h, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", step.x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", step.y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", aspect.min, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", aspect.max, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", aspect.prefer, EET_T_CHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", rel1.relative_x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", rel1.relative_y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", rel1.offset_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", rel1.offset_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", rel1.id_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", rel1.id_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", rel2.relative_x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", rel2.relative_y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", rel2.offset_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", rel2.offset_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", rel2.id_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", rel2.id_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", color_class, EET_T_STRING); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", color.r, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", color.g, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", color.b, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", color.a, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", color2.r, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", color2.g, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", color2.b, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", color2.a, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", map.id_persp, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", map.id_light, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", map.rot.id_center, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", map.rot.x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", map.rot.y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", map.rot.z, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", map.on, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", map.smooth, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", map.alpha, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", map.persp_on, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", map.backcull, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", persp.zplane, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", persp.focal, EET_T_INT); \
+ }
+
+#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \
+ { \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", Dec.state.name, EET_T_STRING); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", Dec.state.value, EET_T_DOUBLE); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", Dec.visible, EET_T_CHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", Dec.align.x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", Dec.align.y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", Dec.fixed.w, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", Dec.fixed.h, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", Dec.min.w, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", Dec.min.h, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", Dec.max.w, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", Dec.max.h, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", Dec.step.x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", Dec.step.y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", Dec.aspect.min, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", Dec.aspect.max, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", Dec.aspect.prefer, EET_T_CHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", Dec.rel1.relative_x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", Dec.rel1.relative_y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", Dec.rel1.offset_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", Dec.rel1.offset_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", Dec.rel1.id_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", Dec.rel1.id_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", Dec.rel2.relative_x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", Dec.rel2.relative_y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", Dec.rel2.offset_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", Dec.rel2.offset_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", Dec.rel2.id_x, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", Dec.rel2.id_y, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", Dec.color_class, EET_T_STRING); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", Dec.color.r, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", Dec.color.g, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", Dec.color.b, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", Dec.color.a, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", Dec.color2.r, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", Dec.color2.g, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", Dec.color2.b, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", Dec.color2.a, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", Dec.map.id_persp, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", Dec.map.id_light, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", Dec.map.rot.id_center, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", Dec.map.rot.x, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", Dec.map.rot.y, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", Dec.map.rot.z, EDJE_T_FLOAT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", Dec.map.on, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", Dec.map.smooth, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", Dec.map.alpha, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", Dec.map.persp_on, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", Dec.map.backcull, EET_T_UCHAR); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", Dec.persp.zplane, EET_T_INT); \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", Dec.persp.focal, EET_T_INT); \
+ }
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
+ eddc.func.mem_free = mem_free_rectangle;
+ eddc.func.mem_alloc = mem_alloc_rectangle;
+ _edje_edd_edje_part_description_rectangle =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_rectangle, Edje_Part_Description_Common);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
+ eddc.func.mem_free = mem_free_swallow;
+ eddc.func.mem_alloc = mem_alloc_swallow;
+ _edje_edd_edje_part_description_swallow =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_swallow, Edje_Part_Description_Common);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common);
+ eddc.func.mem_free = mem_free_group;
+ eddc.func.mem_alloc = mem_alloc_group;
+ _edje_edd_edje_part_description_group =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(_edje_edd_edje_part_description_group, Edje_Part_Description_Common);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Image);
+ eddc.func.mem_free = mem_free_image;
+ eddc.func.mem_alloc = mem_alloc_image;
+ _edje_edd_edje_part_description_image =
eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "state.name", state.name, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "state.value", state.value, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "visible", visible, EET_T_CHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "align.x", align.x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "align.y", align.y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fixed.w", fixed.w, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fixed.h", fixed.h, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "min.w", min.w, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "min.h", min.h, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "max.w", max.w, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "max.h", max.h, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "step.x", step.x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "step.y", step.y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "aspect.min", aspect.min, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "aspect.max", aspect.max, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "aspect.prefer", aspect.prefer, EET_T_CHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel1.relative_x", rel1.relative_x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel1.relative_y", rel1.relative_y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel1.offset_x", rel1.offset_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel1.offset_y", rel1.offset_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel1.id_x", rel1.id_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel1.id_y", rel1.id_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.relative_x", rel2.relative_x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.relative_y", rel2.relative_y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.offset_x", rel2.offset_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.offset_y", rel2.offset_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.id_x", rel2.id_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.id_y", rel2.id_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "image.id", image.id, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "image.set", image.set, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_description, Edje_Part_Description, "image.tween_list", image.tween_list, _edje_edd_edje_part_image_id);
-
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.l", border.l, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.r", border.r, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.t", border.t, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.b", border.b, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.no_fill", border.no_fill, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.scale", border.scale, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.smooth", fill.smooth, EET_T_CHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_rel_x", fill.pos_rel_x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_abs_x", fill.pos_abs_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.rel_x", fill.rel_x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.abs_x", fill.abs_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_rel_y", fill.pos_rel_y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_abs_y", fill.pos_abs_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.rel_y", fill.rel_y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.abs_y", fill.abs_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.angle", fill.angle, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.spread", fill.spread, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.type", fill.type, EET_T_CHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color_class", color_class, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.r", color.r, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.g", color.g, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.b", color.b, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color.a", color.a, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color2.r", color2.r, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color2.g", color2.g, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color2.b", color2.b, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color2.a", color2.a, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color3.r", color3.r, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color3.g", color3.g, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color3.b", color3.b, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "color3.a", color3.a, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.text", text.text, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.text_class", text.text_class, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.style", text.style, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.font", text.font, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.repch", text.repch, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.size", text.size, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.fit_x", text.fit_x, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.fit_y", text.fit_y, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.min_x", text.min_x, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.min_y", text.min_y, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.max_x", text.max_x, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.max_y", text.max_y, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.align.x", text.align.x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.align.y", text.align.y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.id_source", text.id_source, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.id_text_source", text.id_text_source, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "text.elipsis", text.elipsis, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.id", gradient.id, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.type", gradient.type, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.use_rel", gradient.use_rel, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel1.relative_x", gradient.rel1.relative_x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel1.relative_y", gradient.rel1.relative_y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel1.offset_x", gradient.rel1.offset_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel1.offset_y", gradient.rel1.offset_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel2.relative_x", gradient.rel2.relative_x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel2.relative_y", gradient.rel2.relative_y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel2.offset_x", gradient.rel2.offset_x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "gradient.rel2.offset_y", gradient.rel2.offset_y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.layout", box.layout, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.alt_layout", box.alt_layout, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.align.x", box.align.x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.align.y", box.align.y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.padding.x", box.padding.x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.padding.y", box.padding.y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.min.h", box.min.h, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "box.min.v", box.min.v, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.homogeneous", table.homogeneous, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.align.x", table.align.x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.align.y", table.align.y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.padding.x", table.padding.x, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "table.padding.y", table.padding.y, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.id_persp", map.id_persp, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.id_light", map.id_light, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.rot.id_center", map.rot.id_center, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.rot.x", map.rot.x, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.rot.y", map.rot.y, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.rot.z", map.rot.z, EDJE_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.on", map.on, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.smooth", map.smooth, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.alpha", map.alpha, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.persp_on", map.persp_on, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.backcull", map.backcull, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "persp.zplane", persp.zplane, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "persp.focal", persp.focal, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_description, Edje_Part_Description, "external_params", external_params, _edje_edd_edje_external_param);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, common);
+
+ EDJE_DEFINE_POINTER_TYPE(Part_Image_Id, part_image_id);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.tweens", image.tweens, _edje_edd_edje_part_image_id_pointer);
+
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.id", image.id, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.set", image.set, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.l", image.border.l, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.r", image.border.r, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.t", image.border.t, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.b", image.border.b, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.no_fill", image.border.no_fill, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.border.scale", image.border.scale, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.smooth", image.fill.smooth, EET_T_CHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_rel_x", image.fill.pos_rel_x, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_abs_x", image.fill.pos_abs_x, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.rel_x", image.fill.rel_x, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.abs_x", image.fill.abs_x, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_rel_y", image.fill.pos_rel_y, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.pos_abs_y", image.fill.pos_abs_y, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.rel_y", image.fill.rel_y, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.abs_y", image.fill.abs_y, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.angle", image.fill.angle, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.spread", image.fill.spread, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_image, Edje_Part_Description_Image, "image.fill.type", image.fill.type, EET_T_CHAR);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
+ eddc.func.mem_free = mem_free_text;
+ eddc.func.mem_alloc = mem_alloc_text;
+ _edje_edd_edje_part_description_text =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, common);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.r", text.color3.r, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.g", text.color3.g, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.b", text.color3.b, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.color3.a", text.color3.a, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text", text.text, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.min_y", text.min_y, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.max_x", text.max_x, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.max_y", text.max_y, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.align.x", text.align.x, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.align.y", text.align.y, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_text_source", text.id_text_source, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
+ eddc.func.mem_free = mem_free_textblock;
+ eddc.func.mem_alloc = mem_alloc_textblock;
+ _edje_edd_edje_part_description_textblock =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, common);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.r", text.color3.r, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.g", text.color3.g, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.b", text.color3.b, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.color3.a", text.color3.a, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.text", text.text, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_y", text.min_y, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.max_x", text.max_x, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.max_y", text.max_y, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.align.x", text.align.x, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.align.y", text.align.y, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.id_text_source", text.id_text_source, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Box);
+ eddc.func.mem_free = mem_free_box;
+ eddc.func.mem_alloc = mem_alloc_box;
+ _edje_edd_edje_part_description_box =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, common);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.layout", box.layout, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.alt_layout", box.alt_layout, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.align.x", box.align.x, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.align.y", box.align.y, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.padding.x", box.padding.x, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.padding.y", box.padding.y, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.min.h", box.min.h, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_box, Edje_Part_Description_Box, "box.min.v", box.min.v, EET_T_UCHAR);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Table);
+ eddc.func.mem_free = mem_free_table;
+ eddc.func.mem_alloc = mem_alloc_table;
+ _edje_edd_edje_part_description_table =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, common);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.homogeneous", table.homogeneous, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.align.x", table.align.x, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.align.y", table.align.y, EDJE_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.x", table.padding.x, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.y", table.padding.y, EET_T_INT);
+
+ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_External);
+ eddc.func.mem_free = mem_free_external;
+ eddc.func.mem_alloc = mem_alloc_external;
+ _edje_edd_edje_part_description_external =
+ eet_data_descriptor_file_new(&eddc);
+ EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(_edje_edd_edje_part_description_external, Edje_Part_Description_External, common);
+ EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_description_external, Edje_Part_Description_External, "external_params", external_params, _edje_edd_edje_external_param);
+
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_rectangle);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_swallow);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Common, part_description_group);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Image, part_description_image);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Text, part_description_text);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Text, part_description_textblock);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Box, part_description_box);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_Table, part_description_table);
+ EDJE_DEFINE_POINTER_TYPE(Part_Description_External, part_description_external);
+
+ eddc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
+ eddc.func.type_get = _edje_description_variant_type_get;
+ eddc.func.type_set = _edje_description_variant_type_set;
+ _edje_edd_edje_part_description_variant = eet_data_descriptor_file_new(&eddc);
+
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "rectangle", _edje_edd_edje_part_description_rectangle);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "swallow", _edje_edd_edje_part_description_swallow);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "group", _edje_edd_edje_part_description_group);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "image", _edje_edd_edje_part_description_image);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "text", _edje_edd_edje_part_description_text);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "textblock", _edje_edd_edje_part_description_textblock);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "box", _edje_edd_edje_part_description_box);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "table", _edje_edd_edje_part_description_table);
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "external", _edje_edd_edje_part_description_external);
+
+#define EDJE_ADD_ARRAY_MAPPING(Variant, Type, Minus) \
+ { \
+ Edje_Part_Description_List tmp; \
+ \
+ eet_data_descriptor_element_add(Variant, Type, \
+ EET_T_UNKNOW, EET_G_VAR_ARRAY, \
+ 0, (char*)(&tmp.desc_count) - (char*)(&tmp), \
+ NULL, \
+ _edje_edd_edje_part_description_##Minus##_pointer); \
+ }
+
+ _edje_edd_edje_part_description_variant_list = eet_data_descriptor_file_new(&eddc);
+
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "rectangle", rectangle);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "swallow", swallow);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "group", group);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "image", image);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "text", text);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "textblock", textblock);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "box", box);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "table", table);
+ EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "external", external);
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element);
_edje_edd_edje_pack_element =
@@ -422,23 +715,24 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "colspan", colspan, EET_T_USHORT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "rowspan", rowspan, EET_T_USHORT);
+ EDJE_DEFINE_POINTER_TYPE(Pack_Element, pack_element);
+
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part);
+ eddc.func.mem_free = mem_free_part;
+ eddc.func.mem_alloc = mem_alloc_part;
_edje_edd_edje_part =
eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "name", name, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_VARIANT(_edje_edd_edje_part, Edje_Part, "default_desc", default_desc, type, _edje_edd_edje_part_description_variant);
+ EET_DATA_DESCRIPTOR_ADD_VARIANT(_edje_edd_edje_part, Edje_Part, "other", other, type, _edje_edd_edje_part_description_variant_list);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source", source, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source2", source2, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source3", source3, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source4", source4, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source5", source5, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "effect", effect, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "mouse_events", mouse_events, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "repeat_events", repeat_events, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "ignore_flags", ignore_flags, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "scale", scale, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "pointer_mode", pointer_mode, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "precise_is_inside", precise_is_inside, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "use_alternate_font_metrics", use_alternate_font_metrics, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_part, Edje_Part, "default_desc", default_desc, _edje_edd_edje_part_description);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part, Edje_Part, "other_desc", other_desc, _edje_edd_edje_part_description);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_x", dragable.step_x, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_x", dragable.count_x, EET_T_INT);
@@ -446,31 +740,45 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.events_id, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element_pointer);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "effect", effect, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "mouse_events", mouse_events, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "repeat_events", repeat_events, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "ignore_flags", ignore_flags, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "scale", scale, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "precise_is_inside", precise_is_inside, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "use_alternate_font_metrics", use_alternate_font_metrics, EET_T_UCHAR);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "pointer_mode", pointer_mode, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "entry_mode", entry_mode, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "select_mode", select_mode, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "multiline", multiline, EET_T_UCHAR);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source", source, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source2", source2, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source3", source3, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source4", source4, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source5", source5, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.name", api.name, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.description", api.description, EET_T_STRING);
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection);
_edje_edd_edje_part_collection =
eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs", programs, _edje_edd_edje_program);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_collection, Edje_Part_Collection, "parts", parts, _edje_edd_edje_part);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_collection, Edje_Part_Collection, "data", data, _edje_edd_edje_data);
+
+ EDJE_DEFINE_POINTER_TYPE(Program, program);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.fnmatch", programs.fnmatch, _edje_edd_edje_program_pointer);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.strcmp", programs.strcmp, _edje_edd_edje_program_pointer);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.strncmp", programs.strncmp, _edje_edd_edje_program_pointer);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.strrncmp", programs.strrncmp, _edje_edd_edje_program_pointer);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "programs.nocmp", programs.nocmp, _edje_edd_edje_program_pointer);
+
+ EDJE_DEFINE_POINTER_TYPE(Part, part);
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "parts", parts, _edje_edd_edje_part_pointer);
+
+ EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_part_collection, Edje_Part_Collection, "data", data, _edje_edd_edje_string);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_HASH_STRING(_edje_edd_edje_part_collection, Edje_Part_Collection, "alias", alias);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.min.w", prop.min.w, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.min.h", prop.min.h, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "part", part, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR);
}
diff --git a/src/lib/edje_edit.c b/src/lib/edje_edit.c
index 7f9f2bf..b7dea3d 100644
--- a/src/lib/edje_edit.c
+++ b/src/lib/edje_edit.c
@@ -1,8 +1,4 @@
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* TODO
* -----------------------------------------------------------------
* Add LUA Support :)
@@ -62,12 +58,15 @@
#define GET_PD_OR_RETURN(RET) \
Edje *ed; \
Edje_Edit *eed; \
- Edje_Part_Description *pd; \
+ Edje_Real_Part *rp; \
+ Edje_Part_Description_Common *pd; \
if (!evas_object_smart_type_check_ptr(obj, _edje_edit_type)) \
return RET; \
eed = evas_object_smart_data_get(obj); \
if (!eed) return RET; \
ed = (Edje *)eed; \
+ rp = _edje_real_part_get(ed, part); \
+ if (!rp) return RET; \
pd = _edje_part_description_find_byname(eed, part, state, value); \
if (!pd) return RET;
@@ -148,18 +147,18 @@ _edje_edit_smart_add(Evas_Object *obj)
static void
_edje_edit_smart_del(Evas_Object *obj)
{
- Edje_Edit *eed;
+// Edje_Edit *eed;
- eed = evas_object_smart_data_get(obj);
+// eed = evas_object_smart_data_get(obj);
_edje_edit_parent_sc->base.del(obj);
}
static Eina_Bool
_edje_edit_smart_file_set(Evas_Object *obj, const char *file, const char *group)
{
- Edje_Edit *eed;
+// Edje_Edit *eed;
- eed = evas_object_smart_data_get(obj);
+// eed = evas_object_smart_data_get(obj);
/* Nothing custom here yet, so we just call the parent function.
* TODO and maybes:
* * The whole point of this thing is keep track of stuff such as
@@ -184,15 +183,11 @@ edje_edit_object_add(Evas *e)
}
/* End of Edje_Edit smart stuff */
-
-
-
-
-static Edje_Part_Description *
+static Edje_Part_Description_Common *
_edje_part_description_find_byname(Edje_Edit *eed, const char *part, const char *state, double value)
{
Edje_Real_Part *rp;
- Edje_Part_Description *pd;
+ Edje_Part_Description_Common *pd;
if (!eed || !part || !state) return NULL;
@@ -207,8 +202,7 @@ _edje_part_description_find_byname(Edje_Edit *eed, const char *part, const char
static int
_edje_image_id_find(Evas_Object *obj, const char *image_name)
{
- Edje_Image_Directory_Entry *i;
- Eina_List *l;
+ unsigned int i;
GET_ED_OR_RETURN(-1);
@@ -217,14 +211,10 @@ _edje_image_id_find(Evas_Object *obj, const char *image_name)
//printf("SEARCH IMAGE %s\n", image_name);
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- {
- if (strcmp(image_name, i->entry) == 0)
- {
- //printf(" Found id: %d \n", i->id);
- return i->id;
- }
- }
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
+ if (ed->file->image_dir->entries[i].entry
+ && !strcmp(image_name, ed->file->image_dir->entries[i].entry))
+ return i;
return -1;
}
@@ -232,21 +222,17 @@ _edje_image_id_find(Evas_Object *obj, const char *image_name)
static const char *
_edje_image_name_find(Evas_Object *obj, int image_id)
{
- Edje_Image_Directory_Entry *i;
- Eina_List *l;
-
GET_ED_OR_RETURN(NULL);
if (!ed->file) return NULL;
if (!ed->file->image_dir) return NULL;
- //printf("SEARCH IMAGE ID %d\n", image_id);
-
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- if (image_id == i->id)
- return i->entry;
+ /* Special case for external image */
+ if (image_id < 0) image_id = -image_id - 1;
- return NULL;
+ //printf("SEARCH IMAGE ID %d\n", image_id);
+ if ((unsigned int) image_id >= ed->file->image_dir->entries_count) return NULL;
+ return ed->file->image_dir->entries[image_id].entry;
}
static void
@@ -284,7 +270,11 @@ _edje_real_part_free(Edje_Real_Part *rp)
if (rp->text.cache.out_str) eina_stringshare_del(rp->text.cache.out_str);
if (rp->custom)
- _edje_collection_free_part_description_free(rp->custom->description, 0);
+ {
+ _edje_collection_free_part_description_clean(rp->part->type, rp->custom->description, 0);
+ free(rp->custom);
+ rp->custom = NULL;
+ }
free(rp->drag);
@@ -327,6 +317,8 @@ _edje_import_font_file(Edje *ed, const char *path, const char *entry)
}
if (fread(fdata, fsize, 1, f) != 1)
{
+ free(fdata);
+ fclose(f);
ERR("Unable to read all of font file \"%s\"", path);
return EINA_FALSE;
}
@@ -416,7 +408,7 @@ _edje_import_image_file(Edje *ed, const char *path, int id)
return EINA_FALSE;
}
- snprintf(entry, sizeof(entry), "images/%i", id);
+ snprintf(entry, sizeof(entry), "edje/images/%i", id);
/* write the image data */
bytes = eet_data_image_write(eetf, entry,
@@ -449,7 +441,7 @@ _edje_import_image_file(Edje *ed, const char *path, int id)
static int
_edje_part_id_find(Edje *ed, const char *part)
{
- int id;
+ unsigned int id;
for (id = 0; id < ed->table_parts_size; id++)
{
@@ -462,6 +454,47 @@ _edje_part_id_find(Edje *ed, const char *part)
}
static void
+_edje_part_description_id_set(int type, Edje_Part_Description_Common *c, int old_id, int new_id)
+{
+ if (c->rel1.id_x == old_id) c->rel1.id_x = new_id;
+ if (c->rel1.id_y == old_id) c->rel1.id_y = new_id;
+ if (c->rel2.id_x == old_id) c->rel2.id_x = new_id;
+ if (c->rel2.id_y == old_id) c->rel2.id_y = new_id;
+
+ if (type == EDJE_PART_TYPE_TEXT
+ || type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ Edje_Part_Description_Text *t;
+
+ t = (Edje_Part_Description_Text *) c;
+
+ if (t->text.id_source == old_id) t->text.id_source = new_id;
+ if (t->text.id_text_source == old_id) t->text.id_text_source = new_id;
+ }
+}
+
+static void
+_edje_part_program_id_set(Edje_Program *epr, int old_id, int new_id)
+{
+ Edje_Program_Target *pt;
+ Eina_List *ll, *l_next;
+
+ if (epr->action != EDJE_ACTION_TYPE_STATE_SET)
+ return;
+
+ EINA_LIST_FOREACH_SAFE(epr->targets, ll, l_next, pt)
+ {
+ if (pt->id == old_id)
+ {
+ if (new_id == -1)
+ epr->targets = eina_list_remove_list(epr->targets, ll);
+ else
+ pt->id = new_id;
+ }
+ }
+}
+
+static void
_edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id)
{
/* This function change the id of a given real_part.
@@ -470,18 +503,16 @@ _edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id)
* is lost.
* If new Id = -1 then all the depencies will be deleted
*/
- int old_id;
Edje_Part *part;
- Eina_List *l, *ll, *l_next;
- Edje_Part *p;
- Edje_Program *epr;
+ unsigned int j;
+ int old_id;
part = rp->part;
if (!part) return;
//printf("CHANGE ID OF PART %s TO %d\n", part->name, new_id);
- if (!ed || !part || new_id < -1) return;
+ if (!ed || new_id < -1) return;
if (part->id == new_id) return;
@@ -489,55 +520,35 @@ _edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id)
part->id = new_id;
/* Fix all the dependecies in all parts... */
- EINA_LIST_FOREACH(ed->collection->parts, l, p)
+ for (j = 0; j < ed->collection->parts_count; ++j)
{
- Edje_Part_Description *d;
+ Edje_Part *p;
+ unsigned int k;
+
+ p = ed->collection->parts[j];
//printf(" search id: %d in %s\n", old_id, p->name);
if (p->clip_to_id == old_id) p->clip_to_id = new_id;
if (p->dragable.confine_id == old_id) p->dragable.confine_id = new_id;
/* ...in default description */
- d = p->default_desc;
- //printf(" search in %s (%s)\n", p->name, d->state.name);
- if (d->rel1.id_x == old_id) d->rel1.id_x = new_id;
- if (d->rel1.id_y == old_id) d->rel1.id_y = new_id;
- if (d->rel2.id_x == old_id) d->rel2.id_x = new_id;
- if (d->rel2.id_y == old_id) d->rel2.id_y = new_id;
- if (d->text.id_source == old_id) d->text.id_source = new_id;
- if (d->text.id_text_source == old_id) d->text.id_text_source = new_id;
+ _edje_part_description_id_set(p->type, p->default_desc, old_id, new_id);
+
/* ...and in all other descriptions */
- EINA_LIST_FOREACH(p->other_desc, ll, d)
- {
- //printf(" search in %s (%s)\n", p->name, d->state.name);
- if (d->rel1.id_x == old_id) d->rel1.id_x = new_id;
- if (d->rel1.id_y == old_id) d->rel1.id_y = new_id;
- if (d->rel2.id_x == old_id) d->rel2.id_x = new_id;
- if (d->rel2.id_y == old_id) d->rel2.id_y = new_id;
- if (d->text.id_source == old_id) d->text.id_source = new_id;
- if (d->text.id_text_source == old_id) d->text.id_text_source = new_id;
- }
+ for (k = 0; k < p->other.desc_count; ++k)
+ _edje_part_description_id_set(p->type, p->other.desc[k], old_id, new_id);
}
/*...and also in programs targets */
- EINA_LIST_FOREACH(ed->collection->programs, l, epr)
- {
- Edje_Program_Target *pt;
+#define EDJE_EDIT_PROGRAM_ID_SET(Array, Ed, It, Old, New) \
+ for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
+ _edje_part_program_id_set(Ed->collection->programs.Array[It], Old, New);
- if (epr->action != EDJE_ACTION_TYPE_STATE_SET)
- continue;
-
- EINA_LIST_FOREACH_SAFE(epr->targets, ll, l_next, pt)
- {
- if (pt->id == old_id)
- {
- if (new_id == -1)
- epr->targets = eina_list_remove_list(epr->targets, ll);
- else
- pt->id = new_id;
- }
- }
- }
+ EDJE_EDIT_PROGRAM_ID_SET(fnmatch, ed, j, old_id, new_id);
+ EDJE_EDIT_PROGRAM_ID_SET(strcmp, ed, j, old_id, new_id);
+ EDJE_EDIT_PROGRAM_ID_SET(strncmp, ed, j, old_id, new_id);
+ EDJE_EDIT_PROGRAM_ID_SET(strrncmp, ed, j, old_id, new_id);
+ EDJE_EDIT_PROGRAM_ID_SET(nocmp, ed, j, old_id, new_id);
/* Adjust table_parts */
if (new_id >= 0)
@@ -545,6 +556,48 @@ _edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id)
}
static void
+_edje_part_description_id_switch(int type, Edje_Part_Description_Common *c, int id1, int id2)
+{
+ if (c->rel1.id_x == id1) c->rel1.id_x = id2;
+ else if (c->rel1.id_x == id2) c->rel1.id_x = id1;
+ if (c->rel1.id_y == id1) c->rel1.id_y = id2;
+ else if (c->rel1.id_y == id2) c->rel1.id_y = id1;
+ if (c->rel2.id_x == id1) c->rel2.id_x = id2;
+ else if (c->rel2.id_x == id2) c->rel2.id_x = id1;
+ if (c->rel2.id_y == id1) c->rel2.id_y = id2;
+ else if (c->rel2.id_y == id2) c->rel2.id_y = id1;
+
+ if (type == EDJE_PART_TYPE_TEXT
+ || type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ Edje_Part_Description_Text *t;
+
+ t = (Edje_Part_Description_Text *) c;
+
+ if (t->text.id_source == id1) t->text.id_source = id2;
+ else if (t->text.id_source == id2) t->text.id_source = id1;
+ if (t->text.id_text_source == id1) t->text.id_text_source = id2;
+ else if (t->text.id_text_source == id2) t->text.id_text_source = id2;
+ }
+}
+
+static void
+_edje_part_program_id_switch(Edje_Program *epr, int id1, int id2)
+{
+ Edje_Program_Target *pt;
+ Eina_List *ll;
+
+ if (epr->action != EDJE_ACTION_TYPE_STATE_SET)
+ return;
+
+ EINA_LIST_FOREACH(epr->targets, ll, pt)
+ {
+ if (pt->id == id1) pt->id = id2;
+ else if (pt->id == id2) pt->id = id1;
+ }
+}
+
+static void
_edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2)
{
/* This function switch the id of two parts.
@@ -554,9 +607,7 @@ _edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2)
*/
int id1;
int id2;
- Eina_List *l, *ll;
- Edje_Part *p;
- Edje_Program *epr;
+ unsigned int i;
//printf("SWITCH ID OF PART %d AND %d\n", rp1->part->id, rp2->part->id);
@@ -575,10 +626,12 @@ _edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2)
ed->table_parts[id2] = rp1;
// Fix all the dependecies in all parts...
- EINA_LIST_FOREACH(ed->collection->parts, l, p)
+ for (i = 0; i < ed->collection->parts_count; ++i)
{
- Eina_List *ll;
- Edje_Part_Description *d;
+ unsigned int j;
+ Edje_Part *p;
+
+ p = ed->collection->parts[i];
//printf(" search id: %d in %s\n", old_id, p->name);
if (p->clip_to_id == id1) p->clip_to_id = id2;
@@ -587,52 +640,23 @@ _edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2)
else if (p->dragable.confine_id == id2) p->dragable.confine_id = id1;
// ...in default description
- d = p->default_desc;
- // printf(" search in %s (%s)\n", p->name, d->state.name);
- if (d->rel1.id_x == id1) d->rel1.id_x = id2;
- else if (d->rel1.id_x == id2) d->rel1.id_x = id1;
- if (d->rel1.id_y == id1) d->rel1.id_y = id2;
- else if (d->rel1.id_y == id2) d->rel1.id_y = id1;
- if (d->rel2.id_x == id1) d->rel2.id_x = id2;
- else if (d->rel2.id_x == id2) d->rel2.id_x = id1;
- if (d->rel2.id_y == id1) d->rel2.id_y = id2;
- else if (d->rel2.id_y == id2) d->rel2.id_y = id1;
- if (d->text.id_source == id1) d->text.id_source = id2;
- else if (d->text.id_source == id2) d->text.id_source = id1;
- if (d->text.id_text_source == id1) d->text.id_text_source = id2;
- else if (d->text.id_text_source == id2) d->text.id_text_source = id2;
+ _edje_part_description_id_switch(p->type, p->default_desc, id1, id2);
+
// ...and in all other descriptions
- EINA_LIST_FOREACH(p->other_desc, ll, d)
- {
- //printf(" search in %s (%s)\n", p->name, d->state.name);
- if (d->rel1.id_x == id1) d->rel1.id_x = id2;
- else if (d->rel1.id_x == id2) d->rel1.id_x = id1;
- if (d->rel1.id_y == id1) d->rel1.id_y = id2;
- else if (d->rel1.id_y == id2) d->rel1.id_y = id1;
- if (d->rel2.id_x == id1) d->rel2.id_x = id2;
- else if (d->rel2.id_x == id2) d->rel2.id_x = id1;
- if (d->rel2.id_y == id1) d->rel2.id_y = id2;
- else if (d->rel2.id_y == id2) d->rel2.id_y = id1;
- if (d->text.id_source == id1) d->text.id_source = id2;
- else if (d->text.id_source == id2) d->text.id_source = id1;
- if (d->text.id_text_source == id1) d->text.id_text_source = id2;
- else if (d->text.id_text_source == id2) d->text.id_text_source = id2;
- }
+ for (j = 0; j < p->other.desc_count; ++j)
+ _edje_part_description_id_switch(p->type, p->other.desc[j], id1, id2);
}
- //...and also in programs targets
- EINA_LIST_FOREACH(ed->collection->programs, l, epr)
- {
- Edje_Program_Target *pt;
- if (epr->action != EDJE_ACTION_TYPE_STATE_SET)
- continue;
-
- EINA_LIST_FOREACH(epr->targets, ll, pt)
- {
- if (pt->id == id1) pt->id = id2;
- else if (pt->id == id2) pt->id = id1;
- }
- }
+ //...and also in programs targets
+#define EDJE_EDIT_PROGRAM_SWITCH(Array, Ed, It, Id1, Id2) \
+ for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
+ _edje_part_program_id_switch(Ed->collection->programs.Array[i], Id1, Id2);
+
+ EDJE_EDIT_PROGRAM_SWITCH(fnmatch, ed, i, id1, id2);
+ EDJE_EDIT_PROGRAM_SWITCH(strcmp, ed, i, id1, id2);
+ EDJE_EDIT_PROGRAM_SWITCH(strncmp, ed, i, id1, id2);
+ EDJE_EDIT_PROGRAM_SWITCH(strrncmp, ed, i, id1, id2);
+ EDJE_EDIT_PROGRAM_SWITCH(nocmp, ed, i, id1, id2);
//TODO Real part dependencies are ok?
}
@@ -643,10 +667,9 @@ _edje_fix_parts_id(Edje *ed)
* After the execution of this function all parts will have a right
* (uniqe & ordered) id. The table_parts is also updated.
*/
- Eina_List *l;
- Edje_Part *p;
+ unsigned int i;
int correct_id;
- int count;
+ unsigned int count;
//printf("FIXING PARTS ID \n");
@@ -654,21 +677,26 @@ _edje_fix_parts_id(Edje *ed)
/* Give a correct id to all the parts */
correct_id = 0;
- EINA_LIST_FOREACH(ed->collection->parts, l, p)
+ for (i = 0; i < ed->collection->parts_count; ++i)
{
+ Edje_Part *p;
+
+ p = ed->collection->parts[i];
+
//printf(" [%d]Checking part: %s id: %d\n", correct_id, p->name, p->id);
if (p->id != correct_id)
- _edje_part_id_set(ed, ed->table_parts[p->id], correct_id);
+ if (ed->table_parts[p->id])
+ _edje_part_id_set(ed, ed->table_parts[p->id], correct_id);
correct_id++;
}
/* If we have removed some parts realloc table_parts */
- count = eina_list_count(ed->collection->parts);
+ count = ed->collection->parts_count;
if (count != ed->table_parts_size)
{
- ed->table_parts = realloc(ed->table_parts, sizeof(Edje_Real_Part *) * count);
- ed->table_parts_size = count;
+ ed->table_parts = realloc(ed->table_parts, sizeof(Edje_Real_Part *) * count);
+ ed->table_parts_size = count;
}
//printf("\n");
@@ -687,38 +715,6 @@ _edje_if_string_free(Edje *ed, const char *str)
str = NULL;
}
-static Edje_Spectrum_Directory_Entry *
-_edje_edit_spectrum_entry_get(Edje *ed, const char* spectra)
-{
- Edje_Spectrum_Directory_Entry *s;
- Eina_List *l;
-
- if (!ed->file || !spectra || !ed->file->spectrum_dir)
- return NULL;
-
- EINA_LIST_FOREACH(ed->file->spectrum_dir->entries, l, s)
- if (!strcmp(s->entry, spectra))
- return s;
-
- return NULL;
-}
-
-static Edje_Spectrum_Directory_Entry *
-_edje_edit_spectrum_entry_get_by_id(Edje *ed, int spectra_id)
-{
- Edje_Spectrum_Directory_Entry *s;
- Eina_List *l;
-
- if (!ed->file || !ed->file->spectrum_dir)
- return NULL;
-
- EINA_LIST_FOREACH(ed->file->spectrum_dir->entries, l, s)
- if (s->id == spectra_id)
- return s;
-
- return NULL;
-}
-
static Edje_Style *
_edje_edit_style_get(Edje *ed, const char *name)
{
@@ -757,25 +753,25 @@ _edje_edit_style_tag_get(Edje *ed, const char *style, const char *name)
static Edje_External_Directory_Entry *
_edje_edit_external_get(Edje *ed, const char *name)
{
- Eina_List *l;
- Edje_External_Directory_Entry *e;
+ unsigned int i;
if (!ed || !ed->file || !ed->file->external_dir || !name)
return NULL;
- EINA_LIST_FOREACH(ed->file->external_dir->entries, l, e)
- if (e->entry && !strcmp(e->entry, name))
- return e;
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ if (ed->file->external_dir->entries[i].entry
+ && !strcmp(ed->file->external_dir->entries[i].entry, name))
+ return ed->file->external_dir->entries + i;
return NULL;
}
-void
+static void
_edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, const char *new_group_name)
{
-
- Eina_List *gl, *pll, *pl;
- Edje_Part_Collection *pc;
+ Eina_Iterator *i;
+ Eina_List *pll, *pl;
+// Edje_Part_Collection *pc;
Edje_Part_Collection_Directory_Entry *pce;
char *part_name;
const char *source, *old;
@@ -784,13 +780,15 @@ _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name,
GET_ED_OR_RETURN();
- pc = ed->collection;
+// pc = ed->collection;
part_obj = edje_edit_object_add(ed->evas);
old = eina_stringshare_add(old_group_name);
- EINA_LIST_FOREACH(ed->file->collection_dir->entries, gl, pce)
+ i = eina_hash_iterator_data_new(ed->file->collection);
+
+ EINA_ITERATOR_FOREACH(i, pce)
{
edje_object_file_set(part_obj, ed->file->path, pce->entry);
@@ -808,6 +806,9 @@ _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name,
eina_stringshare_del(source);
}
}
+
+ eina_iterator_free(i);
+
eina_stringshare_del(old);
evas_object_del(part_obj);
@@ -869,7 +870,6 @@ edje_edit_group_add(Evas_Object *obj, const char *name)
Edje_Part_Collection_Directory_Entry *de;
Edje_Part_Collection_Directory_Entry *d;
Edje_Part_Collection *pc;
- Eina_List *l;
int id;
int search;
//Code *cd;
@@ -879,9 +879,8 @@ edje_edit_group_add(Evas_Object *obj, const char *name)
//printf("ADD GROUP: %s \n", name);
/* check if a group with the same name already exists */
- EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, d)
- if (!strcmp(d->entry, name))
- return EINA_FALSE;
+ if (eina_hash_find(ed->file->collection, name))
+ return EINA_FALSE;
/* Create structs */
de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
@@ -899,9 +898,12 @@ edje_edit_group_add(Evas_Object *obj, const char *name)
search = 0;
while (id == -1)
{
+ Eina_Iterator *i;
Eina_Bool found = 0;
- EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, d)
+ i = eina_hash_iterator_data_new(ed->file->collection);
+
+ EINA_ITERATOR_FOREACH(i, d)
{
// printf("search if %d is free [id %d]\n", search, d->id);
if (search == d->id)
@@ -910,22 +912,23 @@ edje_edit_group_add(Evas_Object *obj, const char *name)
break;
}
}
- if (!found)
- id = search;
- else
- search++;
+
+ eina_iterator_free(i);
+
+ if (!found) id = search;
+ else search++;
}
/* Init Edje_Part_Collection_Directory_Entry */
//printf(" new id: %d\n", id);
de->id = id;
de->entry = eina_stringshare_add(name);
- ed->file->collection_dir->entries = eina_list_append(ed->file->collection_dir->entries, de);
+ eina_hash_direct_add(ed->file->collection, de->entry, de);
/* Init Edje_Part_Collection */
pc->id = id;
pc->references = 0;
- pc->programs = NULL;
+ memset(&pc->programs, 0, sizeof (pc->programs));
pc->parts = NULL;
pc->data = NULL;
pc->script = NULL;
@@ -933,6 +936,19 @@ edje_edit_group_add(Evas_Object *obj, const char *name)
//cd = _alloc(sizeof(Code));
//codes = eina_list_append(codes, cd);
+#define EDIT_EMN(Tp, Sz, Ce) \
+ Ce->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 10);
+
+ EDIT_EMN(RECTANGLE, Edje_Part_Description_Common, de);
+ EDIT_EMN(TEXT, Edje_Part_Description_Text, de);
+ EDIT_EMN(IMAGE, Edje_Part_Description_Image, de);
+ EDIT_EMN(SWALLOW, Edje_Part_Description_Common, de);
+ EDIT_EMN(TEXTBLOCK, Edje_Part_Description_Text, de);
+ EDIT_EMN(GROUP, Edje_Part_Description_Common, de);
+ EDIT_EMN(BOX, Edje_Part_Description_Box, de);
+ EDIT_EMN(TABLE, Edje_Part_Description_Table, de);
+ EDIT_EMN(EXTERNAL, Edje_Part_Description_External, de);
+ EDIT_EMN(part, Edje_Part, de);
ed->file->collection_cache = eina_list_prepend(ed->file->collection_cache, pc);
_edje_cache_coll_clean(ed->file);
@@ -957,11 +973,12 @@ edje_edit_group_add(Evas_Object *obj, const char *name)
EAPI Eina_Bool
edje_edit_group_del(Evas_Object *obj, const char *group_name)
{
- char buf[32];
- Eina_List *l;
+ Edje_Part_Collection_Directory_Entry *e;
+ Edje_Part_Collection *die = NULL;
Edje_Part_Collection *g;
+ Eina_List *l;
Eet_File *eetf;
- Edje_Part_Collection_Directory_Entry *e;
+ char buf[32];
GET_ED_OR_RETURN(EINA_FALSE);
@@ -972,30 +989,25 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name)
_edje_edit_group_references_update(obj, group_name, NULL);
- EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, e)
- {
- if (!strcmp(e->entry, group_name))
- {
- if (e->id == ed->collection->id) return EINA_FALSE;
- ed->file->collection_dir->entries =
- eina_list_remove_list(ed->file->collection_dir->entries, l);
- break;
- }
- e = NULL;
- }
+ e = eina_hash_find(ed->file->collection, group_name);
if (!e) return EINA_FALSE;
- EINA_LIST_FOREACH(ed->file->collection_cache, l, g)
+ if (e->id == ed->collection->id) return EINA_FALSE;
+ if (e->ref)
{
- if (g->id == e->id)
- {
- ed->file->collection_cache =
- eina_list_remove_list(ed->file->collection_cache, l);
- break;
- }
- g = NULL;
+ ERR("EEK: Group \"%s\" still in use !", group_name);
+ return EINA_FALSE;
}
+ EINA_LIST_FOREACH(ed->file->collection_cache, l, g)
+ if (g->id == e->id)
+ {
+ ed->file->collection_cache =
+ eina_list_remove_list(ed->file->collection_cache, l);
+ die = g;
+ break;
+ }
+
/* Remove collection/id from eet file */
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
if (!eetf)
@@ -1009,10 +1021,8 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name)
eet_close(eetf);
/* Free Group */
- if (g) _edje_collection_free(ed->file, g);
-
- _edje_if_string_free(ed, e->entry);
- free(e);
+ if (die) _edje_collection_free(ed->file, die, e);
+ eina_hash_del(ed->file->collection, group_name, e);
/* we need to save everything to make sure the file won't have broken
* references the next time is loaded */
@@ -1024,23 +1034,18 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name)
EAPI Eina_Bool
edje_edit_group_exist(Evas_Object *obj, const char *group)
{
- Eina_List *l;
- Edje_Part_Collection_Directory_Entry *e;
-
GET_ED_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, e)
- if (e->entry && !strcmp(e->entry, group))
- return EINA_TRUE;
+ if (eina_hash_find(ed->file->collection, group))
+ return EINA_TRUE;
return EINA_FALSE;
}
EAPI Eina_Bool
edje_edit_group_name_set(Evas_Object *obj, const char *new_name)
{
- Eina_List *l;
- Edje_Part_Collection *pc;
Edje_Part_Collection_Directory_Entry *pce;
+ Edje_Part_Collection *pc;
GET_ED_OR_RETURN(EINA_FALSE);
@@ -1058,97 +1063,36 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name)
// pc->part, pc->id, new_name);
//if (pc->part && ed->file->free_strings) eina_stringshare_del(pc->part); TODO FIXME
- pc->part = eina_stringshare_add(new_name);
-
- EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, pce)
- {
- if (pc->id == pce->id)
- {
- eina_hash_del(ed->file->collection_hash,
- pce->entry, NULL);
- if (!ed->file->collection_hash)
- ed->file->collection_hash = eina_hash_string_superfast_new(NULL);
- eina_hash_add(ed->file->collection_hash,
- new_name, pc);
-
- //if (pce->entry && //TODO Also this cause segv
- // !eet_dictionary_string_check(eet_dictionary_get(ed->file->ef), pce->entry))
- // eina_stringshare_del(pce->entry);
- pce->entry = eina_stringshare_add(new_name);
-
- return EINA_TRUE;
- }
- }
- return EINA_FALSE;
-}
+ pce = eina_hash_find(ed->file->collection, pc->part);
-EAPI int
-edje_edit_group_min_w_get(Evas_Object *obj)
-{
- //printf("Get min_w of group\n");
- GET_ED_OR_RETURN(-1);
- if (!ed->collection) return -1;
- return ed->collection->prop.min.w;
-}
+ eina_hash_move(ed->file->collection, pce->entry, new_name);
-EAPI void
-edje_edit_group_min_w_set(Evas_Object *obj, int w)
-{
- //printf("Set min_w of group [new w: %d]\n", w);
- GET_ED_OR_RETURN();
- ed->collection->prop.min.w = w;
-}
+ pce->entry = eina_stringshare_add(new_name);
+ pc->part = pce->entry;
+ eina_stringshare_replace(&ed->group, new_name);
-EAPI int
-edje_edit_group_min_h_get(Evas_Object *obj)
-{
- //printf("Get min_h of group\n");
- GET_ED_OR_RETURN(-1);
- if (!ed->collection) return -1;
- return ed->collection->prop.min.h;
-}
-
-EAPI void
-edje_edit_group_min_h_set(Evas_Object *obj, int h)
-{
- //printf("Set min_h of group [new h: %d]\n", h);
- GET_ED_OR_RETURN();
- ed->collection->prop.min.h = h;
-}
-
-EAPI int
-edje_edit_group_max_w_get(Evas_Object *obj)
-{
- //printf("Get max_w of group\n");
- GET_ED_OR_RETURN(-1);
- if (!ed->collection) return -1;
- return ed->collection->prop.max.w;
-}
-
-EAPI void
-edje_edit_group_max_w_set(Evas_Object *obj, int w)
-{
- //printf("Set max_w of group: [new w: %d]\n", w);
- GET_ED_OR_RETURN();
- ed->collection->prop.max.w = w;
-}
-
-EAPI int
-edje_edit_group_max_h_get(Evas_Object *obj)
-{
- //printf("Get max_h of group\n");
- GET_ED_OR_RETURN(-1);
- if (!ed->collection) return -1;
- return ed->collection->prop.max.h;
+ return EINA_TRUE;
}
-EAPI void
-edje_edit_group_max_h_set(Evas_Object *obj, int h)
-{
- //printf("Set max_h of group: [new h: %d]\n", h);
- GET_ED_OR_RETURN();
- ed->collection->prop.max.h = h;
-}
+#define FUNC_GROUP_ACCESSOR(Class, Value) \
+ EAPI int \
+ edje_edit_group_##Class##_##Value##_get(Evas_Object *obj) \
+ { \
+ GET_ED_OR_RETURN(-1); \
+ if (!ed->collection) return -1; \
+ return ed->collection->prop.Class.Value; \
+ } \
+ EAPI void \
+ edje_edit_group_##Class##_##Value##_set(Evas_Object *obj, int v) \
+ { \
+ GET_ED_OR_RETURN(); \
+ ed->collection->prop.Class.Value = v; \
+ }
+
+FUNC_GROUP_ACCESSOR(min, w);
+FUNC_GROUP_ACCESSOR(min, h);
+FUNC_GROUP_ACCESSOR(max, w);
+FUNC_GROUP_ACCESSOR(max, h);
/***************/
/* DATA API */
@@ -1157,18 +1101,22 @@ edje_edit_group_max_h_set(Evas_Object *obj, int h)
EAPI Eina_List *
edje_edit_group_data_list_get(Evas_Object * obj)
{
- Eina_List *datas;
- Eina_List *l;
- Edje_Data *d;
+ Eina_Iterator *it;
+ Eina_List *datas = NULL;
+ const char *key;
GET_ED_OR_RETURN(NULL);
- if (!ed->file || !ed->collection)
+ if (!ed->file || !ed->collection || !ed->collection->data)
return NULL;
- datas = NULL;
- EINA_LIST_FOREACH(ed->collection->data, l, d)
- datas = eina_list_append(datas, eina_stringshare_add(d->key));
+ it = eina_hash_iterator_key_new(ed->collection->data);
+ if (!it) return NULL;
+
+ EINA_ITERATOR_FOREACH(it, key)
+ datas = eina_list_append(datas, eina_stringshare_add(key));
+
+ eina_iterator_free(it);
return datas;
}
@@ -1176,18 +1124,21 @@ edje_edit_group_data_list_get(Evas_Object * obj)
EAPI Eina_List *
edje_edit_data_list_get(Evas_Object * obj)
{
+ Eina_Iterator *i;
Eina_List *datas = NULL;
- Eina_List *l;
- Edje_Data *d;
+ const char *key;
GET_ED_OR_RETURN(NULL);
if (!ed->file || !ed->file->data)
return NULL;
- datas = NULL;
- EINA_LIST_FOREACH(ed->file->data, l, d)
- datas = eina_list_append(datas, eina_stringshare_add(d->key));
+ i = eina_hash_iterator_key_new(ed->file->data);
+
+ EINA_ITERATOR_FOREACH(i, key)
+ datas = eina_list_append(datas, eina_stringshare_add(key));
+
+ eina_iterator_free(i);
return datas;
}
@@ -1195,172 +1146,153 @@ edje_edit_data_list_get(Evas_Object * obj)
EAPI Eina_Bool
edje_edit_group_data_add(Evas_Object *obj, const char *key, const char *value)
{
- Edje_Data *new;
- Edje_Data *d;
- Eina_List *l;
- int len;
+ Edje_String *es;
GET_ED_OR_RETURN(EINA_FALSE);
if (!key || !ed->file || !ed->collection)
return EINA_FALSE;
- len = strlen(key);
- EINA_LIST_FOREACH(ed->collection->data, l, d)
- if ((d->key) && (!strncmp(d->key, key, len)))
- return EINA_FALSE;
-
- new = _alloc(sizeof(Edje_Data));
- if (!new) return EINA_FALSE;
+ if (!ed->collection->data)
+ ed->collection->data = eina_hash_string_small_new(NULL);
- new->key = (char*)eina_stringshare_add(key);
- if (value) new->value = (char*)eina_stringshare_add(value);
- else new->value = NULL;
+ if (eina_hash_find(ed->collection->data, key))
+ return EINA_FALSE;
- ed->collection->data = eina_list_append(ed->collection->data, new);
+ es = calloc(1, sizeof(Edje_String));
+ if (!es)
+ return EINA_FALSE;
+ es->str = eina_stringshare_add(value);
+ if (!eina_hash_add(ed->collection->data, key, es))
+ {
+ eina_stringshare_del(es->str);
+ free(es);
+ return EINA_FALSE;
+ }
return EINA_TRUE;
}
EAPI Eina_Bool
edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value)
{
- Eina_List *l;
- Edje_Data *d;
- Edje_Data *dd;
+ Edje_String *es;
GET_ED_OR_RETURN(EINA_FALSE);
if (!itemname || !ed->file)
return EINA_FALSE;
- EINA_LIST_FOREACH(ed->file->data, l, dd)
- if (strcmp(dd->key, itemname) == 0)
- return EINA_FALSE;
-
- d = _alloc(sizeof(Edje_Data));
- if (!d) return EINA_FALSE;
-
- d->key = (char*)eina_stringshare_add(itemname);
- if (value) d->value = (char*)eina_stringshare_add(value);
- else d->value = NULL;
+ if (eina_hash_find(ed->file->data, itemname))
+ return EINA_FALSE;
- ed->file->data = eina_list_append(ed->file->data, d);
+ es = calloc(1, sizeof(Edje_String));
+ if (!es)
+ return EINA_FALSE;
+ es->str = eina_stringshare_add(value);
+ if (!eina_hash_add(ed->file->data, itemname, es))
+ {
+ eina_stringshare_del(es->str);
+ free(es);
+ return EINA_FALSE;
+ }
return EINA_TRUE;
}
EAPI Eina_Bool
edje_edit_group_data_del(Evas_Object *obj, const char *key)
{
- Eina_List *l;
- Edje_Data *d;
- int len;
+ Edje_String *value;
GET_ED_OR_RETURN(EINA_FALSE);
if (!key || !ed->file || !ed->collection)
return EINA_FALSE;
- len = strlen(key);
- EINA_LIST_FOREACH(ed->collection->data, l, d)
- {
- if (strncmp(d->key, key, len) == 0)
- {
- _edje_if_string_free(ed, d->key);
- _edje_if_string_free(ed, d->value);
- ed->collection->data = eina_list_remove(ed->collection->data, d);
- free(d);
- return EINA_TRUE;
- }
- }
+ value = eina_hash_find(ed->collection->data, key);
+ if (!value) return EINA_FALSE;
- return EINA_FALSE;
+ eina_hash_del(ed->collection->data, key, value);
+ _edje_if_string_free(ed, value->str);
+ free(value);
+
+ return EINA_TRUE;
}
EAPI Eina_Bool
edje_edit_data_del(Evas_Object *obj, const char *itemname)
{
- Eina_List *l;
- Edje_Data *d;
+ Edje_String *value;
GET_ED_OR_RETURN(EINA_FALSE);
if (!itemname || !ed->file || !ed->file->data)
return 0;
- EINA_LIST_FOREACH(ed->file->data, l, d)
- {
- if (strcmp(d->key, itemname) == 0)
- {
- _edje_if_string_free(ed, d->key);
- _edje_if_string_free(ed, d->value);
- ed->file->data = eina_list_remove(ed->file->data, d);
- free(d);
- return EINA_TRUE;
- }
- }
- return EINA_FALSE;
+ value = eina_hash_find(ed->file->data, itemname);
+ if (!value)
+ return EINA_FALSE;
+
+ eina_hash_del(ed->file->data, itemname, value);
+ _edje_if_string_free(ed, value->str);
+ free(value);
+
+ return EINA_TRUE;
}
EAPI const char *
edje_edit_group_data_value_get(Evas_Object * obj, char *key)
{
- Eina_List *l;
- Edje_Data *d;
- int len;
+ Edje_String *value;
GET_ED_OR_RETURN(NULL);
if (!key || !ed->file || !ed->collection)
return NULL;
- len = strlen(key);
- EINA_LIST_FOREACH(ed->collection->data, l, d)
- if (strncmp(d->key, key, len) == 0)
- return eina_stringshare_add(d->value);
+ value = eina_hash_find(ed->collection->data, key);
+ if (!value)
+ return NULL;
- return NULL;
+ return eina_stringshare_add(edje_string_get(value));
}
EAPI const char *
edje_edit_data_value_get(Evas_Object * obj, char *itemname)
{
- Eina_List *l;
- Edje_Data *d;
+ Edje_String *value;
GET_ED_OR_RETURN(NULL);
if (!itemname || !ed->file || !ed->file->data)
return NULL;
- EINA_LIST_FOREACH(ed->file->data, l, d)
- if (strcmp(d->key, itemname) == 0)
- return eina_stringshare_add(d->value);
+ value = eina_hash_find(ed->file->data, itemname);
+ if (!value)
+ return NULL;
- return NULL;
+ return eina_stringshare_add(edje_string_get(value));
}
EAPI Eina_Bool
edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *value)
{
- Eina_List *l;
- Edje_Data *d;
- int len;
+ Edje_String *es;
GET_ED_OR_RETURN(EINA_FALSE);
if (!key || !value || !ed->file || !ed->collection)
return EINA_FALSE;
- len = strlen(key);
- EINA_LIST_FOREACH(ed->collection->data, l, d)
- if (strncmp(d->key, key, len) == 0)
- {
- _edje_if_string_free(ed, d->value);
- d->value = (char*)eina_stringshare_add(value);
- return EINA_TRUE;
- }
+ es = eina_hash_find(ed->collection->data, key);
+ if (es)
+ {
+ _edje_if_string_free(ed, es->str);
+ es->str = eina_stringshare_add(value);
+ es->id = 0;
+ return EINA_TRUE;
+ }
return EINA_FALSE;
}
@@ -1368,71 +1300,45 @@ edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *va
EAPI Eina_Bool
edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value)
{
- Eina_List *l;
- Edje_Data *d;
+ Edje_String *es;
GET_ED_OR_RETURN(EINA_FALSE);
if (!itemname || !value || !ed->file || !ed->file->data)
return EINA_FALSE;
- EINA_LIST_FOREACH(ed->file->data, l, d)
- if (strcmp(d->key, itemname) == 0)
- {
- _edje_if_string_free(ed, d->value);
- d->value = (char*)eina_stringshare_add(value);
- return EINA_TRUE;
- }
-
+ es = eina_hash_find(ed->file->data, itemname);
+ if (es)
+ {
+ _edje_if_string_free(ed, es->str);
+ es->str = eina_stringshare_add(value);
+ es->id = 0;
+ return EINA_TRUE;
+ }
return EINA_FALSE;
}
EAPI Eina_Bool
edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *new_key)
{
- Eina_List *l;
- Edje_Data *d;
- int len;
-
GET_ED_OR_RETURN(EINA_FALSE);
if (!key || !new_key || !ed->file || !ed->collection) {
return EINA_FALSE;
}
- len = strlen(key);
- EINA_LIST_FOREACH(ed->collection->data, l, d) {
- if (strncmp(d->key, key, len) == 0)
- {
- _edje_if_string_free(ed, d->key);
- d->key = (char*)eina_stringshare_add(new_key);
- return EINA_TRUE;
- }
- }
-
- return EINA_FALSE;
+ return eina_hash_move(ed->collection->data, key, new_key);
}
EAPI Eina_Bool
edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname)
{
- Eina_List *l;
- Edje_Data *d;
-
GET_ED_OR_RETURN(EINA_FALSE);
if (!itemname || !newname || !ed->file || !ed->file->data)
return EINA_FALSE;
- EINA_LIST_FOREACH(ed->file->data, l, d)
- if (strcmp(d->key, itemname) == 0)
- {
- _edje_if_string_free(ed, d->key);
- d->key = (char*)eina_stringshare_add(newname);
- return EINA_TRUE;
- }
-
- return EINA_FALSE;
+ return eina_hash_move(ed->file->data, itemname, newname);
}
/***********************/
@@ -1804,16 +1710,16 @@ EAPI Eina_List *
edje_edit_externals_list_get(Evas_Object *obj)
{
Eina_List *externals = NULL;
- Eina_List *l;
- Edje_External_Directory_Entry *e;
+ unsigned int i;
GET_ED_OR_RETURN(NULL);
if (!ed->file || !ed->file->external_dir)
return NULL;
//printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles));
- EINA_LIST_FOREACH(ed->file->external_dir->entries, l, e)
- externals = eina_list_append(externals, eina_stringshare_add(e->entry));
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ externals = eina_list_append(externals,
+ eina_stringshare_add(ed->file->external_dir->entries[i].entry));
return externals;
}
@@ -1822,19 +1728,41 @@ EAPI Eina_Bool
edje_edit_external_add(Evas_Object *obj, const char *external)
{
Edje_External_Directory_Entry *e;
+ unsigned int freeid;
+ unsigned int i;
+
GET_ED_OR_RETURN(EINA_FALSE);
e = _edje_edit_external_get(ed, external);
if (e) return EINA_FALSE;
- e = _alloc(sizeof(Edje_External_Directory_Entry));
- if (!e) return EINA_FALSE;
- e->entry = (char*)eina_stringshare_add(external);
-
if (!ed->file->external_dir)
ed->file->external_dir = _alloc(sizeof(Edje_External_Directory));
- ed->file->external_dir->entries = \
- eina_list_append(ed->file->external_dir->entries, e);
+
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ if (!ed->file->external_dir->entries[i].entry)
+ break ;
+
+ if (i == ed->file->external_dir->entries_count)
+ {
+ Edje_External_Directory_Entry *tmp;
+ unsigned int max;
+
+ max = ed->file->external_dir->entries_count + 1;
+ tmp = realloc(ed->file->external_dir->entries,
+ sizeof (Edje_External_Directory_Entry) * max);
+
+ if (!tmp) return EINA_FALSE;
+
+ ed->file->external_dir->entries = tmp;
+ freeid = ed->file->external_dir->entries_count;
+ ed->file->external_dir->entries_count = max;
+ }
+ else
+ freeid = i;
+
+ ed->file->external_dir->entries[freeid].entry = (char*)eina_stringshare_add(external);
+
return EINA_TRUE;
}
@@ -1848,16 +1776,8 @@ edje_edit_external_del(Evas_Object *obj, const char *external)
e = _edje_edit_external_get(ed, external);
if (!e) return EINA_FALSE;
- ed->file->external_dir->entries = \
- eina_list_remove(ed->file->external_dir->entries, e);
- if (!ed->file->external_dir->entries)
- {
- free(ed->file->external_dir);
- ed->file->external_dir = NULL;
- }
-
_edje_if_string_free(ed, e->entry);
- free(e);
+ e->entry = NULL;
return EINA_TRUE;
}
@@ -1870,7 +1790,7 @@ EAPI Eina_List *
edje_edit_parts_list_get(Evas_Object *obj)
{
Eina_List *parts = NULL;
- int i;
+ unsigned int i;
GET_ED_OR_RETURN(NULL);
@@ -1905,12 +1825,34 @@ edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name
return EINA_TRUE;
}
-Eina_Bool
+#define FUNC_PART_API_STRING(Value) \
+ EAPI const char * \
+ edje_edit_part_api_##Value##_get(Evas_Object *obj, const char *part) \
+ { \
+ GET_RP_OR_RETURN(NULL); \
+ return eina_stringshare_add(rp->part->api.Value); \
+ } \
+ EAPI Eina_Bool \
+ edje_edit_part_api_##Value##_set(Evas_Object *obj, const char *part, const char *s) \
+ { \
+ GET_RP_OR_RETURN(EINA_FALSE); \
+ _edje_if_string_free(ed, rp->part->api.Value); \
+ rp->part->api.Value = eina_stringshare_add(s); \
+ return EINA_TRUE; \
+ }
+
+FUNC_PART_API_STRING(name);
+FUNC_PART_API_STRING(description);
+
+static Eina_Bool
_edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type, const char *source)
{
+ Edje_Part_Collection_Directory_Entry *ce;
Edje_Part_Collection *pc;
+ Edje_Part **tmp;
Edje_Part *ep;
Edje_Real_Part *rp;
+ int id;
GET_ED_OR_RETURN(EINA_FALSE);
@@ -1934,9 +1876,21 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
/* Init Edje_Part */
pc = ed->collection;
- pc->parts = eina_list_append(pc->parts, ep);
- ep->id = eina_list_count(pc->parts) - 1;
+ tmp = realloc(pc->parts, (pc->parts_count + 1) * sizeof (Edje_Part *));
+ if (!tmp)
+ {
+ free(ep);
+ free(rp);
+ return EINA_FALSE;
+ }
+
+ id = pc->parts_count++;
+
+ pc->parts = tmp;
+ pc->parts[id] = ep;
+
+ ep->id = id;
ep->type = type;
ep->name = eina_stringshare_add(name);
ep->mouse_events = 1;
@@ -1947,12 +1901,13 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
ep->use_alternate_font_metrics = 0;
ep->clip_to_id = -1;
ep->dragable.confine_id = -1;
- ep->dragable.events_id = -1;
+ ep->dragable.event_id = -1;
if (source)
ep->source = eina_stringshare_add(source);
ep->default_desc = NULL;
- ep->other_desc = NULL;
+ ep->other.desc = NULL;
+ ep->other.desc_count = 0;
/* Init Edje_Real_Part */
rp->edje = ed;
@@ -1980,8 +1935,6 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
}
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
rp->object = evas_object_textblock_add(ed->evas);
- else if (ep->type == EDJE_PART_TYPE_GRADIENT)
- rp->object = evas_object_gradient_add(ed->evas);
else
ERR("wrong part type %i!", ep->type);
if (rp->object)
@@ -2019,8 +1972,6 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
evas_object_clip_set(rp->object, ed->clipper);
evas_object_show(ed->clipper);
}
- rp->gradient_id = -1;
-
/* Update table_parts */
ed->table_parts_size++;
@@ -2030,9 +1981,21 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
ed->table_parts[ep->id % ed->table_parts_size] = rp;
/* Create default description */
- edje_edit_state_add(obj, name, "default", 0.0);
+ if (!edje_edit_state_add(obj, name, "default", 0.0))
+ {
+ _edje_if_string_free(ed, ep->name);
+ if (source)
+ _edje_if_string_free(ed, ep->source);
+ free(ep);
+ free(rp);
+ free(ed);
+ return EINA_FALSE;
+ }
edje_edit_part_selected_state_set(obj, name, "default", 0.0);
+ ce = eina_hash_find(ed->file->collection, ed->group);
+ ce->count.part++;
+
return EINA_TRUE;
}
@@ -2055,9 +2018,12 @@ edje_edit_part_external_add(Evas_Object *obj, const char *name, const char *sour
EAPI Eina_Bool
edje_edit_part_del(Evas_Object *obj, const char* part)
{
- Edje_Part *ep;
+ Edje_Part_Collection_Directory_Entry *ce;
Edje_Part_Collection *pc;
- int id;
+ Edje_Part *ep;
+ unsigned int k;
+ unsigned int id;
+ unsigned int i;
GET_RP_OR_RETURN(EINA_FALSE);
@@ -2066,16 +2032,13 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
ep = rp->part;
id = ep->id;
- //if (ed->table_parts_size <= 1) return EINA_FALSE; //don't remove the last part
-
/* Unlik Edje_Real_Parts that link to the removed one */
- int i;
for (i = 0; i < ed->table_parts_size; i++)
{
Edje_Real_Part *real;
if (i == id) continue; //don't check the deleted id
- real = ed->table_parts[i % ed->table_parts_size];
+ real = ed->table_parts[i];
if (real->text.source == rp) real->text.source = NULL;
if (real->text.text_source == rp) real->text.text_source = NULL;
@@ -2115,25 +2078,30 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
/* Remove part from parts list */
pc = ed->collection;
- pc->parts = eina_list_remove(pc->parts, ep);
+ pc->parts_count--;
+ if (id < pc->parts_count) /* Forward parts */
+ {
+ int mcount = (pc->parts_count - id) * sizeof(Edje_Part *);
+ memmove(&pc->parts[id], &pc->parts[id+1], mcount);
+ }
+ pc->parts[pc->parts_count] = NULL;
_edje_fix_parts_id(ed);
/* Free Edje_Part and all descriptions */
+ ce = eina_hash_find(ed->file->collection, ed->group);
+
_edje_if_string_free(ed, ep->name);
if (ep->default_desc)
{
- _edje_collection_free_part_description_free(ep->default_desc, 0);
+ _edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0);
ep->default_desc = NULL;
}
- while (ep->other_desc)
- {
- Edje_Part_Description *desc;
- desc = eina_list_data_get(ep->other_desc);
- ep->other_desc = eina_list_remove(ep->other_desc, desc);
- _edje_collection_free_part_description_free(desc, 0);
- }
- free(ep);
+ for (k = 0; k < ep->other.desc_count; ++k)
+ _edje_collection_free_part_description_free(ep->type, ep->other.desc[k], ce, 0);
+
+ free(ep->other.desc);
+ eina_mempool_free(ce->mp.part, ep);
/* Free Edje_Real_Part */
_edje_real_part_free(rp);
@@ -2143,6 +2111,9 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
evas_object_hide(ed->clipper);
edje_object_calc_force(obj);
+
+ ce->count.part--;
+
return EINA_TRUE;
}
@@ -2174,7 +2145,7 @@ edje_edit_part_above_get(Evas_Object *obj, const char* part)
GET_RP_OR_RETURN(0);
- if (rp->part->id >= ed->table_parts_size - 1) return 0;
+ if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return 0;
next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
@@ -2186,6 +2157,7 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part)
{
Edje_Part_Collection *group;
Edje_Real_Part *prev;
+ Edje_Part *swap;
GET_RP_OR_RETURN(EINA_FALSE);
@@ -2196,8 +2168,10 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part)
/* update parts list */
prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
- group->parts = eina_list_remove(group->parts, rp->part);
- group->parts = eina_list_prepend_relative(group->parts, rp->part, prev->part);
+
+ swap = group->parts[rp->part->id];
+ group->parts[rp->part->id] = group->parts[prev->part->id];
+ group->parts[prev->part->id] = swap;
_edje_parts_id_switch(ed, rp, prev);
@@ -2213,19 +2187,22 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part)
{
Edje_Part_Collection *group;
Edje_Real_Part *next;
+ Edje_Part *swap;
GET_RP_OR_RETURN(EINA_FALSE);
//printf("RESTACK PART: %s ABOVE\n", part);
- if (rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE;
+ if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE;
group = ed->collection;
/* update parts list */
next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
- group->parts = eina_list_remove(group->parts, rp->part);
- group->parts = eina_list_append_relative(group->parts, rp->part, next->part);
+
+ swap = group->parts[rp->part->id];
+ group->parts[rp->part->id] = group->parts[next->part->id];
+ group->parts[next->part->id] = swap;
/* update ids */
_edje_parts_id_switch(ed, rp, next);
@@ -2263,7 +2240,7 @@ edje_edit_part_selected_state_get(Evas_Object *obj, const char *part, double *va
EAPI Eina_Bool
edje_edit_part_selected_state_set(Evas_Object *obj, const char *part, const char *state, double value)
{
- Edje_Part_Description *pd;
+ Edje_Part_Description_Common *pd;
GET_RP_OR_RETURN(EINA_FALSE);
@@ -2427,6 +2404,23 @@ edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_F
rp->part->ignore_flags = ignore_flags;
}
+EAPI void
+edje_edit_part_scale_set(Evas_Object *obj, const char *part, Eina_Bool scale)
+{
+ GET_RP_OR_RETURN();
+
+ rp->part->scale = scale;
+ edje_object_calc_force(obj);
+}
+
+EAPI Eina_Bool
+edje_edit_part_scale_get(Evas_Object *obj, const char *part)
+{
+ GET_RP_OR_RETURN(EINA_FALSE);
+
+ return rp->part->scale;
+}
+
EAPI const char *
edje_edit_part_source_get(Evas_Object *obj, const char *part)
{
@@ -2533,131 +2527,58 @@ edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag)
rp->drag->step.y = rp->part->dragable.step_y;
}
-EAPI int
-edje_edit_part_drag_step_x_get(Evas_Object *obj, const char *part)
-{
- GET_RP_OR_RETURN(0);
- //printf("Get dragX_STEP for part: %s\n", part);
- return rp->part->dragable.step_x;
-}
-
-EAPI void
-edje_edit_part_drag_step_x_set(Evas_Object *obj, const char *part, int step)
-{
- GET_RP_OR_RETURN();
- //printf("Set dragX_STEP for part: %s\n", part);
- rp->part->dragable.step_x = step;
-}
-
-EAPI int
-edje_edit_part_drag_step_y_get(Evas_Object *obj, const char *part)
-{
- GET_RP_OR_RETURN(0);
- //printf("Get dragY_STEP for part: %s\n", part);
- return rp->part->dragable.step_y;
-}
-
-EAPI void
-edje_edit_part_drag_step_y_set(Evas_Object *obj, const char *part, int step)
-{
- GET_RP_OR_RETURN();
- //printf("Set dragY_STEP for part: %s\n", part);
- rp->part->dragable.step_y = step;
-}
-
-EAPI int
-edje_edit_part_drag_count_x_get(Evas_Object *obj, const char *part)
-{
- GET_RP_OR_RETURN(0);
- //printf("Get dragX_COUNT for part: %s\n", part);
- return rp->part->dragable.count_x;
-}
-
-EAPI void
-edje_edit_part_drag_count_x_set(Evas_Object *obj, const char *part, int count)
-{
- GET_RP_OR_RETURN();
- //printf("Set dragX_COUNT for part: %s\n", part);
- rp->part->dragable.count_x = count;
-}
-
-EAPI int
-edje_edit_part_drag_count_y_get(Evas_Object *obj, const char *part)
-{
- GET_RP_OR_RETURN(0);
- //printf("Get dragY_COUNT for part: %s\n", part);
- return rp->part->dragable.count_y;
-}
-
-EAPI void
-edje_edit_part_drag_count_y_set(Evas_Object *obj, const char *part, int count)
-{
- GET_RP_OR_RETURN();
- //printf("Set dragY_COUNT for part: %s\n", part);
- rp->part->dragable.count_y = count;
-}
-
-EAPI const char*
-edje_edit_part_drag_confine_get(Evas_Object *obj, const char *part)
-{
- Edje_Real_Part *confine;
- //printf("******Get drag confine\n");
- GET_RP_OR_RETURN(NULL);
-
- if (rp->part->dragable.confine_id < 0)
- return NULL;
-
- confine = ed->table_parts[rp->part->dragable.confine_id];
- return eina_stringshare_add(confine->part->name);
-}
-
-EAPI void
-edje_edit_part_drag_confine_set(Evas_Object *obj, const char *part, const char *confine)
-{
- Edje_Real_Part *confine_part;
- //printf("******Set drag confine to: %s\n", confine);
- GET_RP_OR_RETURN();
-
- if (!confine)
- {
- rp->part->dragable.confine_id = -1;
- return;
- }
-
- confine_part = _edje_real_part_get(ed, confine);
- rp->part->dragable.confine_id = confine_part->part->id;
-}
-
-EAPI const char*
-edje_edit_part_drag_event_get(Evas_Object *obj, const char *part)
-{
- Edje_Real_Part *events;
- //printf("******Get drag event part\n");
- GET_RP_OR_RETURN(NULL);
-
- if (rp->part->dragable.events_id < 0)
- return NULL;
-
- events = ed->table_parts[rp->part->dragable.events_id];
- return eina_stringshare_add(events->part->name);
-}
-
-EAPI void
-edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event)
-{
- Edje_Real_Part *event_part;
- //printf("******Set drag event to: %s\n", event);
- GET_RP_OR_RETURN();
+#define FUNC_PART_DRAG_INT(Class, Value) \
+ EAPI int \
+ edje_edit_part_drag_##Class##_##Value##_get(Evas_Object *obj, const char *part) \
+ { \
+ GET_RP_OR_RETURN(0); \
+ return rp->part->dragable.Class##_##Value; \
+ } \
+ EAPI void \
+ edje_edit_part_drag_##Class##_##Value##_set(Evas_Object *obj, const char *part, int v) \
+ { \
+ GET_RP_OR_RETURN(); \
+ rp->part->dragable.Class##_##Value = v; \
+ }
+
+FUNC_PART_DRAG_INT(step, x);
+FUNC_PART_DRAG_INT(step, y);
+FUNC_PART_DRAG_INT(count, x);
+FUNC_PART_DRAG_INT(count, y);
+
+#define FUNC_PART_DRAG_ID(Id) \
+ EAPI const char* \
+ edje_edit_part_drag_##Id##_get(Evas_Object *obj, const char *part) \
+ { \
+ Edje_Real_Part *p; \
+ \
+ GET_RP_OR_RETURN(NULL); \
+ \
+ if (rp->part->dragable.Id##_id < 0) \
+ return NULL; \
+ \
+ p = ed->table_parts[rp->part->dragable.Id##_id]; \
+ return eina_stringshare_add(p->part->name); \
+ } \
+ EAPI void \
+ edje_edit_part_drag_##Id##_set(Evas_Object *obj, const char *part, const char *e) \
+ { \
+ Edje_Real_Part *e_part; \
+ \
+ GET_RP_OR_RETURN(); \
+ if (!e) \
+ { \
+ rp->part->dragable.Id##_id = -1; \
+ return ; \
+ } \
+ \
+ e_part = _edje_real_part_get(ed, e); \
+ rp->part->dragable.Id##_id = e_part->part->id; \
+ }
+
+FUNC_PART_DRAG_ID(confine);
+FUNC_PART_DRAG_ID(event);
- if (!event)
- {
- rp->part->dragable.events_id = -1;
- return;
- }
-
- event_part = _edje_real_part_get(ed, event);
- rp->part->dragable.events_id = event_part->part->id;
-}
/*********************/
/* PART STATES API */
/*********************/
@@ -2666,8 +2587,7 @@ edje_edit_part_states_list_get(Evas_Object *obj, const char *part)
{
char state_name[PATH_MAX];
Eina_List *states = NULL;
- Eina_List *l;
- Edje_Part_Description *state;
+ unsigned int i;
GET_RP_OR_RETURN(NULL);
@@ -2679,17 +2599,20 @@ edje_edit_part_states_list_get(Evas_Object *obj, const char *part)
states = NULL;
//append default state
- state = rp->part->default_desc;
snprintf(state_name, PATH_MAX,
- "%s %.2f", state->state.name, state->state.value);
+ "%s %.2f",
+ rp->part->default_desc->state.name,
+ rp->part->default_desc->state.value);
states = eina_list_append(states, eina_stringshare_add(state_name));
//printf("NEW STATE def: %s\n", state->state.name);
//append other states
- EINA_LIST_FOREACH(rp->part->other_desc, l, state)
+ for (i = 0; i < rp->part->other.desc_count; ++i)
{
snprintf(state_name, sizeof(state_name),
- "%s %.2f", state->state.name, state->state.value);
+ "%s %.2f",
+ rp->part->other.desc[i]->state.name,
+ rp->part->other.desc[i]->state.value);
states = eina_list_append(states, eina_stringshare_add(state_name));
//printf("NEW STATE: %s\n", state_name);
}
@@ -2740,45 +2663,126 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state,
return EINA_TRUE;
}
-EAPI void
+EAPI Eina_Bool
edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value)
{
- Edje_Part_Description *pd;
+ Edje_Part_Collection_Directory_Entry *ce;
+ Edje_Part_Description_Common *pd;
+ unsigned int i;
- GET_RP_OR_RETURN();
+ GET_RP_OR_RETURN(EINA_FALSE);
+
+ if (!edje_edit_state_exist(obj, part, state, value))
+ return EINA_FALSE;
pd = _edje_part_description_find_byname(eed, part, state, value);
- if (!pd) return;
+ if (!pd) return EINA_FALSE;
/* Don't allow to delete default state, for now at least; */
if (pd == rp->part->default_desc)
- return;
+ return EINA_FALSE;
/* And if we are deleting the current state, go back to default first */
if (pd == rp->chosen_description)
_edje_part_description_apply(ed, rp, "default", 0.0, NULL, 0.0);
- rp->part->other_desc = eina_list_remove(rp->part->other_desc, pd);
+ ce = eina_hash_find(ed->file->collection, ed->group);
- _edje_collection_free_part_description_free(pd, 0);
+ for (i = 0; i < rp->part->other.desc_count; ++i)
+ if (pd == rp->part->other.desc[i])
+ {
+ memmove(rp->part->other.desc + i,
+ rp->part->other.desc + i + 1,
+ sizeof (Edje_Part_Description_Common*) * (rp->part->other.desc_count - i - 1));
+ rp->part->other.desc_count--;
+ break;
+ }
+
+ _edje_collection_free_part_description_free(rp->part->type, pd, ce, 0);
+ return EINA_TRUE;
}
-EAPI void
+static Edje_Part_Description_Common *
+_edje_edit_state_alloc(int type, Edje *ed)
+{
+ Edje_Part_Collection_Directory_Entry *ce;
+ Edje_Part_Description_Common *pd = NULL;
+
+ ce = eina_hash_find(ed->file->collection, ed->group);
+
+ switch (type)
+ {
+ case EDJE_PART_TYPE_RECTANGLE:
+ pd = eina_mempool_malloc(ce->mp.RECTANGLE, sizeof (Edje_Part_Description_Common));
+ ce->count.RECTANGLE++;
+ break;
+ case EDJE_PART_TYPE_SWALLOW:
+ pd = eina_mempool_malloc(ce->mp.SWALLOW, sizeof (Edje_Part_Description_Common));
+ ce->count.SWALLOW++;
+ break;
+ case EDJE_PART_TYPE_GROUP:
+ pd = eina_mempool_malloc(ce->mp.GROUP, sizeof (Edje_Part_Description_Common));
+ ce->count.GROUP++;
+ break;
+
+#define EDIT_ALLOC_POOL(Short, Type, Name) \
+ case EDJE_PART_TYPE_##Short: \
+ { \
+ Edje_Part_Description_##Type *Name; \
+ \
+ Name = eina_mempool_malloc(ce->mp.Short, \
+ sizeof (Edje_Part_Description_##Type)); \
+ memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \
+ pd = &Name->common; \
+ ce->count.Short++; \
+ break; \
+ }
+
+ EDIT_ALLOC_POOL(IMAGE, Image, image);
+ EDIT_ALLOC_POOL(TEXT, Text, text);
+ EDIT_ALLOC_POOL(TEXTBLOCK, Text, text);
+ EDIT_ALLOC_POOL(BOX, Box, box);
+ EDIT_ALLOC_POOL(TABLE, Table, table);
+ EDIT_ALLOC_POOL(EXTERNAL, External, external_params);
+ }
+
+ return pd;
+}
+
+EAPI Eina_Bool
edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value)
{
- Edje_Part_Description *pd;
+ Edje_Part_Description_Common *pd;
- GET_RP_OR_RETURN();
+ GET_RP_OR_RETURN(EINA_FALSE);
- //printf("ADD STATE: %s TO PART: %s\n", name , part);
+ if (edje_edit_state_exist(obj, part, name, value))
+ return EINA_FALSE;
- pd = _alloc(sizeof(Edje_Part_Description));
- if (!pd) return;
+ //printf("ADD STATE: %s TO PART: %s\n", name , part);
+ pd = _edje_edit_state_alloc(rp->part->type, ed);
+ if (!pd) return EINA_FALSE;
if (!rp->part->default_desc)
- rp->part->default_desc = pd;
+ {
+ rp->part->default_desc = pd;
+ }
else
- rp->part->other_desc = eina_list_append(rp->part->other_desc, pd);
+ {
+ Edje_Part_Description_Common **tmp;
+
+ tmp = realloc(rp->part->other.desc,
+ sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1));
+ if (!tmp)
+ {
+ free(pd);
+ return EINA_FALSE;
+ }
+ rp->part->other.desc = tmp;
+ rp->part->other.desc[rp->part->other.desc_count++] = pd;
+ }
+
+ memset(pd, 0, sizeof (*pd));
pd->state.name = eina_stringshare_add(name);
pd->state.value = value;
@@ -2803,19 +2807,6 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double
pd->rel2.offset_y = -1;
pd->rel2.id_x = -1;
pd->rel2.id_y = -1;
- pd->image.id = -1;
- pd->fill.smooth = 1;
- pd->fill.pos_rel_x = 0.0;
- pd->fill.pos_abs_x = 0;
- pd->fill.rel_x = 1.0;
- pd->fill.abs_x = 0;
- pd->fill.pos_rel_y = 0.0;
- pd->fill.pos_abs_y = 0;
- pd->fill.rel_y = 1.0;
- pd->fill.abs_y = 0;
- pd->fill.angle = 0;
- pd->fill.spread = 0;
- pd->fill.type = EDJE_FILL_TYPE_SCALE;
pd->color_class = NULL;
pd->color.r = 255;
pd->color.g = 255;
@@ -2825,64 +2816,124 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double
pd->color2.g = 0;
pd->color2.b = 0;
pd->color2.a = 255;
- pd->color3.r = 0;
- pd->color3.g = 0;
- pd->color3.b = 0;
- pd->color3.a = 128;
- pd->text.align.x = 0.5;
- pd->text.align.y = 0.5;
- pd->text.id_source = -1;
- pd->text.id_text_source = -1;
- pd->gradient.rel1.relative_x = 0;
- pd->gradient.rel1.relative_y = 0;
- pd->gradient.rel1.offset_x = 0;
- pd->gradient.rel1.offset_y = 0;
- pd->gradient.rel2.relative_x = 1;
- pd->gradient.rel2.relative_y = 1;
- pd->gradient.rel2.offset_x = -1;
- pd->gradient.rel2.offset_y = -1;
- pd->gradient.use_rel = 1;
-
- if ((rp->part->type == EDJE_PART_TYPE_EXTERNAL) && (rp->part->source))
- {
+ pd->map.id_persp = -1;
+ pd->map.id_light = -1;
+ pd->map.rot.id_center = -1;
+ pd->map.rot.x = FROM_DOUBLE(0.0);
+ pd->map.rot.y = FROM_DOUBLE(0.0);
+ pd->map.rot.z = FROM_DOUBLE(0.0);
+ pd->map.on = 0;
+ pd->map.smooth = 1;
+ pd->map.alpha = 1;
+ pd->map.backcull = 0;
+ pd->map.persp_on = 0;
+ pd->persp.zplane = 0;
+ pd->persp.focal = 1000;
+
+ if (rp->part->type == EDJE_PART_TYPE_TEXT
+ || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ Edje_Part_Description_Text *text;
+
+ text = (Edje_Part_Description_Text*) pd;
+
+ memset(&text->text, 0, sizeof (text->text));
+
+ text->text.color3.r = 0;
+ text->text.color3.g = 0;
+ text->text.color3.b = 0;
+ text->text.color3.a = 128;
+ text->text.align.x = 0.5;
+ text->text.align.y = 0.5;
+ text->text.id_source = -1;
+ text->text.id_text_source = -1;
+ }
+ else if (rp->part->type == EDJE_PART_TYPE_IMAGE)
+ {
+ Edje_Part_Description_Image *img;
+
+ img = (Edje_Part_Description_Image*) pd;
+
+ memset(&img->image, 0, sizeof (img->image));
+
+ img->image.id = -1;
+ img->image.fill.smooth = 1;
+ img->image.fill.pos_rel_x = 0.0;
+ img->image.fill.pos_abs_x = 0;
+ img->image.fill.rel_x = 1.0;
+ img->image.fill.abs_x = 0;
+ img->image.fill.pos_rel_y = 0.0;
+ img->image.fill.pos_abs_y = 0;
+ img->image.fill.rel_y = 1.0;
+ img->image.fill.abs_y = 0;
+ img->image.fill.angle = 0;
+ img->image.fill.spread = 0;
+ img->image.fill.type = EDJE_FILL_TYPE_SCALE;
+ }
+ else if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
+ {
+ Edje_Part_Description_External *external;
Edje_External_Param_Info *pi;
- pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source);
- while (pi && pi->name)
+ external = (Edje_Part_Description_External*) pd;
+
+ external->external_params = NULL;
+
+ if (rp->part->source)
{
- Edje_External_Param *p;
- p = _alloc(sizeof(Edje_External_Param));
- /* error checking.. meh */
- p->name = eina_stringshare_add(pi->name);
- p->type = pi->type;
- switch(p->type)
+ pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source);
+ while (pi && pi->name)
{
- case EDJE_EXTERNAL_PARAM_TYPE_INT:
- case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
- if (pi->info.i.def != EDJE_EXTERNAL_INT_UNSET)
- p->i = pi->info.i.def;
- break;
- case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
- if (pi->info.d.def != EDJE_EXTERNAL_DOUBLE_UNSET)
- p->d = pi->info.d.def;
- break;
- case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
- if (pi->info.c.def)
- p->s = eina_stringshare_add(pi->info.c.def);
- break;
- case EDJE_EXTERNAL_PARAM_TYPE_STRING:
- if (pi->info.s.def)
- p->s = eina_stringshare_add(pi->info.s.def);
- break;
- default:
- ERR("unknown external parameter type '%d'", p->type);
+ Edje_External_Param *p;
+ p = _alloc(sizeof(Edje_External_Param));
+ /* error checking.. meh */
+ p->name = eina_stringshare_add(pi->name);
+ p->type = pi->type;
+ switch(p->type)
+ {
+ case EDJE_EXTERNAL_PARAM_TYPE_INT:
+ case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
+ if (pi->info.i.def != EDJE_EXTERNAL_INT_UNSET)
+ p->i = pi->info.i.def;
+ break;
+ case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
+ if (pi->info.d.def != EDJE_EXTERNAL_DOUBLE_UNSET)
+ p->d = pi->info.d.def;
+ break;
+ case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
+ if (pi->info.c.def)
+ p->s = eina_stringshare_add(pi->info.c.def);
+ break;
+ case EDJE_EXTERNAL_PARAM_TYPE_STRING:
+ if (pi->info.s.def)
+ p->s = eina_stringshare_add(pi->info.s.def);
+ break;
+ default:
+ ERR("unknown external parameter type '%d'", p->type);
+ }
+ external->external_params = eina_list_append(external->external_params, p);
+ pi++;
}
- pd->external_params = eina_list_append(pd->external_params, p);
- pi++;
+ if (external->external_params)
+ rp->param1.external_params = _edje_external_params_parse(rp->swallowed_object, external->external_params);
}
- if (pd->external_params)
- rp->param1.external_params = _edje_external_params_parse(rp->swallowed_object, pd->external_params);
}
+ else if (rp->part->type == EDJE_PART_TYPE_BOX)
+ {
+ Edje_Part_Description_Box *box;
+
+ box = (Edje_Part_Description_Box*) pd;
+ memset(&box->box, 0, sizeof (box->box));
+ }
+ else if (rp->part->type == EDJE_PART_TYPE_TABLE)
+ {
+ Edje_Part_Description_Table *table;
+
+ table = (Edje_Part_Description_Table*) pd;
+ memset(&table->table, 0, sizeof (table->table));
+ }
+
+ return EINA_TRUE;
}
EAPI Eina_Bool
@@ -2895,10 +2946,9 @@ edje_edit_state_exist(Evas_Object *obj, const char *part, const char *state, dou
EAPI Eina_Bool
edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, double val_from, const char *to, double val_to)
{
- Edje_Part_Description *pdfrom, *pdto;
- Edje_Part_Image_Id *i;
+ Edje_Part_Description_Common *pdfrom, *pdto;
Edje_External_Param *p;
- Eina_List *l;
+
GET_RP_OR_RETURN(EINA_FALSE);
pdfrom = _edje_part_description_find_byname(eed, part, from, val_from);
@@ -2908,709 +2958,432 @@ edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, doubl
pdto = _edje_part_description_find_byname(eed, part, to, val_to);
if (!pdto)
{
- pdto = _alloc(sizeof(Edje_Part_Description));
- if (!pdto)
- return EINA_FALSE;
+ Edje_Part_Description_Common **tmp;
+
+ pdto = _edje_edit_state_alloc(rp->part->type, ed);
+ if (!pdto) return EINA_FALSE;
/* No need to check for default desc, at this point it must exist */
- rp->part->other_desc = eina_list_append(rp->part->other_desc, pdto);
- pdto->state.name = eina_stringshare_add(to);
- pdto->state.value = val_to;
- }
-
-#define PD_COPY(_x) pdto->_x = pdfrom->_x
-#define PD_STRING_COPY(_x) _edje_if_string_free(ed, pdto->_x); \
- pdto->_x = (char *)eina_stringshare_add(pdfrom->_x)
- PD_COPY(align.x);
- PD_COPY(align.y);
- PD_COPY(fixed.w);
- PD_COPY(fixed.h);
- PD_COPY(min.w);
- PD_COPY(min.h);
- PD_COPY(max.w);
- PD_COPY(max.h);
- PD_COPY(aspect.min);
- PD_COPY(aspect.max);
- PD_COPY(aspect.prefer);
- PD_COPY(rel1.relative_x);
- PD_COPY(rel1.relative_y);
- PD_COPY(rel1.offset_x);
- PD_COPY(rel1.offset_y);
- PD_COPY(rel1.id_x);
- PD_COPY(rel1.id_y);
- PD_COPY(rel2.relative_x);
- PD_COPY(rel2.relative_y);
- PD_COPY(rel2.offset_x);
- PD_COPY(rel2.offset_y);
- PD_COPY(rel2.id_x);
- PD_COPY(rel2.id_y);
- PD_COPY(image.id);
- EINA_LIST_FREE(pdto->image.tween_list, i)
- free(i);
- EINA_LIST_FOREACH(pdfrom->image.tween_list, l, i)
- {
- Edje_Part_Image_Id *new_i;
- new_i = _alloc(sizeof(Edje_Part_Image_Id));
- /* error checking? What to do if failed? Rollback, abort? */
- new_i->id = i->id;
- pdto->image.tween_list = eina_list_append(pdto->image.tween_list, new_i);
- }
- PD_STRING_COPY(gradient.type);
- PD_STRING_COPY(gradient.params);
- PD_COPY(gradient.id);
- PD_COPY(gradient.use_rel);
- PD_COPY(gradient.rel1.relative_x);
- PD_COPY(gradient.rel1.relative_y);
- PD_COPY(gradient.rel1.offset_x);
- PD_COPY(gradient.rel1.offset_y);
- PD_COPY(gradient.rel2.relative_x);
- PD_COPY(gradient.rel2.relative_y);
- PD_COPY(gradient.rel2.offset_x);
- PD_COPY(gradient.rel2.offset_y);
- PD_COPY(border.l);
- PD_COPY(border.r);
- PD_COPY(border.t);
- PD_COPY(border.b);
- PD_COPY(border.no_fill);
- PD_COPY(fill.pos_rel_x);
- PD_COPY(fill.rel_x);
- PD_COPY(fill.pos_rel_y);
- PD_COPY(fill.rel_y);
- PD_COPY(fill.pos_abs_x);
- PD_COPY(fill.abs_x);
- PD_COPY(fill.pos_abs_y);
- PD_COPY(fill.abs_y);
- PD_COPY(fill.angle);
- PD_COPY(fill.spread);
- PD_COPY(fill.smooth);
- PD_COPY(fill.type);
- PD_STRING_COPY(color_class);
- PD_STRING_COPY(text.text);
- PD_STRING_COPY(text.text_class);
- PD_STRING_COPY(text.style);
- PD_STRING_COPY(text.font);
- PD_STRING_COPY(text.repch);
- PD_COPY(text.align.x);
- PD_COPY(text.align.y);
- PD_COPY(text.elipsis);
- PD_COPY(text.size);
- PD_COPY(text.id_source);
- PD_COPY(text.id_text_source);
- PD_COPY(text.fit_x);
- PD_COPY(text.fit_y);
- PD_COPY(text.min_x);
- PD_COPY(text.min_y);
- PD_COPY(text.max_x);
- PD_COPY(text.max_y);
- PD_STRING_COPY(box.layout);
- PD_STRING_COPY(box.alt_layout);
- PD_COPY(box.align.x);
- PD_COPY(box.align.y);
- PD_COPY(box.padding.x);
- PD_COPY(box.padding.y);
- PD_COPY(box.min.h);
- PD_COPY(box.min.v);
- PD_COPY(table.homogeneous);
- PD_COPY(table.align.x);
- PD_COPY(table.align.y);
- PD_COPY(table.padding.x);
- PD_COPY(table.padding.y);
- PD_COPY(color.r);
- PD_COPY(color.g);
- PD_COPY(color.b);
- PD_COPY(color.a);
- PD_COPY(color2.r);
- PD_COPY(color2.g);
- PD_COPY(color2.b);
- PD_COPY(color2.a);
- PD_COPY(color3.r);
- PD_COPY(color3.g);
- PD_COPY(color3.b);
- PD_COPY(color3.a);
- /* XXX: optimize this, most likely we don't need to remove and add */
- EINA_LIST_FREE(pdto->external_params, p)
- {
- _edje_if_string_free(ed, p->name);
- if (p->s)
- _edje_if_string_free(ed, p->s);
- free(p);
- }
- EINA_LIST_FOREACH(pdfrom->external_params, l, p)
- {
- Edje_External_Param *new_p;
- new_p = _alloc(sizeof(Edje_External_Param));
- new_p->name = eina_stringshare_add(p->name);
- new_p->type = p->type;
- switch (p->type)
+
+ tmp = realloc(rp->part->other.desc,
+ sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1));
+ if (!tmp)
{
- case EDJE_EXTERNAL_PARAM_TYPE_INT:
- new_p->i = p->i;
- break;
- case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
- new_p->d = p->d;
- break;
- case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
- case EDJE_EXTERNAL_PARAM_TYPE_STRING:
- new_p->s = eina_stringshare_add(p->s);
- break;
- default:
- break;
+ free(pdto);
+ return EINA_FALSE;
}
- pdto->external_params = eina_list_append(pdto->external_params, new_p);
+ rp->part->other.desc = tmp;
+ rp->part->other.desc[rp->part->other.desc_count++] = pdto;
}
- PD_COPY(visible);
-#undef PD_STRING_COPY
-#undef PD_COPY
- return EINA_TRUE;
-}
+#define PD_STRING_COPY(To, From, _x) \
+ _edje_if_string_free(ed, To->_x); \
+ To->_x = (char *)eina_stringshare_add(From->_x);
-//relative
-EAPI double
-edje_edit_state_rel1_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel1 rel of part: %s state: %s [%f]\n", part, state, pd->rel1.relative_x);
- return TO_DOUBLE(pd->rel1.relative_x);
-}
-
-EAPI double
-edje_edit_state_rel1_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel1 rel of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->rel1.relative_y);
-}
-
-EAPI double
-edje_edit_state_rel2_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel2 rel of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->rel2.relative_x);
-}
-
-EAPI double
-edje_edit_state_rel2_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel2 rel of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->rel2.relative_y);
-}
-
-EAPI void
-edje_edit_state_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel1x of part: %s state: %s to: %f\n", part, state, x);
- //TODO check boudaries
- pd->rel1.relative_x = FROM_DOUBLE(x);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel1y of part: %s state: %s to: %f\n", part, state, y);
- //TODO check boudaries
- pd->rel1.relative_y = FROM_DOUBLE(y);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel2x of part: %s state: %s to: %f\n", part, state, x);
- //TODO check boudaries
- pd->rel2.relative_x = FROM_DOUBLE(x);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel2y of part: %s state: %s to: %f\n", part, state, y);
- pd = _edje_part_description_find_byname(eed, part, state, value);
- //TODO check boudaries
- pd->rel2.relative_y = FROM_DOUBLE(y);
- edje_object_calc_force(obj);
-}
-
-//offset
-EAPI int
-edje_edit_state_rel1_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel1 offset of part: %s state: %s\n", part, state);
- return pd->rel1.offset_x;
-}
-
-EAPI int
-edje_edit_state_rel1_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel1 offset of part: %s state: %s\n", part, state);
- return pd->rel1.offset_y;
-}
-
-EAPI int
-edje_edit_state_rel2_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel2 offset of part: %s state: %s\n", part, state);
- return pd->rel2.offset_x;
-}
-
-EAPI int
-edje_edit_state_rel2_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get rel2 offset of part: %s state: %s\n", part, state);
- return pd->rel2.offset_y;
-}
-
-EAPI void
-edje_edit_state_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel1x offset of part: %s state: %s to: %f\n", part, state, x);
- //TODO check boudaries
- pd->rel1.offset_x = TO_INT(FROM_DOUBLE(x));
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel1y offset of part: %s state: %s to: %f\n", part, state, y);
- //TODO check boudaries
- pd->rel1.offset_y = TO_INT(FROM_DOUBLE(y));
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel2x offset of part: %s state: %s to: %f\n", part, state, x);
- //TODO check boudaries
- pd->rel2.offset_x = TO_INT(FROM_DOUBLE(x));
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set rel2y offset of part: %s state: %s to: %f\n", part, state, y);
- //TODO check boudaries
- pd->rel2.offset_y = TO_INT(FROM_DOUBLE(y));
- edje_object_calc_force(obj);
-}
-
-//relative to
-EAPI const char *
-edje_edit_state_rel1_to_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- Edje_Real_Part *rel;
-
- GET_PD_OR_RETURN(NULL);
-
- //printf("Get rel1x TO of part: %s state: %s\n", part, state);
-
- if (pd->rel1.id_x == -1) return NULL;
-
- rel = ed->table_parts[pd->rel1.id_x % ed->table_parts_size];
-
- if (rel->part->name)
- return eina_stringshare_add(rel->part->name);
- else
- return NULL;
-}
-
-EAPI const char *
-edje_edit_state_rel1_to_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- Edje_Real_Part *rel;
-
- GET_PD_OR_RETURN(NULL);
-
- //printf("Get rel1y TO of part: %s state: %s\n", part, state);
-
- if (pd->rel1.id_y == -1) return NULL;
-
- rel = ed->table_parts[pd->rel1.id_y % ed->table_parts_size];
-
- if (rel->part->name)
- return eina_stringshare_add(rel->part->name);
- else
- return NULL;
-}
-
-EAPI const char *
-edje_edit_state_rel2_to_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- Edje_Real_Part *rel;
+ /* Copy all value */
+ *pdto = *pdfrom;
+ /* Keeping the pdto state name and value */
+ pdto->state.name = eina_stringshare_add(to);
+ pdto->state.value = val_to;
+ /* Update pointer. */
+ PD_STRING_COPY(pdto, pdfrom, color_class);
- GET_PD_OR_RETURN(NULL);
-
- //printf("Get rel2x TO of part: %s state: %s\n", part, state);
-
- if (pd->rel2.id_x == -1) return NULL;
-
- rel = ed->table_parts[pd->rel2.id_x % ed->table_parts_size];
-
- if (rel->part->name)
- return eina_stringshare_add(rel->part->name);
- else
- return NULL;
-}
-
-EAPI const char *
-edje_edit_state_rel2_to_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- Edje_Real_Part *rel;
-
- GET_PD_OR_RETURN(NULL);
-
- //printf("Get rel2y TO of part: %s state: %s\n", part, state);
-
- if (pd->rel2.id_y == -1) return NULL;
-
- rel = ed->table_parts[pd->rel2.id_y % ed->table_parts_size];
-
- if (rel->part->name)
- return eina_stringshare_add(rel->part->name);
- else
- return NULL;
-}
-
-EAPI void
-//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
-edje_edit_state_rel1_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to)
-{
- Edje_Real_Part *relp;
-
- GET_PD_OR_RETURN();
-
- //printf("Set rel1 to x on state: %s (to part: )\n", state);
-
- if (rel_to)
+ switch (rp->part->type)
{
- relp = _edje_real_part_get(ed, rel_to);
- if (!relp) return;
- pd->rel1.id_x = relp->part->id;
- }
- else
- pd->rel1.id_x = -1;
-
- //_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??
- // edje_object_calc_force(obj);//don't work for redraw
-}
-
-EAPI void
-//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
-edje_edit_state_rel1_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to)
-{
- Edje_Real_Part *relp;
+ case EDJE_PART_TYPE_IMAGE:
+ {
+ Edje_Part_Description_Image *img_to = (Edje_Part_Description_Image*) pdto;
+ Edje_Part_Description_Image *img_from = (Edje_Part_Description_Image*) pdfrom;
+ unsigned int i;
+
+ img_to->image = img_from->image;
+
+ /* Update pointers. */
+ for (i = 0; i < img_to->image.tweens_count; ++i)
+ free(img_to->image.tweens[i]);
+ if (img_to->image.tweens_count > 0)
+ free(img_to->image.tweens);
+
+ img_to->image.tweens_count = img_from->image.tweens_count;
+ img_to->image.tweens = calloc(img_to->image.tweens_count,
+ sizeof (Edje_Part_Image_Id*));
+ if (!img_to->image.tweens)
+ break;
- GET_PD_OR_RETURN();
+ for (i = 0; i < img_to->image.tweens_count; ++i)
+ {
+ Edje_Part_Image_Id *new_i;
+ new_i = _alloc(sizeof(Edje_Part_Image_Id));
+ if (!new_i) continue ;
- //printf("Set rel1 to y on state: %s (to part: %s)\n", state, rel_to);
+ *new_i = *img_from->image.tweens[i];
- if (rel_to)
- {
- relp = _edje_real_part_get(ed, rel_to);
- if (!relp) return;
- pd->rel1.id_y = relp->part->id;
- }
- else
- pd->rel1.id_y = -1;
+ img_to->image.tweens[i] = new_i;
+ }
+ break;
+ }
+ case EDJE_PART_TYPE_TEXT:
+ case EDJE_PART_TYPE_TEXTBLOCK:
+ {
+ Edje_Part_Description_Text *text_to = (Edje_Part_Description_Text*) pdto;
+ Edje_Part_Description_Text *text_from = (Edje_Part_Description_Text*) pdfrom;
- //_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??
- // edje_object_calc_force(obj);//don't work for redraw
-}
+ text_to->text = text_from->text;
-EAPI void
-//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
-edje_edit_state_rel2_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to)
-{
- Edje_Real_Part *relp;
+ /* Update pointers. */
+ PD_STRING_COPY(text_to, text_from, text.text.str);
+ PD_STRING_COPY(text_to, text_from, text.text_class);
+ PD_STRING_COPY(text_to, text_from, text.style.str);
+ PD_STRING_COPY(text_to, text_from, text.font.str);
+ PD_STRING_COPY(text_to, text_from, text.repch.str);
+ break;
+ }
+ case EDJE_PART_TYPE_BOX:
+ {
+ Edje_Part_Description_Box *box_to = (Edje_Part_Description_Box*) pdto;
+ Edje_Part_Description_Box *box_from = (Edje_Part_Description_Box*) pdfrom;
- GET_PD_OR_RETURN();
+ box_to->box = box_from->box;
- //printf("Set rel2 to x on state: %s (to part: )\n", state);
+ PD_STRING_COPY(box_to, box_from, box.layout);
+ PD_STRING_COPY(box_to, box_from, box.alt_layout);
+ break;
+ }
+ case EDJE_PART_TYPE_TABLE:
+ {
+ Edje_Part_Description_Table *table_to = (Edje_Part_Description_Table*) pdto;
+ Edje_Part_Description_Table *table_from = (Edje_Part_Description_Table*) pdfrom;
- if (rel_to)
- {
- relp = _edje_real_part_get(ed, rel_to);
- if (!relp) return;
- pd->rel2.id_x = relp->part->id;
+ table_to->table = table_from->table;
+ break;
+ }
+ case EDJE_PART_TYPE_EXTERNAL:
+ {
+ Edje_Part_Description_External *ext_to = (Edje_Part_Description_External*) pdto;
+ Edje_Part_Description_External *ext_from = (Edje_Part_Description_External*) pdfrom;
+ Eina_List *l;
+
+ /* XXX: optimize this, most likely we don't need to remove and add */
+ EINA_LIST_FREE(ext_to->external_params, p)
+ {
+ _edje_if_string_free(ed, p->name);
+ if (p->s)
+ _edje_if_string_free(ed, p->s);
+ free(p);
+ }
+ EINA_LIST_FOREACH(ext_from->external_params, l, p)
+ {
+ Edje_External_Param *new_p;
+ new_p = _alloc(sizeof(Edje_External_Param));
+ new_p->name = eina_stringshare_add(p->name);
+ new_p->type = p->type;
+ switch (p->type)
+ {
+ case EDJE_EXTERNAL_PARAM_TYPE_INT:
+ new_p->i = p->i;
+ break;
+ case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
+ new_p->d = p->d;
+ break;
+ case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
+ case EDJE_EXTERNAL_PARAM_TYPE_STRING:
+ new_p->s = eina_stringshare_add(p->s);
+ break;
+ default:
+ break;
+ }
+ ext_to->external_params = eina_list_append(ext_to->external_params, new_p);
+ }
+ break;
+ }
}
- else
- pd->rel2.id_x = -1;
- //_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??
- // edje_object_calc_force(obj);//don't work for redraw
+#undef PD_STRING_COPY
+
+ return EINA_TRUE;
}
-EAPI void
+#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \
+ EAPI double \
+ edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ GET_PD_OR_RETURN(0); \
+ return TO_DOUBLE(pd->Sub.relative_##Value); \
+ } \
+ EAPI void \
+ edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
+ { \
+ GET_PD_OR_RETURN(); \
+ pd->Sub.relative_##Value = FROM_DOUBLE(v); \
+ edje_object_calc_force(obj); \
+ }
+
+FUNC_STATE_RELATIVE_DOUBLE(rel1, x);
+FUNC_STATE_RELATIVE_DOUBLE(rel1, y);
+FUNC_STATE_RELATIVE_DOUBLE(rel2, x);
+FUNC_STATE_RELATIVE_DOUBLE(rel2, y);
+
+#define FUNC_STATE_OFFSET_INT(Sub, Value) \
+ EAPI int \
+ edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ GET_PD_OR_RETURN(0); \
+ return pd->Sub.offset_##Value; \
+ } \
+ EAPI void \
+ edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
+ { \
+ GET_PD_OR_RETURN(); \
+ pd->Sub.offset_##Value = TO_INT(FROM_DOUBLE(v)); \
+ edje_object_calc_force(obj); \
+ }
+
+FUNC_STATE_OFFSET_INT(rel1, x);
+FUNC_STATE_OFFSET_INT(rel1, y);
+FUNC_STATE_OFFSET_INT(rel2, x);
+FUNC_STATE_OFFSET_INT(rel2, y);
+
+#define FUNC_STATE_REL(Sub, Value) \
+ EAPI const char * \
+ edje_edit_state_##Sub##_to_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ Edje_Real_Part *rel; \
+ \
+ GET_PD_OR_RETURN(NULL); \
+ \
+ if (pd->Sub.id_##Value == -1) return NULL; \
+ \
+ rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \
+ \
+ if (rel->part->name) return eina_stringshare_add(rel->part->name); \
+ return NULL; \
+ } \
+ EAPI void \
+ edje_edit_state_##Sub##_to_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, const char *to) \
+ { \
+ Edje_Real_Part *relp; \
+ \
+ GET_PD_OR_RETURN(); \
+ \
+ if (to) \
+ { \
+ relp = _edje_real_part_get(ed, to); \
+ if (!relp) return; \
+ pd->Sub.id_##Value = relp->part->id; \
+ } \
+ else \
+ pd->Sub.id_##Value = -1; \
+ \
+ }
//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
-edje_edit_state_rel2_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to)
-{
- Edje_Real_Part *relp;
+//_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??
+// edje_object_calc_force(obj);//don't work for redraw
- GET_PD_OR_RETURN();
-
- //printf("Set rel2 to y on state: %s (to part: %s)\n", state, rel_to);
-
- if (rel_to)
- {
- relp = _edje_real_part_get(ed, rel_to);
- if (!relp) return;
- pd->rel2.id_y = relp->part->id;
- }
- else
- pd->rel2.id_y = -1;
-
- //_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??
- // edje_object_calc_force(obj);//don't work for redraw
-}
+FUNC_STATE_REL(rel1, x);
+FUNC_STATE_REL(rel1, y);
+FUNC_STATE_REL(rel2, x);
+FUNC_STATE_REL(rel2, y);
//colors
-EAPI void
-edje_edit_state_color_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a)
-{
- GET_PD_OR_RETURN();
-
- //printf("GET COLOR of state '%s'\n", state);
-
- if (r) *r = pd->color.r;
- if (g) *g = pd->color.g;
- if (b) *b = pd->color.b;
- if (a) *a = pd->color.a;
-}
-
-EAPI void
-edje_edit_state_color2_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a)
-{
- GET_PD_OR_RETURN();
-
- //printf("GET COLOR2 of state '%s'\n", state);
-
- if (r) *r = pd->color2.r;
- if (g) *g = pd->color2.g;
- if (b) *b = pd->color2.b;
- if (a) *a = pd->color2.a;
-}
+#define FUNC_COLOR(Code) \
+ EAPI void \
+ edje_edit_state_##Code##_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a) \
+ { \
+ GET_PD_OR_RETURN(); \
+ \
+ if (r) *r = pd->Code.r; \
+ if (g) *g = pd->Code.g; \
+ if (b) *b = pd->Code.b; \
+ if (a) *a = pd->Code.a; \
+ } \
+ EAPI void \
+ edje_edit_state_##Code##_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) \
+ { \
+ GET_PD_OR_RETURN(); \
+ \
+ if (r > -1 && r < 256) pd->Code.r = r; \
+ if (g > -1 && g < 256) pd->Code.g = g; \
+ if (b > -1 && b < 256) pd->Code.b = b; \
+ if (a > -1 && a < 256) pd->Code.a = a; \
+ \
+ edje_object_calc_force(obj); \
+ }
+
+FUNC_COLOR(color);
+FUNC_COLOR(color2);
EAPI void
edje_edit_state_color3_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a)
{
- GET_PD_OR_RETURN();
-
- //printf("GET COLOR3 of state '%s'\n", state);
-
- if (r) *r = pd->color3.r;
- if (g) *g = pd->color3.g;
- if (b) *b = pd->color3.b;
- if (a) *a = pd->color3.a;
-}
-
-EAPI void
-edje_edit_state_color_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET COLOR of state '%s'\n", state);
-
- if (r > -1 && r < 256) pd->color.r = r;
- if (g > -1 && g < 256) pd->color.g = g;
- if (b > -1 && b < 256) pd->color.b = b;
- if (a > -1 && a < 256) pd->color.a = a;
-
- edje_object_calc_force(obj);
-}
+ Edje_Part_Description_Text *txt;
-EAPI void
-edje_edit_state_color2_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a)
-{
GET_PD_OR_RETURN();
- //printf("SET COLOR2 of state '%s'\n", state);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ {
+ if (r) *r = 0;
+ if (g) *g = 0;
+ if (b) *b = 0;
+ if (a) *a = 0;
+ return;
+ }
- if (r > -1 && r < 256) pd->color2.r = r;
- if (g > -1 && g < 256) pd->color2.g = g;
- if (b > -1 && b < 256) pd->color2.b = b;
- if (a > -1 && a < 256) pd->color2.a = a;
+ txt = (Edje_Part_Description_Text*) pd;
- edje_object_calc_force(obj);
+ if (r) *r = txt->text.color3.r;
+ if (g) *g = txt->text.color3.g;
+ if (b) *b = txt->text.color3.b;
+ if (a) *a = txt->text.color3.a;
}
EAPI void
edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a)
{
- GET_PD_OR_RETURN();
-
- //printf("SET COLOR3 of state '%s'\n", state);
-
- if (r > -1 && r < 256) pd->color3.r = r;
- if (g > -1 && g < 256) pd->color3.g = g;
- if (b > -1 && b < 256) pd->color3.b = b;
- if (a > -1 && a < 256) pd->color3.a = a;
-
- edje_object_calc_force(obj);
-}
-
-//align
-EAPI double
-edje_edit_state_align_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET ALIGN_X of state '%s' [%f]\n", state, pd->align.x);
-
- return TO_DOUBLE(pd->align.x);
-}
-
-EAPI double
-edje_edit_state_align_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET ALIGN_Y of state '%s' [%f]\n", state, pd->align.y);
-
- return TO_DOUBLE(pd->align.y);
-}
-
-EAPI void
-edje_edit_state_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align)
-{
- GET_PD_OR_RETURN();
- //printf("SET ALIGN_X of state '%s' [to: %f]\n", state, align);
- pd->align.x = FROM_DOUBLE(align);
-}
-
-EAPI void
-edje_edit_state_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET ALIGN_Y of state '%s' [to: %f]\n", state, align);
- pd->align.y = FROM_DOUBLE(align);
-}
-
-//min & max
-EAPI int
-edje_edit_state_min_w_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET MIN_W of state '%s' [%d]\n", state, pd->min.w);
- return pd->min.w;
-}
-
-EAPI void
-edje_edit_state_min_w_set(Evas_Object *obj, const char *part, const char *state, double value, int min_w)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET MIN_W of state '%s' [to: %d]\n", state, min_w);
- pd->min.w = min_w;
-}
-
-EAPI int
-edje_edit_state_min_h_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET MIN_H of state '%s' [%d]\n", state, pd->min.h);
- return pd->min.h;
-}
-
-EAPI void
-edje_edit_state_min_h_set(Evas_Object *obj, const char *part, const char *state, double value, int min_h)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET MIN_H of state '%s' [to: %d]\n", state, min_h);
- pd->min.h = min_h;
-}
-
-EAPI int
-edje_edit_state_max_w_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
+ Edje_Part_Description_Text *txt;
- //printf("GET MAX_W of state '%s' [%d]\n", state, pd->max.w);
- return pd->max.w;
-}
-
-EAPI void
-edje_edit_state_max_w_set(Evas_Object *obj, const char *part, const char *state, double value, int max_w)
-{
GET_PD_OR_RETURN();
- //printf("SET MAX_W of state '%s' [to: %d]\n", state, max_w);
- pd->max.w = max_w;
-}
-
-EAPI int
-edje_edit_state_max_h_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET MAX_H of state '%s' [%d]\n", state, pd->max.h);
- return pd->max.h;
-}
-
-EAPI void
-edje_edit_state_max_h_set(Evas_Object *obj, const char *part, const char *state, double value, int max_h)
-{
- GET_PD_OR_RETURN();
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return;
- //printf("SET MAX_H of state '%s' [to: %d]\n", state, max_h);
- pd->max.h = max_h;
-}
+ txt = (Edje_Part_Description_Text*) pd;
-//aspect
-EAPI double
-edje_edit_state_aspect_min_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
+ if (r > -1 && r < 256) txt->text.color3.r = r;
+ if (g > -1 && g < 256) txt->text.color3.g = g;
+ if (b > -1 && b < 256) txt->text.color3.b = b;
+ if (a > -1 && a < 256) txt->text.color3.a = a;
- //printf("GET ASPECT_MIN of state '%s' [%f]\n", state, pd->aspect.min);
- return TO_DOUBLE(pd->aspect.min);
+ edje_object_calc_force(obj);
}
-EAPI double
-edje_edit_state_aspect_max_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET ASPECT_MAX of state '%s' [%f]\n", state, pd->aspect.max);
- return TO_DOUBLE(pd->aspect.max);
-}
+#define FUNC_STATE_DOUBLE(Class, Value) \
+ EAPI double \
+ edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ GET_PD_OR_RETURN(0); \
+ return TO_DOUBLE(pd->Class.Value); \
+ } \
+ EAPI void \
+ edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
+ { \
+ GET_PD_OR_RETURN(); \
+ pd->Class.Value = FROM_DOUBLE(v); \
+ edje_object_calc_force(obj); \
+ }
+
+#define FUNC_STATE_INT(Class, Value) \
+ EAPI int \
+ edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ GET_PD_OR_RETURN(0); \
+ return pd->Class.Value; \
+ } \
+ EAPI void \
+ edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \
+ { \
+ GET_PD_OR_RETURN(); \
+ pd->Class.Value = v; \
+ edje_object_calc_force(obj); \
+ }
+
+FUNC_STATE_DOUBLE(align, x);
+FUNC_STATE_DOUBLE(align, y);
+FUNC_STATE_INT(min, w);
+FUNC_STATE_INT(min, h);
+FUNC_STATE_INT(max, w);
+FUNC_STATE_INT(max, h);
+FUNC_STATE_DOUBLE(aspect, min);
+FUNC_STATE_DOUBLE(aspect, max);
+
+#define FUNC_STATE_DOUBLE_FILL(Class, Type, Value) \
+ EAPI double \
+ edje_edit_state_fill_##Type##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ Edje_Part_Description_Image *img; \
+ \
+ GET_PD_OR_RETURN(0); \
+ \
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE) \
+ return 0; \
+ \
+ img = (Edje_Part_Description_Image*) pd; \
+ \
+ return TO_DOUBLE(img->image.fill.Class##rel_##Value); \
+ } \
+ EAPI void \
+ edje_edit_state_fill_##Type##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
+ { \
+ Edje_Part_Description_Image *img; \
+ \
+ GET_PD_OR_RETURN(); \
+ \
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE) \
+ return; \
+ \
+ img = (Edje_Part_Description_Image*) pd; \
+ \
+ img->image.fill.Class##rel_##Value = FROM_DOUBLE(v); \
+ edje_object_calc_force(obj); \
+ }
+
+#define FUNC_STATE_INT_FILL(Class, Type, Value) \
+ EAPI int \
+ edje_edit_state_fill_##Type##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ Edje_Part_Description_Image *img; \
+ \
+ GET_PD_OR_RETURN(0); \
+ \
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE) \
+ return 0; \
+ \
+ img = (Edje_Part_Description_Image*) pd; \
+ \
+ return img->image.fill.Class##abs_##Value; \
+ } \
+ EAPI void \
+ edje_edit_state_fill_##Type##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
+ { \
+ Edje_Part_Description_Image *img; \
+ \
+ GET_PD_OR_RETURN(); \
+ \
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE) \
+ return; \
+ \
+ img = (Edje_Part_Description_Image*) pd; \
+ \
+ img->image.fill.Class##abs_##Value = FROM_DOUBLE(v); \
+ edje_object_calc_force(obj); \
+ }
+
+FUNC_STATE_DOUBLE_FILL(pos_, origin, x);
+FUNC_STATE_DOUBLE_FILL(pos_, origin, y);
+FUNC_STATE_INT_FILL(pos_, origin, x);
+FUNC_STATE_INT_FILL(pos_, origin, y);
+
+FUNC_STATE_DOUBLE_FILL(, size, x);
+FUNC_STATE_DOUBLE_FILL(, size, y);
+FUNC_STATE_INT_FILL(, size, x);
+FUNC_STATE_INT_FILL(, size, y);
-EAPI void
-edje_edit_state_aspect_min_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect)
+EAPI Eina_Bool
+edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state, double value)
{
- GET_PD_OR_RETURN();
-
- //printf("SET ASPECT_MIN of state '%s' [to: %f]\n", state, aspect);
- pd->aspect.min = FROM_DOUBLE(aspect);
+ GET_PD_OR_RETURN(EINA_FALSE);
+ //printf("Get state visible flag of part: %s state: %s\n", part, state);
+ return pd->visible;
}
EAPI void
-edje_edit_state_aspect_max_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect)
+edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible)
{
GET_PD_OR_RETURN();
-
- //printf("SET ASPECT_MAX of state '%s' [to: %f]\n", state, aspect);
- pd->aspect.max = FROM_DOUBLE(aspect);
+ //printf("Set state visible flag of part: %s state: %s to: %d\n", part, state, visible);
+ if (visible) pd->visible = 1;
+ else pd->visible = 0;
+ edje_object_calc_force(obj);
}
EAPI unsigned char
@@ -3631,162 +3404,6 @@ edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *
pd->aspect.prefer = pref;
}
-//fill
-EAPI double
-edje_edit_state_fill_origin_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get state fill origin of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->fill.pos_rel_x);
-}
-
-EAPI double
-edje_edit_state_fill_origin_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get state fill origin of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->fill.pos_rel_y);
-}
-
-EAPI int
-edje_edit_state_fill_origin_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get state fill origin offset of part: %s state: %s\n", part, state);
- return pd->fill.pos_abs_x;
-}
-
-EAPI int
-edje_edit_state_fill_origin_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get state fill origin offset of part: %s state: %s\n", part, state);
- return pd->fill.pos_abs_y;
-}
-
-
-EAPI void
-edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill origin of part: %s state: %s to: %f\n", part, state, x);
- pd->fill.pos_rel_x = FROM_DOUBLE(x);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill origin of part: %s state: %s to: %f\n", part, state, y);
- pd->fill.pos_rel_y = FROM_DOUBLE(y);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill origin offset x of part: %s state: %s to: %f\n", part, state, x);
- pd->fill.pos_abs_x = FROM_DOUBLE(x);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_fill_origin_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill origin offset y of part: %s state: %s to: %f\n", part, state, y);
- pd->fill.pos_abs_y = FROM_DOUBLE(y);
- edje_object_calc_force(obj);
-}
-
-EAPI double
-edje_edit_state_fill_size_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0.0);
- //printf("Get state fill size of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->fill.rel_x);
-}
-
-EAPI double
-edje_edit_state_fill_size_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0.0);
- //printf("Get state fill size of part: %s state: %s\n", part, state);
- return TO_DOUBLE(pd->fill.rel_y);
-}
-
-EAPI int
-edje_edit_state_fill_size_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get state fill size offset of part: %s state: %s\n", part, state);
- return pd->fill.abs_x;
-}
-
-EAPI int
-edje_edit_state_fill_size_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("Get state fill size offset of part: %s state: %s\n", part, state);
- return pd->fill.abs_y;
-}
-
-EAPI void
-edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill size of part: %s state: %s to: %f\n", part, state, x);
- pd->fill.rel_x = FROM_DOUBLE(x);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill size of part: %s state: %s to: %f\n", part, state, y);
- pd->fill.rel_y = FROM_DOUBLE(y);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill size offset x of part: %s state: %s to: %f\n", part, state, x);
- pd->fill.abs_x = FROM_DOUBLE(x);
- edje_object_calc_force(obj);
-}
-
-EAPI void
-edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y)
-{
- GET_PD_OR_RETURN();
- //printf("Set state fill size offset y of part: %s state: %s to: %f\n", part, state, y);
- pd->fill.abs_y = FROM_DOUBLE(y);
- edje_object_calc_force(obj);
-}
-
-EAPI Eina_Bool
-edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("Get state visible flag of part: %s state: %s\n", part, state);
- return pd->visible;
-}
-
-EAPI void
-edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible)
-{
- GET_PD_OR_RETURN();
- //printf("Set state visible flag of part: %s state: %s to: %d\n", part, state, visible);
- if (visible) pd->visible = 1;
- else pd->visible = 0;
- edje_object_calc_force(obj);
-}
-
EAPI const char*
edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *state, double value)
{
@@ -3807,18 +3424,33 @@ edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *
EAPI const Eina_List *
edje_edit_state_external_params_list_get(Evas_Object *obj, const char *part, const char *state, double value)
{
+ Edje_Part_Description_External *external;
+
GET_PD_OR_RETURN(NULL);
- return pd->external_params;
+
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ return NULL;
+
+ external = (Edje_Part_Description_External *) pd;
+
+ return external->external_params;
}
EAPI Eina_Bool
edje_edit_state_external_param_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Edje_External_Param_Type *type, void **val)
{
- Eina_List *l;
+ Edje_Part_Description_External *external;
Edje_External_Param *p;
+ Eina_List *l;
+
GET_PD_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ return EINA_FALSE;
+
+ external = (Edje_Part_Description_External *) pd;
+
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
if (type) *type = p->type;
@@ -3848,11 +3480,21 @@ edje_edit_state_external_param_get(Evas_Object *obj, const char *part, const cha
EAPI Eina_Bool
edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, int *val)
{
- Eina_List *l;
+ Edje_Part_Description_External *external;
Edje_External_Param *p;
+ Eina_List *l;
+
GET_PD_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ {
+ if (val) *val = 0;
+ return EINA_FALSE;
+ }
+
+ external = (Edje_Part_Description_External *) pd;
+
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_INT)
@@ -3868,11 +3510,21 @@ edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const
EAPI Eina_Bool
edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool *val)
{
- Eina_List *l;
+ Edje_Part_Description_External *external;
Edje_External_Param *p;
+ Eina_List *l;
+
GET_PD_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ {
+ if (val) *val = 0;
+ return EINA_FALSE;
+ }
+
+ external = (Edje_Part_Description_External *) pd;
+
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL)
@@ -3888,11 +3540,21 @@ edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, cons
EAPI Eina_Bool
edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double *val)
{
- Eina_List *l;
+ Edje_Part_Description_External *external;
Edje_External_Param *p;
+ Eina_List *l;
+
GET_PD_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ {
+ if (val) *val = 0;
+ return EINA_FALSE;
+ }
+
+ external = (Edje_Part_Description_External *) pd;
+
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
@@ -3908,11 +3570,21 @@ edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, co
EAPI Eina_Bool
edje_edit_state_external_param_string_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val)
{
- Eina_List *l;
+ Edje_Part_Description_External *external;
Edje_External_Param *p;
+ Eina_List *l;
+
GET_PD_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ {
+ if (val) *val = NULL;
+ return EINA_FALSE;
+ }
+
+ external = (Edje_Part_Description_External *) pd;
+
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)
@@ -3928,11 +3600,21 @@ edje_edit_state_external_param_string_get(Evas_Object *obj, const char *part, co
EAPI Eina_Bool
edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val)
{
- Eina_List *l;
+ Edje_Part_Description_External *external;
Edje_External_Param *p;
+ Eina_List *l;
+
GET_PD_OR_RETURN(EINA_FALSE);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ {
+ if (val) *val = NULL;
+ return EINA_FALSE;
+ }
+
+ external = (Edje_Part_Description_External *) pd;
+
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
@@ -3952,26 +3634,33 @@ edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, co
* - EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: double
* - EDJE_EXTERNAL_PARAM_TYPE_STRING: char*
* - EDJE_EXTERNAL_PARAM_TYPE_CHOICE: char*
+ *
+ * @note: The validation of the parameter will occur only if the part
+ * is in the same state as the one being modified.
*/
EAPI Eina_Bool
edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Edje_External_Param_Type type, ...)
{
va_list ap;
Eina_List *l;
- Edje_External_Param *p;
- Edje_Real_Part *rp;
+ Edje_Part_Description_External *external;
+ Edje_External_Param *p = NULL, old_p = { 0, 0, 0, 0, 0 };
int found = 0;
GET_PD_OR_RETURN(EINA_FALSE);
- rp = _edje_real_part_get(ed, part);
+ if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
+ return EINA_FALSE;
+
+ external = (Edje_Part_Description_External *) pd;
va_start(ap, type);
- EINA_LIST_FOREACH(pd->external_params, l, p)
+ EINA_LIST_FOREACH(external->external_params, l, p)
if (!strcmp(p->name, param))
{
found = 1;
+ old_p = *p;
break;
}
@@ -4007,27 +3696,44 @@ edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const cha
break;
default:
ERR("unknown external parameter type '%d'", type);
+ va_end(ap);
+ if (!found) free(p);
+ else *p = old_p;
+ return EINA_FALSE;
}
va_end(ap);
+ //FIXME:
+ //For now, we're just setting the value if the state is the selected state.
+ //This is a conceptual error and is incoherent with the rest of the API!
+ {
+ const char *sname;
+ double svalue;
+ sname = edje_edit_part_selected_state_get(obj, part, &svalue);
+ if (!strcmp(state, sname) && svalue == value)
+ if (!edje_object_part_external_param_set(obj, part, p))
+ if ((type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) ||
+ (type == EDJE_EXTERNAL_PARAM_TYPE_STRING))
+ {
+ _edje_if_string_free(ed, p->s);
+ if (!found) free(p);
+ else *p = old_p;
+ eina_stringshare_del(sname);
+ return EINA_FALSE;
+ }
+ eina_stringshare_del(sname);
+ }
+
if (!found)
- pd->external_params = eina_list_append(pd->external_params, p);
+ external->external_params = eina_list_append(external->external_params, p);
_edje_external_parsed_params_free(rp->swallowed_object,
rp->param1.external_params);
rp->param1.external_params = \
_edje_external_params_parse(rp->swallowed_object,
- pd->external_params);
+ external->external_params);
- {
- const char * sname;
- double svalue;
- sname = edje_edit_part_selected_state_get(obj, part, &svalue);
- if (!strcmp(state, sname) && svalue == value)
- edje_object_part_external_param_set(obj, part, p);
- eina_stringshare_del(sname);
- }
return EINA_TRUE;
}
@@ -4069,27 +3775,40 @@ edje_edit_state_external_param_choice_set(Evas_Object *obj, const char *part, co
EAPI const char *
edje_edit_state_text_get(Evas_Object *obj, const char *part, const char *state, double value)
{
+ Edje_Part_Description_Text *txt;
+
GET_PD_OR_RETURN(NULL);
- //printf("GET TEXT of state: %s\n", state);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return NULL;
- if (pd->text.text)
- return eina_stringshare_add(pd->text.text);
+ txt = (Edje_Part_Description_Text *) pd;
+ //printf("GET TEXT of state: %s\n", state);
- return NULL;
+ return eina_stringshare_add(edje_string_get(&txt->text.text));
}
EAPI void
edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text)
{
+ Edje_Part_Description_Text *txt;
+
GET_PD_OR_RETURN();
//printf("SET TEXT of state: %s\n", state);
if (!text) return;
- _edje_if_string_free(ed, pd->text.text);
- pd->text.text = (char *)eina_stringshare_add(text);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return;
+
+ txt = (Edje_Part_Description_Text *) pd;
+
+ _edje_if_string_free(ed, txt->text.text.str);
+ txt->text.text.str = (char *)eina_stringshare_add(text);
+ txt->text.text.id = 0;
edje_object_calc_force(obj);
}
@@ -4097,143 +3816,128 @@ edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state,
EAPI int
edje_edit_state_text_size_get(Evas_Object *obj, const char *part, const char *state, double value)
{
+ Edje_Part_Description_Text *txt;
+
GET_PD_OR_RETURN(-1);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return -1;
+
+ txt = (Edje_Part_Description_Text *) pd;
//printf("GET TEXT_SIZE of state: %s [%d]\n", state, pd->text.size);
- return pd->text.size;
+ return txt->text.size;
}
EAPI void
edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size)
{
+ Edje_Part_Description_Text *txt;
+
GET_PD_OR_RETURN();
//printf("SET TEXT_SIZE of state: %s [%d]\n", state, size);
if (size < 0) return;
- pd->text.size = size;
-
- edje_object_calc_force(obj);
-}
-
-EAPI double
-edje_edit_state_text_align_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
-
- //printf("GET TEXT_ALIGN_X of state: %s [%f]\n", state, pd->text.align.x);
- return TO_DOUBLE(pd->text.align.x);
-}
-
-EAPI void
-edje_edit_state_text_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT_ALIGN_X of state: %s [%f]\n", state, align);
-
- pd->text.align.x = FROM_DOUBLE(align);
- edje_object_calc_force(obj);
-}
-
-EAPI double
-edje_edit_state_text_align_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0.0);
-
- //printf("GET TEXT_ALIGN_Y of state: %s [%f]\n", state, pd->text.align.x);
- return TO_DOUBLE(pd->text.align.y);
-}
-
-EAPI void
-edje_edit_state_text_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT_ALIGN_Y of state: %s [%f]\n", state, align);
-
- pd->text.align.y = FROM_DOUBLE(align);
- edje_object_calc_force(obj);
-}
-
-EAPI double
-edje_edit_state_text_elipsis_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0.0);
-
- //printf("GET TEXT_ELIPSIS of state: %s [%f]\n", state, pd->text.elipsis);
- return pd->text.elipsis;
-}
-
-EAPI void
-edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char *state, double value, double balance)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT_ELIPSIS of state: %s [%f]\n", state, balance);
-
- pd->text.elipsis = balance;
- edje_object_calc_force(obj);
-}
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return;
-EAPI Eina_Bool
-edje_edit_state_text_fit_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("GET TEXT_FIT_VERT of state: %s \n", state);
- return pd->text.fit_x;
-}
+ txt = (Edje_Part_Description_Text *) pd;
-EAPI void
-edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT_FIT_VERT of state: %s\n", state);
+ txt->text.size = size;
- pd->text.fit_x = fit ? 1 : 0;
edje_object_calc_force(obj);
}
-EAPI Eina_Bool
-edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("GET TEXT_FIT_VERT of state: %s \n", state);
- return pd->text.fit_y;
-}
-
-EAPI void
-edje_edit_state_text_fit_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET TEXT_FIT_VERT of state: %s\n", state);
-
- pd->text.fit_y = fit ? 1 : 0;
- edje_object_calc_force(obj);
-}
+#define FUNC_TEXT_DOUBLE(Name, Value) \
+ EAPI double \
+ edje_edit_state_text_##Name##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ Edje_Part_Description_Text *txt; \
+ \
+ GET_PD_OR_RETURN(0); \
+ \
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
+ return 0; \
+ \
+ txt = (Edje_Part_Description_Text *) pd; \
+ return TO_DOUBLE(txt->text.Value); \
+ } \
+ EAPI void \
+ edje_edit_state_text_##Name##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
+ { \
+ Edje_Part_Description_Text *txt; \
+ \
+ GET_PD_OR_RETURN(); \
+ \
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
+ return; \
+ \
+ txt = (Edje_Part_Description_Text *) pd; \
+ txt->text.Value = FROM_DOUBLE(v); \
+ edje_object_calc_force(obj); \
+ } \
+
+FUNC_TEXT_DOUBLE(align_x, align.x);
+FUNC_TEXT_DOUBLE(align_y, align.y);
+FUNC_TEXT_DOUBLE(elipsis, elipsis);
+
+#define FUNC_TEXT_BOOL_FIT(Value) \
+ EAPI Eina_Bool \
+ edje_edit_state_text_fit_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
+ { \
+ Edje_Part_Description_Text *txt; \
+ \
+ GET_PD_OR_RETURN(EINA_FALSE); \
+ \
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
+ return EINA_FALSE; \
+ \
+ txt = (Edje_Part_Description_Text *) pd; \
+ return txt->text.fit_##Value; \
+ } \
+ EAPI void \
+ edje_edit_state_text_fit_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool fit) \
+ { \
+ Edje_Part_Description_Text *txt; \
+ \
+ GET_PD_OR_RETURN(); \
+ \
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
+ return; \
+ \
+ txt = (Edje_Part_Description_Text *) pd; \
+ txt->text.fit_##Value = fit ? 1 : 0; \
+ edje_object_calc_force(obj); \
+ }
+
+FUNC_TEXT_BOOL_FIT(x);
+FUNC_TEXT_BOOL_FIT(y);
EAPI Eina_List *
edje_edit_fonts_list_get(Evas_Object *obj)
{
- Edje_Font_Directory_Entry *f;
+ Eina_Iterator *it;
Eina_List *fonts = NULL;
- Eina_List *l;
+ Edje_Font_Directory_Entry *f;
GET_ED_OR_RETURN(NULL);
- if (!ed->file) return NULL;
- if (!ed->file->font_dir) return NULL;
+ if (!ed->file || !ed->file->fonts) return NULL;
- //printf("GET FONT LIST for %s\n", ed->file->path);
+ it = eina_hash_iterator_data_new(ed->file->fonts);
+ if (!it) return NULL;
- EINA_LIST_FOREACH(ed->file->font_dir->entries, l, f)
- {
- fonts = eina_list_append(fonts, f);
- //printf(" Font: %s (%s) \n", f->entry, f->path);
- }
+ EINA_ITERATOR_FOREACH(it, f)
+ fonts = eina_list_append(fonts, f);
+
+ eina_iterator_free(it);
return fonts;
}
@@ -4242,6 +3946,7 @@ EAPI Eina_Bool
edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
{
char entry[PATH_MAX];
+ char *new_path;
struct stat st;
Edje_Font_Directory_Entry *fnt;
@@ -4254,28 +3959,29 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
if (!ed->file) return EINA_FALSE;
if (!ed->path) return EINA_FALSE;
- /* Create Font_Directory if not exist */
- if (!ed->file->font_dir)
+ /* Alias */
+ if (alias)
{
- ed->file->font_dir = _alloc(sizeof(Edje_Font_Directory));
- if (!ed->file->font_dir) return EINA_FALSE;
+ if ((new_path = strrchr(path, '/'))) new_path ++;
+ else new_path = (char *)path;
}
- if (!ed->file->font_hash)
+ else
{
- ed->file->font_hash = eina_hash_string_superfast_new(NULL);
- if (!ed->file->font_hash) return EINA_FALSE;
+ if ((alias = strrchr(path, '/'))) alias ++;
+ else alias = (char *)path;
+ new_path = (char *)alias;
}
+ snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
- /* Alias */
- if (!alias)
+ /* Initializing a new font hash, if no exist */
+ if (!ed->file->fonts)
{
- if ((alias = strrchr(path, '/'))) alias ++;
- else alias = (char *)path;
+ ed->file->fonts = eina_hash_string_small_new(NULL);
+ if (!ed->file->fonts) return EINA_FALSE;
}
- snprintf(entry, sizeof(entry), "fonts/%s", alias);
/* Check if exists */
- fnt = eina_hash_find(ed->file->font_hash, alias);
+ fnt = eina_hash_find(ed->file->fonts, alias);
if (fnt)
return EINA_FALSE;
@@ -4286,25 +3992,15 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
ERR("Unable to alloc font entry part \"%s\"", alias);
return EINA_FALSE;
}
- fnt->entry = strdup(alias);
- fnt->path = strdup(entry);
+ fnt->file = eina_stringshare_add(new_path);
+ fnt->entry = eina_stringshare_add(alias);
- ed->file->font_dir->entries = eina_list_append(
- ed->file->font_dir->entries,
- fnt);
- eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt);
+ eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);
/* Import font */
if (!_edje_import_font_file(ed, path, entry))
{
- ed->file->font_dir->entries = eina_list_remove(
- ed->file->font_dir->entries,
- fnt);
- eina_hash_del_by_key(ed->file->font_hash, alias);
-
- free((char *)fnt->entry);
- free((char *)fnt->path);
- free(fnt);
+ eina_hash_del(ed->file->fonts, fnt->entry, fnt);
return EINA_FALSE;
}
@@ -4324,30 +4020,13 @@ edje_edit_font_del(Evas_Object *obj, const char* alias)
if (!ed->file) return EINA_FALSE;
if (!ed->path) return EINA_FALSE;
- if (!ed->file->font_dir)
- return EINA_TRUE;
-
- fnt = eina_hash_find(ed->file->font_hash, alias);
+ fnt = eina_hash_find(ed->file->fonts, alias);
if (!fnt)
{
WRN("Unable to find font entry part \"%s\"", alias);
return EINA_TRUE;
}
- ed->file->font_dir->entries = eina_list_remove(
- ed->file->font_dir->entries,
- fnt);
-
- if (!eina_hash_del_by_key(ed->file->font_hash, alias))
- {
- ERR("Unable to remove font \"%s\" of fonts hash", alias);
-
- ed->file->font_dir->entries = eina_list_append(
- ed->file->font_dir->entries,
- fnt);
- return EINA_FALSE;
- }
-
/* Erase font to edje file */
{
char entry[PATH_MAX];
@@ -4358,23 +4037,15 @@ edje_edit_font_del(Evas_Object *obj, const char* alias)
if (!eetf)
{
ERR("Unable to open \"%s\" for writing output", ed->path);
- eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt);
- ed->file->font_dir->entries = eina_list_append(
- ed->file->font_dir->entries,
- fnt);
return EINA_FALSE;
}
- snprintf(entry, sizeof(entry), "fonts/%s", alias);
+ snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
if (eet_delete(eetf, entry) <= 0)
{
ERR("Unable to delete \"%s\" font entry", entry);
eet_close(eetf);
- eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt);
- ed->file->font_dir->entries = eina_list_append(
- ed->file->font_dir->entries,
- fnt);
return EINA_FALSE;
}
@@ -4382,18 +4053,12 @@ edje_edit_font_del(Evas_Object *obj, const char* alias)
if (!_edje_edit_edje_file_save(eetf, ed->file))
{
eet_close(eetf);
- eina_hash_direct_add(ed->file->font_hash, fnt->entry, fnt);
- ed->file->font_dir->entries = eina_list_append(
- ed->file->font_dir->entries,
- fnt);
return EINA_FALSE;
}
eet_close(eetf);
}
- free((char *)fnt->entry);
- free((char *)fnt->path);
- free(fnt);
+ eina_hash_del(ed->file->fonts, alias, fnt);
return EINA_TRUE;
}
@@ -4401,22 +4066,35 @@ edje_edit_font_del(Evas_Object *obj, const char* alias)
EAPI const char *
edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value)
{
+ Edje_Part_Description_Text *txt;
+
GET_PD_OR_RETURN(NULL);
- //printf("GET FONT of state: %s [%s]\n", state, pd->text.font);
- if (!pd->text.font) return NULL;
- return eina_stringshare_add(pd->text.font);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return NULL;
+
+ txt = (Edje_Part_Description_Text*) pd;
+
+ return eina_stringshare_add(edje_string_get(&txt->text.font));
}
EAPI void
edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font)
{
+ Edje_Part_Description_Text *txt;
+
GET_PD_OR_RETURN();
- //printf("SET FONT of state: %s [%s]\n", state, font);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return;
+
+ txt = (Edje_Part_Description_Text*) pd;
- _edje_if_string_free(ed, pd->text.font);
- pd->text.font = (char *)eina_stringshare_add(font);
+ _edje_if_string_free(ed, txt->text.font.str);
+ txt->text.font.str = (char *)eina_stringshare_add(font);
+ txt->text.font.id = 0;
edje_object_calc_force(obj);
}
@@ -4448,9 +4126,8 @@ edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect e
EAPI Eina_List *
edje_edit_images_list_get(Evas_Object *obj)
{
- Edje_Image_Directory_Entry *i;
Eina_List *images = NULL;
- Eina_List *l;
+ unsigned int i;
GET_ED_OR_RETURN(NULL);
@@ -4458,13 +4135,9 @@ edje_edit_images_list_get(Evas_Object *obj)
if (!ed->file->image_dir) return NULL;
//printf("GET IMAGES LIST for %s\n", ed->file->path);
-
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- {
- images = eina_list_append(images, eina_stringshare_add(i->entry));
- //printf(" Image: %s (type: %d param: %d id: %d) \n",
- // i->entry, i->source_type, i->source_param, i->id);
- }
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
+ images = eina_list_append(images,
+ eina_stringshare_add(ed->file->image_dir->entries[i].entry));
return images;
}
@@ -4472,9 +4145,9 @@ edje_edit_images_list_get(Evas_Object *obj)
EAPI Eina_Bool
edje_edit_image_add(Evas_Object *obj, const char* path)
{
- Eina_List *l;
Edje_Image_Directory_Entry *de;
- int free_id = 0;
+ unsigned int i;
+ int free_id = -1;
char *name;
GET_ED_OR_RETURN(EINA_FALSE);
@@ -4495,33 +4168,44 @@ edje_edit_image_add(Evas_Object *obj, const char* path)
else name = (char *)path;
/* Loop trough image directory to find if image exist */
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, de)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (!strcmp(name, de->entry))
+ de = ed->file->image_dir->entries + i;
+
+ if (!de->entry)
+ free_id = i;
+ else if (!strcmp(name, de->entry))
return EINA_FALSE;
- if (de->id >= free_id)
- free_id = de->id + 1; /*TODO search for free (hole) id*/
}
- /* Create Image Entry */
- de = _alloc(sizeof(Edje_Image_Directory_Entry));
- if (!de) return EINA_FALSE;
- de->entry = strdup(name);
+ if (free_id == -1)
+ {
+ Edje_Image_Directory_Entry *tmp;
+ unsigned int count;
+
+ count = ed->file->image_dir->entries_count + 1;
+
+ tmp = realloc(ed->file->image_dir->entries,
+ sizeof (Edje_Image_Directory_Entry) * count);
+ if (!tmp) return EINA_FALSE;
+
+ ed->file->image_dir->entries = tmp;
+ free_id = ed->file->image_dir->entries_count;
+ ed->file->image_dir->entries_count = count;
+ }
+
+ /* Set Image Entry */
+ de = ed->file->image_dir->entries + free_id;
+ de->entry = eina_stringshare_add(name);
de->id = free_id;
de->source_type = 1;
de->source_param = 1;
- /* Add image to Image Directory */
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
-
/* Import image */
if (!_edje_import_image_file(ed, path, free_id))
{
- ed->file->image_dir->entries =
- eina_list_remove(ed->file->image_dir->entries, de);
- free(de->entry);
- free(de);
+ eina_stringshare_del(de->entry);
+ de->entry = NULL;
return EINA_FALSE;
}
@@ -4531,8 +4215,8 @@ edje_edit_image_add(Evas_Object *obj, const char* path)
EAPI Eina_Bool
edje_edit_image_del(Evas_Object *obj, const char* name)
{
- Eina_List *l;
Edje_Image_Directory_Entry *de;
+ unsigned int i;
GET_ED_OR_RETURN(EINA_FALSE);
@@ -4544,18 +4228,16 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
if (!ed->file->image_dir)
return EINA_TRUE;
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, de)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (!strcmp(name, de->entry))
- {
- ed->file->image_dir->entries = eina_list_remove_list(
- ed->file->image_dir->entries, l);
- break;
- }
- de = NULL;
+ de = ed->file->image_dir->entries + i;
+
+ if (de->entry
+ && !strcmp(name, de->entry))
+ break;
}
- if (!de)
+ if (i == ed->file->image_dir->entries_count)
{
WRN("Unable to find image entry part \"%s\"", name);
return EINA_TRUE;
@@ -4570,19 +4252,15 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
if (!eetf)
{
ERR("Unable to open \"%s\" for writing output", ed->path);
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
return EINA_FALSE;
}
- snprintf(entry, sizeof(entry), "images/%i", de->id);
+ snprintf(entry, sizeof(entry), "edje/images/%i", de->id);
if (eet_delete(eetf, entry) <= 0)
{
ERR("Unable to delete \"%s\" font entry", entry);
eet_close(eetf);
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
return EINA_FALSE;
}
@@ -4590,16 +4268,14 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
if (!_edje_edit_edje_file_save(eetf, ed->file))
{
eet_close(eetf);
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
return EINA_FALSE;
}
eet_close(eetf);
}
- free(de->entry);
- free(de);
+ _edje_if_string_free(ed, de->entry);
+ de->entry = NULL;
return EINA_TRUE;
}
@@ -4607,9 +4283,7 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
EAPI Eina_Bool
edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
{
- Eina_List *l;
Edje_Image_Directory_Entry *de;
- Edje_Image_Directory_Entry *i, *t;
GET_ED_OR_RETURN(EINA_FALSE);
@@ -4625,34 +4299,14 @@ edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
}
/* Loop trough image directory to find if image exist */
- t = NULL;
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- {
- if (!i) return EINA_FALSE;
- if (i->id == id) t = i;
- }
+ if (id < 0) id = - id - 1;
+ if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE;
- /* Create Image Entry */
- if (!t)
- {
- de = _alloc(sizeof(Edje_Image_Directory_Entry));
- if (!de) return EINA_FALSE;
- }
- else
- {
- de = t;
- free(de->entry);
- }
- de->entry = strdup(name);
- de->id = id;
+ de = ed->file->image_dir->entries + id;
+ eina_stringshare_replace(&de->entry, name);
de->source_type = 1;
de->source_param = 1;
- /* Add image to Image Directory */
- if (!t)
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
-
return EINA_TRUE;
}
@@ -4665,27 +4319,29 @@ edje_edit_image_id_get(Evas_Object *obj, const char *image_name)
EAPI Edje_Edit_Image_Comp
edje_edit_image_compression_type_get(Evas_Object *obj, const char *image)
{
- Edje_Image_Directory_Entry *i = NULL;
- Eina_List *l;
+ Edje_Image_Directory_Entry *de = NULL;
+ unsigned int i;
GET_ED_OR_RETURN(-1);
if (!ed->file) return -1;
if (!ed->file->image_dir) return -1;
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (strcmp(i->entry, image) == 0)
+ de = ed->file->image_dir->entries + i;
+
+ if (de->entry
+ && !strcmp(image, de->entry))
break;
- i = NULL;
}
- if (!i) return -1;
+ if (i == ed->file->image_dir->entries_count) return -1;
- switch(i->source_type)
+ switch(de->source_type)
{
case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT:
- if (i->source_param == 0) // RAW
+ if (de->source_param == 0) // RAW
return EDJE_EDIT_IMAGE_COMP_RAW;
else // COMP
return EDJE_EDIT_IMAGE_COMP_COMP;
@@ -4704,32 +4360,40 @@ edje_edit_image_compression_type_get(Evas_Object *obj, const char *image)
EAPI int
edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image)
{
- Eina_List *l;
- Edje_Image_Directory_Entry *i;
+ Edje_Image_Directory_Entry *de;
+ unsigned int i;
GET_ED_OR_RETURN(-1);
// Gets the Image Entry
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (strcmp(i->entry, image) == 0) break;
- i = NULL;
+ de = ed->file->image_dir->entries + i;
+ if (de->entry
+ && !strcmp(de->entry, image))
+ break;
}
- if (!i) return -1;
- if (i->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2;
+ if (i == ed->file->image_dir->entries_count) return -1;
+ if (de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2;
- return i->source_param;
+ return de->source_param;
}
EAPI const char *
edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state, double value)
{
+ Edje_Part_Description_Image *img;
char *image;
GET_PD_OR_RETURN(NULL);
- image = (char *)_edje_image_name_find(obj, pd->image.id);
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return NULL;
+
+ img = (Edje_Part_Description_Image *) pd;
+
+ image = (char *)_edje_image_name_find(obj, img->image.id);
if (!image) return NULL;
//printf("GET IMAGE for %s [%s]\n", state, image);
@@ -4739,16 +4403,22 @@ edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state,
EAPI void
edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image)
{
+ Edje_Part_Description_Image *img;
int id;
GET_PD_OR_RETURN();
if (!image) return;
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return;
+
id = _edje_image_id_find(obj, image);
//printf("SET IMAGE for %s [%s]\n", state, image);
- if (id > -1) pd->image.id = id;
+ img = (Edje_Part_Description_Image *) pd;
+
+ if (id > -1) img->image.id = id;
edje_object_calc_force(obj);
}
@@ -4756,17 +4426,21 @@ edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state,
EAPI Eina_List *
edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char *state, double value)
{
- Edje_Part_Image_Id *i;
- Eina_List *tweens = NULL, *l;
+ Edje_Part_Description_Image *img;
+ Eina_List *tweens = NULL;
const char *name;
+ unsigned int i;
GET_PD_OR_RETURN(NULL);
- //printf("GET TWEEN LIST for %s\n", state);
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return NULL;
- EINA_LIST_FOREACH(pd->image.tween_list, l, i)
+ img = (Edje_Part_Description_Image *) pd;
+
+ for (i = 0; i < img->image.tweens_count; ++i)
{
- name = _edje_image_name_find(obj, i->id);
+ name = _edje_image_name_find(obj, img->image.tweens[i]->id);
//printf(" t: %s\n", name);
tweens = eina_list_append(tweens, eina_stringshare_add(name));
}
@@ -4777,11 +4451,16 @@ edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char *
EAPI Eina_Bool
edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
{
+ Edje_Part_Description_Image *img;
+ Edje_Part_Image_Id **tmp;
Edje_Part_Image_Id *i;
int id;
GET_PD_OR_RETURN(EINA_FALSE);
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return EINA_FALSE;
+
id = _edje_image_id_find(obj, tween);
if (id < EINA_FALSE) return 0;
@@ -4790,8 +4469,19 @@ edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state,
if (!i) return EINA_FALSE;
i->id = id;
+ img = (Edje_Part_Description_Image *) pd;
+
/* add to tween list */
- pd->image.tween_list = eina_list_append(pd->image.tween_list, i);
+ tmp = realloc(img->image.tweens,
+ sizeof (Edje_Part_Image_Id*) * img->image.tweens_count);
+ if (!tmp)
+ {
+ free(i);
+ return EINA_FALSE;
+ }
+
+ tmp[img->image.tweens_count++] = i;
+ img->image.tweens = tmp;
return EINA_TRUE;
}
@@ -4799,22 +4489,31 @@ edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state,
EAPI Eina_Bool
edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
{
- Eina_List *l;
- Edje_Part_Image_Id *i;
- int id;
+ Edje_Part_Description_Image *img;
+ unsigned int i;
+ int search;
GET_PD_OR_RETURN(EINA_FALSE);
- if (!pd->image.tween_list) return EINA_FALSE;
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return EINA_FALSE;
- id = _edje_image_id_find(obj, tween);
- if (id < 0) return EINA_FALSE;
+ img = (Edje_Part_Description_Image *) pd;
+
+ if (!img->image.tweens_count) return EINA_FALSE;
+
+ search = _edje_image_id_find(obj, tween);
+ if (search < 0) return EINA_FALSE;
- EINA_LIST_FOREACH(pd->image.tween_list, l, i)
+ for (i = 0; i < img->image.tweens_count; ++i)
{
- if (i->id == id)
+ if (img->image.tweens[i]->id == search)
{
- pd->image.tween_list = eina_list_remove_list(pd->image.tween_list, l);
+ img->image.tweens_count--;
+ free(img->image.tweens[i]);
+ memmove(img->image.tweens + i,
+ img->image.tweens + i + 1,
+ sizeof (Edje_Part_Description_Image*) * (img->image.tweens_count - i));
return EINA_TRUE;
}
}
@@ -4824,507 +4523,92 @@ edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state,
EAPI void
edje_edit_state_image_border_get(Evas_Object *obj, const char *part, const char *state, double value, int *l, int *r, int *t, int *b)
{
- GET_PD_OR_RETURN();
-
- //printf("GET IMAGE_BORDER of state '%s'\n", state);
-
- if (l) *l = pd->border.l;
- if (r) *r = pd->border.r;
- if (t) *t = pd->border.t;
- if (b) *b = pd->border.b;
-}
-
-EAPI void
-edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b)
-{
- GET_PD_OR_RETURN();
-
- //printf("SET IMAGE_BORDER of state '%s'\n", state);
-
- if (l > -1) pd->border.l = l;
- if (r > -1) pd->border.r = r;
- if (t > -1) pd->border.t = t;
- if (b > -1) pd->border.b = b;
-
- edje_object_calc_force(obj);
-}
-
-EAPI unsigned char
-edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- if (pd->border.no_fill == 0) return 1;
- else if (pd->border.no_fill == 1) return 0;
- else if (pd->border.no_fill == 2) return 2;
- return 0;
-}
+ Edje_Part_Description_Image *img;
-EAPI void
-edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill)
-{
GET_PD_OR_RETURN();
- if (fill == 0) pd->border.no_fill = 1;
- else if (fill == 1) pd->border.no_fill = 0;
- else if (fill == 2) pd->border.no_fill = 2;
-
- edje_object_calc_force(obj);
-}
-
-/******************/
-/* SPECTRUM API */
-/******************/
-
-EAPI Eina_List *
-edje_edit_spectrum_list_get(Evas_Object *obj)
-{
- Edje_Spectrum_Directory_Entry *s;
- Eina_List *spectrum = NULL;
- Eina_List *l;
-
- GET_ED_OR_RETURN(NULL);
-
- if (!ed->file) return NULL;
- if (!ed->file->spectrum_dir) return NULL;
-
- //printf("GET SPECTRUM LIST for %s\n", ed->file->path);
-
- EINA_LIST_FOREACH(ed->file->spectrum_dir->entries, l, s)
- {
- //printf("SPECTRUM: %s [id: %d]\n", s->entry, s->id);
- spectrum = eina_list_append(spectrum, eina_stringshare_add(s->entry));
- }
-
- return spectrum;
-}
-
-EAPI Eina_Bool
-edje_edit_spectra_add(Evas_Object *obj, const char* name)
-{
- GET_ED_OR_RETURN(EINA_FALSE);
-
- //printf("SPECTRA ADD [new name:%s]\n", name);
-
- Edje_Spectrum_Directory_Entry *s;
-
- if (!ed->file) return EINA_FALSE;
-
- if (_edje_edit_spectrum_entry_get(ed, name)) return EINA_FALSE;
-
- if (!ed->file->spectrum_dir)
- {
- ed->file->spectrum_dir = _alloc(sizeof(Edje_Spectrum_Directory));
- if (!ed->file->spectrum_dir) return EINA_FALSE;
- }
-
- s = _alloc(sizeof(Edje_Spectrum_Directory_Entry));
- if (!s) return EINA_FALSE;
- ed->file->spectrum_dir->entries = eina_list_append(ed->file->spectrum_dir->entries, s);
- s->id = eina_list_count(ed->file->spectrum_dir->entries) - 1; //TODO Search for id holes
- s->entry = (char*)eina_stringshare_add(name);
- s->filename = NULL;
- s->color_list = NULL;
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-edje_edit_spectra_del(Evas_Object *obj, const char* spectra)
-{
- Edje_Spectrum_Directory_Entry *s;
- GET_ED_OR_RETURN(EINA_FALSE);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
-
- //printf("SPECTRA DEL %s\n", spectra);
-
- ed->file->spectrum_dir->entries = eina_list_remove(ed->file->spectrum_dir->entries, s);
- _edje_if_string_free(ed, s->entry);
- _edje_if_string_free(ed, s->filename);
- while (s->color_list)
- {
- Edje_Spectrum_Color *color;
- color = eina_list_data_get(s->color_list);
- free(color);
- s->color_list = eina_list_remove_list(s->color_list, s->color_list);
- }
- free(s);
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-edje_edit_spectra_name_set(Evas_Object *obj, const char* spectra, const char* name)
-{
- Edje_Spectrum_Directory_Entry *s;
-
- GET_ED_OR_RETURN(EINA_FALSE);
-
- //printf("SET SPECTRA NAME for spectra: %s [new name:%s]\n", spectra, name);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
-
- _edje_if_string_free(ed, s->entry);
- s->entry = (char*)eina_stringshare_add(name);
-
- return EINA_TRUE;
-}
-
-EAPI int
-edje_edit_spectra_stop_num_get(Evas_Object *obj, const char* spectra)
-{
- Edje_Spectrum_Directory_Entry *s;
-
- GET_ED_OR_RETURN(EINA_FALSE);
-
- //printf("GET SPECTRA STOP NUM for spectra: %s\n", spectra);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
-
- return eina_list_count(s->color_list);
-}
-
-EAPI Eina_Bool
-edje_edit_spectra_stop_num_set(Evas_Object *obj, const char* spectra, int num)
-{
- Edje_Spectrum_Directory_Entry *s;
- Edje_Spectrum_Color *color;
- GET_ED_OR_RETURN(EINA_FALSE);
-
- //printf("SET SPECTRA STOP NUM for spectra: %s\n", spectra);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
-
- if (num == eina_list_count(s->color_list)) return EINA_TRUE;
-
- //destroy all colors
- while (s->color_list)
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
{
- color = eina_list_data_get(s->color_list);
- free(color);
- s->color_list = eina_list_remove_list(s->color_list, s->color_list);
+ if (l) *l = 0;
+ if (r) *r = 0;
+ if (t) *t = 0;
+ if (b) *b = 0;
+ return;
}
- //... and recreate (TODO we should optimize this function)
- while (num)
- {
- color = _alloc(sizeof(Edje_Spectrum_Color));
- if (!color) return EINA_FALSE;
- s->color_list = eina_list_append(s->color_list, color);
- color->r = 255;
- color->g = 255;
- color->b = 255;
- color->a = 255;
- color->d = 10;
- num--;
- }
+ img = (Edje_Part_Description_Image *) pd;
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-edje_edit_spectra_stop_color_get(Evas_Object *obj, const char* spectra, int stop_number, int *r, int *g, int *b, int *a, int *d)
-{
- Edje_Spectrum_Directory_Entry *s;
- Edje_Spectrum_Color *color;
- GET_ED_OR_RETURN(EINA_FALSE);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
- //printf("GET SPECTRA STOP COLOR for spectra: %s stopn: %d\n", spectra, stop_number);
-
- color = eina_list_nth(s->color_list, stop_number);
- if (!color) return EINA_FALSE;
- if (r) *r = color->r;
- if (g) *g = color->g;
- if (b) *b = color->b;
- if (a) *a = color->a;
- if (d) *d = color->d;
-
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-edje_edit_spectra_stop_color_set(Evas_Object *obj, const char* spectra, int stop_number, int r, int g, int b, int a, int d)
-{
- Edje_Spectrum_Directory_Entry *s;
- Edje_Spectrum_Color *color;
- GET_ED_OR_RETURN(EINA_FALSE);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
- //printf("SET SPECTRA STOP COLOR for spectra: %s stopn: %d\n", spectra, stop_number);
-
- color = eina_list_nth(s->color_list, stop_number);
- if (!color) return EINA_FALSE;
- color->r = r;
- color->g = g;
- color->b = b;
- color->a = a;
- color->d = d;
-
- edje_object_calc_force(obj);
-
- return EINA_TRUE;
-}
-
-
-/******************/
-/* GRADIENT API */
-/******************/
-
-EAPI const char *
-edje_edit_state_gradient_type_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(NULL);
-
- if (!pd->gradient.type)
- return NULL;
-
-// printf("GET GRADIENT TYPE for part: %s state: %s [%s]\n", part, state, pd->gradient.type);
-
- return eina_stringshare_add(pd->gradient.type);
-}
-
-EAPI Eina_Bool
-edje_edit_state_gradient_type_set(Evas_Object *obj, const char *part, const char *state, double value, const char *type)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- if (!type) return EINA_FALSE;
-
-// printf("SET GRADIENT TYPE for part: %s state: %s TO: %s\n", part, state, type);
-
- _edje_if_string_free(ed, pd->gradient.type);
- pd->gradient.type = (char *)eina_stringshare_add(type);
- edje_object_calc_force(obj);
- return EINA_TRUE;
-}
-
-
-EAPI Eina_Bool
-edje_edit_state_gradient_use_fill_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
-
- if (!pd->gradient.type)
- return EINA_FALSE;
-
- //~ if (!strcmp(pd->gradient.type, "linear"))
- //~ return 0;
- return EINA_TRUE;
-}
-
-EAPI const char *
-edje_edit_state_gradient_spectra_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- Edje_Spectrum_Directory_Entry *s;
-
- GET_PD_OR_RETURN(0);
-
- //printf("GET GRADIENT SPECTRA for part: %s state: %s\n", part, state);
- s = _edje_edit_spectrum_entry_get_by_id(ed, pd->gradient.id);
- if (!s) return 0;
-
- return eina_stringshare_add(s->entry);
-}
-
-EAPI Eina_Bool
-edje_edit_state_gradient_spectra_set(Evas_Object *obj, const char *part, const char *state, double value, const char* spectra)
-{
- Edje_Spectrum_Directory_Entry *s;
-
- GET_PD_OR_RETURN(EINA_FALSE);
-
- //printf("SET GRADIENT SPECTRA for part: %s state: %s [%s]\n", part, state, spectra);
-
- s = _edje_edit_spectrum_entry_get(ed, spectra);
- if (!s) return EINA_FALSE;
-
- pd->gradient.id = s->id;
- edje_object_calc_force(obj);
+ //printf("GET IMAGE_BORDER of state '%s'\n", state);
- return EINA_TRUE;
-}
-
-EAPI int
-edje_edit_state_gradient_angle_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- return pd->fill.angle;
+ if (l) *l = img->image.border.l;
+ if (r) *r = img->image.border.r;
+ if (t) *t = img->image.border.t;
+ if (b) *b = img->image.border.b;
}
EAPI void
-edje_edit_state_gradient_angle_set(Evas_Object *obj, const char *part, const char *state, double value, int angle)
-{
- GET_PD_OR_RETURN();
- pd->fill.angle = angle;
- edje_object_calc_force(obj);
-}
-
-EAPI double
-edje_edit_state_gradient_rel1_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL1 RELX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.relative_x);
-
- return TO_DOUBLE(pd->gradient.rel1.relative_x);
-}
-
-EAPI double
-edje_edit_state_gradient_rel1_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL1 RELY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.relative_y);
-
- return TO_DOUBLE(pd->gradient.rel1.relative_y);
-}
-
-EAPI double
-edje_edit_state_gradient_rel2_relative_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL2 RELX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.relative_x);
-
- return TO_DOUBLE(pd->gradient.rel2.relative_x);
-}
-
-EAPI double
-edje_edit_state_gradient_rel2_relative_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL2 RELY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.relative_y);
-
- return TO_DOUBLE(pd->gradient.rel2.relative_y);
-}
-
-EAPI Eina_Bool
-edje_edit_state_gradient_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double val)
+edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, double value, int l, int r, int t, int b)
{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL1 RELX for part: %s state: %s [TO %f]\n", part, state, val);
-
- pd->gradient.rel1.relative_x = FROM_DOUBLE(val);
- edje_object_calc_force(obj);
- return EINA_TRUE;
-}
+ Edje_Part_Description_Image *img;
-EAPI Eina_Bool
-edje_edit_state_gradient_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double val)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL1 RELY for part: %s state: %s [TO %f]\n", part, state, val);
+ GET_PD_OR_RETURN();
- pd->gradient.rel1.relative_y = FROM_DOUBLE(val);
- edje_object_calc_force(obj);
- return EINA_TRUE;
-}
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return;
-EAPI Eina_Bool
-edje_edit_state_gradient_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double val)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL2 RELX for part: %s state: %s [TO %f]\n", part, state, val);
+ img = (Edje_Part_Description_Image *) pd;
- pd->gradient.rel2.relative_x = FROM_DOUBLE(val);
- edje_object_calc_force(obj);
- return EINA_TRUE;
-}
+ //printf("SET IMAGE_BORDER of state '%s'\n", state);
-EAPI Eina_Bool
-edje_edit_state_gradient_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double val)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL2 RELY for part: %s state: %s [TO %f]\n", part, state, val);
+ if (l > -1) img->image.border.l = l;
+ if (r > -1) img->image.border.r = r;
+ if (t > -1) img->image.border.t = t;
+ if (b > -1) img->image.border.b = b;
- pd->gradient.rel2.relative_y = FROM_DOUBLE(val);
edje_object_calc_force(obj);
- return EINA_TRUE;
}
-EAPI int
-edje_edit_state_gradient_rel1_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL1 OFFSETX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.offset_x);
- return pd->gradient.rel1.offset_x;
-}
-
-EAPI int
-edje_edit_state_gradient_rel1_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value)
+EAPI unsigned char
+edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value)
{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL1 OFFSETY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel1.offset_y);
- return pd->gradient.rel1.offset_y;
-}
+ Edje_Part_Description_Image *img;
-EAPI int
-edje_edit_state_gradient_rel2_offset_x_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL2 OFFSETX for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.offset_x);
- return pd->gradient.rel2.offset_x;
-}
-EAPI int
-edje_edit_state_gradient_rel2_offset_y_get(Evas_Object *obj, const char *part, const char *state, double value)
-{
- GET_PD_OR_RETURN(0);
- //printf("GET GRADIENT REL2 OFFSETY for part: %s state: %s [%f]\n", part, state, pd->gradient.rel2.offset_y);
- return pd->gradient.rel2.offset_y;
-}
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return 0;
-EAPI Eina_Bool
-edje_edit_state_gradient_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, int val)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL1 OFFSETX for part: %s state: %s [TO %d]\n", part, state, val);
+ img = (Edje_Part_Description_Image *) pd;
- pd->gradient.rel1.offset_x = val;
- edje_object_calc_force(obj);
- return EINA_TRUE;
+ if (img->image.border.no_fill == 0) return 1;
+ else if (img->image.border.no_fill == 1) return 0;
+ else if (img->image.border.no_fill == 2) return 2;
+ return 0;
}
-EAPI Eina_Bool
-edje_edit_state_gradient_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, int val)
+EAPI void
+edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill)
{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL1 OFFSETY for part: %s state: %s [TO %d]\n", part, state, val);
+ Edje_Part_Description_Image *img;
- pd->gradient.rel1.offset_y = val;
- edje_object_calc_force(obj);
- return EINA_TRUE;
-}
+ GET_PD_OR_RETURN();
-EAPI Eina_Bool
-edje_edit_state_gradient_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, int val)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL2 OFFSETX for part: %s state: %s [TO %d]\n", part, state, val);
+ if (rp->part->type != EDJE_PART_TYPE_IMAGE)
+ return;
- pd->gradient.rel2.offset_x = val;
- edje_object_calc_force(obj);
- return EINA_TRUE;
-}
+ img = (Edje_Part_Description_Image *) pd;
-EAPI Eina_Bool
-edje_edit_state_gradient_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, int val)
-{
- GET_PD_OR_RETURN(EINA_FALSE);
- //printf("SET GRADIENT REL2 OFFSETY for part: %s state: %s [TO %d]\n", part, state, val);
+ if (fill == 0) img->image.border.no_fill = 1;
+ else if (fill == 1) img->image.border.no_fill = 0;
+ else if (fill == 2) img->image.border.no_fill = 2;
- pd->gradient.rel2.offset_y = val;
edje_object_calc_force(obj);
- return EINA_TRUE;
}
/******************/
/* PROGRAMS API */
/******************/
-Edje_Program *
+static Edje_Program *
_edje_program_get_byname(Evas_Object *obj, const char *prog_name)
{
Edje_Program *epr;
@@ -5384,10 +4668,14 @@ edje_edit_program_add(Evas_Object *obj, const char *name)
//Add program to group
pc = ed->collection;
- pc->programs = eina_list_append(pc->programs, epr);
+
+ /* By default, source and signal are empty, so they fill in nocmp category */
+ ed->collection->programs.nocmp = realloc(ed->collection->programs.nocmp,
+ sizeof (Edje_Program*) * (ed->collection->programs.nocmp_count + 1));
+ ed->collection->programs.nocmp[ed->collection->programs.nocmp_count++] = epr;
//Init Edje_Program
- epr->id = eina_list_count(pc->programs) - 1;
+ epr->id = ed->table_programs_size;
epr->name = eina_stringshare_add(name);
epr->signal = NULL;
epr->source = NULL;
@@ -5422,7 +4710,9 @@ edje_edit_program_add(Evas_Object *obj, const char *name)
EAPI Eina_Bool
edje_edit_program_del(Evas_Object *obj, const char *prog)
{
- Eina_List *l, *l_next, *rem;
+ Eina_List *l, *l_next;
+ Edje_Program_Target *prt;
+ Edje_Program_After *pa;
Edje_Part_Collection *pc;
Edje_Program *p;
int id, i;
@@ -5433,25 +4723,20 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
pc = ed->collection;
- rem = eina_list_nth_list(pc->programs, epr->id);
- l = eina_list_last(pc->programs);
- if (rem != l)
+ //Remove program from programs list
+ id = epr->id;
+ _edje_program_remove(ed->collection, epr);
+
+ /* fix table program */
+ if (epr->id != ed->table_programs_size - 1)
{
/* If the removed program is not the last in the list/table,
* put the last one in its place and update references to it later */
- p = eina_list_data_get(l);
- pc->programs = eina_list_remove_list(pc->programs, l);
- pc->programs = eina_list_append_relative_list(pc->programs, p, rem);
-
- ed->table_programs[epr->id] = p;
- old_id = p->id;
- p->id = epr->id;
+ ed->table_programs[epr->id] = ed->table_programs[ed->table_programs_size - 1];
+ old_id = ed->table_programs_size - 1;
+ ed->table_programs[epr->id]->id = epr->id;
}
- //Remove program from programs list
- id = epr->id;
- pc->programs = eina_list_remove(pc->programs, epr);
-
//Free Edje_Program
_edje_if_string_free(ed, epr->name);
_edje_if_string_free(ed, epr->signal);
@@ -5461,22 +4746,10 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
_edje_if_string_free(ed, epr->state);
_edje_if_string_free(ed, epr->state2);
- while (epr->targets)
- {
- Edje_Program_Target *prt;
-
- prt = eina_list_data_get(epr->targets);
- epr->targets = eina_list_remove_list(epr->targets, epr->targets);
- free(prt);
- }
- while (epr->after)
- {
- Edje_Program_After *pa;
-
- pa = eina_list_data_get(epr->after);
- epr->after = eina_list_remove_list(epr->after, epr->after);
- free(pa);
- }
+ EINA_LIST_FREE(epr->targets, prt)
+ free(prt);
+ EINA_LIST_FREE(epr->after, pa)
+ free(pa);
free(epr);
ed->table_programs_size--;
@@ -5570,15 +4843,17 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou
if (!source) return EINA_FALSE;
- //printf("SET SOURCE for program: %s [%s]\n", prog, source);
-
+ /* Remove from program array */
+ _edje_program_remove(ed->collection, epr);
_edje_if_string_free(ed, epr->source);
+
+ /* Insert it back */
epr->source = eina_stringshare_add(source);
+ _edje_program_insert(ed->collection, epr);
//Update patterns
- if (ed->patterns.programs.sources_patterns)
- edje_match_patterns_free(ed->patterns.programs.sources_patterns);
- ed->patterns.programs.sources_patterns = edje_match_programs_source_init(ed->collection->programs);
+ _edje_programs_patterns_clean(ed);
+ _edje_programs_patterns_init(ed);
return EINA_TRUE;
}
@@ -5647,15 +4922,17 @@ edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *sig
if (!signal) return EINA_FALSE;
- //printf("SET SIGNAL for program: %s [%s]\n", prog, signal);
-
+ /* Remove from program array */
+ _edje_program_remove(ed->collection, epr);
_edje_if_string_free(ed, epr->signal);
+
+ /* Insert it back */
epr->signal = eina_stringshare_add(signal);
+ _edje_program_insert(ed->collection, epr);
//Update patterns
- if (ed->patterns.programs.signals_patterns)
- edje_match_patterns_free(ed->patterns.programs.signals_patterns);
- ed->patterns.programs.signals_patterns = edje_match_programs_signal_init(ed->collection->programs);
+ _edje_programs_patterns_clean(ed);
+ _edje_programs_patterns_init(ed);
return EINA_TRUE;
}
@@ -6059,6 +5336,46 @@ edje_edit_program_after_del(Evas_Object *obj, const char *prog, const char *afte
return EINA_TRUE;
}
+EAPI const char *
+edje_edit_program_api_name_get(Evas_Object *obj, const char *prog)
+{
+ GET_EPR_OR_RETURN(NULL);
+
+ return eina_stringshare_add(epr->api.name);
+}
+
+EAPI const char *
+edje_edit_program_api_description_get(Evas_Object *obj, const char *prog)
+{
+ GET_EPR_OR_RETURN(NULL);
+
+ return eina_stringshare_add(epr->api.description);
+}
+
+EAPI Eina_Bool
+edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char* name)
+{
+ GET_ED_OR_RETURN(EINA_FALSE);
+ GET_EPR_OR_RETURN(EINA_FALSE);
+
+ _edje_if_string_free(ed, epr->api.name);
+ epr->api.name = eina_stringshare_add(name);
+
+ return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_program_api_description_set(Evas_Object *obj, const char *prog, const char *description)
+{
+ GET_ED_OR_RETURN(EINA_FALSE);
+ GET_EPR_OR_RETURN(EINA_FALSE);
+
+ _edje_if_string_free(ed, epr->api.description);
+ epr->api.description = eina_stringshare_add(description);
+
+ return EINA_TRUE;
+}
+
/*************************/
/* EMBRYO SCRIPTS API */
/*************************/
@@ -6098,32 +5415,9 @@ edje_edit_script_get(Evas_Object *obj)
#define BUF_APPENDF(FMT, ...) \
ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__)
-static char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL"};
-static char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"};
-static char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"};
-static Eina_Bool
-_edje_generate_source_of_spectra(Edje * ed, const char *name, Eina_Strbuf *buf)
-{
- Edje_Spectrum_Directory_Entry *d;
- Edje_Spectrum_Color *color = NULL;
- Eina_List *l;
- Eina_Bool ret = EINA_TRUE;
-
- if (!ed || !name || !buf) return EINA_FALSE;
-
- if ((d = _edje_edit_spectrum_entry_get(ed, name)))
- {
- BUF_APPENDF(I1 "spectrum { name: \"%s\";\n", d->entry);
-
- EINA_LIST_FOREACH(d->color_list, l, color)
- if (color)
- BUF_APPENDF(I2 "color: %d %d %d %d %d;\n", color->r, color->g,
- color->b, color->a, color->d);
-
- BUF_APPEND(I1 "}\n");
- }
- return ret;
-}
+static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL"};
+static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"};
+static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"};
static Eina_Bool
_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf)
@@ -6178,6 +5472,7 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str
double db, db2;
char *data;
Eina_Bool ret = EINA_TRUE;
+ const char *api_name, *api_description;
GET_ED_OR_RETURN(EINA_FALSE);
@@ -6240,7 +5535,8 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str
switch (edje_edit_program_transition_get(obj, program))
{
case EDJE_TWEEN_MODE_LINEAR:
- BUF_APPENDF(I4"transition: LINEAR %.5f;\n", db);
+ if (db)
+ BUF_APPENDF(I4"transition: LINEAR %.5f;\n", db);
break;
case EDJE_TWEEN_MODE_ACCELERATE:
BUF_APPENDF(I4"transition: ACCELERATE %.5f;\n", db);
@@ -6278,6 +5574,30 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str
}
// TODO Support script {}
+ /* api */
+ api_name = edje_edit_program_api_name_get(obj, program);
+ api_description = edje_edit_program_api_description_get(obj, program);
+
+ if (api_name || api_description)
+ {
+ if (api_name && api_description)
+ {
+ BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description);
+ edje_edit_string_free(api_name);
+ edje_edit_string_free(api_description);
+ }
+ else
+ if (api_name)
+ {
+ BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name);
+ edje_edit_string_free(api_name);
+ }
+ else
+ {
+ BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description);
+ edje_edit_string_free(api_description);
+ }
+ }
BUF_APPEND(I3 "}\n");
return ret;
@@ -6287,15 +5607,10 @@ static Eina_Bool
_edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *state, double value, Eina_Strbuf *buf)
{
Eina_List *l, *ll;
- Edje_Real_Part *rp;
- const char *str;
Eina_Bool ret = EINA_TRUE;
GET_PD_OR_RETURN(EINA_FALSE);
- rp = _edje_real_part_get(ed, part);
- if (!rp) return EINA_FALSE;
-
BUF_APPENDF(I4"description { state: \"%s\" %g;\n", pd->state.name, pd->state.value);
//TODO Support inherit
@@ -6320,20 +5635,29 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
BUF_APPENDF(I5"aspect_preference: %s;\n", prefers[pd->aspect.prefer]);
if (pd->color_class)
- BUF_APPENDF(I5"color_class: \"%s\";\n", pd->color_class);
+ BUF_APPENDF(I5"color_class: \"%s\";\n", pd->color_class);
if (pd->color.r != 255 || pd->color.g != 255 ||
- pd->color.b != 255 || pd->color.a != 255)
- BUF_APPENDF(I5"color: %d %d %d %d;\n",
- pd->color.r, pd->color.g, pd->color.b, pd->color.a);
+ pd->color.b != 255 || pd->color.a != 255)
+ BUF_APPENDF(I5"color: %d %d %d %d;\n",
+ pd->color.r, pd->color.g, pd->color.b, pd->color.a);
if (pd->color2.r != 0 || pd->color2.g != 0 ||
- pd->color2.b != 0 || pd->color2.a != 255)
- BUF_APPENDF(I5"color2: %d %d %d %d;\n",
- pd->color2.r, pd->color2.g, pd->color2.b, pd->color2.a);
- if (pd->color3.r != 0 || pd->color3.g != 0 ||
- pd->color3.b != 0 || pd->color3.a != 128)
- BUF_APPENDF(I5"color3: %d %d %d %d;\n",
- pd->color3.r, pd->color3.g, pd->color3.b, pd->color3.a);
+ pd->color2.b != 0 || pd->color2.a != 255)
+ BUF_APPENDF(I5"color2: %d %d %d %d;\n",
+ pd->color2.r, pd->color2.g, pd->color2.b, pd->color2.a);
+
+ if (rp->part->type == EDJE_PART_TYPE_TEXT
+ || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ Edje_Part_Description_Text *txt;
+
+ txt = (Edje_Part_Description_Text *) pd;
+
+ if (txt->text.color3.r != 0 || txt->text.color3.g != 0 ||
+ txt->text.color3.b != 0 || txt->text.color3.a != 128)
+ BUF_APPENDF(I5"color3: %d %d %d %d;\n",
+ txt->text.color3.r, txt->text.color3.g, txt->text.color3.b, txt->text.color3.a);
+ }
//Rel1
if (pd->rel1.relative_x || pd->rel1.relative_y || pd->rel1.offset_x ||
@@ -6381,59 +5705,61 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
//Image
if (rp->part->type == EDJE_PART_TYPE_IMAGE)
{
- char *data;
+ char *data;
+ const char *image_name;
+
+ Edje_Part_Description_Image *img;
+
+ img = (Edje_Part_Description_Image *) pd;
BUF_APPEND(I5"image {\n");
- BUF_APPENDF(I6"normal: \"%s\";\n", _edje_image_name_find(obj, pd->image.id));
+
+ image_name = _edje_image_name_find(obj, img->image.id);
+ if (image_name)
+ BUF_APPENDF(I6"normal: \"%s\";\n", image_name);
ll = edje_edit_state_tweens_list_get(obj, part, state, value);
EINA_LIST_FOREACH(ll, l, data)
BUF_APPENDF(I6"tween: \"%s\";\n", data);
edje_edit_string_list_free(ll);
- if (pd->border.l || pd->border.r || pd->border.t || pd->border.b)
- BUF_APPENDF(I6"border: %d %d %d %d;\n", pd->border.l, pd->border.r, pd->border.t, pd->border.b);
- if (pd->border.no_fill == 1)
+ if (img->image.border.l || img->image.border.r || img->image.border.t || img->image.border.b)
+ BUF_APPENDF(I6"border: %d %d %d %d;\n", img->image.border.l, img->image.border.r, img->image.border.t, img->image.border.b);
+ if (img->image.border.no_fill == 1)
BUF_APPEND(I6"middle: NONE;\n");
- else if (pd->border.no_fill == 0)
+ else if (img->image.border.no_fill == 0)
BUF_APPEND(I6"middle: DEFAULT;\n");
- else if (pd->border.no_fill == 2)
+ else if (img->image.border.no_fill == 2)
BUF_APPEND(I6"middle: SOLID;\n");
BUF_APPEND(I5"}\n");//image
- }
- //Fill
- if (rp->part->type == EDJE_PART_TYPE_IMAGE ||
- rp->part->type == EDJE_PART_TYPE_GRADIENT)
- {
+ //Fill
+
BUF_APPEND(I5"fill {\n");
- if (rp->part->type == EDJE_PART_TYPE_IMAGE && !pd->fill.smooth)
+ if (rp->part->type == EDJE_PART_TYPE_IMAGE && !img->image.fill.smooth)
BUF_APPEND(I6"smooth: 0;\n");
//TODO Support spread
- if (rp->part->type == EDJE_PART_TYPE_GRADIENT && pd->fill.angle)
- BUF_APPENDF(I6"angle: %d;\n", pd->fill.angle);
- //TODO Support type
- if (pd->fill.pos_rel_x || pd->fill.pos_rel_y ||
- pd->fill.pos_abs_x || pd->fill.pos_abs_y)
+ if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y ||
+ img->image.fill.pos_abs_x || img->image.fill.pos_abs_y)
{
BUF_APPEND(I6"origin {\n");
- if (pd->fill.pos_rel_x || pd->fill.pos_rel_y)
- BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(pd->fill.pos_rel_x), TO_DOUBLE(pd->fill.pos_rel_y));
- if (pd->fill.pos_abs_x || pd->fill.pos_abs_y)
- BUF_APPENDF(I7"offset: %d %d;\n", pd->fill.pos_abs_x, pd->fill.pos_abs_y);
+ if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y)
+ BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.pos_rel_x), TO_DOUBLE(img->image.fill.pos_rel_y));
+ if (img->image.fill.pos_abs_x || img->image.fill.pos_abs_y)
+ BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.pos_abs_x, img->image.fill.pos_abs_y);
BUF_APPEND(I6"}\n");
}
- if (TO_DOUBLE(pd->fill.rel_x) != 1.0 || TO_DOUBLE(pd->fill.rel_y) != 1.0 ||
- pd->fill.abs_x || pd->fill.abs_y)
+ if (TO_DOUBLE(img->image.fill.rel_x) != 1.0 || TO_DOUBLE(img->image.fill.rel_y) != 1.0 ||
+ img->image.fill.abs_x || img->image.fill.abs_y)
{
BUF_APPEND(I6"size {\n");
- if (pd->fill.rel_x != 1.0 || pd->fill.rel_y != 1.0)
- BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(pd->fill.rel_x), TO_DOUBLE(pd->fill.rel_y));
- if (pd->fill.abs_x || pd->fill.abs_y)
- BUF_APPENDF(I7"offset: %d %d;\n", pd->fill.abs_x, pd->fill.abs_y);
+ if (img->image.fill.rel_x != 1.0 || img->image.fill.rel_y != 1.0)
+ BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.rel_x), TO_DOUBLE(img->image.fill.rel_y));
+ if (img->image.fill.abs_x || img->image.fill.abs_y)
+ BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y);
BUF_APPEND(I6"}\n");
}
@@ -6443,37 +5769,38 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
//Text
if (rp->part->type == EDJE_PART_TYPE_TEXT)
{
+ Edje_Part_Description_Text *txt;
+
+ txt = (Edje_Part_Description_Text *) pd;
+
BUF_APPEND(I5"text {\n");
- if (pd->text.text)
- BUF_APPENDF(I6"text: \"%s\";\n", pd->text.text);
- BUF_APPENDF(I6"font: \"%s\";\n", pd->text.font);
- BUF_APPENDF(I6"size: %d;\n", pd->text.size);
- if (pd->text.text_class)
- BUF_APPENDF(I6"text_class: \"%s\";\n", pd->text.text_class);
- if (pd->text.fit_x || pd->text.fit_y)
- BUF_APPENDF(I6"fit: %d %d;\n", pd->text.fit_x, pd->text.fit_y);
+ if (edje_string_get(&txt->text.text))
+ {
+ if (txt->text.text.id)
+ BUF_APPENDF(I6"text: _(\"%s\");\n", edje_string_id_get(&txt->text.text));
+ else
+ BUF_APPENDF(I6"text: \"%s\";\n", edje_string_get(&txt->text.text));
+ }
+ if (edje_string_get(&txt->text.font))
+ {
+ if (txt->text.font.id)
+ BUF_APPENDF(I6"font: _(\"%s\");\n", edje_string_id_get(&txt->text.font));
+ else
+ BUF_APPENDF(I6"font: \"%s\";\n", edje_string_get(&txt->text.font));
+ }
+ if (txt->text.size)
+ BUF_APPENDF(I6"size: %d;\n", txt->text.size);
+ if (txt->text.text_class)
+ BUF_APPENDF(I6"text_class: \"%s\";\n", txt->text.text_class);
+ if (txt->text.fit_x || txt->text.fit_y)
+ BUF_APPENDF(I6"fit: %d %d;\n", txt->text.fit_x, txt->text.fit_y);
//TODO Support min & max
- if (TO_DOUBLE(pd->text.align.x) != 0.5 || TO_DOUBLE(pd->text.align.y) != 0.5)
- BUF_APPENDF(I6"align: %g %g;\n", TO_DOUBLE(pd->text.align.x), TO_DOUBLE(pd->text.align.y));
+ if (TO_DOUBLE(txt->text.align.x) != 0.5 || TO_DOUBLE(txt->text.align.y) != 0.5)
+ BUF_APPENDF(I6"align: %g %g;\n", TO_DOUBLE(txt->text.align.x), TO_DOUBLE(txt->text.align.y));
//TODO Support source
//TODO Support text_source
- if (pd->text.elipsis)
- BUF_APPENDF(I6"elipsis: %g;\n", pd->text.elipsis);
- BUF_APPEND(I5"}\n");
- }
-
- //Gradient
- if (rp->part->type == EDJE_PART_TYPE_GRADIENT)
- {
- BUF_APPEND(I5"gradient {\n");
- BUF_APPENDF(I6"type: \"%s\";\n", pd->gradient.type);
- str = edje_edit_state_gradient_spectra_get(obj, part, state, value);
- if (str)
- {
- BUF_APPENDF(I6"spectrum: \"%s\";\n", str);
- edje_edit_string_free(str);
- }
- //TODO rel1 and 2 seems unused
+ if (txt->text.elipsis)
+ BUF_APPENDF(I6"elipsis: %g;\n", txt->text.elipsis);
BUF_APPEND(I5"}\n");
}
@@ -6521,12 +5848,14 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
}
static Eina_Bool
-_edje_generate_source_of_part(Evas_Object *obj, const char *part, Eina_Strbuf *buf)
+_edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
{
+ const char *part = ep->name;
const char *str;
Eina_List *l, *ll;
char *data;
Eina_Bool ret = EINA_TRUE;
+ const char *api_name, *api_description;
BUF_APPENDF(I3"part { name: \"%s\";\n", part);
BUF_APPENDF(I4"type: %s;\n", types[edje_edit_part_type_get(obj, part)]);
@@ -6534,8 +5863,9 @@ _edje_generate_source_of_part(Evas_Object *obj, const char *part, Eina_Strbuf *b
BUF_APPEND(I4"mouse_events: 0;\n");
if (edje_edit_part_repeat_events_get(obj, part))
BUF_APPEND(I4"repeat_events: 1;\n");
+ if (edje_edit_part_scale_get(obj, part))
+ BUF_APPEND(I4"scale: 1;\n");
//TODO Support ignore_flags
- //TODO Support scale
//TODO Support pointer_mode
//TODO Support precise_is_inside
//TODO Support use_alternate_font_metrics
@@ -6594,17 +5924,43 @@ _edje_generate_source_of_part(Evas_Object *obj, const char *part, Eina_Strbuf *b
}
edje_edit_string_list_free(ll);
+ api_name = edje_edit_part_api_name_get(obj, part);
+ api_description = edje_edit_part_api_description_get(obj, part);
+
+ if (api_name || api_description)
+ {
+ if (api_name && api_description)
+ {
+ BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description);
+ edje_edit_string_free(api_name);
+ edje_edit_string_free(api_description);
+ }
+ else
+ if (api_name)
+ {
+ BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name);
+ edje_edit_string_free(api_name);
+ }
+ else
+ {
+ BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description);
+ edje_edit_string_free(api_description);
+ }
+ }
+
BUF_APPEND(I3"}\n");//part
return ret;
}
static Eina_Bool
-_edje_generate_source_of_group(Edje *ed, const char *group, Eina_Strbuf *buf)
+_edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf)
{
Evas_Object *obj;
Eina_List *l, *ll;
+ unsigned int i;
int w, h;
char *data;
+ const char *group = pce->entry;
Eina_Bool ret = EINA_TRUE;
obj = edje_edit_object_add(ed->evas);
@@ -6618,38 +5974,42 @@ _edje_generate_source_of_group(Edje *ed, const char *group, Eina_Strbuf *buf)
BUF_APPENDF(I2"min: %d %d;\n", w, h);
w = edje_edit_group_max_w_get(obj);
h = edje_edit_group_max_h_get(obj);
- if ((w > -1) || (h > -1))
+ if ((w > 0) || (h > 0))
BUF_APPENDF(I2"max: %d %d;\n", w, h);
/* Data */
- if ((ll = edje_edit_group_data_list_get(obj)))
+ if (pce->ref->data)
{
- BUF_APPEND(I2"data {\n");
+ Eina_Iterator *it;
+ Eina_Hash_Tuple *tuple;
+ BUF_APPEND(I2"data {\n");
- EINA_LIST_FOREACH(ll, l, data)
- {
- BUF_APPENDF(I3"item: \"%s\" \"%s\";\n", data,
- edje_edit_group_data_value_get(obj, data));
- }
+ it = eina_hash_iterator_tuple_new(pce->ref->data);
- BUF_APPEND(I2"}\n\n");
- edje_edit_string_list_free(ll);
- }
+ if (!it)
+ {
+ ERR("Generating EDC for Group[%s] data.", group);
+ return EINA_FALSE;
+ }
- if (!ret)
- {
- ERR("Generating EDC for Group[%s] data.", group);
- return EINA_FALSE;
+ EINA_ITERATOR_FOREACH(it, tuple)
+ BUF_APPENDF(I3"item: \"%s\" \"%s\";\n", (char *)tuple->key,
+ edje_string_get(tuple->data));
+
+ eina_iterator_free(it);
+ BUF_APPEND(I2"}\n");
}
//TODO Support script
/* Parts */
BUF_APPEND(I2"parts {\n");
- ll = edje_edit_parts_list_get(obj);
- EINA_LIST_FOREACH(ll, l, data)
- ret &= _edje_generate_source_of_part(obj, data, buf);
- edje_edit_string_list_free(ll);
+ for (i = 0; i < pce->ref->parts_count; i++)
+ {
+ Edje_Part *ep;
+ ep = pce->ref->parts[i];
+ ret &= _edje_generate_source_of_part(obj, ep, buf);
+ }
BUF_APPEND(I2"}\n");//parts
if (!ret)
@@ -6663,7 +6023,7 @@ _edje_generate_source_of_group(Edje *ed, const char *group, Eina_Strbuf *buf)
{
BUF_APPEND(I2 "programs {\n");
EINA_LIST_FOREACH(ll, l, data)
- _edje_generate_source_of_program(obj, data, buf);
+ ret &= _edje_generate_source_of_program(obj, data, buf);
BUF_APPEND(I2 "}\n");
edje_edit_string_list_free(ll);
}
@@ -6792,25 +6152,6 @@ _edje_generate_source(Evas_Object *obj)
}
}
- /* Spectrum */
- if ((ll = edje_edit_spectrum_list_get(obj)))
- {
- BUF_APPEND(I0 "spectra {\n");
-
- EINA_LIST_FOREACH(ll, l, entry)
- _edje_generate_source_of_spectra(ed, entry, buf);
-
- BUF_APPEND(I0 "}\n\n");
- edje_edit_string_list_free(ll);
-
- if (!ret)
- {
- ERR("Generating EDC for Spectrum");
- eina_strbuf_free(buf);
- return NULL;
- }
- }
-
/* Styles */
if ((ll = edje_edit_styles_list_get(obj)))
{
@@ -6831,34 +6172,44 @@ _edje_generate_source(Evas_Object *obj)
/* Externals */
if ((ll = edje_edit_externals_list_get(obj)))
{
- BUF_APPEND(I0 "externals {\n");
- EINA_LIST_FOREACH(ll, l, entry)
- BUF_APPENDF(I1 "external: \"%s\";\n", entry);
+ BUF_APPEND(I0 "externals {\n");
+ EINA_LIST_FOREACH(ll, l, entry)
+ BUF_APPENDF(I1 "external: \"%s\";\n", entry);
- BUF_APPEND(I0 "}\n\n");
- edje_edit_string_list_free(ll);
+ BUF_APPEND(I0 "}\n\n");
+ edje_edit_string_list_free(ll);
- if (!ret)
- {
- ERR("Generating EDC for Externals");
- eina_strbuf_free(buf);
- return NULL;
- }
+ if (!ret)
+ {
+ ERR("Generating EDC for Externals");
+ eina_strbuf_free(buf);
+ return NULL;
+ }
}
/* Collections */
- BUF_APPEND("collections {\n");
- ll = edje_file_collection_list(ed->file->path);
- EINA_LIST_FOREACH(ll, l, entry)
- ret &= _edje_generate_source_of_group(ed, entry, buf);
- BUF_APPEND("}\n\n");
- edje_file_collection_list_free(ll);
-
- if (!ret)
+ if (ed->file->collection)
{
- ERR("Generating EDC for Collections");
- eina_strbuf_free(buf);
- return NULL;
+ Eina_Iterator *it;
+ Edje_Part_Collection_Directory_Entry *pce;
+ BUF_APPEND("collections {\n");
+
+ it = eina_hash_iterator_data_new(ed->file->collection);
+
+ if (!it)
+ {
+ ERR("Generating EDC for Collections");
+ eina_strbuf_free(buf);
+ return NULL;
+ }
+
+ EINA_ITERATOR_FOREACH(it, pce)
+ {
+ ret &= _edje_generate_source_of_group(ed, pce, buf);
+ }
+
+ eina_iterator_free(it);
+ BUF_APPEND("}\n\n");
}
return buf;
@@ -6894,12 +6245,12 @@ source_edd(void)
if (_srcfile_edd) return;
- eet_eina_stream_data_descriptor_class_set(&eddc, "srcfile", sizeof(SrcFile));
+ eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile", sizeof(SrcFile));
_srcfile_edd = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "name", name, EET_T_INLINED_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "file", file, EET_T_INLINED_STRING);
- eet_eina_stream_data_descriptor_class_set(&eddc, "srcfile_list", sizeof(SrcFile_List));
+ eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile_list", sizeof(SrcFile_List));
_srcfile_list_edd = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd);
}
@@ -6910,7 +6261,7 @@ _edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef)
{
/* Write Edje_File structure */
INF("** Writing Edje_File* ed->file");
- if (eet_data_write(eetf, _edje_edd_edje_file, "edje_file", ef, 1) <= 0)
+ if (eet_data_write(eetf, _edje_edd_edje_file, "edje/file", ef, 1) <= 0)
{
ERR("Error. unable to write \"edje_file\" entry to \"%s\"", ef->path);
return EINA_FALSE;
@@ -6923,14 +6274,13 @@ _edje_edit_collection_save(Eet_File *eetf, Edje_Part_Collection *epc)
{
char buf[256];
- snprintf(buf, sizeof(buf), "collections/%i", epc->id);
+ snprintf(buf, sizeof(buf), "edje/collections/%i", epc->id);
- if (eet_data_write(eetf, _edje_edd_edje_part_collection, buf, epc, 1) <= 0)
- {
- ERR("Error. unable to write \"%s\" part entry", buf);
- return EINA_FALSE;
- }
- return EINA_TRUE;
+ if (eet_data_write(eetf, _edje_edd_edje_part_collection, buf, epc, 1) > 0)
+ return EINA_TRUE;
+
+ ERR("Error. unable to write \"%s\" part entry", buf);
+ return EINA_FALSE;
}
static Eina_Bool
@@ -7057,19 +6407,23 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only)
{
Eina_List *l;
Edje_Part_Collection *edc;
+ Edje_Part_Collection_Directory_Entry *ce;
Eina_Iterator *it;
INF("** Writing all collections");
- it = eina_hash_iterator_data_new(ef->collection_hash);
- while (eina_iterator_next(it, (void **)&edc))
+ it = eina_hash_iterator_data_new(ef->collection);
+ while (eina_iterator_next(it, (void **)&ce))
{
- INF("** Writing hash Edje_Part_Collection* ed->collection "
- "[id: %d]", edc->id);
- if(!_edje_edit_collection_save(eetf, edc))
+ if (ce->ref)
{
- eet_close(eetf);
- return EINA_FALSE;
+ INF("** Writing hash Edje_Part_Collection* ed->collection "
+ "[id: %d]", ce->id);
+ if(!_edje_edit_collection_save(eetf, ce->ref))
+ {
+ eet_close(eetf);
+ return EINA_FALSE;
+ }
}
}
eina_iterator_free(it);
@@ -7121,9 +6475,9 @@ edje_edit_save_all(Evas_Object *obj)
EAPI void
edje_edit_print_internal_status(Evas_Object *obj)
{
- Eina_List *l;
- Edje_Part *p;
Edje_Program *epr;
+ unsigned int i;
+ int j;
GET_ED_OR_RETURN();
@@ -7138,10 +6492,13 @@ edje_edit_print_internal_status(Evas_Object *obj)
INF(" parent: '%s'", ed->parent);
INF("*** Parts [table:%d list:%d]", ed->table_parts_size,
- eina_list_count(ed->collection->parts));
- EINA_LIST_FOREACH(ed->collection->parts, l, p)
+ ed->collection->parts_count);
+ for (i = 0; i < ed->collection->parts_count; ++i)
{
Edje_Real_Part *rp;
+ Edje_Part *p;
+
+ p = ed->collection->parts[i];
rp = ed->table_parts[p->id % ed->table_parts_size];
printf(" [%d]%s ", p->id, p->name);
@@ -7151,18 +6508,16 @@ edje_edit_print_internal_status(Evas_Object *obj)
WRN(" WRONG (table[%id]->name = '%s')", p->id, rp->part->name);
}
- INF("*** Programs [table:%d list:%d]", ed->table_programs_size,
- eina_list_count(ed->collection->programs));
- EINA_LIST_FOREACH(ed->collection->programs, l, epr)
+ INF("*** Programs [table:%d list:%d,%d,%d,%d,%d]", ed->table_programs_size,
+ 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);
+ for(j = 0; j < ed->table_programs_size; ++j)
{
- Edje_Program *epr2;
-
- epr2 = ed->table_programs[epr->id % ed->table_programs_size];
- printf(" [%d]%s ", epr->id, epr->name);
- if (epr == epr2)
- printf(" OK!\n");
- else
- WRN(" WRONG (table[%id]->name = '%s')", epr->id, epr2->name);
+ epr = ed->table_programs[i % ed->table_programs_size];
+ printf(" [%d]%s\n", epr->id, epr->name);
}
printf("\n");
diff --git a/src/lib/edje_embryo.c b/src/lib/edje_embryo.c
index 873516a..96e9cb8 100644
--- a/src/lib/edje_embryo.c
+++ b/src/lib/edje_embryo.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -291,7 +287,7 @@ _edje_embryo_fn_get_str(Embryo_Program *ep, Embryo_Cell *params)
s = (char *)_edje_var_str_get(ed, (int)params[1]);
if (s)
{
- if (strlen(s) < params[3])
+ if ((int) strlen(s) < params[3])
{
SETSTR(s, params[2]);
}
@@ -514,7 +510,7 @@ _edje_embryo_fn_fetch_str(Embryo_Program *ep, Embryo_Cell *params)
(int) params[2]);
if (s)
{
- if (strlen(s) < params[4])
+ if ((int) strlen(s) < params[4])
{
SETSTR(s, params[3]);
}
@@ -875,7 +871,7 @@ _edje_embryo_fn_get_state(Embryo_Program *ep, Embryo_Cell *params)
s = rp->chosen_description->state.name;
if (s)
{
- if (strlen(s) < params[3])
+ if ((int) strlen(s) < params[3])
{
SETSTR(s, params[2]);
}
@@ -1091,7 +1087,7 @@ _edje_embryo_fn_get_text(Embryo_Program *ep, Embryo_Cell *params)
s = (char *)edje_object_part_text_get(ed->obj, rp->part->name);
if (s)
{
- if (strlen(s) < params[3])
+ if ((int) strlen(s) < params[3])
{
SETSTR(s, params[2]);
}
@@ -1330,7 +1326,7 @@ _edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params)
int id, i, n;
Embryo_Cell *ptr;
- if (params[0] < (sizeof(Embryo_Cell) * (2))) return 0;
+ if (params[0] < (int) (sizeof(Embryo_Cell) * (2))) return 0;
ed = embryo_program_data_get(ep);
type = params[1];
id = params[2];
@@ -1557,9 +1553,7 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params)
{
Edje *ed = embryo_program_data_get(ep);
Edje_Real_Part *rp;
- Edje_Part_Description *parent, *d;
- Edje_Part_Image_Id *iid;
- Eina_List *l;
+ Edje_Part_Description_Common *parent, *d = NULL;
char *name;
float val;
@@ -1585,8 +1579,38 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params)
return 0;
/* now create the custom state */
- if (!(d = calloc(1, sizeof(Edje_Part_Description))))
- return 0;
+ switch (rp->part->type)
+ {
+#define ALLOC_DESC(Short, Type, To) \
+ case EDJE_PART_TYPE_##Short: To = calloc(1, sizeof (Edje_Part_Description_##Type)); break;
+
+#define ALLOC_COPY_DESC(Short, Type, To, Spec) \
+ case EDJE_PART_TYPE_##Short: \
+ { \
+ Edje_Part_Description_##Type *tmp; \
+ Edje_Part_Description_##Type *new; \
+ \
+ tmp = (Edje_Part_Description_##Type *) parent; \
+ \
+ new = calloc(1, sizeof (Edje_Part_Description_##Type)); \
+ new->Spec = tmp->Spec; \
+ d = &new->common; \
+ break; \
+ }
+
+ ALLOC_DESC(RECTANGLE, Common, d);
+ ALLOC_DESC(SWALLOW, Common, d);
+ ALLOC_DESC(GROUP, Common, d);
+
+ ALLOC_COPY_DESC(IMAGE, Image, d, image);
+ ALLOC_COPY_DESC(TEXT, Text, d, text);
+ ALLOC_COPY_DESC(TEXTBLOCK, Text, d, text);
+ ALLOC_COPY_DESC(BOX, Box, d, box);
+ ALLOC_COPY_DESC(TABLE, Table, d, table);
+ ALLOC_COPY_DESC(EXTERNAL, External, d, external_params);
+ }
+
+ if (!d) return 0;
rp->custom = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State));
if (!rp->custom)
@@ -1605,26 +1629,53 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params)
/* make sure all the allocated memory is getting copied,
* not just referenced
*/
- d->image.tween_list = NULL;
-
- EINA_LIST_FOREACH(parent->image.tween_list, l, iid)
+ if (rp->part->type == EDJE_PART_TYPE_IMAGE)
{
- Edje_Part_Image_Id *iid_new;
+ Edje_Part_Description_Image *img_desc;
+ Edje_Part_Description_Image *parent_img_desc;
+
+ img_desc = (Edje_Part_Description_Image*) d;
+ parent_img_desc = (Edje_Part_Description_Image*) parent;
+
+ img_desc->image.tweens_count = parent_img_desc->image.tweens_count;
+ img_desc->image.tweens = calloc(img_desc->image.tweens_count,
+ sizeof(Edje_Part_Image_Id*));
+ if (img_desc->image.tweens)
+ {
+ unsigned int i;
+
+ for (i = 0; i < parent_img_desc->image.tweens_count; ++i)
+ {
+ Edje_Part_Image_Id *iid_new;
- iid_new = calloc(1, sizeof(Edje_Part_Image_Id));
- if (!iid_new) continue;
+ iid_new = calloc(1, sizeof(Edje_Part_Image_Id));
+ if (!iid_new) continue;
- iid_new->id = iid->id;
+ *iid_new = *parent_img_desc->image.tweens[i];
- d->image.tween_list = eina_list_append(d->image.tween_list, iid_new);
+ img_desc->image.tweens[i] = iid_new;
+ }
+ }
}
#define DUP(x) x ? (char *)eina_stringshare_add(x) : NULL
d->color_class = DUP(d->color_class);
- d->text.text = DUP(d->text.text);
- d->text.text_class = DUP(d->text.text_class);
- d->text.font = DUP(d->text.font);
- d->text.style = DUP(d->text.style);
+
+ if (rp->part->type == EDJE_PART_TYPE_TEXT
+ || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ Edje_Part_Description_Text *text_desc;
+
+ text_desc = (Edje_Part_Description_Text*) d;
+
+ text_desc->text.text_class = DUP(text_desc->text.text_class);
+ text_desc->text.text.str = DUP(edje_string_get(&text_desc->text.text));
+ text_desc->text.text.id = 0;
+ text_desc->text.font.str = DUP(edje_string_get(&text_desc->text.font));
+ text_desc->text.font.id = 0;
+ text_desc->text.style.str = DUP(edje_string_get(&text_desc->text.style));
+ text_desc->text.style.id = 0;
+ }
#undef DUP
rp->custom->description = d;
@@ -1641,7 +1692,7 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params)
char *s;
/* we need at least 3 arguments */
- if (params[0] < (sizeof(Embryo_Cell) * 3))
+ if (params[0] < (int) (sizeof(Embryo_Cell) * 3))
return 0;
if (params[1] < 0)
@@ -1716,14 +1767,23 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params)
break;
case EDJE_STATE_PARAM_COLOR3:
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Text *text;
- GETINT(rp->custom->description->color3.r, params[3]);
- GETINT(rp->custom->description->color3.g, params[4]);
- GETINT(rp->custom->description->color3.b, params[5]);
- GETINT(rp->custom->description->color3.a, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
- break;
+ CHKPARAM(6);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ GETINT(text->text.color3.r, params[3]);
+ GETINT(text->text.color3.g, params[4]);
+ GETINT(text->text.color3.b, params[5]);
+ GETINT(text->text.color3.a, params[6]);
+ break;
+ }
case EDJE_STATE_PARAM_COLOR_CLASS:
CHKPARAM(3);
@@ -1784,128 +1844,210 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params)
break;
case EDJE_STATE_PARAM_IMAGE:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Image *img;
- GETINT(rp->custom->description->image.id, params[3]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(3);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+ GETINT(img->image.id, params[3]);
+
+ break;
+ }
case EDJE_STATE_PARAM_BORDER:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Image *img;
- GETINT(rp->custom->description->border.l, params[3]);
- GETINT(rp->custom->description->border.r, params[4]);
- GETINT(rp->custom->description->border.t, params[5]);
- GETINT(rp->custom->description->border.b, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(6);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ GETINT(img->image.border.l, params[3]);
+ GETINT(img->image.border.r, params[4]);
+ GETINT(img->image.border.t, params[5]);
+ GETINT(img->image.border.b, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_FILL_SMOOTH:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Image *img;
- GETINT(rp->custom->description->fill.smooth, params[3]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(3);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ GETINT(img->image.fill.smooth, params[3]);
+
+ break;
+ }
case EDJE_STATE_PARAM_FILL_POS:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Image *img;
- GETFLOAT_T(rp->custom->description->fill.pos_rel_x, params[3]);
- GETFLOAT_T(rp->custom->description->fill.pos_rel_y, params[4]);
- GETINT(rp->custom->description->fill.pos_abs_x, params[5]);
- GETINT(rp->custom->description->fill.pos_abs_y, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(6);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ GETFLOAT_T(img->image.fill.pos_rel_x, params[3]);
+ GETFLOAT_T(img->image.fill.pos_rel_y, params[4]);
+ GETINT(img->image.fill.pos_abs_x, params[5]);
+ GETINT(img->image.fill.pos_abs_y, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_FILL_SIZE:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Image *img;
- GETFLOAT_T(rp->custom->description->fill.rel_x, params[3]);
- GETFLOAT_T(rp->custom->description->fill.rel_y, params[4]);
- GETINT(rp->custom->description->fill.abs_x, params[5]);
- GETINT(rp->custom->description->fill.abs_y, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(6);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ GETFLOAT_T(img->image.fill.rel_x, params[3]);
+ GETFLOAT_T(img->image.fill.rel_y, params[4]);
+ GETINT(img->image.fill.abs_x, params[5]);
+ GETINT(img->image.fill.abs_y, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Text *text;
- GETSTR(s, params[3]);
- GETSTREVAS(s, rp->custom->description->text.text);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
+ CHKPARAM(3);
- break;
+ GETSTR(s, params[3]);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+ GETSTREVAS(s, text->text.text.str);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_CLASS:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Text *text;
- GETSTR(s, params[3]);
- GETSTREVAS(s, rp->custom->description->text.text_class);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
+ CHKPARAM(3);
- break;
+ GETSTR(s, params[3]);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+ GETSTREVAS(s, text->text.text_class);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_FONT:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Text *text;
- GETSTR(s, params[3]);
- GETSTREVAS(s, rp->custom->description->text.font);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
+ CHKPARAM(3);
- break;
+ GETSTR(s, params[3]);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+ GETSTREVAS(s, text->text.font.str);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_STYLE:
- if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Text *text;
- GETSTR(s, params[3]);
- GETSTREVAS(s, rp->custom->description->text.style);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0;
+ CHKPARAM(3);
- break;
+ GETSTR(s, params[3]);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+ GETSTREVAS(s, text->text.style.str);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_SIZE:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Text *text;
- GETINT(rp->custom->description->text.size, params[3]);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
+ CHKPARAM(3);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+ GETINT(text->text.size, params[3]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_FIT:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- GETINT(rp->custom->description->text.fit_x, params[3]);
- GETINT(rp->custom->description->text.fit_y, params[4]);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
+ CHKPARAM(4);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ GETINT(text->text.fit_x, params[3]);
+ GETINT(text->text.fit_y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_MIN:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- GETINT(rp->custom->description->text.min_x, params[3]);
- GETINT(rp->custom->description->text.min_y, params[4]);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
+ CHKPARAM(4);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ GETINT(text->text.min_x, params[3]);
+ GETINT(text->text.min_y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_MAX:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- GETINT(rp->custom->description->text.max_x, params[3]);
- GETINT(rp->custom->description->text.max_y, params[4]);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
+ CHKPARAM(4);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ GETINT(text->text.max_x, params[3]);
+ GETINT(text->text.max_y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_ALIGN:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- GETFLOAT_T(rp->custom->description->text.align.x, params[3]);
- GETFLOAT_T(rp->custom->description->text.align.y, params[4]);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
+ CHKPARAM(4);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ GETFLOAT_T(text->text.align.x, params[3]);
+ GETFLOAT_T(text->text.align.y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_VISIBLE:
CHKPARAM(3);
@@ -1998,7 +2140,7 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params)
char *s;
/* we need at least 3 arguments */
- if (params[0] < (sizeof(Embryo_Cell) * 3))
+ if (params[0] < (int) (sizeof(Embryo_Cell) * 3))
return 0;
if (params[1] < 0)
@@ -2073,14 +2215,24 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params)
break;
case EDJE_STATE_PARAM_COLOR3:
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Text *text;
- SETINT(rp->custom->description->color3.r, params[3]);
- SETINT(rp->custom->description->color3.g, params[4]);
- SETINT(rp->custom->description->color3.b, params[5]);
- SETINT(rp->custom->description->color3.a, params[6]);
+ if (rp->part->type == EDJE_PART_TYPE_TEXT
+ || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ return 0;
- break;
+ CHKPARAM(6);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ SETINT(text->text.color3.r, params[3]);
+ SETINT(text->text.color3.g, params[4]);
+ SETINT(text->text.color3.b, params[5]);
+ SETINT(text->text.color3.a, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_COLOR_CLASS:
CHKPARAM(4);
@@ -2131,128 +2283,220 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params)
break;
case EDJE_STATE_PARAM_IMAGE:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Image *img;
- SETINT(rp->custom->description->image.id, params[3]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(3);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ SETINT(img->image.id, params[3]);
+
+ break;
+ }
case EDJE_STATE_PARAM_BORDER:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Image *img;
- SETINT(rp->custom->description->border.l, params[3]);
- SETINT(rp->custom->description->border.r, params[4]);
- SETINT(rp->custom->description->border.t, params[5]);
- SETINT(rp->custom->description->border.b, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(6);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ SETINT(img->image.border.l, params[3]);
+ SETINT(img->image.border.r, params[4]);
+ SETINT(img->image.border.t, params[5]);
+ SETINT(img->image.border.b, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_FILL_SMOOTH:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Image *img;
- SETINT(rp->custom->description->fill.smooth, params[3]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(3);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ SETINT(img->image.fill.smooth, params[3]);
+
+ break;
+ }
case EDJE_STATE_PARAM_FILL_POS:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Image *img;
- SETFLOAT_T(rp->custom->description->fill.pos_rel_x, params[3]);
- SETFLOAT_T(rp->custom->description->fill.pos_rel_y, params[4]);
- SETINT(rp->custom->description->fill.pos_abs_x, params[5]);
- SETINT(rp->custom->description->fill.pos_abs_y, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(6);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ SETFLOAT_T(img->image.fill.pos_rel_x, params[3]);
+ SETFLOAT_T(img->image.fill.pos_rel_y, params[4]);
+ SETINT(img->image.fill.pos_abs_x, params[5]);
+ SETINT(img->image.fill.pos_abs_y, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_FILL_SIZE:
- if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
- CHKPARAM(6);
+ {
+ Edje_Part_Description_Image *img;
- SETFLOAT_T(rp->custom->description->fill.rel_x, params[3]);
- SETFLOAT_T(rp->custom->description->fill.rel_y, params[4]);
- SETINT(rp->custom->description->fill.abs_x, params[5]);
- SETINT(rp->custom->description->fill.abs_y, params[6]);
+ if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0;
+ CHKPARAM(6);
- break;
+ img = (Edje_Part_Description_Image*) rp->custom->description;
+
+ SETFLOAT_T(img->image.fill.rel_x, params[3]);
+ SETFLOAT_T(img->image.fill.rel_y, params[4]);
+ SETINT(img->image.fill.abs_x, params[5]);
+ SETINT(img->image.fill.abs_y, params[6]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- s = rp->custom->description->text.text;
- SETSTRALLOCATE(s);
+ if (rp->part->type == EDJE_PART_TYPE_TEXT
+ || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ return 0;
- break;
+ CHKPARAM(4);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ s = (char *)text->text.text.str;
+ SETSTRALLOCATE(s);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_CLASS:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
+ {
+ Edje_Part_Description_Text *text;
+
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(4);
+ return 0;
- s = rp->custom->description->text.text_class;
- SETSTRALLOCATE(s);
+ CHKPARAM(4);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ s = text->text.text_class;
+ SETSTRALLOCATE(s);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_FONT:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- s = rp->custom->description->text.font;
- SETSTRALLOCATE(s);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- break;
+ CHKPARAM(4);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ s = (char *)text->text.font.str;
+ SETSTRALLOCATE(s);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_STYLE:
- if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- s = rp->custom->description->text.style;
- SETSTRALLOCATE(s);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0;
- break;
+ CHKPARAM(4);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ s = (char *)text->text.style.str;
+ SETSTRALLOCATE(s);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_SIZE:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(3);
+ {
+ Edje_Part_Description_Text *text;
- SETINT(rp->custom->description->text.size, params[3]);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- break;
+ CHKPARAM(3);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ SETINT(text->text.size, params[3]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_FIT:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- SETINT(rp->custom->description->text.fit_x, params[3]);
- SETINT(rp->custom->description->text.fit_y, params[4]);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
+ CHKPARAM(4);
- break;
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ SETINT(text->text.fit_x, params[3]);
+ SETINT(text->text.fit_y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_MIN:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- SETINT(rp->custom->description->text.min_x, params[3]);
- SETINT(rp->custom->description->text.min_y, params[4]);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
- break;
+ CHKPARAM(4);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ SETINT(text->text.min_x, params[3]);
+ SETINT(text->text.min_y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_MAX:
- if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && \
- (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
- return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- SETINT(rp->custom->description->text.max_x, params[3]);
- SETINT(rp->custom->description->text.max_y, params[4]);
+ if ( (rp->part->type != EDJE_PART_TYPE_TEXT) &&
+ (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ return 0;
- break;
+ CHKPARAM(4);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ SETINT(text->text.max_x, params[3]);
+ SETINT(text->text.max_y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_TEXT_ALIGN:
- if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- CHKPARAM(4);
+ {
+ Edje_Part_Description_Text *text;
- SETFLOAT_T(rp->custom->description->text.align.x, params[3]);
- SETFLOAT_T(rp->custom->description->text.align.y, params[4]);
+ if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0;
- break;
+ CHKPARAM(4);
+
+ text = (Edje_Part_Description_Text*) rp->custom->description;
+
+ SETFLOAT_T(text->text.align.x, params[3]);
+ SETFLOAT_T(text->text.align.y, params[4]);
+
+ break;
+ }
case EDJE_STATE_PARAM_VISIBLE:
CHKPARAM(3);
diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c
index 17818e1..16ae0ec 100644
--- a/src/lib/edje_entry.c
+++ b/src/lib/edje_entry.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -29,9 +25,9 @@ void *alloca (size_t);
#ifdef HAVE_ECORE_IMF
static int _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
-static int _edje_entry_imf_event_commit_cb(void *data, int type, void *event);
-static int _edje_entry_imf_event_changed_cb(void *data, int type, void *event);
-static int _edje_entry_imf_event_delete_surrounding_cb(void *data, int type, void *event);
+static Eina_Bool _edje_entry_imf_event_commit_cb(void *data, int type, void *event);
+static Eina_Bool _edje_entry_imf_event_changed_cb(void *data, int type, void *event);
+static Eina_Bool _edje_entry_imf_event_delete_surrounding_cb(void *data, int type, void *event);
#endif
typedef struct _Entry Entry;
@@ -85,12 +81,12 @@ struct _Anchor
};
#ifdef HAVE_ECORE_IMF
-static void
+ static void
_edje_entry_focus_in_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Edje_Real_Part *rp;
Entry *en;
-
+
rp = data;
if (!rp || !rp->entry_data || !rp->edje || !rp->edje->obj) return;
@@ -99,12 +95,12 @@ _edje_entry_focus_in_cb(void *data, Evas_Object *o __UNUSED__, const char *emiss
if (evas_object_focus_get(rp->edje->obj))
{
- ecore_imf_context_reset(en->imf_context);
- ecore_imf_context_focus_in(en->imf_context);
+ ecore_imf_context_reset(en->imf_context);
+ ecore_imf_context_focus_in(en->imf_context);
}
}
-static void
+ static void
_edje_entry_focus_out_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Edje_Real_Part *rp;
@@ -122,7 +118,7 @@ _edje_entry_focus_out_cb(void *data, Evas_Object *o __UNUSED__, const char *emis
}
#endif
-static void
+ static void
_edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Edje *ed = data;
@@ -130,26 +126,26 @@ _edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
Edje_Real_Part *rp;
Entry *en;
#endif
-
+
_edje_emit(ed, "focus,in", "");
#ifdef HAVE_ECORE_IMF
rp = ed->focused_part;
if (rp == NULL) return;
-
+
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
- (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
+ (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
return;
-
+
if (en->imf_context)
{
- ecore_imf_context_reset(en->imf_context);
- ecore_imf_context_focus_in(en->imf_context);
+ ecore_imf_context_reset(en->imf_context);
+ ecore_imf_context_focus_in(en->imf_context);
}
#endif
}
-
-static void
+
+ static void
_edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Edje *ed = data;
@@ -157,34 +153,34 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
Edje_Real_Part *rp = ed->focused_part;
Entry *en;
#endif
-
+
_edje_emit(ed, "focus,out", "");
#ifdef HAVE_ECORE_IMF
if (!rp) return;
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
- (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
+ (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
return;
if (en->imf_context)
{
ecore_imf_context_reset(en->imf_context);
ecore_imf_context_cursor_position_set(en->imf_context,
- evas_textblock_cursor_pos_get(en->cursor));
+ evas_textblock_cursor_pos_get(en->cursor));
ecore_imf_context_focus_out(en->imf_context);
}
#endif
}
// need one for markup and format too - how to do it? extra type param?
-static void
+ static void
_text_filter_prepend(Entry *en, const char *text)
{
char *text2;
Edje_Text_Insert_Filter_Callback *cb;
Eina_List *l;
-
+
text2 = strdup(text);
EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
{
@@ -197,8 +193,6 @@ _text_filter_prepend(Entry *en, const char *text)
if (text2)
{
evas_textblock_cursor_text_prepend(en->cursor, text2);
-// evas_textblock_cursor_format_prepend(en->cursor, text2);
-// evas_object_textblock_text_markup_prepend(en->cursor, text2);
free(text2);
}
}
@@ -216,105 +210,14 @@ _curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entr
static void
_curs_back(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
- if (!evas_textblock_cursor_char_prev(c))
- {
- if (evas_textblock_cursor_node_prev(c))
- {
- while (evas_textblock_cursor_node_format_get(c))
- {
- if (evas_textblock_cursor_node_format_is_visible_get(c)) break;
- if (!evas_textblock_cursor_node_prev(c)) break;
- }
- }
- }
+ evas_textblock_cursor_char_prev(c);
_curs_update_from_curs(c, o, en);
}
static void
_curs_next(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
- int ln, ln2, ok;
- Eina_Bool eol;
-
- ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
- eol = evas_textblock_cursor_eol_get(c);
- if (!evas_textblock_cursor_char_next(c))
- {
- if (!eol)
- {
- ln2 = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
- if (ln2 != ln)
- {
- evas_textblock_cursor_char_prev(c);
- evas_textblock_cursor_eol_set(c, 1);
- _curs_update_from_curs(c, o, en);
- return;
- }
- ok = evas_textblock_cursor_node_next(c);
- if (!ok)
- {
- evas_textblock_cursor_line_last(c);
- _curs_update_from_curs(c, o, en);
- return;
- }
- while (evas_textblock_cursor_node_format_get(c))
- {
- if (evas_textblock_cursor_node_format_is_visible_get(c))
- break;
- if (!evas_textblock_cursor_node_next(c))
- break;
- }
- return;
- }
- evas_textblock_cursor_eol_set(c, 0);
- if (evas_textblock_cursor_node_next(c))
- {
- while (evas_textblock_cursor_node_format_get(c))
- {
- if (evas_textblock_cursor_node_format_is_visible_get(c))
- break;
- if (!evas_textblock_cursor_node_next(c))
- break;
- }
- }
- }
- else
- {
- int len, pos;
-
- len = evas_textblock_cursor_node_text_length_get(c);
- pos = evas_textblock_cursor_pos_get(c);
- if (pos == len)
- {
- evas_textblock_cursor_node_next(c);
- if (!eol)
- {
- ln2 = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
- if (ln2 != ln)
- {
- evas_textblock_cursor_node_prev(c);
- evas_textblock_cursor_line_last(c);
- _curs_update_from_curs(c, o, en);
- return;
- }
- }
- }
- else
- {
- if (!eol)
- {
- ln2 = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
- if (ln2 != ln)
- {
- evas_textblock_cursor_char_prev(c);
- evas_textblock_cursor_eol_set(c, 1);
- _curs_update_from_curs(c, o, en);
- return;
- }
- }
- }
- evas_textblock_cursor_eol_set(c, 0);
- }
+ evas_textblock_cursor_char_next(c);
_curs_update_from_curs(c, o, en);
}
@@ -323,9 +226,9 @@ _curs_line_last_get(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *
{
Evas_Textblock_Cursor *cc;
int ln;
-
+
cc = evas_object_textblock_cursor_new(o);
- evas_textblock_cursor_node_last(cc);
+ evas_textblock_cursor_paragraph_last(cc);
ln = evas_textblock_cursor_line_geometry_get(cc, NULL, NULL, NULL, NULL);
evas_textblock_cursor_free(cc);
return ln;
@@ -334,34 +237,29 @@ _curs_line_last_get(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *
static void
_curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
- evas_textblock_cursor_line_first(c);
+ evas_textblock_cursor_line_char_first(c);
_curs_update_from_curs(c, o, en);
}
static void
_curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
- evas_textblock_cursor_line_last(c);
-// if (!evas_textblock_cursor_node_format_get(c))
-// _curs_next(c, o, en);
+ evas_textblock_cursor_line_char_last(c);
_curs_update_from_curs(c, o, en);
}
static void
_curs_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
- evas_textblock_cursor_line_set(c, 0);
- evas_textblock_cursor_line_first(c);
+ evas_textblock_cursor_paragraph_first(c);
_curs_update_from_curs(c, o, en);
}
static void
_curs_end(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
- evas_textblock_cursor_node_last(c);
+ evas_textblock_cursor_paragraph_last(c);
_curs_lin_end(c, o, en);
-// evas_textblock_cursor_line_set(c, _curs_line_last_get(c, o, en));
-// _curs_lin_end(c, o, en);
_curs_update_from_curs(c, o, en);
}
@@ -384,7 +282,7 @@ _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
if (en->cx < (lx + (lw / 2)))
{
if (ln == last) _curs_end(c, o, en);
-// evas_textblock_cursor_line_first(c);
+// evas_textblock_cursor_line_char_last(c);
_curs_lin_start(c, o, en);
}
else
@@ -393,7 +291,7 @@ _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
_curs_end(c, o, en);
else
_curs_lin_end(c, o, en);
-// evas_textblock_cursor_line_last(c);
+// evas_textblock_cursor_line_char_last(c);
}
}
@@ -626,11 +524,11 @@ _edje_anchor_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN
len = 200 + strlen(n);
buf = alloca(len);
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
- snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, an->name);
+ snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, n);
else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
- snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, an->name);
+ snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, n);
else
- snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, an->name);
+ snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, n);
_edje_emit(rp->edje, buf, rp->part->name);
}
}
@@ -657,7 +555,7 @@ _edje_anchor_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
if (!n) n = "";
len = 200 + strlen(n);
buf = alloca(len);
- snprintf(buf, len, "anchor,mouse,up,%i,%s", ev->button, an->name);
+ snprintf(buf, len, "anchor,mouse,up,%i,%s", ev->button, n);
_edje_emit(rp->edje, buf, rp->part->name);
}
}
@@ -684,7 +582,7 @@ _edje_anchor_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN
if (!n) n = "";
len = 200 + strlen(n);
buf = alloca(len);
- snprintf(buf, len, "anchor,mouse,move,%s", an->name);
+ snprintf(buf, len, "anchor,mouse,move,%s", n);
_edje_emit(rp->edje, buf, rp->part->name);
}
}
@@ -706,7 +604,7 @@ _edje_anchor_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
if (!n) n = "";
len = 200 + strlen(n);
buf = alloca(len);
- snprintf(buf, len, "anchor,mouse,in,%s", an->name);
+ snprintf(buf, len, "anchor,mouse,in,%s", n);
_edje_emit(rp->edje, buf, rp->part->name);
}
}
@@ -728,7 +626,7 @@ _edje_anchor_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU
if (!n) n = "";
len = 200 + strlen(n);
buf = alloca(len);
- snprintf(buf, len, "anchor,mouse,out,%s", an->name);
+ snprintf(buf, len, "anchor,mouse,out,%s", n);
_edje_emit(rp->edje, buf, rp->part->name);
}
}
@@ -854,7 +752,8 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
{
Evas_Coord cx, cy, cw, ch;
- evas_textblock_cursor_format_item_geometry_get(an->start, &cx, &cy, &cw, &ch);
+ if (!evas_textblock_cursor_format_item_geometry_get(an->start, &cx, &cy, &cw, &ch))
+ continue ;
evas_object_move(sel->obj, x + cx, y + cy);
evas_object_resize(sel->obj, cw, ch);
}
@@ -926,17 +825,18 @@ static void
_anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
Evas_Textblock_Cursor *c1;
+ const Evas_Object_Textblock_Node_Format *node;
Anchor *an = NULL;
- int firsttext = 0;
_anchors_clear(c, o, en);
c1 = evas_object_textblock_cursor_new(o);
- evas_textblock_cursor_node_first(c1);
- do
+ node = evas_textblock_node_format_first_get(o);
+ for (; node ; node = evas_textblock_node_format_next_get(node))
{
const char *s;
-
- s = evas_textblock_cursor_node_format_get(c1);
+
+ evas_textblock_cursor_at_format_set(c1, node);
+ s = evas_textblock_node_format_text_get(node);
if (s)
{
if ((!strncmp(s, "+ a ", 4)) || (!strncmp(s, "+a ", 3)))
@@ -945,7 +845,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
if (an)
{
char *p;
-
+
an->en = en;
p = strstr(s, "href=");
if (p)
@@ -961,9 +861,11 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
}
else if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
{
+ /* Close the anchor, if the anchor was without text, free it as well */
if (an)
{
- if (!firsttext)
+ evas_textblock_cursor_at_format_set(an->end, node);
+ if (!evas_textblock_cursor_compare(an->start, an->end))
{
if (an->name) free(an->name);
evas_textblock_cursor_free(an->start);
@@ -971,7 +873,6 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
en->anchors = eina_list_remove(en->anchors, an);
free(an);
}
- firsttext = 0;
an = NULL;
}
}
@@ -981,7 +882,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
if (an)
{
char *p;
-
+
an->en = en;
an->item = 1;
p = strstr(s, "href=");
@@ -1000,7 +901,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
if (an)
{
-/*
+/*
if (!firsttext)
{
if (an->name) free(an->name);
@@ -1010,142 +911,32 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
free(an);
}
*/
- firsttext = 0;
an = NULL;
}
}
}
- else
- {
- s = evas_textblock_cursor_node_text_get(c1);
- if (an)
- {
- if (!an->item)
- {
- if (!firsttext)
- {
- evas_textblock_cursor_copy(c1, an->start);
- firsttext = 1;
- }
- }
- evas_textblock_cursor_char_last(c1);
- evas_textblock_cursor_copy(c1, an->end);
- }
- }
- }
- while (evas_textblock_cursor_node_next(c1));
+ }
evas_textblock_cursor_free(c1);
}
static void
-_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
+_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
{
- Evas_Textblock_Cursor *c1;
-
- c1 = evas_object_textblock_cursor_new(o);
- evas_textblock_cursor_node_last(c1);
- if (!evas_textblock_cursor_compare(en->sel_end, c1))
- evas_textblock_cursor_node_prev(en->sel_end);
- if (!evas_textblock_cursor_compare(en->sel_start, c1))
- evas_textblock_cursor_node_prev(en->sel_start);
- evas_textblock_cursor_free(c1);
evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
}
static void
-_backspace(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
+_backspace(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED__)
{
- Evas_Textblock_Cursor *c1, *c2;
- int nodel = 0;
-
- c1 = evas_object_textblock_cursor_new(o);
- if (!evas_textblock_cursor_char_prev(c))
- {
- if (!evas_textblock_cursor_node_prev(c))
- nodel = 1;
- else
- {
- evas_textblock_cursor_copy(c, c1);
- if (evas_textblock_cursor_node_format_get(c) &&
- (!evas_textblock_cursor_node_format_is_visible_get(c)))
- _curs_back(c, o, en);
- }
- }
- else
- {
- evas_textblock_cursor_copy(c, c1);
- }
- c2 = evas_object_textblock_cursor_new(o);
- evas_textblock_cursor_copy(c, c2);
- if (!nodel)
- {
- evas_textblock_cursor_range_delete(c1, c2);
- }
- evas_textblock_cursor_copy(c, c1);
- _curs_back(c, o, en);
- evas_textblock_cursor_copy(c, c2);
- if ((!evas_textblock_cursor_char_next(c2)) &&
- (!evas_textblock_cursor_node_next(c2)))
- {
- _curs_end(c, o, en);
- }
- else if (evas_textblock_cursor_compare(c, c1))
- {
- _curs_next(c, o, en);
- }
-
- evas_textblock_cursor_free(c1);
- evas_textblock_cursor_free(c2);
+ if (evas_textblock_cursor_char_prev(c))
+ evas_textblock_cursor_char_delete(c);
}
static void
-_delete(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
+_delete(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED__)
{
- Evas_Textblock_Cursor *c1, *c2;
-
- c1 = evas_object_textblock_cursor_new(o);
- c2 = evas_object_textblock_cursor_new(o);
- evas_textblock_cursor_copy(c, c1);
- evas_textblock_cursor_copy(c, c2);
- evas_textblock_cursor_char_last(c2);
- if (evas_textblock_cursor_node_format_get(c1) &&
- (!evas_textblock_cursor_node_format_is_visible_get(c1)))
- {
- // non-visible format-node
- evas_textblock_cursor_copy(c1, c2);
- while (evas_textblock_cursor_node_next(c2))
- {
- if ((!evas_textblock_cursor_node_format_get(c2)) ||
- (evas_textblock_cursor_node_format_is_visible_get(c2)))
- {
- evas_textblock_cursor_node_prev(c2);
- break;
- }
- }
- }
- else
- {
- if (evas_textblock_cursor_node_format_is_visible_get(c1))
- {
- // visible format node
- // do nothing just copy c to c1/c2 and range del
- }
- else
- {
- // if it's a text node
- if (!evas_textblock_cursor_char_next(c1))
- {
- if (evas_textblock_cursor_compare(c1, c2) > 0)
- _curs_next(c, o, en);
- }
- }
- evas_textblock_cursor_copy(c, c1);
- evas_textblock_cursor_copy(c, c2);
- }
- evas_textblock_cursor_range_delete(c1, c2);
- evas_textblock_cursor_free(c1);
- evas_textblock_cursor_free(c2);
+ evas_textblock_cursor_char_delete(c);
}
static void
@@ -1447,8 +1238,14 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
if (en->have_selection)
_range_del(en->cursor, rp->object, en);
_sel_clear(en->cursor, rp->object, en);
- //yy
- evas_textblock_cursor_format_prepend(en->cursor, "\n");
+ if (shift)
+ {
+ evas_textblock_cursor_format_prepend(en->cursor, "\n");
+ }
+ else
+ {
+ evas_textblock_cursor_format_prepend(en->cursor, "ps");
+ }
_curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
@@ -1526,7 +1323,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
Evas_Event_Mouse_Down *ev = event_info;
Entry *en;
Evas_Coord x, y, w, h;
- Eina_Bool multiline;
+// Eina_Bool multiline;
Evas_Textblock_Cursor *tc;
Eina_Bool dosel = EINA_FALSE;
if (!rp) return;
@@ -1556,7 +1353,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
}
tc = evas_object_textblock_cursor_new(rp->object);
evas_textblock_cursor_copy(en->cursor, tc);
- multiline = rp->part->multiline;
+// multiline = rp->part->multiline;
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
en->cx = ev->canvas.x - x;
en->cy = ev->canvas.y - y;
@@ -1813,7 +1610,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
}
static void
-_evas_focus_in_cb(void *data, Evas *e, void *event_info)
+_evas_focus_in_cb(void *data, Evas *e, __UNUSED__ void *event_info)
{
Edje *ed = (Edje *)data;
@@ -1823,7 +1620,7 @@ _evas_focus_in_cb(void *data, Evas *e, void *event_info)
}
static void
-_evas_focus_out_cb(void *data, Evas *e, void *event_info)
+_evas_focus_out_cb(void *data, Evas *e, __UNUSED__ void *event_info)
{
Edje *ed = (Edje *)data;
@@ -1892,10 +1689,13 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
{
+ Edje_Part_Description_Text *txt;
+
+ txt = (Edje_Part_Description_Text *) rp->chosen_description;
+
en->select_allow = 0;
- if ((rp->chosen_description) &&
- (rp->chosen_description->text.repch))
- evas_object_textblock_replace_char_set(rp->object, rp->chosen_description->text.repch);
+ if (txt && edje_string_get(&txt->text.repch))
+ evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch));
else
evas_object_textblock_replace_char_set(rp->object, "*");
}
@@ -2072,7 +1872,7 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
_sel_clear(en->cursor, rp->object, en);
evas_object_textblock_text_markup_set(rp->object, text);
/*
- evas_textblock_cursor_node_last(en->cursor);
+ evas_textblock_cursor_paragraph_last(en->cursor);
if (!evas_textblock_cursor_node_format_get(en->cursor))
{
evas_textblock_cursor_format_append(en->cursor, "\n");
@@ -2371,11 +2171,8 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
if (!c) return EINA_FALSE;
if (!evas_textblock_cursor_char_next(c))
{
- evas_textblock_cursor_eol_set(c, 0);
- if (evas_textblock_cursor_node_next(c)) goto ok;
- else return EINA_FALSE;
+ return EINA_FALSE;
}
- ok:
_curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@@ -2401,7 +2198,7 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
if (!c) return EINA_FALSE;
if (!evas_textblock_cursor_char_prev(c))
{
- if (evas_textblock_cursor_node_prev(c)) goto ok;
+ if (evas_textblock_cursor_paragraph_prev(c)) goto ok;
else return EINA_FALSE;
}
ok:
@@ -2440,9 +2237,9 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
{
if (cx < (lx +(lw / 2)))
- evas_textblock_cursor_line_first(c);
+ evas_textblock_cursor_line_char_last(c);
else
- evas_textblock_cursor_line_last(c);
+ evas_textblock_cursor_line_char_last(c);
}
_curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@@ -2478,9 +2275,9 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
{
if (cx < (lx +(lw / 2)))
- evas_textblock_cursor_line_first(c);
+ evas_textblock_cursor_line_char_last(c);
else
- evas_textblock_cursor_line_last(c);
+ evas_textblock_cursor_line_char_last(c);
}
_curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@@ -2505,7 +2302,7 @@ _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
Entry *en = rp->entry_data;
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
- evas_textblock_cursor_node_first(c);
+ evas_textblock_cursor_paragraph_first(c);
_curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@@ -2575,7 +2372,7 @@ _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
Entry *en = rp->entry_data;
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
- evas_textblock_cursor_line_first(c);
+ evas_textblock_cursor_line_char_first(c);
_curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@@ -2598,7 +2395,7 @@ _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
Entry *en = rp->entry_data;
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
- evas_textblock_cursor_line_last(c);
+ evas_textblock_cursor_line_char_last(c);
_curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
@@ -2620,7 +2417,7 @@ _edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
{
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return EINA_FALSE;
- if (evas_textblock_cursor_node_format_get(c)) return EINA_TRUE;
+ if (evas_textblock_cursor_is_format(c)) return EINA_TRUE;
return EINA_FALSE;
}
@@ -2629,7 +2426,7 @@ _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
{
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return EINA_FALSE;
- return evas_textblock_cursor_node_format_is_visible_get(c);
+ return evas_textblock_cursor_format_is_visible_get(c);
}
const char *
@@ -2638,16 +2435,21 @@ _edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur)
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
const char *s;
static char buf[16];
- int pos, pos2, ch;
+ int pos, pos2, i;
if (!c) return NULL;
- s = evas_textblock_cursor_node_format_get(c);
+ s = evas_textblock_node_format_text_get(evas_textblock_cursor_format_get(c));
if (s) return s;
- s = evas_textblock_cursor_node_text_get(c);
+ s = evas_textblock_cursor_paragraph_text_get(c);
if (!s) return NULL;
pos = evas_textblock_cursor_pos_get(c);
- pos2 = evas_string_char_next_get(s, pos, &ch);
- strncpy(buf, s + pos, pos2 - pos);
- buf[pos2 - pos] = 0;
+ /* Get the actual utf8 pos */
+ for (i = 0 ; pos > 0 ; pos--)
+ {
+ i = evas_string_char_next_get(s, i, NULL);
+ }
+ pos2 = evas_string_char_next_get(s, i, NULL);
+ strncpy(buf, s + i, pos2 - i);
+ buf[pos2 - i] = 0;
return buf;
}
@@ -2679,7 +2481,7 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNU
return 1;
}
-static int
+static Eina_Bool
_edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
{
Edje* ed = data;
@@ -2687,15 +2489,15 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
Entry *en;
Ecore_IMF_Event_Commit *ev = event;
int i;
-
- if (!rp) return 1;
-
+
+ if (!rp) return ECORE_CALLBACK_PASS_ON;
+
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
- return 1;
-
- if (en->imf_context != ev->ctx) return 1;
+ return ECORE_CALLBACK_PASS_ON;
+
+ if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
if (en->have_composition)
{
@@ -2712,11 +2514,11 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event)
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);
-
- return 0;
+
+ return ECORE_CALLBACK_DONE;
}
-static int
+static Eina_Bool
_edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event)
{
Edje* ed = data;
@@ -2727,23 +2529,23 @@ _edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event)
int i;
char *preedit_string;
- if (!rp) return 1;
+ if (!rp) return ECORE_CALLBACK_PASS_ON;
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
- return 1;
-
- if (!en->imf_context) return 1;
-
- if (en->imf_context != ev->ctx) return 1;
+ return ECORE_CALLBACK_PASS_ON;
+
+ if (!en->imf_context) return ECORE_CALLBACK_PASS_ON;
+
+ if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
ecore_imf_context_preedit_string_get(en->imf_context, &preedit_string, &length);
// FIXME : check the maximum length of evas_textblock
if ( 0 /* check the maximum length of evas_textblock */ )
- return 1;
-
+ return ECORE_CALLBACK_PASS_ON;
+
if (en->have_composition)
{
// delete the composing characters
@@ -2761,33 +2563,33 @@ _edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event)
//xx
evas_object_textblock_text_markup_prepend(en->cursor, preedit_string);
-
+
_sel_extend(en->cursor, rp->object, en);
_curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);
-
- return 0;
+
+ return ECORE_CALLBACK_DONE;
}
-static int
+static Eina_Bool
_edje_entry_imf_event_delete_surrounding_cb(void *data, int type __UNUSED__, void *event)
{
Edje *ed = data;
Edje_Real_Part *rp = ed->focused_part;
Entry *en;
Ecore_IMF_Event_Delete_Surrounding *ev = event;
-
- if (!rp) return 1;
+
+ if (!rp) return ECORE_CALLBACK_PASS_ON;
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
- return 1;
-
- if (en->imf_context != ev->ctx) return 1;
-
- return 0;
+ return ECORE_CALLBACK_PASS_ON;
+
+ if (en->imf_context != ev->ctx) return ECORE_CALLBACK_PASS_ON;
+
+ return ECORE_CALLBACK_DONE;
}
#endif
diff --git a/src/lib/edje_external.c b/src/lib/edje_external.c
index 8a8eea5..bf60d24 100644
--- a/src/lib/edje_external.c
+++ b/src/lib/edje_external.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "edje_private.h"
static Eina_Hash *type_registry = NULL;
@@ -181,6 +177,29 @@ edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Ed
return _edje_external_param_get(rp->swallowed_object, param);
}
+
+
+EAPI Evas_Object*
+edje_object_part_external_content_get(const Evas_Object *obj, const char *part, const char *content)
+{
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ if (!content) return EINA_FALSE;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!part)) return EINA_FALSE;
+
+ rp = _edje_real_part_recursive_get(ed, (char *)part);
+ if (!rp)
+ {
+ ERR("no part '%s'", part);
+ return EINA_FALSE;
+ }
+
+ return _edje_external_content_get(rp->swallowed_object, content);
+}
+
/**
* Facility to query the type of the given parameter of the given part.
*
@@ -594,13 +613,31 @@ _edje_external_param_get(const Evas_Object *obj, Edje_External_Param *param)
}
if (!type->param_get)
{
- ERR("external type '%s' from module '%s' does not provide param_set()",
+ ERR("external type '%s' from module '%s' does not provide param_get()",
type->module_name, type->module);
return EINA_FALSE;
}
return type->param_get(type->data, obj, param);
}
+Evas_Object*
+_edje_external_content_get(const Evas_Object *obj, const char *content)
+{
+ Edje_External_Type *type = evas_object_data_get(obj, "Edje_External_Type");
+ if (!type)
+ {
+ ERR("no external type for object %p", obj);
+ return EINA_FALSE;
+ }
+ if (!type->content_get)
+ {
+ ERR("external type '%s' from module '%s' does not provide content_get()",
+ type->module_name, type->module);
+ return EINA_FALSE;
+ }
+ return type->content_get(type->data, obj, content);
+}
+
void
_edje_external_params_free(Eina_List *external_params, Eina_Bool free_strings)
{
@@ -618,31 +655,34 @@ _edje_external_params_free(Eina_List *external_params, Eina_Bool free_strings)
}
void
-_edje_external_recalc_apply(Edje *ed, Edje_Real_Part *ep,
- Edje_Calc_Params *params,
- Edje_Part_Description *chosen_desc)
+_edje_external_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep,
+ Edje_Calc_Params *params __UNUSED__,
+ Edje_Part_Description_Common *chosen_desc __UNUSED__)
{
Edje_External_Type *type;
+ Edje_Part_Description_External *ext;
void *params1, *params2 = NULL;
- if (!ep->swallowed_object) return;
+ if (!ep->swallowed_object) return;
type = evas_object_data_get(ep->swallowed_object, "Edje_External_Type");
- if (!type) return;
+ if ((!type) || (!type->state_set)) return;
- if (!type->state_set) return;
+ ext = (Edje_Part_Description_External*) ep->param1.description;
params1 = ep->param1.external_params ?
- ep->param1.external_params :
- ep->param1.description->external_params;
+ ep->param1.external_params : ext->external_params;
if (ep->param2 && ep->param2->description)
- params2 = ep->param2->external_params ?
- ep->param2->external_params :
- ep->param2->description->external_params;
+ {
+ ext = (Edje_Part_Description_External*) ep->param2->description;
+
+ params2 = ep->param2->external_params ?
+ ep->param2->external_params : ext->external_params;
+ }
type->state_set(type->data, ep->swallowed_object,
- params1, params2, ep->description_pos);
+ params1, params2, ep->description_pos);
}
void *
diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c
index 3d5fdad..4d2acfd 100644
--- a/src/lib/edje_load.c
+++ b/src/lib/edje_load.c
@@ -1,12 +1,7 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "edje_private.h"
-static Eina_Bool _edje_file_collection_hash_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata);
#ifdef EDJE_PROGRAM_CACHE
static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
#endif
@@ -146,14 +141,16 @@ edje_file_collection_list(const char *file)
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
if (edf != NULL)
{
- if (edf->collection_dir)
- {
- Eina_List *l;
- Edje_Part_Collection_Directory_Entry *ce;
+ 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);
- EINA_LIST_FOREACH(edf->collection_dir->entries, l, ce)
- lst = eina_list_append(lst, eina_stringshare_add(ce->entry));
- }
_edje_cache_file_unref(edf);
}
return lst;
@@ -185,28 +182,42 @@ edje_file_group_exists(const char *file, const char *glob)
{
Edje_File *edf;
int error_ret = 0;
+ Eina_Bool succeed = EINA_FALSE;
if ((!file) || (!*file)) return EINA_FALSE;
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
if (edf != NULL)
{
- if (edf->collection_dir)
+ Edje_Patterns *patterns;
+
+ if (edf->collection_patterns)
{
- Edje_Patterns *patterns;
+ patterns = edf->collection_patterns;
+ }
+ else
+ {
+ Edje_Part_Collection_Directory_Entry *ce;
+ Eina_Iterator *i;
+ Eina_List *l = NULL;
- patterns =
- edje_match_collection_dir_init(edf->collection_dir->entries);
- if (edje_match_collection_dir_exec(patterns, glob))
- {
- edje_match_patterns_free(patterns);
- _edje_cache_file_unref(edf);
- return EINA_TRUE;
- }
- edje_match_patterns_free(patterns);
+ i = eina_hash_iterator_data_new(edf->collection);
+
+ EINA_ITERATOR_FOREACH(i, ce)
+ l = eina_list_append(l, ce);
+
+ eina_iterator_free(i);
+
+ patterns = edje_match_collection_dir_init(l);
+ eina_list_free(l);
}
+
+ succeed = edje_match_collection_dir_exec(patterns, glob);
+
+ edf->collection_patterns = patterns;
+
_edje_cache_file_unref(edf);
}
- return EINA_FALSE;
+ return succeed;
}
@@ -237,11 +248,10 @@ edje_file_data_get(const char *file, const char *key)
edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL);
if (edf != NULL)
{
- if (edf->data_cache != NULL)
- {
- str = eina_hash_find(edf->data_cache, key);
- if (str) str = strdup(str);
- }
+ str = (char*) edje_string_get(eina_hash_find(edf->data, key));
+
+ if (str) str = strdup(str);
+
_edje_cache_file_unref(edf);
}
}
@@ -258,29 +268,56 @@ _edje_programs_patterns_clean(Edje *ed)
NULL);
ed->patterns.programs.exact_match = NULL;
- ed->patterns.programs.globing = eina_list_free(ed->patterns.programs.globing);
+ free(ed->patterns.programs.u.programs.globing);
+ ed->patterns.programs.u.programs.globing = NULL;
}
void
_edje_programs_patterns_init(Edje *ed)
{
Edje_Signals_Sources_Patterns *ssp = &ed->patterns.programs;
+ Edje_Program **all;
+ unsigned int i, j;
if (ssp->signals_patterns)
return;
- ssp->globing = edje_match_program_hash_build(ed->collection->programs,
- &ssp->exact_match);
-
- ssp->signals_patterns = edje_match_programs_signal_init(ssp->globing);
- ssp->sources_patterns = edje_match_programs_source_init(ssp->globing);
+ 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);
}
int
_edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, Eina_List *group_path)
{
Edje *ed;
- int n;
+ unsigned int n;
Eina_List *parts = NULL;
Eina_List *old_swallows;
int group_path_started = 0;
@@ -309,13 +346,10 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
if (ed->file && ed->file->external_dir)
{
- const Edje_External_Directory_Entry *ext;
- const Eina_List *n;
+ unsigned int i;
- EINA_LIST_FOREACH(ed->file->external_dir->entries, n, ext)
- {
- edje_module_load(ext->entry);
- }
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ edje_module_load(ed->file->external_dir->entries[i].entry);
}
_edje_textblock_styles_add(ed);
@@ -337,16 +371,16 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
}
else
{
- Eina_List *l;
- int i;
+ unsigned int i;
int errors = 0;
- Edje_Part *ep;
/* colorclass stuff */
- EINA_LIST_FOREACH(ed->collection->parts, l, ep)
+ for (i = 0; i < ed->collection->parts_count; ++i)
{
- Eina_List *hist = NULL;
- Edje_Part_Description *desc;
+ Edje_Part *ep;
+ unsigned int k;
+
+ ep = ed->collection->parts[i];
if (errors)
break;
@@ -354,17 +388,23 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
if ((ep->default_desc) && (ep->default_desc->color_class))
_edje_color_class_member_add(ed, ep->default_desc->color_class);
- EINA_LIST_FOREACH(ep->other_desc, hist, desc)
- if (desc->color_class)
- _edje_color_class_member_add(ed, desc->color_class);
+ for (k = 0; k < ep->other.desc_count; k++)
+ {
+ Edje_Part_Description_Common *desc;
+
+ desc = ep->other.desc[k];
+
+ if (desc->color_class)
+ _edje_color_class_member_add(ed, desc->color_class);
+ }
}
/* build real parts */
- for (n = 0, l = ed->collection->parts; l; l = eina_list_next(l), n++)
+ for (n = 0; n < ed->collection->parts_count; n++)
{
Edje_Part *ep;
Edje_Real_Part *rp;
- ep = eina_list_data_get(l);
+ ep = ed->collection->parts[n];
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
if (!rp)
{
@@ -422,15 +462,15 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
case EDJE_PART_TYPE_TEXTBLOCK:
rp->object = evas_object_textblock_add(ed->evas);
break;
- case EDJE_PART_TYPE_GRADIENT:
- rp->object = evas_object_gradient_add(ed->evas);
- break;
case EDJE_PART_TYPE_BOX:
rp->object = evas_object_box_add(ed->evas);
break;
case EDJE_PART_TYPE_TABLE:
rp->object = evas_object_table_add(ed->evas);
break;
+ case EDJE_PART_TYPE_GRADIENT:
+ ERR("SPANK ! SPANK ! SPANK !\nYOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !!\n THEY ARE NOW REMOVED !",
+ ep->name, group, file);
default:
ERR("wrong part type %i!", ep->type);
break;
@@ -462,11 +502,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
if (rp->part->clip_to_id < 0)
evas_object_clip_set(rp->object, ed->clipper);
}
- rp->gradient_id = -1;
}
if (n > 0)
{
Edje_Real_Part *rp;
+ Eina_List *l;
+
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
ed->table_parts_size = n;
/* FIXME: check malloc return */
@@ -505,10 +546,10 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
}
/* replay events for dragable */
- if (rp->part->dragable.events_id >= 0)
+ if (rp->part->dragable.event_id >= 0)
{
rp->events_to =
- ed->table_parts[rp->part->dragable.events_id % ed->table_parts_size];
+ ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
/* events_to may be used only with dragable */
if (!rp->events_to->part->dragable.x &&
!rp->events_to->part->dragable.y)
@@ -519,40 +560,63 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
rp->swallow_params.min.w = 0;
rp->swallow_params.max.w = -1;
rp->swallow_params.max.h = -1;
-
- if (ed->file->feature_ver < 1)
+
+ if (rp->part->type == EDJE_PART_TYPE_TEXT
+ || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
{
- rp->param1.description->text.id_source = -1;
- rp->param1.description->text.id_text_source = -1;
+ 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;
+ }
}
- if (rp->param1.description->text.id_source >= 0)
- rp->text.source = ed->table_parts[rp->param1.description->text.id_source % ed->table_parts_size];
- if (rp->param1.description->text.id_text_source >= 0)
- rp->text.text_source = ed->table_parts[rp->param1.description->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;
- }
}
}
_edje_programs_patterns_init(ed);
-
- n = eina_list_count(ed->collection->programs);
+
+ 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;
if (n > 0)
{
Edje_Program *pr;
- /* FIXME: keeping a table AND a list is just bad - nuke list */
+ unsigned int i;
+
ed->table_programs = malloc(sizeof(Edje_Program *) * n);
- ed->table_programs_size = n;
- /* FIXME: check malloc return */
- n = 0;
- EINA_LIST_FOREACH(ed->collection->programs, l, pr)
+ if (ed->table_programs)
{
- ed->table_programs[n] = pr;
- n++;
+ 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);
}
}
_edje_ref(ed);
@@ -591,7 +655,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
* XXX: and they're always set in this case, but GCC fails to
* XXX: notice that, so let's shut it up
*/
- Eina_List *curr_item = NULL;
+ Edje_Pack_Element **curr_item = NULL;
+ unsigned int item_count = 0;
Edje_Pack_Element *pack_it = NULL;
const char *source = NULL;
@@ -607,18 +672,30 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
if (rp->part->items)
{
curr_item = rp->part->items;
- pack_it = curr_item->data;
- source = pack_it->source;
+ item_count = rp->part->items_count;
+ if (item_count > 0)
+ {
+ pack_it = *curr_item;
+ source = pack_it->source;
+ item_count--;
+ curr_item++;
+ }
}
break;
case EDJE_PART_TYPE_EXTERNAL:
{
+ Edje_Part_Description_External *external;
Evas_Object *child_obj;
- child_obj = _edje_external_type_add(rp->part->source, evas_object_evas_get(ed->obj), ed->obj, rp->part->default_desc->external_params, rp->part->name);
+
+ 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);
- rp->param1.external_params = _edje_external_params_parse(child_obj, rp->param1.description->external_params);
+ rp->param1.external_params = _edje_external_params_parse(child_obj,
+ external->external_params);
_edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
}
}
@@ -709,12 +786,19 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
evas_object_data_set(child_obj, "\377 edje.table_item", pack_it);
}
rp->items = eina_list_append(rp->items, child_obj);
- if (!(curr_item = curr_item->next))
- source = NULL;
- else
+
+ if (item_count > 0)
{
- pack_it = curr_item->data;
+ pack_it = *curr_item;
source = pack_it->source;
+ curr_item++;
+ item_count--;
+ }
+ else
+ {
+ source = NULL;
+ curr_item = NULL;
+ pack_it = NULL;
}
}
}
@@ -762,12 +846,16 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
if ((rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
(rp->part->default_desc))
{
+ Edje_Part_Description_Text *text;
Edje_Style *stl = NULL;
const char *style;
-
- style = rp->part->default_desc->text.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;
@@ -814,7 +902,7 @@ static Eina_List *
_edje_swallows_collect(Edje *ed)
{
Eina_List *swallows = NULL;
- int i;
+ unsigned int i;
if (!ed->file || !ed->table_parts) return NULL;
for (i = 0; i < ed->table_parts_size; i++)
@@ -851,7 +939,7 @@ _edje_file_del(Edje *ed)
if (!((ed->file) && (ed->collection))) return;
if (ed->table_parts)
{
- int i;
+ unsigned int i;
for (i = 0; i < ed->table_parts_size; i++)
{
Edje_Real_Part *rp;
@@ -905,8 +993,12 @@ _edje_file_del(Edje *ed)
lua_pop(ed->L, 1);
_edje_lua_free_reg(ed->L, rp->custom->description); // created in edje_lua.c::_edje_lua_part_fn_custom_state
}
-#endif
- _edje_collection_free_part_description_free(rp->custom->description, ed->file->free_strings);
+#endif
+ _edje_collection_free_part_description_clean(rp->part->type,
+ rp->custom->description,
+ ed->file->free_strings);
+ free(rp->custom->description);
+ rp->custom->description = NULL;
}
/* Cleanup optional part. */
@@ -927,16 +1019,18 @@ _edje_file_del(Edje *ed)
}
if ((ed->file) && (ed->collection))
{
- Eina_List *l;
Edje_Part *ep;
+ unsigned int i;
_edje_textblock_styles_del(ed);
- EINA_LIST_FOREACH(ed->collection->parts, l, ep)
+ for (i = 0; i < ed->collection->parts_count; ++i)
{
- _edje_text_part_on_del(ed, ep);
- _edje_color_class_on_del(ed, ep);
+ ep = ed->collection->parts[i];
+
+ _edje_text_part_on_del(ed, ep);
+ _edje_color_class_on_del(ed, ep);
}
-
+
_edje_cache_coll_unref(ed->file, ed->collection);
ed->collection = NULL;
}
@@ -984,99 +1078,52 @@ _edje_file_del(Edje *ed)
ed->table_programs = NULL;
ed->table_programs_size = 0;
}
-/**
- * Used to free the cached data values that are stored in the data_cache
- * hash table.
- */
-static Eina_Bool data_cache_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
-{
- Edje_File *edf;
-
- edf = fdata;
- if (edf->free_strings) eina_stringshare_del(data);
- return EINA_TRUE;
-}
void
_edje_file_free(Edje_File *edf)
{
Edje_Color_Class *ecc;
- Edje_Data *edt;
- if (edf->font_dir)
- {
- Edje_Font_Directory_Entry *fe;
+#define HASH_FREE(Hash) \
+ if (Hash) eina_hash_free(Hash); \
+ Hash = NULL;
- EINA_LIST_FREE(edf->font_dir->entries, fe)
- {
- eina_hash_del(edf->font_hash, fe->entry, edf);
- if (edf->free_strings && fe->path) eina_stringshare_del(fe->path);
- free(fe);
- }
- free(edf->font_dir);
- }
- if (edf->font_hash)
- {
- eina_hash_free(edf->font_hash);
- edf->font_hash = NULL;
- }
- if (edf->image_dir)
- {
- Edje_Image_Directory_Entry *ie;
+ /* Clean cache before cleaning memory pool */
+ if (edf->collection_cache) _edje_cache_coll_flush(edf);
- EINA_LIST_FREE(edf->image_dir->entries, ie)
- {
- if (edf->free_strings && ie->entry) eina_stringshare_del(ie->entry);
- free(ie);
- }
- free(edf->image_dir);
- }
- if (edf->collection_dir)
+ HASH_FREE(edf->fonts);
+ HASH_FREE(edf->collection);
+ HASH_FREE(edf->data);
+
+ if (edf->image_dir)
{
- Edje_Part_Collection_Directory_Entry *ce;
+ unsigned int i;
- EINA_LIST_FREE(edf->collection_dir->entries, ce)
+ if (edf->free_strings)
{
- if (edf->free_strings && ce->entry) eina_stringshare_del(ce->entry);
- free(ce);
+ for (i = 0; i < edf->image_dir->entries_count; ++i)
+ eina_stringshare_del(edf->image_dir->entries[i].entry);
}
- free(edf->collection_dir);
- }
- if (edf->spectrum_dir)
- {
- Edje_Spectrum_Directory_Entry *se;
- EINA_LIST_FREE(edf->spectrum_dir->entries, se)
+ /* Sets have been added after edje received eet dictionnary support */
+ for (i = 0; i < edf->image_dir->sets_count; ++i)
{
- Edje_Spectrum_Color *sc;
+ Edje_Image_Directory_Set_Entry *se;
- EINA_LIST_FREE(se->color_list, sc)
- free(sc);
+ EINA_LIST_FREE(edf->image_dir->sets[i].entries, se)
+ free(se);
- if (edf->free_strings)
- {
- if (se->entry) eina_stringshare_del(se->entry);
- if (se->filename) eina_stringshare_del(se->filename);
- }
- free(se);
}
- free(edf->spectrum_dir);
- }
- EINA_LIST_FREE(edf->data, edt)
- {
- if (edf->free_strings)
- {
- if (edt->key) eina_stringshare_del(edt->key);
- if (edt->value) eina_stringshare_del(edt->value);
- }
- free(edt);
+ free(edf->image_dir->entries);
+ free(edf->image_dir->sets);
+ free(edf->image_dir);
}
- if (edf->data_cache)
+
+ if (edf->external_dir)
{
- eina_hash_foreach(edf->data_cache, data_cache_free, edf);
- eina_hash_free(edf->data_cache);
- edf->data_cache = NULL;
+ if (edf->external_dir->entries) free(edf->external_dir->entries);
+ free(edf->external_dir);
}
EINA_LIST_FREE(edf->color_classes, ecc)
@@ -1085,88 +1132,89 @@ _edje_file_free(Edje_File *edf)
free(ecc);
}
- /* FIXME: free collection_hash and collection_cache */
- if (edf->collection_hash)
- {
- ERR("EDJE ERROR:\n"
- "\n"
- "Naughty Programmer - spank spank!\n"
- "\n"
- "This program as probably called edje_shutdown() with active Edje objects\n"
- "still around.\n This can cause problems as both Evas and Edje retain\n"
- "references to the objects. you should shut down all canvases and objects\n"
- "before calling edje_shutdown().\n"
- "The following errors are the edje object files and parts that are still\n"
- "hanging around, with their reference counts");
- eina_hash_foreach(edf->collection_hash,
- _edje_file_collection_hash_foreach, edf);
- eina_hash_free(edf->collection_hash);
- }
+ if (edf->collection_patterns) edje_match_patterns_free(edf->collection_patterns);
if (edf->path) eina_stringshare_del(edf->path);
if (edf->free_strings && edf->compiler) eina_stringshare_del(edf->compiler);
- if (edf->collection_cache) _edje_cache_coll_flush(edf);
_edje_textblock_style_cleanup(edf);
if (edf->ef) eet_close(edf->ef);
free(edf);
}
-void
-_edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec)
+static void
+_edje_program_free(Edje_Program *pr, Eina_Bool free_strings)
{
- Edje_Program *pr;
- Edje_Part *ep;
+ Edje_Program_Target *prt;
+ Edje_Program_After *pa;
- _edje_embryo_script_shutdown(ec);
- EINA_LIST_FREE(ec->programs, pr)
+ if (free_strings)
{
- Edje_Program_Target *prt;
- Edje_Program_After *pa;
-
- if (edf->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);
- }
- EINA_LIST_FREE(pr->targets, prt)
- free(prt);
- EINA_LIST_FREE(pr->after, pa)
- free(pa);
- free(pr);
+ 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);
}
- EINA_LIST_FREE(ec->parts, ep)
+ EINA_LIST_FREE(pr->targets, prt)
+ free(prt);
+ EINA_LIST_FREE(pr->after, pa)
+ free(pa);
+ free(pr);
+}
+
+void
+_edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collection_Directory_Entry *ce)
+{
+ unsigned int i;
+
+ _edje_embryo_script_shutdown(ec);
+
+#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);
+
+ for (i = 0; i < ec->parts_count; ++i)
{
- Edje_Part_Description *desc;
+ Edje_Part *ep;
+ unsigned int j;
+
+ ep = ec->parts[i];
if (edf->free_strings && ep->name) eina_stringshare_del(ep->name);
if (ep->default_desc)
{
- _edje_collection_free_part_description_free(ep->default_desc, edf->free_strings);
+ _edje_collection_free_part_description_clean(ep->type, ep->default_desc, edf->free_strings);
ep->default_desc = NULL;
}
- EINA_LIST_FREE(ep->other_desc, desc)
- _edje_collection_free_part_description_free(desc, edf->free_strings);
- free(ep);
+ for (j = 0; j < ep->other.desc_count; ++j)
+ _edje_collection_free_part_description_clean(ep->type, ep->other.desc[j], edf->free_strings);
+
+ free(ep->other.desc);
+ free(ep->items);
}
+ free(ec->parts);
+ ec->parts = NULL;
+
if (ec->data)
{
- Edje_Data *edt;
+ Eina_Iterator *it;
+ Edje_String *es;
- EINA_LIST_FREE(ec->data, edt)
- {
- if (edf->free_strings)
- {
- if (edt->key) eina_stringshare_del(edt->key);
- if (edt->value) eina_stringshare_del(edt->value);
- }
- free(edt);
- }
+ it = eina_hash_iterator_data_new(ec->data);
+ EINA_ITERATOR_FOREACH(it, es)
+ free(es);
+ eina_iterator_free(it);
+
+ eina_hash_free(ec->data);
}
- if (edf->free_strings && ec->part) eina_stringshare_del(ec->part);
#ifdef EDJE_PROGRAM_CACHE
if (ec->prog_cache.no_matches) eina_hash_free(ec->prog_cache.no_matches);
if (ec->prog_cache.matches)
@@ -1178,48 +1226,98 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec)
}
#endif
if (ec->script) embryo_program_free(ec->script);
-#ifdef LUA2
+#ifdef LUA2
_edje_lua2_script_unload(ec);
#endif
+
+ /* Destroy all part and description. */
+ eina_mempool_del(ce->mp.RECTANGLE);
+ eina_mempool_del(ce->mp.TEXT);
+ eina_mempool_del(ce->mp.IMAGE);
+ 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);
+ eina_mempool_del(ce->mp.part);
+ memset(&ce->mp, 0, sizeof (ce->mp));
+
free(ec);
+ ce->ref = NULL;
}
void
-_edje_collection_free_part_description_free(Edje_Part_Description *desc, Eina_Bool free_strings)
+_edje_collection_free_part_description_clean(int type, Edje_Part_Description_Common *desc, Eina_Bool free_strings)
{
- Edje_Part_Image_Id *pi;
+ if (free_strings && desc->color_class) eina_stringshare_del(desc->color_class);
- EINA_LIST_FREE(desc->image.tween_list, pi)
- free(pi);
- if (desc->external_params)
- _edje_external_params_free(desc->external_params, free_strings);
- if (free_strings)
+ switch (type)
{
- if (desc->color_class) eina_stringshare_del(desc->color_class);
- if (desc->text.text) eina_stringshare_del(desc->text.text);
- if (desc->text.text_class) eina_stringshare_del(desc->text.text_class);
- if (desc->text.style) eina_stringshare_del(desc->text.style);
- if (desc->text.font) eina_stringshare_del(desc->text.font);
- if (desc->gradient.type) eina_stringshare_del(desc->gradient.type);
- if (desc->gradient.params) eina_stringshare_del(desc->gradient.params);
+ case EDJE_PART_TYPE_IMAGE:
+ {
+ Edje_Part_Description_Image *img;
+ unsigned int i;
+
+ img = (Edje_Part_Description_Image *) desc;
+
+ for (i = 0; i < img->image.tweens_count; ++i)
+ free(img->image.tweens[i]);
+ free(img->image.tweens);
+ break;
+ }
+ 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);
+ break;
+ }
+ case EDJE_PART_TYPE_TEXT:
+ case EDJE_PART_TYPE_TEXTBLOCK:
+ if (free_strings)
+ {
+ Edje_Part_Description_Text *text;
+
+ text = (Edje_Part_Description_Text *) desc;
+
+ if (text->text.text.str) eina_stringshare_del(text->text.text.str);
+ if (text->text.text_class) eina_stringshare_del(text->text.text_class);
+ if (text->text.style.str) eina_stringshare_del(text->text.style.str);
+ if (text->text.font.str) eina_stringshare_del(text->text.font.str);
+ }
+ break;
}
- free(desc);
}
-static Eina_Bool
-_edje_file_collection_hash_foreach(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
+void
+_edje_collection_free_part_description_free(int type,
+ Edje_Part_Description_Common *desc,
+ Edje_Part_Collection_Directory_Entry *ce,
+ Eina_Bool free_strings)
{
- Edje_File *edf;
- Edje_Part_Collection *coll;
+#define FREE_POOL(Type, Ce, Desc) \
+ case EDJE_PART_TYPE_##Type: eina_mempool_free(Ce->mp.Type, Desc); \
+ ce->count.Type--; \
+ break;
- edf = fdata;
- coll = data;
- ERR("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) ",
- edf->path, edf->references,
- coll->part, coll->references);
- _edje_collection_free(edf, coll);
+ _edje_collection_free_part_description_clean(type, desc, free_strings);
- return EINA_TRUE;
+ switch (type)
+ {
+ FREE_POOL(RECTANGLE, ce, desc);
+ FREE_POOL(TEXT, ce, desc);
+ FREE_POOL(IMAGE, ce, desc);
+ FREE_POOL(SWALLOW, ce, desc);
+ FREE_POOL(TEXTBLOCK, ce, desc);
+ FREE_POOL(GROUP, ce, desc);
+ FREE_POOL(BOX, ce, desc);
+ FREE_POOL(TABLE, ce, desc);
+ FREE_POOL(EXTERNAL, ce, desc);
+ }
}
#ifdef EDJE_PROGRAM_CACHE
diff --git a/src/lib/edje_lua.c b/src/lib/edje_lua.c
index d0480fe..b01d0ad 100644
--- a/src/lib/edje_lua.c
+++ b/src/lib/edje_lua.c
@@ -1,99 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/**
-@page luaref Edje LUA scripting
-
-
-@section intro Introduction
-
-Lua scripts are declared in edc files with the @a lua_script keyword. Like this:
-@code
-group {
- name: "mygroup";
- lua_script {
- print("LUA: on-load script");
- }
- parts {
- ...
- }
- programs {
- program {
- signal: "a_signal";
- source: "a_part";
- lua_script {
- print("LUA: 'mouse,down,1' on 'button'");
- }
- }
- }
-}
-@endcode
-
-Inside a lua_script code block, there's a reference to your edje @ref Group named
-@a ed, which you may use for accessing your parts (e.g. a part named "label"
-is accessed through @a ed.label). This is the main object that is used to
-access every parts and is also used to create @ref Timer, @ref poller and
-@ref animator; to emit signal, send messagges, run/stop programs and more.
-Look at the @ref Group class to see all the methods and properties.
-
-Some object attributes return a table of values, the @ref Object attribute
-@a geometry for example return a table of 4 values (x,y,w,h). This tables don't
-have named index thus you can access the fields only using: geometry[1] for the
-x value. NOTE that you can NOT use gemetry.x or .geometry["x"]. But
-you can use the lua unpack function in this way:
-@code
-x, y, w, h = unpack(ed.part_name.geometry)
-print("geometry: ", x, y, w, h)
-// the same for state names:
-state, val = unpack(ed.part_name.state)
-print("state: ", state, val)
-// and for setting tables attributes:
-custom.color = { 255, 255, 255, 255 }
-ed.part_name.state = { 'custom', 0.0 }
-@endcode
-
-Classes hierarchy:
-- @ref Timer
-- @ref Animator
-- @ref Poller
-- @ref Object
- - @ref Group
- - @ref Part
- - @ref Image
- - @ref Line
- - @ref Polygon
- - @ref Table
- - @ref Description
-
-References:
-@li For general LUA documentations look at the official LUA manual
-(http://www.lua.org/manual/5.1/)
-@li The lua-users wiki is also full of lua info (http://lua-users.org/wiki/)
-@li Examples of edc files that use LUA can be found in the doc/examples folder
-in the edje sources.
-
-
-Lua snippets:
-@code
-// print one or more values in console in a tabbed way or using printf style
-print("something to say", val1, val2)
-s = string.format("%d %d", 3, 4)
-print(s)
-
-// string concat
-print("string1" .. "string2" .. val1)
-
-// var to string
-tostring(var)
-
-// Print the type of a variable
-print(type(var))
-
-@endcode
-
-*/
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -122,6 +26,8 @@ void *alloca(size_t);
#include <lauxlib.h>
#include <lualib.h>
+#ifndef LUA2
+
#define EDJE_LUA_GET 1
#define EDJE_LUA_SET 2
#define EDJE_LUA_FN 3
@@ -231,7 +137,7 @@ struct _Edje_Lua_Edje_Part_Description
jmp_buf _edje_lua_panic_jmp;
static int
-_edje_lua_custom_panic(lua_State *L)
+_edje_lua_custom_panic(__UNUSED__ lua_State *L)
{
printf("PANIC\n");
longjmp(_edje_lua_panic_jmp, 1);
@@ -343,7 +249,6 @@ _edje_lua_reg_count (lua_State *L)
static Edje_Lua_Ref *
_edje_lua_new_ref(lua_State *L, int index)
{
- //printf ("_edje_lua_new_ref %d %d %d\n", L, lua_objlen(L, LUA_REGISTRYINDEX), _edje_lua_reg_count(L));
lua_pushvalue(L, index);
Edje_Lua_Ref *ref = malloc(sizeof(Edje_Lua_Ref));
ref->id = luaL_ref(L, LUA_REGISTRYINDEX);
@@ -801,31 +706,6 @@ const luaL_Reg lClass_fn[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Timer,Timer Class}
-
-The timer class is a wrapper around ecore_timer. You can create a timer using
-the @a timer(secs,callback) method of the @ref Group class.
-The callback function will be called every @a secs seconds until it will
-return CALLBACK_RENEW. If CALLBACK_CANCEL is returned the timer will stop.
-
-Example:
-@code
-lua_script {
- function timer_cb()
- print("timer_cb")
- return CALLBACK_RENEW
- end
-
- timer = ed:timer(0.5, timer_cb)
-}
-@endcode
-
-A more detailed example can be found in doc/examples/lua_timer.edc
-
-@seealso{Ecore Timer Docs,http://docs.enlightenment.org/auto/ecore/group__Ecore__Timer__Group.html}
-*/
const luaL_Reg lTimer_get[];
@@ -846,13 +726,13 @@ const Edje_Lua_Reg *cTimer[] = {
NULL // sentinel
};
-static int
+static Eina_Bool
_edje_lua_timer_cb(void *data)
{
Edje_Lua_Timer *obj = data;
lua_State *L = obj->L;
int err_code;
- int res;
+ Eina_Bool res;
_edje_lua_get_ref(L, obj->cb); // callback function
_edje_lua_get_reg(L, obj);
@@ -860,7 +740,7 @@ _edje_lua_timer_cb(void *data)
if ((err_code = lua_pcall(L, 1, 1, 0)))
{
_edje_lua_error(L, err_code);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
res = luaL_optint(L, -1, ECORE_CALLBACK_CANCEL);
@@ -923,13 +803,6 @@ _edje_lua_timer_get_interval(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Timer.pending
-@li Timer.precision
-@li Timer.interval
-*/
const luaL_Reg lTimer_get[] = {
{"pending", _edje_lua_timer_get_pending},
{"precision", _edje_lua_timer_get_precision},
@@ -946,12 +819,6 @@ _edje_lua_timer_set_interval(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Timer.interval
-*/
-
const luaL_Reg lTimer_set[] = {
{"interval", _edje_lua_timer_set_interval},
{NULL, NULL} // sentinel
@@ -1002,14 +869,6 @@ _edje_lua_timer_fn_delay(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li Timer:del()
-@li Timer:freeze()
-@li Timer:thaw()
-@li Timer:delay(secs)
-*/
const luaL_Reg lTimer_fn[] = {
{"del", _edje_lua_timer_fn_del},
{"freeze", _edje_lua_timer_fn_freeze},
@@ -1018,13 +877,6 @@ const luaL_Reg lTimer_fn[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Animator,Animator Class}
-
-The animator class is a wrapper around ecore_animator. Animator are used the
-same way as @ref Timer.
-*/
const luaL_Reg lAnimator_get[];
const luaL_Reg lAnimator_fn[];
@@ -1042,10 +894,11 @@ const Edje_Lua_Reg *cAnimator[] = {
NULL // sentinel
};
-static int
+static Eina_Bool
_edje_lua_animator_cb(void *data)
{
- int err, res;
+ Eina_Bool res;
+ int err;
Edje_Lua_Animator *obj = data;
lua_State *L = obj->L;
@@ -1055,7 +908,7 @@ _edje_lua_animator_cb(void *data)
if ((err = lua_pcall(L, 1, 1, 0)))
{
_edje_lua_error(L, err);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
res = luaL_checkint(L, -1);
@@ -1088,11 +941,6 @@ _edje_lua_animator_get_frametime(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Animator.frametime
-*/
const luaL_Reg lAnimator_get[] = {
{"frametime", _edje_lua_animator_get_frametime},
{NULL, NULL}
@@ -1116,23 +964,11 @@ _edje_lua_animator_fn_del(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li Animator:del()
-*/
const luaL_Reg lAnimator_fn[] = {
{"del", _edje_lua_animator_fn_del},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Poller,Poller Class}
-
-The poller class is a wrapper around ecore_poller.
-
-*/
const luaL_Reg lPoller_get[];
const luaL_Reg lPoller_fn[];
@@ -1150,10 +986,11 @@ const Edje_Lua_Reg *cPoller[] = {
NULL // sentinel
};
-static int
+static Eina_Bool
_edje_lua_poller_cb(void *data)
{
- int err, res;
+ Eina_Bool res;
+ int err;
Edje_Lua_Poller *obj = data;
lua_State *L = obj->L;
@@ -1163,7 +1000,7 @@ _edje_lua_poller_cb(void *data)
if ((err = lua_pcall(L, 1, 1, 0)))
{
_edje_lua_error(L, err);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
res = luaL_checkint(L, -1);
@@ -1196,11 +1033,6 @@ _edje_lua_poller_get_interval(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Poller.interval
-*/
const luaL_Reg lPoller_get[] = {
{"interval", _edje_lua_poller_get_interval},
{NULL, NULL}
@@ -1226,11 +1058,6 @@ _edje_lua_poller_fn_del(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li Poller:del()
-*/
const luaL_Reg lPoller_fn[] = {
{"del", _edje_lua_poller_fn_del},
{NULL, NULL}
@@ -1412,36 +1239,6 @@ const luaL_Reg lTransition_fn[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Object,General Object Class}
-
-This is the base class, many other classes are children of this.
-
-You can attach event callbacks to this class using a classic c approach:
-@code
-function mouse_move_cb(self, ...)
- print("mouse_move", ...)
-end
-
-rect = ed:rectangle()
-rect.mouse_events = true
-rect.mouse_move = mouse_move_cb
-@endcode
-or you can also do the same in a more lua-fashion style
-@code
-rect = ed:rectangle {
- mouse_events = true,
- mouse_move = function (self, ...)
- print ('mouse_move', ...)
- end
-}
-@endcode
-
-
-@seealso{Evas Object Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Group.html}
-*/
-
const luaL_Reg lObject_get[];
const luaL_Reg lObject_set[];
@@ -1456,8 +1253,7 @@ const Edje_Lua_Reg mObject = {
};
static void
-_edje_lua_object_del_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info)
+_edje_lua_object_del_cb(void *data, __UNUSED__ Evas * e, Evas_Object * obj, __UNUSED__ void *event_info)
{
//printf("_edje_lua_object_delete_cb\n");
lua_State *L = data;
@@ -1563,20 +1359,6 @@ _edje_lua_object_fn_clip_unset(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li Object:del()
-@li Object:show()
-@li Object:hide()
-@li Object:move(x, y)
-@li Object:resize(w, h)
-@li Object:raise()
-@li Object:lower()
-@li Object:stack_above()
-@li Object:stack_below()
-@li Object:clip_unset()
-*/
const luaL_Reg lObject_fn[] = {
{"del", _edje_lua_object_fn_del},
{"show", _edje_lua_object_fn_show},
@@ -1909,39 +1691,6 @@ _edje_lua_object_get_mouse_events(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Object.name
-@li Object.geometry: (x, y, width, height)
-@li Object.type: object type (RECT=1, TEXT, IMAGE, SWALLOW, TEXTBLOCK, GRADIENT, GROUP, BOX, TABLE, EXTERNAL)
-@li Object.layer
-@li Object.above
-@li Object.below
-@li Object.size_hint_min: (w,h)
-@li Object.size_hint_max: (w,h)
-@li Object.size_hint_request: (w,h)
-@li Object.size_hint_aspect: (aspect, w, h)
-@li Object.size_hint_align: (w,h)
-@li Object.size_hint_weight: (w,h)
-@li Object.size_hint_padding: (l,r,t,b)
-@li Object.visible
-@li Object.render_op
-@li Object.anti_alias
-@li Object.scale
-@li Object.color: (r, g, b, alpha)
-@li Object.color_interpolation
-@li Object.clip
-@li Object.clipees
-@li Object.evas (not implemeted, always return nil)
-@li Object.pass_events
-@li Object.repeat_events
-@li Object.propagate_events
-@li Object.focus
-@li Object.pointer_mode
-@li Object.precise_is_inside
-@li Object.mouse_events
-*/
const luaL_Reg lObject_get[] = {
{"name", _edje_lua_object_get_name},
{"geometry", _edje_lua_object_get_geometry},
@@ -2206,7 +1955,7 @@ _edje_lua_object_set_precise_is_inside(lua_State *L)
lua_insert(L, -2);
static void
-_edje_lua_object_cb_mouse_in(void *data, Evas * e, Evas_Object * obj,
+_edje_lua_object_cb_mouse_in(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
void *event_info)
{
OBJECT_CB_MACRO("mouse_in");
@@ -2223,7 +1972,7 @@ _edje_lua_object_cb_mouse_in(void *data, Evas * e, Evas_Object * obj,
}
static void
-_edje_lua_object_cb_mouse_out(void *data, Evas * e, Evas_Object * obj,
+_edje_lua_object_cb_mouse_out(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
void *event_info)
{
OBJECT_CB_MACRO("mouse_out");
@@ -2240,7 +1989,7 @@ _edje_lua_object_cb_mouse_out(void *data, Evas * e, Evas_Object * obj,
}
static void
-_edje_lua_object_cb_mouse_down(void *data, Evas * e, Evas_Object * obj,
+_edje_lua_object_cb_mouse_down(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
void *event_info)
{
OBJECT_CB_MACRO("mouse_down");
@@ -2258,7 +2007,7 @@ _edje_lua_object_cb_mouse_down(void *data, Evas * e, Evas_Object * obj,
}
static void
-_edje_lua_object_cb_mouse_up(void *data, Evas * e, Evas_Object * obj,
+_edje_lua_object_cb_mouse_up(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
void *event_info)
{
OBJECT_CB_MACRO("mouse_up");
@@ -2276,7 +2025,7 @@ _edje_lua_object_cb_mouse_up(void *data, Evas * e, Evas_Object * obj,
}
static void
-_edje_lua_object_cb_mouse_move(void *data, Evas * e, Evas_Object * obj,
+_edje_lua_object_cb_mouse_move(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
void *event_info)
{
OBJECT_CB_MACRO("mouse_move");
@@ -2294,7 +2043,7 @@ _edje_lua_object_cb_mouse_move(void *data, Evas * e, Evas_Object * obj,
}
static void
-_edje_lua_object_cb_mouse_wheel(void *data, Evas * e, Evas_Object * obj,
+_edje_lua_object_cb_mouse_wheel(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
void *event_info)
{
OBJECT_CB_MACRO("mouse_wheel");
@@ -2339,32 +2088,6 @@ _edje_lua_object_set_mouse_events(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Object.name
-@li Object.layer
-@li Object.size_hint_min: (w,h)
-@li Object.size_hint_max: (w,h)
-@li Object.size_hint_request: (w,h)
-@li Object.size_hint_aspect: (w,h)
-@li Object.size_hint_align: (w,h)
-@li Object.size_hint_weight: (w,h)
-@li Object.size_hint_padding: (l,r,t,b)
-@li Object.render_op
-@li Object.anti_alias
-@li Object.scale
-@li Object.color: (r, g, b, alpha)
-@li Object.color_interpolation
-@li Object.clip
-@li Object.pass_events
-@li Object.repeat_events
-@li Object.propagate_events
-@li Object.focus
-@li Object.pointer_mode
-@li Object.precise_is_inside
-@li Object.mouse_events
-*/
const luaL_Reg lObject_set[] = {
{"name", _edje_lua_object_set_name},
{"layer", _edje_lua_object_set_layer},
@@ -2390,16 +2113,6 @@ const luaL_Reg lObject_set[] = {
{"mouse_events", _edje_lua_object_set_mouse_events},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@events
-@li Object.mouse_in: func(self,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_out: func(self,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_down: func(self,button,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_up: func(self,button,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_move: func(self,buttons,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_wheel: func(self,z,output_x,output_y,canvas_x,canvas_y)
-*/
const Edje_Lua_Reg *cRectangle[] = {
&mClass,
@@ -2407,11 +2120,6 @@ const Edje_Lua_Reg *cRectangle[] = {
NULL // sentinel
};
-/**
-@page luaref
-@luaclass{Image,Image Class}
-@seealso{Evas Object Image Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Image.html}
-*/
const luaL_Reg lImage_get[];
const luaL_Reg lImage_set[];
@@ -2444,11 +2152,6 @@ _edje_lua_image_get_size(lua_State *L)
return 1;
};
-/**
-@page luaref
-@attributes
-@li Image.size: (w,h)
-*/
const luaL_Reg lImage_get[] = {
{"size", _edje_lua_image_get_size},
{NULL, NULL} // sentinel
@@ -2460,7 +2163,7 @@ _edje_lua_image_set_file(lua_State *L)
Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
int id = edje_edit_image_id_get(obj->ed->obj, luaL_checkstring(L, 2));
char buf[256];
- sprintf(buf, "images/%i", id);
+ sprintf(buf, "edje/images/%i", id);
evas_object_image_file_set(obj->eo, obj->ed->path, buf);
return 0;
}
@@ -2498,14 +2201,6 @@ _edje_lua_image_set_alpha(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Image.file
-@li Image.fill: (x,y,w,h)
-@li Image.fill_transform
-@li Image.alpha
-*/
const luaL_Reg lImage_set[] = {
{"file", _edje_lua_image_set_file},
{"fill", _edje_lua_image_set_fill},
@@ -2514,11 +2209,6 @@ const luaL_Reg lImage_set[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Line,Line Class}
-@seealso{Evas Object Line Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Line__Group.html}
-*/
const luaL_Reg lLine_get[];
const luaL_Reg lLine_set[];
@@ -2550,11 +2240,6 @@ _edje_lua_line_get_xy(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Line.xy: (x1,y1,x2,y2)
-*/
const luaL_Reg lLine_get[] = {
{"xy", _edje_lua_line_get_xy},
{NULL, NULL} // sentinel
@@ -2577,21 +2262,11 @@ _edje_lua_line_set_xy(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Line.xy: (x1,y1,x2,y2)
-*/
const luaL_Reg lLine_set[] = {
{"xy", _edje_lua_line_set_xy},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Polygon,Polygon Class}
-@seealso{Evas Object Polygon Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Polygon.html}
-*/
const luaL_Reg lPolygon_fn[];
const Edje_Lua_Reg mPolygon = {
@@ -2626,23 +2301,12 @@ _edje_lua_polygon_fn_points_clear(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li Polygon:point_add(x,y)
-@li Polygon:points_clear()
-*/
const luaL_Reg lPolygon_fn[] = {
{"point_add", _edje_lua_polygon_fn_point_add},
{"points_clear", _edje_lua_polygon_fn_points_clear},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Table,Table Class}
-@seealso{Evas Object Table Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Table.html}
-*/
const luaL_Reg lTable_get[];
const luaL_Reg lTable_set[];
@@ -2731,15 +2395,6 @@ _edje_lua_table_get_children(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Table.homogeneous
-@li Table.padding: (horiz,vert)
-@li Table.align: (horiz,vert)
-@li Table.col_row_size: (cols,rows)
-@li Table.children
-*/
const luaL_Reg lTable_get[] = {
{"homogeneous", _edje_lua_table_get_homogeneous},
{"padding", _edje_lua_table_get_padding},
@@ -2784,13 +2439,6 @@ _edje_lua_table_set_align(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Table.homogeneous
-@li Table.padding: (horiz,vert)
-@li Table.align: (horiz,vert)
-*/
const luaL_Reg lTable_set[] = {
{"homogeneous", _edje_lua_table_set_homogeneous},
{"padding", _edje_lua_table_set_padding},
@@ -2830,13 +2478,6 @@ _edje_lua_table_fn_clear(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li Table.pack(child,col,row,colspan,rowspan)
-@li Table.unpack(child)
-@li Table.clear(clear)
-*/
const luaL_Reg lTable_fn[] = {
{"pack", _edje_lua_table_fn_pack},
{"unpack", _edje_lua_table_fn_unpack},
@@ -2844,11 +2485,6 @@ const luaL_Reg lTable_fn[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Description,Description Class}
-*/
-
const luaL_Reg lDescription_get[];
const luaL_Reg lDescription_set[];
@@ -3318,41 +2954,6 @@ _edje_lua_description_get_visible(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Description.alignment: (x,y)
-@li Description.min: (w,h)
-@li Description.max: (w,h)
-@li Description.step: (w,h)
-@li Description.aspect: (x,y)
-@li Description.aspect_pref
-@li Description.color: (r,g,b,a)
-@li Description.color2: (r,g,b,a)
-@li Description.color3: (r,g,b,a)
-@li Description.color_class
-@li Description.rel1: (x,y)
-@li Description.rel1_to: (to_x,to_y)
-@li Description.rel1_offset: (x,y)
-@li Description.rel2: (x,y)
-@li Description.rel2_to: (to_x,to_y)
-@li Description.rel2_offset: (x,y)
-@li Description.image (not yet implemented)
-@li Description.border: (l,r,t,b)
-@li Description.fill_smooth
-@li Description.fill_pos: (rel_x,rel_y,offset_x,offset_y)
-@li Description.fill_size: (rel_x,rel_y,offset_x,offset_y)
-@li Description.text
-@li Description.text_class
-@li Description.text_font
-@li Description.text_style
-@li Description.text_size
-@li Description.text_fit: (x,y)
-@li Description.text_min: (x,y)
-@li Description.text_max: (x,y)
-@li Description.text_align: (x,y)
-@li Description.visible
-*/
const luaL_Reg lDescription_get[] = {
{"alignment", _edje_lua_description_get_alignment},
{"min", _edje_lua_description_get_min},
@@ -3844,41 +3445,6 @@ _edje_lua_description_set_visible(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Description.alignment: (x,y)
-@li Description.min: (w,h)
-@li Description.max: (w,h)
-@li Description.step: (w,h)
-@li Description.aspect: (x,y)
-@li Description.aspect_pref
-@li Description.color: (r,g,b,a)
-@li Description.color2: (r,g,b,a)
-@li Description.color3: (r,g,b,a)
-@li Description.color_class
-@li Description.rel1: (x,y)
-@li Description.rel1_to: (to_x,to_y)
-@li Description.rel1_offset: (x,y)
-@li Description.rel2: (x,y)
-@li Description.rel2_to: (to_x,to_y)
-@li Description.rel2_offset: (x,y)
-@li Description.image
-@li Description.border: (l,r,t,b)
-@li Description.fill_smooth
-@li Description.fill_pos: (rel_x,rel_y,offset_x,offset_y)
-@li Description.fill_size: (rel_x,rel_y,offset_x,offset_y)
-@li Description.text
-@li Description.text_class
-@li Description.text_font
-@li Description.text_style
-@li Description.text_size
-@li Description.text_fit: (x,y)
-@li Description.text_min: (x,y)
-@li Description.text_max: (x,y)
-@li Description.text_align: (x,y)
-@li Description.visible
-*/
const luaL_Reg lDescription_set[] = {
{"alignment", _edje_lua_description_set_alignment},
{"min", _edje_lua_description_set_min},
@@ -3914,14 +3480,6 @@ const luaL_Reg lDescription_set[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Part,Part Class}
-
-Parts are objects, that is, they inherit the methods from the @ref Object class.
-They also contain the following methods and attributes:
-
-*/
const luaL_Reg lPart_get[];
const luaL_Reg lPart_set[];
@@ -3936,8 +3494,8 @@ const Edje_Lua_Reg mPart = {
};
static void
-_edje_lua_edje_part_del_cb(void *data, Evas * e, Evas_Object * obj,
- void *event_info)
+_edje_lua_edje_part_del_cb(void *data, __UNUSED__ Evas * e, Evas_Object * obj,
+ __UNUSED__ void *event_info)
{
//printf("_edje_lua_object_delete_cb\n");
lua_State *L = data;
@@ -4161,26 +3719,6 @@ _edje_lua_part_get_table_col_row_size(lua_State *L)
static int _edje_lua_part_fn_custom_state(lua_State *L);
-/**
-@page luaref
-@attributes
-@li @ref Object Part.swallow
-@li Part.drag_dir
-@li Part.drag_value: (dx,dy)
-@li Part.drag_size: (dx,dy)
-@li Part.drag_step: (dx,dy)
-@li Part.drag_page: (dx,dy)
-@li Part.type
-@li Part.effect
-@li Part.mouse_events
-@li Part.states_list
-@li Part.state: (state,value)
-@li Part.text
-@li Part.text_selection
-@li Part.text_cursor_geometry: (x,y,w,h)
-@li Part.geometry: (x,y,w,h)
-@li Part.part_col_row_size: (cols,rows)
-*/
const luaL_Reg lPart_get[] = {
{"custom_state", _edje_lua_part_fn_custom_state},
{"Swallow", _edje_lua_part_get_swallow}, //TODO it the capital S correct?
@@ -4322,20 +3860,6 @@ _edje_lua_part_set_drag_page(lua_State *L)
return 0;
}
-/**
-@page luaref
-@setters
-@li Part.drag_value: (dx,dy)
-@li Part.drag_size: (dx,dy)
-@li Part.drag_step: (dx,dy)
-@li Part.drag_page: (dx,dy)
-@li Part.effect
-@li Part.mouse_events
-@li Part.repeat_events
-@li Part.state: (state,value)
-@li Part.tween_state
-@li Part.text
-*/
const luaL_Reg lPart_set[] = {
{"drag_value", _edje_lua_part_set_drag_value},
{"drag_size", _edje_lua_part_set_drag_size},
@@ -4566,26 +4090,6 @@ _edje_lua_part_fn_box_remove_all(lua_State *L)
return 1;
}
-/**
-@page luaref
-@methods
-@li Part:swallow(obj)
-@li Part:unswallow()
-@li @ref PartDescription Part:custom_state(state_name, state_val)
-@li Part:text_select_none
-@li Part:text_select_all
-@li Part:text_insert(text)
-@li Part:table_pack(child, row, colspan, rowspan)
-@li Part:table_unpack(child)
-@li Part:table_clear(clear)
-@li Part:box_append(item)
-@li Part:box_prepend(item)
-@li Part:box_insert_before(item, before)
-@li Part:box_insert_at(item, index)
-@li Part:box_remove(item)
-@li Part:box_remove_at(item, index)
-@li Part:box_remove_all(clear)
-*/
const luaL_Reg lPart_fn[] = {
{"swallow", _edje_lua_part_fn_swallow},
{"unswallow", _edje_lua_part_fn_unswallow},
@@ -4610,14 +4114,6 @@ const luaL_Reg lPart_fn[] = {
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Group,Group Class}
-
-Groups are objects, that is, they inherit the methods from the general
-@ref Object Class.
-They also contain the following methods and attributes:
-*/
const luaL_Reg lGroup_mt[];
const luaL_Reg lGroup_get[];
@@ -4805,21 +4301,6 @@ _edje_lua_group_get_frametime(lua_State *L)
return 1;
}
-/**
-@page luaref
-@attributes
-@li Group.group
-@li Group.mouse: (x,y)
-@li Group.mouse_buttons
-@li Group.size_min: (w,h)
-@li Group.size_max: (w,h)
-@li Group.scale
-@li Group.load_error
-@li Group.load_error_str
-@li Group.play
-@li Group.animation
-@li Group.frametime
-*/
const luaL_Reg lGroup_get[] = {
{"group", _edje_lua_group_get_group},
{"mouse", _edje_lua_group_get_mouse},
@@ -4925,18 +4406,6 @@ _edje_lua_group_set_frametime(lua_State *L)
edje_frametime_set(luaL_checknumber(L, 2));
return 0;
}
-/**
-@page luaref
-@setters
-@li Group.group
-@li Group.size_min: (w,h)
-@li Group.size_max: (w,h)
-@li Group.scale
-@li Group.play
-@li Group.animation
-@li Group.text_change_cb
-@li Group.frametime
-*/
const luaL_Reg lGroup_set[] = {
{"group", _edje_lua_group_set_group},
{"size_min", _edje_lua_group_set_size_min},
@@ -5018,8 +4487,8 @@ _edje_lua_group_fn_poller(lua_State *L)
}
// Only 1 type of poller currently implemented in ecore
- tar->ep = ecore_poller_add(ECORE_POLLER_CORE, interval,
- _edje_lua_poller_cb, tar);
+ tar->ep = ecore_poller_add(ECORE_POLLER_CORE, interval,
+ _edje_lua_poller_cb, tar);
tar->L = L;
_edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_poller_cb/del
tar->cb = _edje_lua_new_ref(L, 3); // freed in _edje_lua_poller_cb/del
@@ -5320,22 +4789,6 @@ _edje_lua_group_fn_thaw(lua_State *L)
return 0;
}
-/**
-@page luaref
-@methods
-@li @ref Timer Group:timer(secs, callback)
-@li @ref Animator Group:animator(func)
-@li @ref Poller Group:poller(interval, callback)
-@li @ref Transform Group:transform()
-@li Group:signal_emit(emission, source)
-@li Group:message_send(message_type, id, msg)
-@li Group:program_run(name)
-@li Group:program_stop(name)
-@li Group:signal_callback_add(emission, source, callback)
-@li Group:signal_callback_del(emission, source)
-@li Group:freeze()
-@li Group:thaw()
-*/
const luaL_Reg lGroup_fn[] = {
{"timer", _edje_lua_group_fn_timer},
{"animator", _edje_lua_group_fn_animator},
@@ -5712,3 +5165,5 @@ _edje_lua_shutdown()
lua_close(Ledje);
Ledje = NULL;
}
+
+#endif // not LUA2
diff --git a/src/lib/edje_lua2.c b/src/lib/edje_lua2.c
index b18fd3a..3db6a59 100644
--- a/src/lib/edje_lua2.c
+++ b/src/lib/edje_lua2.c
@@ -1,3 +1,163 @@
+/**
+ * @page luaref Edje Lua scripting
+ *
+ * @section intro Introduction
+ *
+ * Lua is intended for script-only objects at this point (with embryo left
+ * for augmenting standard programs). Since script-only objects effectively
+ * define objects entirely via Lua script (resize handling, event handling
+ * etc. etc.) this places many more demands on them, and thus a more powerful
+ * language is in order. Lua is that language.
+ *
+ * To get you started, here's an example:
+ * @code
+ * collections {
+ * group { name: "example";
+ * lua_script_only: 1;
+ * lua_script {
+ * --// stick object private/local vars here
+ * local D;
+ * local count = 0;
+ * local fndata = 99;
+ *
+ * local function mycb3 (v)
+ * print("lua::callback transition " .. D.val .. " v: " .. v);
+ * d = {};
+ * edje.size(d);
+ * print("lua::objsize= " .. d.w .. " , " .. d.h);
+ * sz = {w=v * 80, h=v * 40};
+ * D.rect:geom(((d.w / 2) * math.sin(v * 2 * math.pi)) + ((d.w - sz.w) / 2),
+ * ((d.h / 2) * math.cos(v * 2 * math.pi)) + ((d.h - sz.h) / 2),
+ * sz.w, sz.h);
+ * D.rect:color(255, 128, v * 255, 255);
+ * D.rect:move(d);
+ * print("lua::pos= " .. d.x .. " , " .. d.y);
+ *
+ * r = D.rect:above();
+ * if (r ~= nil) then
+ * print("lua::rcol");
+ * r:color(20, v * 255, 60, 255);
+ * else
+ * print("lua::r none!!!!!!!!!!!!!!1");
+ * end
+ * d = edje.size();
+ * D.clip:geom(10, 10, d.w - 20, d.h - 20);
+ * c = D.clip:clipees();
+ * for i=1,table.getn(c),1 do
+ * d = c[i]:geom();
+ * print("lua::" .. i .. " geom = " .. d.x .. "," .. d.y .. " " .. d.w .. "x" .. d.h);
+ * end
+ * return true;
+ * end
+ *
+ * local function mycb2 ()
+ * print("lua::callback animator " .. count);
+ * print("lua:: seconds: " .. edje.seconds());
+ * print("lua:: looptime: " .. edje.looptime());
+ * local date = edje.date();
+ * print("lua:: date: " ..
+ * date.year .. "|" ..
+ * date.month .. "|" ..
+ * date.day .. "|" ..
+ * date.yearday .. "|" ..
+ * date.weekday .. "|" ..
+ * date.hour .. "|" ..
+ * date.min .. "|" ..
+ * date.sec
+ * );
+ * return true;
+ * end
+ *
+ * local function mycb ()
+ * print("lua::callback " .. count .. " fndata = " .. fndata);
+ * count = count + 1; --// keep count of calls - object data
+ * fndata = fndata + 3; --// play with object vars to see if they persist
+ * D.tim = edje.timer(0.25, mycb); --// inside cb add new timer
+ * D.ani = edje.animator(mycb2);
+ * return false; --// cease repeating the timer
+ * end
+ *
+ * --// init object here
+ * D = {}; --// data is empty table to start
+ * D.val = math.random(); --// start with soem random value so
+ * fndata = fndata + D.val; --// func data start point
+ * print("lua::init ... " .. D.val);
+ * edje.echo("lua::echo('hello world')");
+ * --// actually add the timer to call mycb in 1.23 sec
+ * D.tim = edje.timer(1.23, mycb);
+ * D.tra = edje.transition(5.0, mycb3);
+ *
+ * if (edje.spanky) then edje.spanky(); end
+ *
+ * edje.messagesend(7, "none" );
+ * edje.messagesend(7, "sig", "signal", "source");
+ * edje.messagesend(7, "str", "hello world");
+ * edje.messagesend(7, "int", 987);
+ * edje.messagesend(7, "float", 987.321);
+ * edje.messagesend(7, "strset", {"hello", "there", "world"});
+ * edje.messagesend(7, "intset", {1, 2, 3});
+ * edje.messagesend(7, "floatset", {1.1, 2.2, 3.3});
+ * edje.messagesend(7, "strint", "hello world", 7);
+ * edje.messagesend(7, "strfloat", "hello world", 7.654);
+ * edje.messagesend(7, "strintset","hello world", {1, 2, 3});
+ *
+ * D.rect = edje.rect();
+ * D.rect:geom (5, 10, 50, 30);
+ * D.rect:color (255, 128, 60, 255);
+ * D.rect:show ();
+ *
+ * D.rect2 = edje.rect();
+ * D.rect2:geom (50, 50, 50, 50);
+ * D.rect2:color (20, 30, 60, 120);
+ * D.rect2:show ();
+ *
+ * D.clip = edje.rect();
+ * D.clip:geom (10, 10, 150, 150);
+ * D.clip:color (200, 200, 50, 200);
+ * D.clip:show ();
+ *
+ * D.rect2:clip(D.clip);
+ * D.rect:clip(D.clip);
+ *
+ * --// example of deleting something
+ * --// D.tim:del();
+ *
+ * --// shutdown func - generally empty or not there. everything gcd for you
+ * function shutdown ()
+ * print("lua::shutdown ... " .. D.val);
+ * end
+ * function show ()
+ * print("lua::show ... " .. D.val);
+ * end
+ * function hide ()
+ * print("lua::hide ... " .. D.val);
+ * end
+ * function move (x, y)
+ * print("lua::move ... " .. D.val);
+ * print(" x=" .. x .. " x=" .. y);
+ * end
+ * function resize (w, h)
+ * print("lua::resize ... " .. D.val);
+ * print(" w=" .. w .. " h=" .. h);
+ * end
+ * function message (id, type, v1, v2)
+ * print("lua::message ... " .. D.val);
+ * print(" id=" .. id .. " type=" .. type);
+ * --// handle youre message type here. chekc id + type then use v1
+ * --// and/or v2 (or neither) appropriately. they are the same as
+ * --// the 2nd and 3rd param passed to edje.messagesend() (if any
+ * --// are passed at all)
+ * end
+ * function signal (sig, src)
+ * print("lua::signal ... " .. D.val);
+ * print(" sig=" .. sig .. " src=" .. src);
+ * end
+ * }
+ * }
+ * }
+ * @endcode
+ *
+ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -29,10 +189,12 @@ extern "C"
//--------------------------------------------------------------------------//
-typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc;
-typedef struct _Edje_Lua_Obj Edje_Lua_Obj;
-typedef struct _Edje_Lua_Timer Edje_Lua_Timer;
-typedef struct _Edje_Lua_Anim Edje_Lua_Anim;
+typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc;
+typedef struct _Edje_Lua_Obj Edje_Lua_Obj;
+typedef struct _Edje_Lua_Timer Edje_Lua_Timer;
+typedef struct _Edje_Lua_Animator Edje_Lua_Animator;
+typedef struct _Edje_Lua_Transition Edje_Lua_Transition;
+typedef struct _Edje_Lua_Evas_Object Edje_Lua_Evas_Object;
//--------------------------------------------------------------------------//
struct _Edje_Lua_Alloc
@@ -46,6 +208,7 @@ struct _Edje_Lua_Obj
Edje *ed;
void (*free_func) (void *obj);
+ Eina_Bool is_evas_obj : 1;
};
struct _Edje_Lua_Timer
@@ -55,13 +218,28 @@ struct _Edje_Lua_Timer
int fn_ref;
};
-struct _Edje_Lua_Anim
+struct _Edje_Lua_Animator
{
Edje_Lua_Obj obj;
- Ecore_Animator *anim;
+ Ecore_Animator *animator;
int fn_ref;
};
+struct _Edje_Lua_Transition
+{
+ Edje_Lua_Obj obj;
+ Ecore_Animator *animator;
+ double transition, start;
+ int fn_ref;
+};
+
+struct _Edje_Lua_Evas_Object
+{
+ Edje_Lua_Obj obj;
+ Evas_Object *evas_obj;
+ int x, y, w, h;
+};
+
//--------------------------------------------------------------------------//
static int _elua_obj_gc(lua_State *L);
@@ -70,36 +248,173 @@ static int _elua_obj_del(lua_State *L);
static int _elua_echo(lua_State *L);
static int _elua_timer(lua_State *L);
-static int _elua_anim(lua_State *L);
+static int _elua_animator(lua_State *L);
+static int _elua_transition(lua_State *L);
+static int _elua_seconds(lua_State *L);
+static int _elua_looptime(lua_State *L);
+static int _elua_date(lua_State *L);
+
+static int _elua_emit(lua_State *L);
+static int _elua_messagesend(lua_State *L);
+
+static int _elua_objpos(lua_State *L);
+static int _elua_objsize(lua_State *L);
+static int _elua_objgeom(lua_State *L);
+
+static int _elua_show(lua_State *L);
+static int _elua_hide(lua_State *L);
+static int _elua_visible(lua_State *L);
+static int _elua_move(lua_State *L);
+static int _elua_resize(lua_State *L);
+static int _elua_pos(lua_State *L);
+static int _elua_size(lua_State *L);
+static int _elua_geom(lua_State *L);
+static int _elua_raise(lua_State *L);
+static int _elua_lower(lua_State *L);
+static int _elua_above(lua_State *L);
+static int _elua_below(lua_State *L);
+static int _elua_top(lua_State *L);
+static int _elua_bottom(lua_State *L);
+static int _elua_color(lua_State *L);
+static int _elua_clip(lua_State *L);
+static int _elua_unclip(lua_State *L);
+static int _elua_clipees(lua_State *L);
+static int _elua_type(lua_State *L);
+static int _elua_pass(lua_State *L);
+static int _elua_repeat(lua_State *L);
+static int _elua_precise(lua_State *L);
+
+static int _elua_rect(lua_State *L);
+
+#define ELO "|-ELO"
//--------------------------------------------------------------------------//
static lua_State *lstate = NULL;
+static jmp_buf panic_jmp;
+// FIXME: methods lua scrupt can provide that edje will call (not done yet):
+// // scale set
+// // key down
+// // key up
+// // get dragable pos
+// // set dragable pos
+// // set drag size, step, page
+// // get drag size, step, page
+// // dragable step
+// // dragable page
+// // get part text
+// // set part text
+// // get swallow part
+// // set swallow part
+// // unswallow part
+// // textclass change
+// // colorclass change
+// // min size get <- ?? maybe set fn
+// // max size get <- ?? maybe set fn
+// // min size caclc (min/max restriction)
+// // preload
+// // preload cancel
+// // play set
+// // animation set
+// // parts extends calc
+// // part object get
+// // part geometry get
+//
+// // LATER: all the entry calls
+// // LATER: box and table calls
+// // LATER: perspective stuff change
+//
static const struct luaL_reg _elua_edje_api [] =
{
- {"echo", _elua_echo}, // test func - echo (i know we have print. test)
+ // add an echo too to make it more shelly
+ {"echo", _elua_echo}, // test func - echo (i know we have print. test)
+
+ // time based "callback" systems
+ {"timer", _elua_timer}, // add timer
+ {"animator", _elua_animator}, // add animator
+ {"transition", _elua_transition}, // add transition
+ // FIXME: need poller
+
+ // system information (time, date blah blah)
+ {"seconds", _elua_seconds}, // get seconds
+ {"looptime", _elua_looptime}, // get loop time
+ {"date", _elua_date}, // get date in a table
+
+ // talk to application/caller
+ {"emit", _elua_emit}, // emit signal + src
+ {"messagesend", _elua_messagesend}, // send a structured message
+
+ // query edje - size, pos
+ {"pos", _elua_objpos}, // get while edje object pos in canvas
+ {"size", _elua_objsize}, // get while edje object pos in canvas
+ {"geom", _elua_objgeom}, // get while edje object geometry in canvas
+
+ // FIXME: query color classes
+ // FIXME: query text classes
+
+ {"rect", _elua_rect}, // new rect
+ // FIXME: need image(filled, normal), text, textblock, edje
+
+ {NULL, NULL} // end
+};
+
+static const struct luaL_reg _elua_edje_evas_obj [] =
+{
+ // generic object methods
+ {"del", _elua_obj_del}, // generic del any object created for edje (evas objects, timers, animators, transitions... everything)
- {"del", _elua_obj_del}, // generic del any object created for edje
+ // now evas stuff (manipulate, delete etc.)
+ {"show", _elua_show}, // show, return current visibility
+ {"hide", _elua_hide}, // hide, return current visibility
+ {"visible", _elua_visible}, // get object visibility
+ {"move", _elua_move}, // move, return current position
+ {"resize", _elua_resize}, // resize, return current size
+ {"pos", _elua_pos}, // move, return current position
+ {"size", _elua_size}, // resize, return current size
+ {"geom", _elua_geom}, // move and resize and return current geometry
- {"timer", _elua_timer}, // add timer
- {"anim", _elua_anim}, // add animator (not done yet)
+ {"raise", _elua_raise}, // raise to top
+ {"lower", _elua_lower}, // lower to bottom
+ {"above", _elua_above}, // get object above or stack obj above given obj
+ {"below", _elua_below}, // get object below or stack obj below given obj
+ {"top", _elua_top}, // get top
+ {"bottom", _elua_bottom}, // get bottom
+ {"color", _elua_color}, // set color, return color
+ {"clip", _elua_clip}, // set clip obj, return clip object
+ {"unclip", _elua_unclip}, // clear clip obj
+ {"clipees", _elua_clipees}, // get clip children
+ {"type", _elua_type}, // get object type
+ {"pass", _elua_pass}, // set pass events, get pass events
+ {"repeat", _elua_repeat}, // set repeat events, get repeat events
+ {"precise", _elua_precise}, // set precise inside flag, get precise
+ // FIXME: set callbacks (mouse down, up, blah blah blah)
+ //
+ // FIXME: set scale (explicit value)
+ // FIXME: need to set auto-scale (same as scale: 1)
+ // FIXME: later - set render op, anti-alias, pointer mode (autograb, nograb)
+ // FIXME: later -
+
+ // FIXME: map api here
+
{NULL, NULL} // end
};
+
static const struct luaL_reg _elua_edje_meta [] =
{
{"__gc", _elua_obj_gc}, // garbage collector func for edje objects
{NULL, NULL} // end
};
+
static const luaL_Reg _elua_libs[] =
{
{"", luaopen_base},
// {LUA_LOADLIBNAME, luaopen_package}, // disable this lib - don't want
{LUA_TABLIBNAME, luaopen_table},
// {LUA_IOLIBNAME, luaopen_io}, // disable this lib - don't want
- {LUA_OSLIBNAME, luaopen_os},
+ {LUA_OSLIBNAME, luaopen_os}, // FIXME: audit os lib - maybe not provide or only provide specific calls
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
// {LUA_DBLIBNAME, luaopen_debug}, // disable this lib - don't want
@@ -107,7 +422,7 @@ static const luaL_Reg _elua_libs[] =
{NULL, NULL} // end
};
static const char *_elua_key = "key";
-
+static const char *_elua_objs = "objs";
//--------------------------------------------------------------------------//
static void *
@@ -131,12 +446,12 @@ _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
ptr2 = realloc(ptr, nsize);
if (ptr2) return ptr2;
- ERR("Edje Lua cannot re-allocate %i bytes\n", nsize);
+ ERR("Edje Lua cannot re-allocate %zu bytes", nsize);
return ptr2;
}
static int
-_elua_custom_panic(lua_State *L)
+_elua_custom_panic(lua_State *L __UNUSED__)
{
ERR("Lua Panic!!!!");
return 1;
@@ -148,7 +463,7 @@ void
_edje_lua2_error_full(const char *file, const char *fnc, int line,
lua_State *L, int err_code)
{
- char *err_type;
+ const char *err_type;
switch (err_code)
{
@@ -178,32 +493,44 @@ _elua_init(void)
{
static Edje_Lua_Alloc ela = { MAX_LUA_MEM, 0 };
const luaL_Reg *l;
+ lua_State *L;
if (lstate) return;
- lstate = lua_newstate(_elua_alloc, &ela); //0
- lua_atpanic(lstate, _elua_custom_panic); //0
+
+ lstate = L = lua_newstate(_elua_alloc, &ela);
+ lua_atpanic(L, _elua_custom_panic);
// FIXME: figure out optimal gc settings later
-// lua_gc(lstate, LUA_GCSETPAUSE, 200); //0
-// lua_gc(lstate, LUA_GCSETSTEPMUL, 200); //0
+// lua_gc(L, LUA_GCSETPAUSE, 200);
+// lua_gc(L, LUA_GCSETSTEPMUL, 200);
for (l = _elua_libs; l->func; l++)
{
- lua_pushcfunction(lstate, l->func);
- lua_pushstring(lstate, l->name);
- lua_call(lstate, 1, 0);
+ lua_pushcfunction(L, l->func);
+ lua_pushstring(L, l->name);
+ lua_call(L, 1, 0);
}
- luaL_register(lstate, "edje", _elua_edje_api); //+1
-
- luaL_newmetatable(lstate, "edje"); //+1
+ luaL_register(L, "edje", _elua_edje_api);
+ luaL_newmetatable(L, "edje");
+ luaL_register(L, 0, _elua_edje_meta);
- luaL_register(lstate, 0, _elua_edje_meta); //0
-
- lua_pushliteral(lstate, "__index"); //+1
- lua_pushvalue(lstate, -3); //+1
- lua_rawset(lstate, -3); //-2
- lua_pop(lstate, 2);
+ luaL_register(L, "edje_evas_obj", _elua_edje_evas_obj);
+ luaL_newmetatable(L, "edje_evas_obj");
+ luaL_register(L, 0, _elua_edje_meta);
+
+ lua_pushliteral(L, "__index");
+ lua_pushvalue(L, -3);
+ lua_rawset(L, -3);
+ lua_pop(L, 2);
+
+ // weak table for our objects
+ lua_pushlightuserdata(L, &_elua_objs);
+ lua_newtable(L);
+ lua_pushstring(L, "__mode");
+ lua_pushstring(L, "v");
+ lua_rawset(L, -3);
+ lua_rawset(L, LUA_REGISTRYINDEX);
}
@@ -211,18 +538,18 @@ _elua_init(void)
static void
_elua_table_ptr_set(lua_State *L, const void *key, const void *val)
{
- lua_pushlightuserdata(L, (void *)key); //+1
- lua_pushlightuserdata(L, (void *)val); //+1
- lua_settable(L, LUA_REGISTRYINDEX); //-2
+ lua_pushlightuserdata(L, (void *)key);
+ lua_pushlightuserdata(L, (void *)val);
+ lua_settable(L, LUA_REGISTRYINDEX);
}
static const void *
_elua_table_ptr_get(lua_State *L, const void *key)
{
const void *ptr;
- lua_pushlightuserdata(L, (void *)key); //+1
- lua_gettable(L, LUA_REGISTRYINDEX); //0
- ptr = lua_topointer(L, -1); //0
+ lua_pushlightuserdata(L, (void *)key);
+ lua_gettable(L, LUA_REGISTRYINDEX);
+ ptr = lua_topointer(L, -1);
lua_pop(L, 1);
return ptr;
}
@@ -230,34 +557,65 @@ _elua_table_ptr_get(lua_State *L, const void *key)
static void
_elua_table_ptr_del(lua_State *L, const void *key)
{
- lua_pushlightuserdata(L, (void *)key); //+1
- lua_pushnil(L); //+1
- lua_settable(L, LUA_REGISTRYINDEX); //-2
+ lua_pushlightuserdata(L, (void *)key);
+ lua_pushnil(L);
+ lua_settable(L, LUA_REGISTRYINDEX);
}
static void
_elua_gc(lua_State *L)
{
- lua_gc(L, LUA_GCCOLLECT, 0); //0
+ lua_gc(L, LUA_GCCOLLECT, 0);
}
//-------------
+/**
+ * Cori: Assumes object to be saved on top of stack
+ */
+static void
+_elua_ref_set(lua_State *L, void *key)
+{
+ lua_pushlightuserdata(L, &_elua_objs);
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ lua_pushlightuserdata(L, key);
+ lua_pushvalue(L,-3); // key & obj table & obj
+ lua_rawset(L, -3);
+ lua_pop(L, 1); // pop obj table
+}
+
+/**
+ * Cori: Get an object from the object table
+ */
+static void *
+_elua_ref_get(lua_State *L, void *key)
+{
+ lua_pushlightuserdata(L, &_elua_objs);
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ lua_pushlightuserdata(L, key);
+ lua_rawget(L, -2);
+ lua_remove(L, -2); // kill obj table
+ return lua_touserdata(L, -2);
+}
+
static Edje_Lua_Obj *
_elua_obj_new(lua_State *L, Edje *ed, int size)
{
Edje_Lua_Obj *obj;
-
- obj = (Edje_Lua_Obj *)lua_newuserdata(L, size); //+1
+
+ obj = (Edje_Lua_Obj *)lua_newuserdata(L, size);
memset(obj, 0, size);
ed->lua_objs = eina_inlist_append(ed->lua_objs, EINA_INLIST_GET(obj));
- luaL_getmetatable(L, "edje"); //+1
- lua_setmetatable(L, -2); //-1
+
+ luaL_getmetatable(L, "edje_evas_obj");
+ lua_setmetatable(L, -2);
obj->ed = ed;
+
+ _elua_ref_set(L, obj);
return obj;
}
static void
-_elua_obj_free(lua_State *L, Edje_Lua_Obj *obj)
+_elua_obj_free(lua_State *L __UNUSED__, Edje_Lua_Obj *obj)
{
if (!obj->free_func) return;
obj->free_func(obj);
@@ -271,7 +629,7 @@ static int
_elua_obj_gc(lua_State *L)
{
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
- if (!obj) return 0;
+ if (!obj) return 0;
_elua_obj_free(L, obj);
return 0;
}
@@ -282,46 +640,275 @@ _elua_obj_del(lua_State *L)
return _elua_obj_gc(L);
}
+//----------------------------------------------------------------------------
+//-------------------------------------------
+//---------------------------
+//-------------------
+//---------------
+//-------------
+
+void
+_edje_lua2_script_func_shutdown(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "shutdown");
+ if (!lua_isnil(ed->L, -1))
+ {
+ if ((err = lua_pcall(ed->L, 0, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+ _edje_lua2_script_shutdown(ed);
+}
+
+void
+_edje_lua2_script_func_show(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "show");
+ if (!lua_isnil(ed->L, -1))
+ {
+ if ((err = lua_pcall(ed->L, 0, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_hide(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "hide");
+ if (!lua_isnil(ed->L, -1))
+ {
+ if ((err = lua_pcall(ed->L, 0, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_move(Edje *ed)
+{
+ int err;
+
+ // FIXME: move all objects created by script
+ lua_getglobal(ed->L, "move");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushinteger(ed->L, ed->x);
+ lua_pushinteger(ed->L, ed->y);
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_resize(Edje *ed)
+{
+ int err;
+
+ lua_getglobal(ed->L, "resize");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushinteger(ed->L, ed->w);
+ lua_pushinteger(ed->L, ed->h);
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_message(Edje *ed, Edje_Message *em)
+{
+ int err, n, c, i;
+
+ lua_getglobal(ed->L, "message");
+ if (!lua_isnil(ed->L, -1))
+ {
+ n = 2;
+ lua_pushinteger(ed->L, em->id);
+ switch (em->type)
+ {
+ case EDJE_MESSAGE_NONE:
+ lua_pushstring(ed->L, "none");
+ break;
+ case EDJE_MESSAGE_SIGNAL:
+ break;
+ case EDJE_MESSAGE_STRING:
+ lua_pushstring(ed->L, "str");
+ lua_pushstring(ed->L, ((Edje_Message_String *)em->msg)->str);
+ n += 1;
+ break;
+ case EDJE_MESSAGE_INT:
+ lua_pushstring(ed->L, "int");
+ lua_pushinteger(ed->L, ((Edje_Message_Int *)em->msg)->val);
+ n += 1;
+ break;
+ case EDJE_MESSAGE_FLOAT:
+ lua_pushstring(ed->L, "float");
+ lua_pushnumber(ed->L, ((Edje_Message_Float *)em->msg)->val);
+ n += 1;
+ break;
+ case EDJE_MESSAGE_STRING_SET:
+ lua_pushstring(ed->L, "strset");
+ c = ((Edje_Message_String_Set *)em->msg)->count;
+ lua_createtable(ed->L, c, 0);
+ for (i = 0; i < c; i++)
+ {
+ lua_pushstring(ed->L, ((Edje_Message_String_Set *)em->msg)->str[i]);
+ lua_rawseti(ed->L, -2, i + 1);
+ }
+ n += 1;
+ break;
+ case EDJE_MESSAGE_INT_SET:
+ lua_pushstring(ed->L, "intset");
+ c = ((Edje_Message_Int_Set *)em->msg)->count;
+ lua_createtable(ed->L, c, 0);
+ for (i = 0; i < c; i++)
+ {
+ lua_pushinteger(ed->L, ((Edje_Message_Int_Set *)em->msg)->val[i]);
+ lua_rawseti(ed->L, -2, i + 1);
+ }
+ n += 1;
+ break;
+ case EDJE_MESSAGE_FLOAT_SET:
+ lua_pushstring(ed->L, "floatset");
+ c = ((Edje_Message_Float_Set *)em->msg)->count;
+ lua_createtable(ed->L, c, 0);
+ for (i = 0; i < c; i++)
+ {
+ lua_pushnumber(ed->L, ((Edje_Message_Float_Set *)em->msg)->val[i]);
+ lua_rawseti(ed->L, -2, i + 1);
+ }
+ n += 1;
+ break;
+ case EDJE_MESSAGE_STRING_INT:
+ lua_pushstring(ed->L, "strint");
+ lua_pushstring(ed->L, ((Edje_Message_String_Int *)em->msg)->str);
+ lua_pushinteger(ed->L, ((Edje_Message_String_Int *)em->msg)->val);
+ n += 2;
+ break;
+ case EDJE_MESSAGE_STRING_FLOAT:
+ lua_pushstring(ed->L, "strfloat");
+ lua_pushstring(ed->L, ((Edje_Message_String_Float *)em->msg)->str);
+ lua_pushnumber(ed->L, ((Edje_Message_String_Float *)em->msg)->val);
+ n += 2;
+ break;
+ case EDJE_MESSAGE_STRING_INT_SET:
+ lua_pushstring(ed->L, "strintset");
+ lua_pushstring(ed->L, ((Edje_Message_String_Int_Set *)em->msg)->str);
+ c = ((Edje_Message_String_Int_Set *)em->msg)->count;
+ lua_createtable(ed->L, c, 0);
+ for (i = 0; i < c; i++)
+ {
+ lua_pushinteger(ed->L, ((Edje_Message_String_Int_Set *)em->msg)->val[i]);
+ lua_rawseti(ed->L, -2, i + 1);
+ }
+ n += 2;
+ break;
+ case EDJE_MESSAGE_STRING_FLOAT_SET:
+ lua_pushstring(ed->L, "strfloatset");
+ lua_pushstring(ed->L, ((Edje_Message_String_Float_Set *)em->msg)->str);
+ c = ((Edje_Message_String_Float_Set *)em->msg)->count;
+ lua_createtable(ed->L, c, 0);
+ for (i = 0; i < c; i++)
+ {
+ lua_pushnumber(ed->L, ((Edje_Message_String_Float_Set *)em->msg)->val[i]);
+ lua_rawseti(ed->L, -2, i + 1);
+ }
+ n += 2;
+ break;
+ default:
+ break;
+ }
+ if ((err = lua_pcall(ed->L, n, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+void
+_edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src)
+{
+ int err;
+
+ lua_getglobal(ed->L, "signal");
+ if (!lua_isnil(ed->L, -1))
+ {
+ lua_pushstring(ed->L, sig);
+ lua_pushstring(ed->L, src);
+ if ((err = lua_pcall(ed->L, 2, 0, 0)))
+ _edje_lua2_error(ed->L, err);
+ }
+ else
+ lua_pop(ed->L, 1);
+}
+
+//-------------
+//-------------
//-------------
static int
_elua_echo(lua_State *L)
{
- const char *string = luaL_checkstring(L, 1); //0
+ const char *string = luaL_checkstring(L, 1);
printf("%s\n", string);
- return 1;
+ return 0;
}
-
//-------------
-static int
+static Eina_Bool
_elua_timer_cb(void *data)
{
Edje_Lua_Timer *elt = data;
- int ret = 0;
- int err;
+ lua_State *L;
+ int ret = 0, err = 0;
if (!elt->obj.ed) return 0;
- lua_rawgeti(lstate, LUA_REGISTRYINDEX, elt->fn_ref); //+1
- if ((err = lua_pcall(lstate, 0, 1, 0))) //+1
+ L = elt->obj.ed->L;
+ if (!L) return 0;
+ lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref);
+ if (setjmp(panic_jmp) == 1)
+ {
+ ERR("Timer callback panic");
+ _edje_lua2_error(L, err);
+ _elua_obj_free(L, (Edje_Lua_Obj *)elt);
+ _elua_gc(L);
+ return 0;
+ }
+ if ((err = lua_pcall(L, 0, 1, 0)))
{
- _edje_lua2_error(lstate, err); //0
- _elua_obj_free(lstate, (Edje_Lua_Obj *)elt);
- _elua_gc(lstate);
+ _edje_lua2_error(L, err);
+ _elua_obj_free(L, (Edje_Lua_Obj *)elt);
+ _elua_gc(L);
return 0;
}
- ret = luaL_checkint(lstate, -1); //0
- lua_pop(lstate, 1);
- if (ret == 0)
- _elua_obj_free(lstate, (Edje_Lua_Obj *)elt);
- _elua_gc(lstate);
+ ret = lua_toboolean(L, -1);
+ lua_pop(L, 1);
+ if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)elt);
+ _elua_gc(L);
return ret;
}
static void
_elua_timer_free(void *obj)
{
- Edje_Lua_Timer *elt = (Edje_Lua_Timer *)obj;
- luaL_unref(lstate, LUA_REGISTRYINDEX, elt->fn_ref); //0
+ Edje_Lua_Timer *elt = obj;
+ lua_State *L;
+ if (!elt->obj.ed) return;
+ L = elt->obj.ed->L;
+ luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); //0
elt->fn_ref = 0;
ecore_timer_del(elt->timer);
elt->timer = NULL;
@@ -333,68 +920,1113 @@ _elua_timer(lua_State *L)
Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
Edje_Lua_Timer *elt;
double val;
-
+
val = luaL_checknumber(L, 1);
luaL_checkany(L, 2);
- elt = (Edje_Lua_Timer *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Timer)); //+1
+ elt = (Edje_Lua_Timer *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Timer));
elt->obj.free_func = _elua_timer_free;
elt->timer = ecore_timer_add(val, _elua_timer_cb, elt);
- lua_pushvalue(L, 2); //+1
+ lua_pushvalue(L, 2);
+ elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+ _elua_gc(L);
+ return 1;
+}
+
+//-------------
+static Eina_Bool
+_elua_animator_cb(void *data)
+{
+ Edje_Lua_Animator *ela = data;
+ lua_State *L;
+ int ret = 0, err = 0;
+
+ if (!ela->obj.ed) return 0;
+ L = ela->obj.ed->L;
+ if (!L) return 0;
+ lua_rawgeti(L, LUA_REGISTRYINDEX, ela->fn_ref);
+ if (setjmp(panic_jmp) == 1)
+ {
+ ERR("Animator callback panic");
+ _edje_lua2_error(L, err);
+ _elua_obj_free(L, (Edje_Lua_Obj *)ela);
+ _elua_gc(L);
+ return 0;
+ }
+ if ((err = lua_pcall(L, 0, 1, 0)))
+ {
+ _edje_lua2_error(L, err);
+ _elua_obj_free(L, (Edje_Lua_Obj *)ela);
+ _elua_gc(L);
+ return 0;
+ }
+ ret = lua_toboolean(L, -1);
+ lua_pop(L, 1);
+ if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)ela);
+ _elua_gc(L);
+ return ret;
+}
+
+static void
+_elua_animator_free(void *obj)
+{
+ Edje_Lua_Animator *ela = obj;
+ lua_State *L;
+ if (!ela->obj.ed) return;
+ L = ela->obj.ed->L;
+ luaL_unref(L, LUA_REGISTRYINDEX, ela->fn_ref);
+ ela->fn_ref = 0;
+ ecore_animator_del(ela->animator);
+ ela->animator = NULL;
+}
+
+static int
+_elua_animator(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ Edje_Lua_Animator *ela;
+
+ luaL_checkany(L, 1);
+
+ ela = (Edje_Lua_Animator *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Animator));
+ ela->obj.free_func = _elua_animator_free;
+ ela->animator = ecore_animator_add(_elua_animator_cb, ela);
+ lua_pushvalue(L, 1);
+ ela->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+ _elua_gc(L);
+ return 1;
+}
+
+//-------------
+static Eina_Bool
+_elua_transition_cb(void *data)
+{
+ Edje_Lua_Transition *elt = data;
+ lua_State *L;
+ int ret = 0, err = 0;
+ double t;
+
+ if (!elt->obj.ed) return 0;
+ L = elt->obj.ed->L;
+ if (!L) return 0;
+ t = (ecore_loop_time_get() - elt->start) / elt->transition;
+ if (t > 1.0) t = 1.0;
+ lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref);
+ lua_pushnumber(L, t);
+ if (setjmp(panic_jmp) == 1)
+ {
+ ERR("Transition callback panic");
+ _edje_lua2_error(L, err);
+ _elua_obj_free(L, (Edje_Lua_Obj *)elt);
+ _elua_gc(L);
+ return 0;
+ }
+ if ((err = lua_pcall(L, 1, 1, 0)))
+ {
+ _edje_lua2_error(L, err);
+ _elua_obj_free(L, (Edje_Lua_Obj *)elt);
+ _elua_gc(L);
+ return 0;
+ }
+ ret = lua_toboolean(L, -1);
+ lua_pop(L, 1);
+ if (t >= 1.0) ret = 0;
+ if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)elt);
+ _elua_gc(L);
+ return ret;
+}
+
+static void
+_elua_transition_free(void *obj)
+{
+ Edje_Lua_Transition *elt = obj;
+ lua_State *L;
+ if (!elt->obj.ed) return;
+ L = elt->obj.ed->L;
+ luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); //0
+ elt->fn_ref = 0;
+ ecore_animator_del(elt->animator);
+ elt->animator = NULL;
+}
+
+static int
+_elua_transition(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ Edje_Lua_Transition *elt;
+ double val;
+
+ val = luaL_checknumber(L, 1);
+ luaL_checkany(L, 2);
+
+ elt = (Edje_Lua_Transition *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Transition));
+ elt->obj.free_func = _elua_transition_free;
+ elt->animator = ecore_animator_add(_elua_transition_cb, elt);
+ if (val < 0.0000001) val = 0.0000001;
+ elt->transition = val;
+ elt->start = ecore_loop_time_get();
+ lua_pushvalue(L, 2);
elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX);
-// lua_pop(ed->L, 2); // don't pop - return back to lua
- _elua_gc(lstate);
+ _elua_gc(L);
return 1;
}
+//-------------
+static int
+_elua_seconds(lua_State *L)
+{
+ double t = ecore_time_get();
+ lua_pushnumber(L, t);
+ return 1;
+}
+
+//-------------
+static int
+_elua_looptime(lua_State *L)
+{
+ double t = ecore_loop_time_get();
+ lua_pushnumber(L, t);
+ return 1;
+}
//-------------
static int
-_elua_anim(lua_State *L)
+_elua_date(lua_State *L)
+{
+ static time_t last_tzset = 0;
+ struct timeval timev;
+ struct tm *tm;
+ time_t tt;
+
+ lua_newtable(L);
+ gettimeofday(&timev, NULL);
+ tt = (time_t)(timev.tv_sec);
+ if ((tt > (last_tzset + 1)) || (tt < (last_tzset - 1)))
+ {
+ last_tzset = tt;
+ tzset();
+ }
+ tm = localtime(&tt);
+ if (tm)
+ {
+ double t;
+
+ lua_pushstring(L, "year");
+ lua_pushinteger(L, (int)(tm->tm_year + 1900));
+ lua_settable(L, -3);
+ lua_pushstring(L, "month");
+ lua_pushinteger(L, (int)(tm->tm_mon + 1));
+ lua_settable(L, -3);
+ lua_pushstring(L, "day");
+ lua_pushinteger(L, (int)(tm->tm_mday));
+ lua_settable(L, -3);
+ lua_pushstring(L, "yearday");
+ lua_pushinteger(L, (int)(tm->tm_yday));
+ lua_settable(L, -3);
+ lua_pushstring(L, "weekday");
+ lua_pushinteger(L, (int)((tm->tm_wday + 6) % 7));
+ lua_settable(L, -3);
+ lua_pushstring(L, "hour");
+ lua_pushinteger(L, (int)(tm->tm_hour));
+ lua_settable(L, -3);
+ lua_pushstring(L, "min");
+ lua_pushinteger(L, (int)(tm->tm_min));
+ lua_settable(L, -3);
+ t = (double)tm->tm_sec + (((double)timev.tv_usec) / 1000000);
+ lua_pushstring(L, "sec");
+ lua_pushnumber(L, t);
+ lua_settable(L, -3);
+ }
+ return 1;
+}
+
+//-------------
+static int
+_elua_emit(lua_State *L)
{
- // xxxxx
- // not done yet - but do like timer (but 1 arg only - no timeout val)
- // xxxxx
Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ const char *sig = luaL_checkstring(L, 1);
+ const char *src = luaL_checkstring(L, 2);
+ if ((!sig) || (!src)) return 0;
+ _edje_emit(ed, sig, src);
+ return 0;
+}
+
+//-------------
+static int
+_elua_messagesend(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ int id = luaL_checkinteger(L, 1);
+ const char *type = luaL_checkstring(L, 2);
+ if (!type) return 0;
+ if (!strcmp(type, "none"))
+ {
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_NONE, id, NULL);
+ }
+ else if (!strcmp(type, "sig"))
+ {
+ const char *sig = luaL_checkstring(L, 3);
+ const char *src = luaL_checkstring(L, 4);
+ _edje_emit(ed, sig, src);
+ }
+ else if (!strcmp(type, "str"))
+ {
+ Edje_Message_String *emsg;
+ const char *str = luaL_checkstring(L, 3);
+ emsg = alloca(sizeof(Edje_Message_String));
+ emsg->str = (char *)str;
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING, id, emsg);
+ }
+ else if (!strcmp(type, "int"))
+ {
+ Edje_Message_Int *emsg;
+ int val = luaL_checkinteger(L, 3);
+ emsg = alloca(sizeof(Edje_Message_Int));
+ emsg->val = val;
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_INT, id, emsg);
+ }
+ else if (!strcmp(type, "float"))
+ {
+ Edje_Message_Float *emsg;
+ float val = luaL_checknumber(L, 3);
+ emsg = alloca(sizeof(Edje_Message_Float));
+ emsg->val = val;
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_FLOAT, id, emsg);
+ }
+ else if (!strcmp(type, "strset"))
+ {
+ Edje_Message_String_Set *emsg;
+ int i, n;
+ const char *str;
+ luaL_checktype(L, 3, LUA_TTABLE);
+ n = lua_objlen(L, 3);
+ emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 1) * sizeof(char *)));
+ emsg->count = n;
+ for (i = 1; i <= n; i ++)
+ {
+ lua_rawgeti(L, 3, i);
+ str = lua_tostring(L, -1);
+ emsg->str[i - 1] = (char *)str;
+ }
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_SET, id, emsg);
+ }
+ else if (!strcmp(type, "intset"))
+ {
+ Edje_Message_Int_Set *emsg;
+ int i, n;
+ luaL_checktype(L, 3, LUA_TTABLE);
+ n = lua_objlen(L, 3);
+ emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 1) * sizeof(int)));
+ emsg->count = n;
+ for (i = 1; i <= n; i ++)
+ {
+ lua_rawgeti(L, 3, i);
+ emsg->val[i - 1] = lua_tointeger(L, -1);
+ }
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_INT_SET, id, emsg);
+ }
+ else if (!strcmp(type, "floatset"))
+ {
+ Edje_Message_Float_Set *emsg;
+ int i, n;
+ luaL_checktype(L, 3, LUA_TTABLE);
+ n = lua_objlen(L, 3);
+ emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 1) * sizeof(double)));
+ emsg->count = n;
+ for (i = 1; i <= n; i ++)
+ {
+ lua_rawgeti(L, 3, i);
+ emsg->val[i - 1] = lua_tonumber(L, -1);
+ }
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_FLOAT_SET, id, emsg);
+ }
+ else if (!strcmp(type, "strint"))
+ {
+ Edje_Message_String_Int *emsg;
+ const char *str = luaL_checkstring(L, 3);
+ emsg = alloca(sizeof(Edje_Message_String_Int));
+ emsg->str = (char *)str;
+ emsg->val = luaL_checkinteger(L, 4);
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_INT, id, emsg);
+ }
+ else if (!strcmp(type, "strfloat"))
+ {
+ Edje_Message_String_Float *emsg;
+ const char *str = luaL_checkstring(L, 3);
+ emsg = alloca(sizeof(Edje_Message_String_Float));
+ emsg->str = (char *)str;
+ emsg->val = luaL_checknumber(L, 4);
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_FLOAT, id, emsg);
+ }
+ else if (!strcmp(type, "strintset"))
+ {
+ Edje_Message_String_Int_Set *emsg;
+ int i, n;
+ const char *str = luaL_checkstring(L, 3);
+ if (!str) return 0;
+ luaL_checktype(L, 4, LUA_TTABLE);
+ n = lua_objlen(L, 4);
+ emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 1) * sizeof(int)));
+ emsg->str = (char *)str;
+ emsg->count = n;
+ for (i = 1; i <= n; i ++)
+ {
+ lua_rawgeti(L, 4, i);
+ emsg->val[i - 1] = lua_tointeger(L, -1);
+ }
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_INT_SET, id, emsg);
+ }
+ else if (!strcmp(type, "strfloatset"))
+ {
+ Edje_Message_String_Float_Set *emsg;
+ int i, n;
+ const char *str = luaL_checkstring(L, 3);
+ if (!str) return 0;
+ luaL_checktype(L, 4, LUA_TTABLE);
+ n = lua_objlen(L, 4);
+ emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 1) * sizeof(double)));
+ emsg->str = (char *)str;
+ emsg->count = n;
+ for (i = 1; i <= n; i ++)
+ {
+ lua_rawgeti(L, 4, i);
+ emsg->val[i - 1] = lua_tonumber(L, -1);
+ }
+ _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_FLOAT_SET, id, emsg);
+ }
+ return 0;
+}
+
+//-------------
+static int
+_elua_objpos(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ if (!lua_istable(L, 1)) lua_newtable(L);
+ lua_pushstring(L, "x");
+ lua_pushinteger(L, ed->x);
+ lua_settable(L, -3);
+ lua_pushstring(L, "y");
+ lua_pushinteger(L, ed->y);
+ lua_settable(L, -3);
+ return 1;
+}
+
+static int
+_elua_objsize(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ if (!lua_istable(L, 1)) lua_newtable(L);
+ lua_pushstring(L, "w");
+ lua_pushinteger(L, ed->w);
+ lua_settable(L, -3);
+ lua_pushstring(L, "h");
+ lua_pushinteger(L, ed->h);
+ lua_settable(L, -3);
return 1;
}
+static int
+_elua_objgeom(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ if (!lua_istable(L, 1)) lua_newtable(L);
+ lua_pushstring(L, "x");
+ lua_pushinteger(L, ed->x);
+ lua_settable(L, -3);
+ lua_pushstring(L, "y");
+ lua_pushinteger(L, ed->y);
+ lua_settable(L, -3);
+ lua_pushstring(L, "w");
+ lua_pushinteger(L, ed->w);
+ lua_settable(L, -3);
+ lua_pushstring(L, "h");
+ lua_pushinteger(L, ed->h);
+ lua_settable(L, -3);
+ return 1;
+}
+
+//-------------
+//-------------
+static int
+_elua_2_int_get(lua_State *L, int i, Eina_Bool tr,
+ const char *n1, int *v1,
+ const char *n2, int *v2
+ )
+{
+ int n = 0;
+
+ if (lua_istable(L, i))
+ {
+ lua_getfield(L, i, n1);
+ if (lua_isnil(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_rawgeti(L, i, 1);
+ lua_rawgeti(L, i, 2);
+ }
+ else
+ lua_getfield(L, i, n2);
+ if ((!lua_isnil(L, -1)) && (!lua_isnil(L, -2)))
+ {
+ *v1 = lua_tointeger(L, -2);
+ *v2 = lua_tointeger(L, -1);
+ n = 1;
+ }
+ if (tr) lua_settop(L, i);
+ }
+ else
+ {
+ if ((lua_isnumber(L, i + 0)) && (lua_isnumber(L, i + 1)))
+ {
+ *v1 = lua_tointeger(L, i + 0);
+ *v2 = lua_tointeger(L, i + 1);
+ n = 2;
+ }
+ if (tr) lua_newtable(L);
+ }
+ return n;
+}
+
+static int
+_elua_3_int_get(lua_State *L, int i, Eina_Bool tr,
+ const char *n1, int *v1,
+ const char *n2, int *v2,
+ const char *n3, int *v3
+ )
+{
+ int n = 0;
+
+ if (lua_istable(L, i))
+ {
+ lua_getfield(L, i, n1);
+ if (lua_isnil(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_rawgeti(L, i, 1);
+ lua_rawgeti(L, i, 2);
+ lua_rawgeti(L, i, 3);
+ }
+ else
+ {
+ lua_getfield(L, i, n2);
+ lua_getfield(L, i, n3);
+ }
+ if ((!lua_isnil(L, -1)) && (!lua_isnil(L, -2)) &&
+ (!lua_isnil(L, -3)))
+ {
+ *v1 = lua_tointeger(L, -3);
+ *v2 = lua_tointeger(L, -2);
+ *v3 = lua_tointeger(L, -1);
+ n = 1;
+ }
+ if (tr) lua_settop(L, i);
+ }
+ else
+ {
+ if ((lua_isnumber(L, i + 0)) && (lua_isnumber(L, i + 1)) &&
+ (lua_isnumber(L, i + 2)))
+ {
+ *v1 = lua_tointeger(L, i + 0);
+ *v2 = lua_tointeger(L, i + 1);
+ *v3 = lua_tointeger(L, i + 2);
+ n = 3;
+ }
+ if (tr) lua_newtable(L);
+ }
+ return n;
+}
+
+static int
+_elua_4_int_get(lua_State *L, int i, Eina_Bool tr,
+ const char *n1, int *v1,
+ const char *n2, int *v2,
+ const char *n3, int *v3,
+ const char *n4, int *v4
+ )
+{
+ int n = 0;
+
+ if (lua_istable(L, i))
+ {
+ lua_getfield(L, i, n1);
+ if (lua_isnil(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_rawgeti(L, i, 1);
+ lua_rawgeti(L, i, 2);
+ lua_rawgeti(L, i, 3);
+ lua_rawgeti(L, i, 4);
+ }
+ else
+ {
+ lua_getfield(L, i, n2);
+ lua_getfield(L, i, n3);
+ lua_getfield(L, i, n4);
+ }
+ if ((!lua_isnil(L, -1)) && (!lua_isnil(L, -2)) &&
+ (!lua_isnil(L, -3)) && (!lua_isnil(L, -4)))
+ {
+ *v1 = lua_tointeger(L, -4);
+ *v2 = lua_tointeger(L, -3);
+ *v3 = lua_tointeger(L, -2);
+ *v4 = lua_tointeger(L, -1);
+ n = 1;
+ }
+ if (tr) lua_settop(L, i);
+ }
+ else
+ {
+ if ((lua_isnumber(L, i + 0)) && (lua_isnumber(L, i + 1)) &&
+ (lua_isnumber(L, i + 2)) && (lua_isnumber(L, i + 3)))
+ {
+ *v1 = lua_tointeger(L, i + 0);
+ *v2 = lua_tointeger(L, i + 1);
+ *v3 = lua_tointeger(L, i + 2);
+ *v4 = lua_tointeger(L, i + 3);
+ n = 4;
+ }
+ if (tr) lua_newtable(L);
+ }
+ return n;
+}
+
+static void
+_elua_int_ret(lua_State *L, const char *n, int v)
+{
+ lua_pushstring(L, n);
+ lua_pushinteger(L, v);
+ lua_settable(L, -3);
+}
+
+static void
+_elua_color_fix(int *r, int *g, int *b, int *a)
+{
+ if (*r > *a) *r = *a;
+ if (*g > *a) *g = *a;
+ if (*b > *a) *b = *a;
+}
+
+//-------------
+//-------------
+
+static int
+_elua_show(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ evas_object_show(elo->evas_obj);
+ lua_pushboolean(L, evas_object_visible_get(elo->evas_obj));
+ return 1;
+}
+
+static int
+_elua_hide(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ evas_object_hide(elo->evas_obj);
+ lua_pushboolean(L, evas_object_visible_get(elo->evas_obj));
+ return 1;
+}
+
+static int
+_elua_visible(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int n;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ n = lua_gettop(L);
+ if (n == 2)
+ {
+ if (lua_isboolean(L, 2))
+ {
+ if (lua_toboolean(L, 2)) evas_object_show(elo->evas_obj);
+ else evas_object_hide(elo->evas_obj);
+ }
+ }
+ lua_pushboolean(L, evas_object_visible_get(elo->evas_obj));
+ return 1;
+}
+
+static int
+_elua_move(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int x, y;
+
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (_elua_2_int_get(L, 2, EINA_TRUE, "x", &x, "y", &y) > 0)
+ {
+ if ((x != elo->x) || (y != elo->y))
+ {
+ elo->x = x;
+ elo->y = y;
+ evas_object_move(elo->evas_obj,
+ obj->ed->x + elo->x,
+ obj->ed->y + elo->y);
+ }
+ }
+ _elua_int_ret(L, "x", elo->x);
+ _elua_int_ret(L, "y", elo->y);
+ return 1;
+}
+
+static int
+_elua_resize(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int w, h;
+
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (_elua_2_int_get(L, 2, EINA_TRUE, "w", &w, "h", &h) > 0)
+ {
+ if ((w != elo->w) || (h != elo->h))
+ {
+ elo->w = w;
+ elo->h = h;
+ evas_object_resize(elo->evas_obj, elo->w, elo->h);
+ }
+ }
+ _elua_int_ret(L, "w", elo->w);
+ _elua_int_ret(L, "h", elo->h);
+ return 1;
+}
+
+static int
+_elua_pos(lua_State *L)
+{
+ return _elua_move(L);
+}
+
+static int
+_elua_size(lua_State *L)
+{
+ return _elua_resize(L);
+}
+
+static int
+_elua_geom(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int x, y, w, h;
+
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (_elua_4_int_get(L, 2, EINA_TRUE, "x", &x, "y", &y, "w", &w, "h", &h) > 0)
+ {
+ if ((x != elo->x) || (y != elo->y))
+ {
+ elo->x = x;
+ elo->y = y;
+ evas_object_move(elo->evas_obj,
+ obj->ed->x + elo->x,
+ obj->ed->y + elo->y);
+ }
+ if ((w != elo->w) || (h != elo->h))
+ {
+ elo->w = w;
+ elo->h = h;
+ evas_object_resize(elo->evas_obj, elo->w, elo->h);
+ }
+ }
+ _elua_int_ret(L, "x", elo->x);
+ _elua_int_ret(L, "y", elo->y);
+ _elua_int_ret(L, "w", elo->w);
+ _elua_int_ret(L, "h", elo->h);
+ return 1;
+}
+
+static int
+_elua_raise(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ evas_object_raise(elo->evas_obj);
+ return 0;
+}
+
+static int
+_elua_lower(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ evas_object_lower(elo->evas_obj);
+ return 0;
+}
+
+static int
+_elua_above(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ Edje_Lua_Evas_Object *elo2;
+ Evas_Object *o;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (!(o = evas_object_above_get(elo->evas_obj))) return 0;
+ if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
+ _elua_ref_get(L, elo2);
+ return 1;
+}
+
+static int
+_elua_below(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ Edje_Lua_Evas_Object *elo2;
+ Evas_Object *o;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (!(o = evas_object_below_get(elo->evas_obj))) return 0;
+ if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
+ _elua_ref_get(L, elo2);
+ return 1;
+}
+
+static int
+_elua_top(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ // Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ Edje_Lua_Evas_Object *elo2;
+ Evas_Object *o;
+ Eina_List *list, *l;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (!(list = (Eina_List *)evas_object_smart_members_get(obj->ed->obj))) return 0;
+ if (!list) return 0;
+ for (l = eina_list_last(list); l; l = l->prev)
+ {
+ o = l->data;
+ if ((elo2 = evas_object_data_get(o, ELO)))
+ {
+ _elua_ref_get(L, elo2);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int
+_elua_bottom(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+// Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ Edje_Lua_Evas_Object *elo2;
+ Evas_Object *o;
+ Eina_List *list, *l;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (!(list = (Eina_List *)evas_object_smart_members_get(obj->ed->obj))) return 0;
+ for (l = list; l; l = l->next)
+ {
+ o = l->data;
+ if ((elo2 = evas_object_data_get(o, ELO)))
+ {
+ _elua_ref_get(L, elo2);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int
+_elua_color(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int r, g, b, a;
+
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ if (_elua_4_int_get(L, 2, EINA_TRUE, "r", &r, "g", &g, "b", &b, "a", &a) > 0)
+ {
+ _elua_color_fix(&r, &g, &b, &a);
+ evas_object_color_set(elo->evas_obj, r, g, b, a);
+ }
+ evas_object_color_get(elo->evas_obj, &r, &g, &b, &a);
+ _elua_int_ret(L, "r", r);
+ _elua_int_ret(L, "g", g);
+ _elua_int_ret(L, "b", b);
+ _elua_int_ret(L, "a", a);
+ return 1;
+}
+
+static int
+_elua_clip(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo2, *elo = (Edje_Lua_Evas_Object *)obj;
+ Evas_Object *o;
+ int n;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ n = lua_gettop(L);
+ if (n == 2)
+ {
+ Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2);
+ elo2 = (Edje_Lua_Evas_Object *)obj2;
+ evas_object_clip_set(elo->evas_obj, elo2->evas_obj);
+ }
+ o = evas_object_clip_get(elo->evas_obj);
+ if (!o) return 0;
+ if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
+ _elua_ref_get(L, elo2);
+ return 1;
+}
+
+static int
+_elua_unclip(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ evas_object_clip_unset(elo->evas_obj);
+ return 0;
+}
+
+static int
+_elua_clipees(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo2, *elo = (Edje_Lua_Evas_Object *)obj;
+ Eina_List *list, *l;
+ Evas_Object *o;
+ int n = 0;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ list = (Eina_List *)evas_object_clipees_get(elo->evas_obj);
+ lua_newtable(L);
+ EINA_LIST_FOREACH(list, l, o)
+ {
+ if (!(elo2 = evas_object_data_get(o, ELO))) continue;
+ lua_pushinteger(L, n + 1);
+ _elua_ref_get(L, elo2);
+ lua_settable(L, -3);
+ n++;
+ }
+ return 1;
+}
+
+static int
+_elua_type(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ const char *t;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ t = evas_object_type_get(elo->evas_obj);
+ if (!t) return 0;
+ lua_pushstring(L, t);
+ return 1;
+}
+
+static int
+_elua_pass(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int n;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ n = lua_gettop(L);
+ if (n == 2)
+ {
+ if (lua_isboolean(L, 2))
+ {
+ evas_object_pass_events_set(elo->evas_obj, lua_toboolean(L, 2));
+ }
+ }
+ lua_pushboolean(L, evas_object_pass_events_get(elo->evas_obj));
+ return 1;
+}
+
+static int
+_elua_repeat(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int n;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ n = lua_gettop(L);
+ if (n == 2)
+ {
+ if (lua_isboolean(L, 2))
+ {
+ evas_object_repeat_events_set(elo->evas_obj, lua_toboolean(L, 2));
+ }
+ }
+ lua_pushboolean(L, evas_object_repeat_events_get(elo->evas_obj));
+ return 1;
+}
+
+static int
+_elua_precise(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int n;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ n = lua_gettop(L);
+ if (n == 2)
+ {
+ evas_object_precise_is_inside_set(elo->evas_obj, lua_toboolean(L, 2));
+ }
+ lua_pushboolean(L, evas_object_precise_is_inside_get(elo->evas_obj));
+ return 1;
+}
+
+//-------------
+static void
+_elua_evas_obj_free(void *obj)
+{
+ Edje_Lua_Evas_Object *elo = obj;
+// lua_State *L;
+ if (!elo->obj.ed) return;
+// L = elo->obj.ed->L;
+ evas_object_del(elo->evas_obj);
+ elo->evas_obj = NULL;
+}
+
+static int
+_elua_rect(lua_State *L)
+{
+ Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key);
+ Edje_Lua_Evas_Object *elo;
+
+ elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
+ elo->obj.free_func = _elua_evas_obj_free;
+ elo->obj.is_evas_obj = 1;
+ elo->evas_obj = evas_object_rectangle_add(evas_object_evas_get(ed->obj));
+ evas_object_smart_member_add(elo->evas_obj, ed->obj);
+ evas_object_clip_set(elo->evas_obj, ed->clipper);
+ evas_object_move(elo->evas_obj, ed->x, ed->y);
+ evas_object_resize(elo->evas_obj, 0, 0);
+ evas_object_data_set(elo->evas_obj, ELO, elo);
+ return 1;
+}
+
+//-------------
+//---------------
+//-------------------
+//---------------------------
+//-------------------------------------------
+//----------------------------------------------------------------------------
//-------------
void
_edje_lua2_script_init(Edje *ed)
{
+ static Edje_Lua_Alloc ela = { MAX_LUA_MEM, 0 };
+ const luaL_Reg *l;
+ char buf[256];
+ void *data;
+ int size;
+ lua_State *L;
+
if (ed->L) return;
_elua_init();
- ed->L = lstate;
+ L = ed->L = lua_newstate(_elua_alloc, &ela);
+ lua_atpanic(L, _elua_custom_panic);
+
+// FIXME: figure out optimal gc settings later
+// lua_gc(L, LUA_GCSETPAUSE, 200);
+// lua_gc(L, LUA_GCSETSTEPMUL, 200);
+
+ for (l = _elua_libs; l->func; l++)
+ {
+ lua_pushcfunction(L, l->func);
+ lua_pushstring(L, l->name);
+ lua_call(L, 1, 0);
+ }
+
+
+ luaL_register(L, "edje", _elua_edje_api);
+ luaL_newmetatable(L, "edje");
+ luaL_register(L, 0, _elua_edje_meta);
+
+ luaL_register(L, "edje_evas_obj", _elua_edje_evas_obj);
+ luaL_newmetatable(L, "edje_evas_obj");
+ luaL_register(L, 0, _elua_edje_meta);
- lua_newtable(ed->L); //+1
- ed->lua_ref = luaL_ref(ed->L, LUA_REGISTRYINDEX); //+1
-// lua_pushvalue(ed->L, LUA_GLOBALSINDEX);
-// lua_setfield(ed->L, -2, "__index");
-// lua_setmetatable(ed->L, -2);
-// lua_setfenv(ed->L, -2);
+ lua_pushliteral(L, "__index");
+ lua_pushvalue(L, -3);
+ lua_rawset(L, -3);
+ lua_pop(L, 2);
+
+ // weak table for our objects
+ lua_pushlightuserdata(L, &_elua_objs);
+ lua_newtable(L);
+ lua_pushstring(L, "__mode");
+ lua_pushstring(L, "v");
+ lua_rawset(L, -3);
+ lua_rawset(L, LUA_REGISTRYINDEX);
+
+ _elua_table_ptr_set(L, _elua_key, ed);
- _elua_table_ptr_set(ed->L, _elua_key, ed); //0
-// lua_pop(ed->L, 1); // our current script stack anyway
+ snprintf(buf, sizeof(buf), "lua_scripts/%i", ed->collection->id);
+ data = eet_read(ed->file->ef, buf, &size);
+
+ if (data)
+ {
+ int err;
+
+ err = luaL_loadbuffer(L, data, size, "edje_lua_script");
+ if (err)
+ {
+ if (err == LUA_ERRSYNTAX)
+ ERR("lua load syntax error: %s",
+ lua_tostring(L, -1));
+ else if (err == LUA_ERRMEM)
+ ERR("lua load memory allocation error: %s",
+ lua_tostring(L, -1));
+ }
+ free(data);
+ if (setjmp(panic_jmp) == 1)
+ {
+ ERR("Script init panic");
+ return;
+ }
+ if ((err = lua_pcall(L, 0, 0, 0)))
+ _edje_lua2_error(L, err);
+ }
}
void
_edje_lua2_script_shutdown(Edje *ed)
{
if (!ed->L) return;
- lua_getfenv(ed->L, -1);
- lua_pushnil(ed->L);
- luaL_unref(ed->L, LUA_REGISTRYINDEX, ed->lua_ref); //0
- lua_gc(ed->L, LUA_GCCOLLECT, 0); //0
-
+ lua_close(ed->L);
+ ed->L = NULL;
while (ed->lua_objs)
{
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)ed->lua_objs;
if (obj->free_func)
{
ERR("uncollected Lua object %p", obj);
- _elua_obj_free(ed->L, obj);
+ ed->lua_objs = eina_inlist_remove(ed->lua_objs, ed->lua_objs);
}
else
{
@@ -402,33 +2034,22 @@ _edje_lua2_script_shutdown(Edje *ed)
ed->lua_objs = eina_inlist_remove(ed->lua_objs, ed->lua_objs);
}
}
-
- ed->L = NULL;
}
void
-_edje_lua2_script_load(Edje_Part_Collection *edc, void *data, int size)
+_edje_lua2_script_load(Edje_Part_Collection *edc __UNUSED__, void *data __UNUSED__, int size __UNUSED__)
{
- int err;
-
_elua_init();
-
- err = luaL_loadbuffer(lstate, data, size, "edje_lua_script"); //+1
- if (err)
- {
- if (err == LUA_ERRSYNTAX)
- ERR("lua load syntax error: %s", lua_tostring(lstate, -1)); //0
- else if (err == LUA_ERRMEM)
- ERR("lua load memory allocation error: %s", lua_tostring(lstate, -1)); //0
- }
- if ((err = lua_pcall(lstate, 0, 0, 0))) //0
- _edje_lua2_error(lstate, err); //0
}
void
-_edje_lua2_script_unload(Edje_Part_Collection *edc)
+_edje_lua2_script_unload(Edje_Part_Collection *edc __UNUSED__)
{
- lua_gc(lstate, LUA_GCCOLLECT, 0); //0
+ lua_State *L;
+
+ if (!lstate) return;
+ L = lstate;
+ lua_gc(L, LUA_GCCOLLECT, 0);
}
#endif
diff --git a/src/lib/edje_lua_script_only.c b/src/lib/edje_lua_script_only.c
index 52ea6c4..cc58278 100644
--- a/src/lib/edje_lua_script_only.c
+++ b/src/lib/edje_lua_script_only.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -39,20 +35,7 @@ _edje_lua_script_only_init(Edje *ed)
if (ed->collection)
{
#ifdef LUA2
- int err;
-
_edje_lua2_script_init(ed);
- if (ed->L)
- {
- lua_getglobal(ed->L, "init");
- if (!lua_isnil(ed->L, -1))
- {
- if ((err = lua_pcall(ed->L, 0, 0, 0)))
- _edje_lua2_error(ed->L, err);
- }
- else
- lua_pop(ed->L, 1);
- }
#else
ed->L = _edje_lua_new_thread(ed, _edje_lua_state_get()); // freed in _edje_lua_script_only_shutdown
_edje_lua_new_reg(ed->L, -1, ed->L); // freed in _edje_lua_script_only_shutdown
@@ -86,20 +69,7 @@ _edje_lua_script_only_shutdown(Edje *ed)
if (ed->collection && ed->L)
{
#ifdef LUA2
- int err;
-
- if (ed->L)
- {
- lua_getglobal(ed->L, "shutdown");
- if (!lua_isnil(ed->L, -1))
- {
- if ((err = lua_pcall(ed->L, 0, 0, 0)))
- _edje_lua2_error(ed->L, err);
- }
- else
- lua_pop(ed->L, 1);
- }
- _edje_lua2_script_shutdown(ed);
+ _edje_lua2_script_func_shutdown(ed);
#else
lua_State *L = ed->L;
lua_getglobal(L, "shutdown");
@@ -123,10 +93,11 @@ _edje_lua_script_only_shutdown(Edje *ed)
void
_edje_lua_script_only_show(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_show(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "show");
if (!lua_isnil (L, -1))
@@ -142,17 +113,18 @@ _edje_lua_script_only_show(Edje * ed)
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_hide(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_hide(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "hide");
if (!lua_isnil (L, -1))
@@ -168,17 +140,18 @@ _edje_lua_script_only_hide(Edje * ed)
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_move(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_move(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "move");
if (!lua_isnil (L, -1))
@@ -196,17 +169,18 @@ _edje_lua_script_only_move(Edje * ed)
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_resize(Edje * ed)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_resize(ed);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "resize");
if (!lua_isnil (L, -1))
@@ -224,17 +198,18 @@ _edje_lua_script_only_resize(Edje * ed)
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
void
_edje_lua_script_only_message(Edje * ed, Edje_Message * em)
{
-#ifdef LUA2
-#else
if (ed->collection && ed->L)
{
+#ifdef LUA2
+ _edje_lua2_script_func_message(ed, em);
+#else
lua_State *L = ed->L;
lua_getglobal(L, "message");
if (!lua_isnil (L, -1))
@@ -338,7 +313,7 @@ _edje_lua_script_only_message(Edje * ed, Edje_Message * em)
}
else
lua_pop (L, 1);
- }
#endif
+ }
}
diff --git a/src/lib/edje_main.c b/src/lib/edje_main.c
index b4539f7..60ea237 100644
--- a/src/lib/edje_main.c
+++ b/src/lib/edje_main.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <time.h>
#include "edje_private.h"
@@ -70,19 +66,19 @@ edje_init(void)
if (!ecore_init())
{
- ERR("Edje: Ecore init failed");
+ ERR("Ecore init failed");
goto unregister_log_domain;
}
if (!embryo_init())
{
- ERR("Edje: Embryo init failed");
+ ERR("Embryo init failed");
goto shutdown_ecore;
}
if (!eet_init())
{
- ERR("Edje: Eet init failed");
+ ERR("Eet init failed");
goto shutdown_embryo;
}
@@ -93,7 +89,9 @@ edje_init(void)
_edje_box_init();
_edje_external_init();
_edje_module_init();
+#ifndef LUA2
_edje_lua_init();
+#endif
_edje_message_init();
_edje_real_part_mp = eina_mempool_add("chained_mempool",
@@ -122,7 +120,9 @@ edje_init(void)
_edje_real_part_state_mp = NULL;
_edje_real_part_mp = NULL;
_edje_message_shutdown();
+#ifndef LUA2
_edje_lua_shutdown();
+#endif
_edje_module_shutdown();
_edje_external_shutdown();
_edje_box_shutdown();
@@ -181,7 +181,9 @@ edje_shutdown(void)
_edje_real_part_mp = NULL;
_edje_message_shutdown();
+#ifndef LUA2
_edje_lua_shutdown();
+#endif
_edje_module_shutdown();
_edje_external_shutdown();
_edje_box_shutdown();
diff --git a/src/lib/edje_match.c b/src/lib/edje_match.c
index b7752dd..85aa3b1 100644
--- a/src/lib/edje_match.c
+++ b/src/lib/edje_match.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "edje_private.h"
@@ -250,9 +246,9 @@ _edje_match_patterns_exec_init_states(Edje_States *states,
/* Exported function. */
-#define EDJE_MATCH_INIT(Func, Type, Source, Show) \
+#define EDJE_MATCH_INIT_LIST(Func, Type, Source, Show) \
Edje_Patterns* \
- Func(Eina_List *lst) \
+ Func(const Eina_List *lst) \
{ \
Edje_Patterns *r; \
size_t i; \
@@ -312,21 +308,79 @@ _edje_match_patterns_exec_init_states(Edje_States *states,
return r; \
}
-EDJE_MATCH_INIT(edje_match_collection_dir_init,
- Edje_Part_Collection_Directory_Entry,
- entry, 0);
-EDJE_MATCH_INIT(edje_match_programs_signal_init,
- Edje_Program,
- signal, 0);
-EDJE_MATCH_INIT(edje_match_programs_source_init,
- Edje_Program,
- source, 0);
-EDJE_MATCH_INIT(edje_match_callback_signal_init,
- Edje_Signal_Callback,
- signal, 0);
-EDJE_MATCH_INIT(edje_match_callback_source_init,
- Edje_Signal_Callback,
- source, 0);
+#define EDJE_MATCH_INIT_ARRAY(Func, Type, Source, Show) \
+ Edje_Patterns* \
+ Func(Type * const *lst, unsigned int count) \
+ { \
+ Edje_Patterns *r; \
+ size_t i; \
+ \
+ if (!lst || count == 0) \
+ return NULL; \
+ \
+ r = malloc(sizeof (Edje_Patterns) + \
+ count \
+ * sizeof(*r->finals) \
+ * sizeof(*r->patterns)); \
+ if (!r) return NULL; \
+ \
+ r->ref = 1; \
+ r->delete_me = 0; \
+ r->patterns_size = count; \
+ r->max_length = 0; \
+ r->patterns = (const char **) r->finals + r->patterns_size + 1; \
+ \
+ for (i = 0; i < count; ++i) \
+ { \
+ const char *str; \
+ size_t j; \
+ \
+ if (!lst[i]) \
+ { \
+ free(r); \
+ return NULL; \
+ } \
+ \
+ str = lst[i]->Source; \
+ if (!str) str = ""; \
+ r->patterns[i] = str; \
+ \
+ if (Show) \
+ INF("%lu [%s]", (unsigned long)i, str); \
+ \
+ r->finals[i] = 0; \
+ for (j = 0; str[j]; ++j) \
+ if (str[j] != '*') \
+ r->finals[i] = j + 1; \
+ \
+ if (j > r->max_length) \
+ r->max_length = j; \
+ } \
+ \
+ if (!_edje_match_states_alloc(r, 2)) \
+ { \
+ free(r); \
+ return NULL; \
+ } \
+ \
+ return r; \
+ }
+
+EDJE_MATCH_INIT_LIST(edje_match_collection_dir_init,
+ Edje_Part_Collection_Directory_Entry,
+ entry, 0);
+EDJE_MATCH_INIT_ARRAY(edje_match_programs_signal_init,
+ Edje_Program,
+ signal, 0);
+EDJE_MATCH_INIT_ARRAY(edje_match_programs_source_init,
+ Edje_Program,
+ source, 0);
+EDJE_MATCH_INIT_LIST(edje_match_callback_signal_init,
+ Edje_Signal_Callback,
+ signal, 0);
+EDJE_MATCH_INIT_LIST(edje_match_callback_source_init,
+ Edje_Signal_Callback,
+ source, 0);
static Eina_Bool
_edje_match_collection_dir_exec_finals(const size_t *finals,
@@ -345,7 +399,7 @@ edje_match_programs_exec_check_finals(const size_t *signal_finals,
const size_t *source_finals,
const Edje_States *signal_states,
const Edje_States *source_states,
- Eina_List *programs,
+ Edje_Program **programs,
Eina_Bool (*func)(Edje_Program *pr, void *data),
void *data)
{
@@ -360,7 +414,7 @@ edje_match_programs_exec_check_finals(const size_t *signal_finals,
{
Edje_Program *pr;
- pr = eina_list_nth(programs, signal_states->states[i].idx);
+ pr = programs[signal_states->states[i].idx];
if (pr)
{
if (func(pr, data))
@@ -487,7 +541,7 @@ edje_match_programs_exec(const Edje_Patterns *ppat_signal,
const Edje_Patterns *ppat_source,
const char *signal,
const char *source,
- Eina_List *programs,
+ Edje_Program **programs,
Eina_Bool (*func)(Edje_Program *pr, void *data),
void *data)
{
@@ -609,40 +663,40 @@ _edje_signal_source_key_cmp(const Edje_Signal_Source_Char *node,
Eina_List *
-edje_match_program_hash_build(const Eina_List *callbacks,
+edje_match_program_hash_build(Edje_Program * const *programs,
+ unsigned int count,
Eina_Rbtree **tree)
{
Eina_List *result = NULL;
Eina_Rbtree *new = NULL;
- Edje_Program *program;
- const Eina_List *l;
+ unsigned int i;
- EINA_LIST_FOREACH(callbacks, l, program)
+ for (i = 0; i < count; ++i)
{
- if (program->signal && strpbrk(program->signal, "*?[\\") == NULL
- && program->source && strpbrk(program->source, "*?[\\") == NULL)
+ if (programs[i]->signal && strpbrk(programs[i]->signal, "*?[\\") == NULL
+ && programs[i]->source && strpbrk(programs[i]->source, "*?[\\") == NULL)
{
Edje_Signal_Source_Char *item;
- item = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(new, program->signal, 0,
- EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), program->source);
+ item = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(new, programs[i]->signal, 0,
+ EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), programs[i]->source);
if (!item)
{
item = malloc(sizeof (Edje_Signal_Source_Char));
if (!item) continue;
- item->signal = program->signal;
- item->source = program->source;
+ item->signal = programs[i]->signal;
+ item->source = programs[i]->source;
item->list = NULL;
new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item),
EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL);
}
- item->list = eina_list_prepend(item->list, program);
+ item->list = eina_list_prepend(item->list, programs[i]);
}
else
- result = eina_list_prepend(result, program);
+ result = eina_list_prepend(result, programs[i]);
}
*tree = new;
diff --git a/src/lib/edje_message_queue.c b/src/lib/edje_message_queue.c
index 6f8e86d..25b0dcb 100644
--- a/src/lib/edje_message_queue.c
+++ b/src/lib/edje_message_queue.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "edje_private.h"
@@ -49,7 +45,7 @@ EAPI void
edje_object_message_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
{
Edje *ed;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return;
@@ -156,10 +152,10 @@ edje_message_signal_process(void)
}
-static int
+static Eina_Bool
_edje_dummy_timer(void *data __UNUSED__)
{
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
static void
@@ -176,7 +172,7 @@ _edje_job(void *data __UNUSED__)
_injob--;
}
-static int
+static Eina_Bool
_edje_job_loss_timer(void *data __UNUSED__)
{
_job_loss_timer = NULL;
@@ -184,7 +180,7 @@ _edje_job_loss_timer(void *data __UNUSED__)
{
_job = ecore_job_add(_edje_job, NULL);
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
void
@@ -211,8 +207,19 @@ _edje_message_shutdown(void)
void
_edje_message_cb_set(Edje *ed, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data)
{
+ unsigned int i;
+
ed->message.func = func;
ed->message.data = data;
+ for (i = 0 ; i < ed->table_parts_size ; i++) {
+ Edje_Real_Part *rp;
+ rp = ed->table_parts[i];
+ if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object) {
+ Edje *edj2 = _edje_fetch(rp->swallowed_object);
+ if (!edj2) continue;
+ _edje_message_cb_set(edj2, func, data);
+ }
+ }
}
Edje_Message *
diff --git a/src/lib/edje_module.c b/src/lib/edje_module.c
index 1828e7c..6b197d1 100644
--- a/src/lib/edje_module.c
+++ b/src/lib/edje_module.c
@@ -32,123 +32,144 @@ void *alloca (size_t);
#include <Ecore_File.h>
#include "Edje.h"
-
-#define LOG_COLOR "\033[36m"
+#include "edje_private.h"
Eina_Hash *_registered_modules = NULL;
-Eina_Array *_available_modules = NULL;
-Eina_List *_modules_name = NULL;
-static int _edje_modules_log_dom = -1;
+Eina_List *_modules_paths = NULL;
-const char *
-_edje_module_name_get(Eina_Module *m)
-{
- const char *name;
- ssize_t len;
-
- name = ecore_file_file_get(eina_module_file_get(m));
- len = strlen(name);
- len -= sizeof(SHARED_LIB_SUFFIX) - 1;
- if (len <= 0) return NULL;
- return eina_stringshare_add_length(name, len);
-}
+Eina_List *_modules_found = NULL;
+
+#if defined(__CEGCC__) || defined(__MINGW32CE__)
+# define EDJE_MODULE_NAME "edje_%s.dll"
+#elif _WIN32
+# define EDJE_MODULE_NAME "module.dll"
+#else
+# define EDJE_MODULE_NAME "module.so"
+#endif
EAPI Eina_Bool
edje_module_load(const char *module)
{
- Eina_Module *m;
+ const char *path;
+ Eina_List *l;
EINA_SAFETY_ON_NULL_RETURN_VAL(module, EINA_FALSE);
if (eina_hash_find(_registered_modules, module))
return EINA_TRUE;
- m = eina_module_find(_available_modules, module);
-
- if (!m)
+ EINA_LIST_FOREACH(_modules_paths, l, path)
{
- EINA_LOG_ERR("Could not find the module %s", module);
- return EINA_FALSE;
- }
+ Eina_Module *em;
+ char tmp[PATH_MAX];
- if (!eina_module_load(m))
- {
- EINA_LOG_ERR("Could not load the module %s", module);
- return EINA_TRUE;
+ /* A warning is expected has the naming change under wince. */
+ snprintf(tmp, sizeof (tmp), "%s/%s/%s/" EDJE_MODULE_NAME, path, module, MODULE_ARCH, module);
+ em = eina_module_new(tmp);
+ if (!em) continue ;
+
+ if (!eina_module_load(em))
+ {
+ eina_module_free(em);
+ continue ;
+ }
+
+ return !!eina_hash_add(_registered_modules, module, em);
}
- return !!eina_hash_add(_registered_modules, module, m);
+ ERR("Could not find the module %s", module);
+ return EINA_FALSE;
}
void
_edje_module_init(void)
{
+ char *paths[4] = { NULL, NULL, NULL, NULL };
unsigned int i;
- Eina_Array_Iterator it;
- Eina_Module *m;
-
- _edje_modules_log_dom = eina_log_domain_register("edje_module", LOG_COLOR);
+ unsigned int j;
+
+ _registered_modules = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free));
+
+ /* 1. ~/.edje/modules/ */
+ paths[0] = eina_module_environment_path_get("HOME", "/.edje/modules");
+ /* 2. $(EDJE_MODULE_DIR)/edje/modules/ */
+ paths[1] = eina_module_environment_path_get("EDJE_MODULES_DIR", "/edje/modules");
+ /* 3. libedje.so/../edje/modules/ */
+ paths[2] = eina_module_symbol_path_get(_edje_module_init, "/edje/modules");
+ /* 4. PREFIX/edje/modules/ */
+#ifndef _MSC_VER
+ paths[3] = strdup(PACKAGE_LIB_DIR "/edje/modules");
+#endif
- if (_edje_modules_log_dom < 0)
- {
- EINA_LOG_ERR("Could not register log domain: edje_module");
- return;
- }
+ for (j = 0; j < ((sizeof (paths) / sizeof (char*)) - 1); ++j)
+ for (i = j + 1; i < sizeof (paths) / sizeof (char*); ++i)
+ if (paths[i] && paths[j] && !strcmp(paths[i], paths[j]))
+ {
+ free(paths[i]);
+ paths[i] = NULL;
+ }
+
+ for (i = 0; i < sizeof (paths) / sizeof (char*); ++i)
+ if (paths[i])
+ _modules_paths = eina_list_append(_modules_paths, paths[i]);
+}
- _registered_modules = eina_hash_string_small_new(NULL);
- _available_modules = eina_module_list_get(_available_modules,
- PACKAGE_LIB_DIR "/edje", 0, NULL, NULL);
+void
+_edje_module_shutdown(void)
+{
+ char *path;
- if (!_available_modules)
+ if (_registered_modules)
{
eina_hash_free(_registered_modules);
- return;
+ _registered_modules = NULL;
}
- EINA_ARRAY_ITER_NEXT(_available_modules, i, m, it)
- {
- const char *name;
-
- name = _edje_module_name_get(m);
- _modules_name = eina_list_append(_modules_name, name);
- }
+ EINA_LIST_FREE(_modules_paths, path)
+ free(path);
+ EINA_LIST_FREE(_modules_found, path)
+ eina_stringshare_del(path);
}
-void
-_edje_module_shutdown(void)
+EAPI const Eina_List *
+edje_available_modules_get(void)
{
+ Eina_File_Direct_Info *info;
+ Eina_Iterator *it;
Eina_List *l;
- const char *data;
+ const char *path;
+ Eina_List *result = NULL;
- eina_module_list_free(_available_modules);
- if (_available_modules)
+ /* FIXME: Stat each possible dir and check if they did change, before starting a huge round of readdir/stat */
+ if (_modules_found)
{
- eina_array_free(_available_modules);
- _available_modules = NULL;
+ EINA_LIST_FREE(_modules_found, path)
+ eina_stringshare_del(path);
}
- if (_registered_modules)
+ EINA_LIST_FOREACH(_modules_paths, l, path)
{
- eina_hash_free(_registered_modules);
- _registered_modules = NULL;
- }
+ it = eina_file_direct_ls(path);
- if (_modules_name)
- {
- EINA_LIST_FOREACH(_modules_name, l, data)
- {
- eina_stringshare_del(data);
- }
- _modules_name = NULL;
+ if (it)
+ {
+ EINA_ITERATOR_FOREACH(it, info)
+ {
+ char tmp[PATH_MAX];
+
+ /* A warning is expected has the naming change under wince. */
+ snprintf(tmp, sizeof (tmp), "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH, ecore_file_file_get(info->path));
+
+ if (ecore_file_exists(tmp))
+ result = eina_list_append(result, eina_stringshare_add(ecore_file_file_get(info->path)));
+ }
+
+ eina_iterator_free(it);
+ }
}
- eina_log_domain_unregister(_edje_modules_log_dom);
- _edje_modules_log_dom = -1;
-}
+ _modules_found = result;
-EAPI const Eina_List *
-edje_available_modules_get(void)
-{
- return _modules_name;
+ return result;
}
diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h
index 11e8882..15eda54 100644
--- a/src/lib/edje_private.h
+++ b/src/lib/edje_private.h
@@ -18,6 +18,7 @@
#include <Eet.h>
#include <Embryo.h>
#include <time.h>
+#include <sys/time.h>
#include "Edje.h"
#include "Edje_Edit.h"
@@ -134,7 +135,7 @@ struct _Edje_Smart_Api
/* increment this when the EET data descriptors have changed and old
* EETs cannot be loaded/used correctly anymore.
*/
-#define EDJE_FILE_VERSION 2
+#define EDJE_FILE_VERSION 3
/* FIXME:
*
@@ -143,7 +144,6 @@ struct _Edje_Smart_Api
* ? programs can do multiple actions from one signal
* ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
* ? text entry widget (single line only)
- * ? reduce linked list walking and list_nth calls
*
* ? recursions, unsafe callbacks outside Edje etc. with freeze, ref/unref and block/unblock and break_programs needs to be redesigned & fixed
* ? all unsafe calls that may result in callbacks must be marked and dealt with
@@ -200,6 +200,12 @@ struct _Edje_Aspect
Edje_Aspect_Control mode;
};
+struct _Edje_String
+{
+ const char *str;
+ unsigned int id;
+};
+
typedef struct _Edje_Position_Scale Edje_Alignment;
typedef struct _Edje_Position_Scale Edje_Position_Scale;
typedef struct _Edje_Position Edje_Position;
@@ -208,32 +214,40 @@ typedef struct _Edje_Rectangle Edje_Rectangle;
typedef struct _Edje_Color Edje_Color;
typedef struct _Edje_Aspect_Prefer Edje_Aspect_Prefer;
typedef struct _Edje_Aspect Edje_Aspect;
+typedef struct _Edje_String Edje_String;
typedef struct _Edje_File Edje_File;
typedef struct _Edje_Style Edje_Style;
typedef struct _Edje_Style_Tag Edje_Style_Tag;
-typedef struct _Edje_Data Edje_Data;
typedef struct _Edje_External_Directory Edje_External_Directory;
typedef struct _Edje_External_Directory_Entry Edje_External_Directory_Entry;
-typedef struct _Edje_Font_Directory Edje_Font_Directory;
typedef struct _Edje_Font_Directory_Entry Edje_Font_Directory_Entry;
typedef struct _Edje_Image_Directory Edje_Image_Directory;
typedef struct _Edje_Image_Directory_Entry Edje_Image_Directory_Entry;
typedef struct _Edje_Image_Directory_Set Edje_Image_Directory_Set;
typedef struct _Edje_Image_Directory_Set_Entry Edje_Image_Directory_Set_Entry;
-typedef struct _Edje_Spectrum_Directory Edje_Spectrum_Directory;
-typedef struct _Edje_Spectrum_Directory_Entry Edje_Spectrum_Directory_Entry;
typedef struct _Edje_Program Edje_Program;
typedef struct _Edje_Program_Target Edje_Program_Target;
typedef struct _Edje_Program_After Edje_Program_After;
-typedef struct _Edje_Part_Collection_Directory Edje_Part_Collection_Directory;
typedef struct _Edje_Part_Collection_Directory_Entry Edje_Part_Collection_Directory_Entry;
typedef struct _Edje_Pack_Element Edje_Pack_Element;
typedef struct _Edje_Part_Collection Edje_Part_Collection;
typedef struct _Edje_Part Edje_Part;
+typedef struct _Edje_Part_Api Edje_Part_Api;
+typedef struct _Edje_Part_Dragable Edje_Part_Dragable;
typedef struct _Edje_Part_Image_Id Edje_Part_Image_Id;
-typedef struct _Edje_Part_Description Edje_Part_Description;
-typedef struct _Edje_Spectrum_Color Edje_Spectrum_Color;
+typedef struct _Edje_Part_Description_Image Edje_Part_Description_Image;
+typedef struct _Edje_Part_Description_Text Edje_Part_Description_Text;
+typedef struct _Edje_Part_Description_Box Edje_Part_Description_Box;
+typedef struct _Edje_Part_Description_Table Edje_Part_Description_Table;
+typedef struct _Edje_Part_Description_External Edje_Part_Description_External;
+typedef struct _Edje_Part_Description_Common Edje_Part_Description_Common;
+typedef struct _Edje_Part_Description_Spec_Fill Edje_Part_Description_Spec_Fill;
+typedef struct _Edje_Part_Description_Spec_Border Edje_Part_Description_Spec_Border;
+typedef struct _Edje_Part_Description_Spec_Image Edje_Part_Description_Spec_Image;
+typedef struct _Edje_Part_Description_Spec_Text Edje_Part_Description_Spec_Text;
+typedef struct _Edje_Part_Description_Spec_Box Edje_Part_Description_Spec_Box;
+typedef struct _Edje_Part_Description_Spec_Table Edje_Part_Description_Spec_Table;
typedef struct _Edje_Patterns Edje_Patterns;
#define EDJE_INF_MAX_W 100000
@@ -309,6 +323,8 @@ typedef struct _Edje_Patterns Edje_Patterns;
#define EDJE_PART_PATH_SEPARATOR ':'
#define EDJE_PART_PATH_SEPARATOR_STRING ":"
+#define EDJE_PART_PATH_SEPARATOR_INDEXL '['
+#define EDJE_PART_PATH_SEPARATOR_INDEXR ']'
/*----------*/
struct _Edje_File
@@ -317,28 +333,28 @@ struct _Edje_File
time_t mtime;
Edje_External_Directory *external_dir;
- Edje_Font_Directory *font_dir;
Edje_Image_Directory *image_dir;
- Edje_Spectrum_Directory *spectrum_dir;
- Edje_Part_Collection_Directory *collection_dir;
- Eina_List *data;
Eina_List *styles;
Eina_List *color_classes;
int references;
- char *compiler;
+ const char *compiler;
int version;
int feature_ver;
- Eina_Hash *collection_hash;
- Eina_Hash *font_hash;
- Eina_List *collection_cache;
- Eina_Hash *data_cache;
+ Eina_Hash *data;
+ Eina_Hash *fonts;
+
+ Eina_Hash *collection;
+ Eina_List *collection_cache;
+
+ Edje_Patterns *collection_patterns;
Eet_File *ef;
-
- unsigned int free_strings : 1;
- unsigned int dangling : 1;
+
+ unsigned char free_strings : 1;
+ unsigned char dangling : 1;
+ unsigned char warning : 1;
};
struct _Edje_Style
@@ -359,23 +375,10 @@ struct _Edje_Style_Tag
/*----------*/
-struct _Edje_Data
-{
- char *key;
- char *value;
-};
-
-/*----------*/
-
-struct _Edje_Font_Directory
-{
- Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
-};
struct _Edje_Font_Directory_Entry
{
const char *entry; /* the name of the font */
- const char *path;
const char *file; /* the name of the file */
};
@@ -383,7 +386,8 @@ struct _Edje_Font_Directory_Entry
struct _Edje_External_Directory
{
- Eina_List *entries; /* a list of Edje_External_Directory_Entry */
+ Edje_External_Directory_Entry *entries; /* a list of Edje_External_Directory_Entry */
+ unsigned int entries_count;
};
struct _Edje_External_Directory_Entry
@@ -400,13 +404,16 @@ struct _Edje_External_Directory_Entry
struct _Edje_Image_Directory
{
- Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
- Eina_List *sets; /* a list of Edje_Image_Directory_Set */
+ Edje_Image_Directory_Entry *entries; /* an array of Edje_Image_Directory_Entry */
+ unsigned int entries_count;
+
+ Edje_Image_Directory_Set *sets;
+ unsigned int sets_count; /* an array of Edje_Image_Directory_Set */
};
struct _Edje_Image_Directory_Entry
{
- char *entry; /* the nominal name of the image - if any */
+ const char *entry; /* the nominal name of the image - if any */
int source_type; /* alternate source mode. 0 = none */
int source_param; /* extra params on encoding */
int id; /* the id no. of the image */
@@ -422,7 +429,7 @@ struct _Edje_Image_Directory_Set
struct _Edje_Image_Directory_Set_Entry
{
- char *name;
+ const char *name;
int id;
struct {
@@ -435,29 +442,6 @@ struct _Edje_Image_Directory_Set_Entry
/*----------*/
-struct _Edje_Spectrum_Directory
-{
- Eina_List *entries; /* a list of Edje_Spectrum_Directory_Entry */
-};
-
-struct _Edje_Spectrum_Directory_Entry
-{
- char *entry;
- /* only one of the following two should be included. filename takes precedence */
- char *filename; /* filename of external spectrum. */
- Eina_List *color_list; /* list of Edje_Spectrum_Color */
- int id;
-};
-
-struct _Edje_Spectrum_Color
-{
- int r, g, b, a;
- int d;
-};
-
-
-/*----------*/
-
struct _Edje_Program /* a conditional program to be run */
{
int id; /* id of program */
@@ -515,17 +499,40 @@ struct _Edje_Program_After /* the action to run after another action */
/*----------*/
-struct _Edje_Part_Collection_Directory
-{
- Eina_List *entries; /* a list of Edje_Part_Collection_Directory_Entry */
-
- int references;
-};
-
struct _Edje_Part_Collection_Directory_Entry
{
const char *entry; /* the nominal name of the part collection */
int id; /* the id of this named part collection */
+
+ struct
+ {
+ int RECTANGLE;
+ int TEXT;
+ int IMAGE;
+ int SWALLOW;
+ int TEXTBLOCK;
+ int GROUP;
+ int BOX;
+ int TABLE;
+ int EXTERNAL;
+ int part;
+ } count;
+
+ struct
+ {
+ Eina_Mempool *RECTANGLE;
+ Eina_Mempool *TEXT;
+ Eina_Mempool *IMAGE;
+ Eina_Mempool *SWALLOW;
+ Eina_Mempool *TEXTBLOCK;
+ Eina_Mempool *GROUP;
+ Eina_Mempool *BOX;
+ Eina_Mempool *TABLE;
+ Eina_Mempool *EXTERNAL;
+ Eina_Mempool *part;
+ } mp;
+
+ Edje_Part_Collection *ref;
};
/*----------*/
@@ -554,17 +561,38 @@ struct _Edje_Pack_Element
struct _Edje_Part_Collection
{
- Eina_List *programs; /* a list of Edje_Program */
- Eina_List *parts; /* a list of Edje_Part */
- Eina_List *data;
+ struct { /* list of Edje_Program */
+ Edje_Program **fnmatch; /* complex match with "*?[\" */
+ unsigned int fnmatch_count;
+
+ Edje_Program **strcmp; /* No special caractere, plain strcmp does the work */
+ unsigned int strcmp_count;
+
+ Edje_Program **strncmp; /* Finish by * or ?, plain strncmp does the work */
+ unsigned int strncmp_count;
+
+ Edje_Program **strrncmp; /* Start with * or ?, reverse strncmp will do the job */
+ unsigned int strrncmp_count;
+
+ Edje_Program **nocmp; /* Empty signal/source that will never match */
+ unsigned int nocmp_count;
+ } programs;
+
+ Edje_Part **parts; /* an array of Edje_Part */
+ unsigned int parts_count;
+
+ Eina_Hash *data;
int id; /* the collection id */
+ Eina_Hash *alias; /* aliasing part */
+
struct {
Edje_Size min, max;
} prop;
int references;
+
#ifdef EDJE_PROGRAM_CACHE
struct {
Eina_Hash *no_matches;
@@ -574,36 +602,57 @@ struct _Edje_Part_Collection
Embryo_Program *script; /* all the embryo script code for this group */
const char *part;
-
+
unsigned char script_only;
unsigned char lua_script_only;
+
+ unsigned char checked : 1;
};
-struct _Edje_Part
+struct _Edje_Part_Dragable
{
- const char *name; /* the name if any of the part */
- Edje_Part_Description *default_desc; /* the part descriptor for default */
- Eina_List *other_desc; /* other possible descriptors */
- const char *source, *source2, *source3, *source4, *source5, *source6;
- int id; /* its id number */
- int clip_to_id; /* the part id to clip this one to */
- struct {
- int step_x; /* drag jumps n pixels (0 = no limit) */
- int step_y; /* drag jumps n pixels (0 = no limit) */
+ int step_x; /* drag jumps n pixels (0 = no limit) */
+ int step_y; /* drag jumps n pixels (0 = no limit) */
+
+ int count_x; /* drag area divided by n (0 = no limit) */
+ int count_y; /* drag area divided by n (0 = no limit) */
+
+ int confine_id; /* dragging within this bit, -1 = no */
+
+ /* davinchi */
+ int event_id; /* If it is used as scrollbar */
+
+ signed char x; /* can u click & drag this bit in x dir */
+ signed char y; /* can u click & drag this bit in y dir */
+};
+
+struct _Edje_Part_Api
+{
+ const char *name;
+ const char *description;
+};
- int count_x; /* drag area divided by n (0 = no limit) */
- int count_y; /* drag area divided by n (0 = no limit) */
+typedef struct _Edje_Part_Description_List Edje_Part_Description_List;
+struct _Edje_Part_Description_List
+{
+ Edje_Part_Description_Common **desc;
+ unsigned int desc_count;
+};
- int confine_id; /* dragging within this bit, -1 = no */
+struct _Edje_Part
+{
+ const char *name; /* the name if any of the part */
+ Edje_Part_Description_Common *default_desc; /* the part descriptor for default */
- /* davinchi */
- int events_id; /* If it is used as scrollbar */
+ Edje_Part_Description_List other; /* other possible descriptors */
- signed char x; /* can u click & drag this bit in x dir */
- signed char y; /* can u click & drag this bit in y dir */
- } dragable;
- Eina_List *items; /* packed items for box and table */
+ const char *source, *source2, *source3, *source4, *source5, *source6;
+ int id; /* its id number */
+ int clip_to_id; /* the part id to clip this one to */
+ Edje_Part_Dragable dragable;
+ Edje_Pack_Element **items; /* packed items for box and table */
+ unsigned int items_count;
unsigned char type; /* what type (image, rect, text) */
unsigned char effect; /* 0 = plain... */
unsigned char mouse_events; /* it will affect/respond to mouse events */
@@ -616,10 +665,7 @@ struct _Edje_Part
unsigned char entry_mode;
unsigned char select_mode;
unsigned char multiline;
- struct {
- const char *name;
- const char *description;
- } api;
+ Edje_Part_Api api;
};
struct _Edje_Part_Image_Id
@@ -628,7 +674,7 @@ struct _Edje_Part_Image_Id
Eina_Bool set;
};
-struct _Edje_Part_Description
+struct _Edje_Part_Description_Common
{
struct {
double value; /* the value of the state (for ranges) */
@@ -645,6 +691,10 @@ struct _Edje_Part_Description
Edje_Position step; /* size stepping by n pixels, 0 = none */
Edje_Aspect_Prefer aspect;
+ char *color_class; /* how to modify the color */
+ Edje_Color color;
+ Edje_Color color2;
+
struct {
FLOAT_T relative_x;
FLOAT_T relative_y;
@@ -655,90 +705,6 @@ struct _Edje_Part_Description
} rel1, rel2;
struct {
- Eina_List *tween_list; /* list of Edje_Part_Image_Id */
- int id; /* the image id to use */
- int scale_hint; /* evas scale hint */
- Eina_Bool set; /* if image condition it's content */
- } image;
-
- struct {
- char *type; /* type of spectrum - 'linear', 'radial', etc */
- char *params; /* params for spectrum type */
- int id; /* the spectrum id to use */
- int use_rel; /* 1 - use rel1,rel2; 0 - use fill */
- struct {
- FLOAT_T relative_x;
- FLOAT_T relative_y;
- int offset_x;
- int offset_y;
- } rel1, rel2; /* linear gradient fill options */
- } gradient;
-
- struct {
- int l, r, t, b; /* border scaling on image fill */
- unsigned char no_fill; /* do we fill the center of the image if bordered? 1 == NO!!!! */
- unsigned char scale; /* scale image border by same as scale factor */
- } border;
-
- struct {
- FLOAT_T pos_rel_x; /* fill offset x relative to area */
- FLOAT_T rel_x; /* relative size compared to area */
- FLOAT_T pos_rel_y; /* fill offset y relative to area */
- FLOAT_T rel_y; /* relative size compared to area */
- int pos_abs_x; /* fill offset x added to fill offset */
- int abs_x; /* size of fill added to relative fill */
- int pos_abs_y; /* fill offset y added to fill offset */
- int abs_y; /* size of fill added to relative fill */
- int angle; /* angle of fill -- currently only used by grads */
- int spread; /* spread of fill -- currently only used by grads */
- char smooth; /* fill with smooth scaling or not */
- unsigned char type; /* fill coordinate from container (SCALE) or from source image (TILE) */
- } fill;
-
- char *color_class; /* how to modify the color */
-
- struct {
- char *text; /* if "" or NULL, then leave text unchanged */
- char *text_class; /* how to apply/modify the font */
- char *style; /* the text style if a textblock */
- char *font; /* if a specific font is asked for */
- char *repch; /* replacement char for password mode entry */
-
- Edje_Alignment align; /* text alignment within bounds */
-
- double elipsis; /* 0.0 - 1.0 defining where the elipsis align */
- int size; /* 0 = use user set size */
- int id_source; /* -1 if none */
- int id_text_source; /* -1 if none */
-
- unsigned char fit_x; /* resize font size down to fit in x dir */
- unsigned char fit_y; /* resize font size down to fit in y dir */
- unsigned char min_x; /* if text size should be part min size */
- unsigned char min_y; /* if text size should be part min size */
- unsigned char max_x; /* if text size should be part max size */
- unsigned char max_y; /* if text size should be part max size */
- } text;
-
- struct {
- char *layout, *alt_layout;
- Edje_Alignment align;
- struct {
- int x, y;
- } padding;
- struct {
- Eina_Bool h, v;
- } min;
- } box;
-
- struct {
- unsigned char homogeneous;
- Edje_Alignment align;
- struct {
- int x, y;
- } padding;
- } table;
-
- struct {
int id_persp;
int id_light;
struct {
@@ -751,18 +717,125 @@ struct _Edje_Part_Description
unsigned char smooth;
unsigned char alpha;
} map;
-
+
struct {
int zplane;
int focal;
} persp;
-
- Edje_Color color, color2, color3; /* color for rect or text, shadow etc. */
- Eina_List *external_params; /* parameters for external objects */
unsigned char visible; /* is it shown */
};
+struct _Edje_Part_Description_Spec_Fill
+{
+ FLOAT_T pos_rel_x; /* fill offset x relative to area */
+ FLOAT_T rel_x; /* relative size compared to area */
+ FLOAT_T pos_rel_y; /* fill offset y relative to area */
+ FLOAT_T rel_y; /* relative size compared to area */
+ int pos_abs_x; /* fill offset x added to fill offset */
+ int abs_x; /* size of fill added to relative fill */
+ int pos_abs_y; /* fill offset y added to fill offset */
+ int abs_y; /* size of fill added to relative fill */
+ int angle; /* angle of fill -- currently only used by grads */
+ int spread; /* spread of fill -- currently only used by grads */
+ char smooth; /* fill with smooth scaling or not */
+ unsigned char type; /* fill coordinate from container (SCALE) or from source image (TILE) */
+};
+
+struct _Edje_Part_Description_Spec_Border
+{
+ int l, r, t, b; /* border scaling on image fill */
+ unsigned char no_fill; /* do we fill the center of the image if bordered? 1 == NO!!!! */
+ unsigned char scale; /* scale image border by same as scale factor */
+};
+
+struct _Edje_Part_Description_Spec_Image
+{
+ Edje_Part_Image_Id **tweens; /* list of Edje_Part_Image_Id */
+ unsigned int tweens_count; /* number of tweens */
+
+ int id; /* the image id to use */
+ int scale_hint; /* evas scale hint */
+ Eina_Bool set; /* if image condition it's content */
+
+ Edje_Part_Description_Spec_Border border;
+ Edje_Part_Description_Spec_Fill fill;
+};
+
+struct _Edje_Part_Description_Spec_Text
+{
+ Edje_String text; /* if "" or NULL, then leave text unchanged */
+ char *text_class; /* how to apply/modify the font */
+ Edje_String style; /* the text style if a textblock */
+ Edje_String font; /* if a specific font is asked for */
+ Edje_String repch; /* replacement char for password mode entry */
+
+ Edje_Alignment align; /* text alignment within bounds */
+ Edje_Color color3;
+
+ double elipsis; /* 0.0 - 1.0 defining where the elipsis align */
+ int size; /* 0 = use user set size */
+ int id_source; /* -1 if none */
+ int id_text_source; /* -1 if none */
+
+ unsigned char fit_x; /* resize font size down to fit in x dir */
+ unsigned char fit_y; /* resize font size down to fit in y dir */
+ unsigned char min_x; /* if text size should be part min size */
+ unsigned char min_y; /* if text size should be part min size */
+ unsigned char max_x; /* if text size should be part max size */
+ unsigned char max_y; /* if text size should be part max size */
+};
+
+struct _Edje_Part_Description_Spec_Box
+{
+ char *layout, *alt_layout;
+ Edje_Alignment align;
+ struct {
+ int x, y;
+ } padding;
+ struct {
+ Eina_Bool h, v;
+ } min;
+};
+
+struct _Edje_Part_Description_Spec_Table
+{
+ unsigned char homogeneous;
+ Edje_Alignment align;
+ struct {
+ int x, y;
+ } padding;
+};
+
+struct _Edje_Part_Description_Image
+{
+ Edje_Part_Description_Common common;
+ Edje_Part_Description_Spec_Image image;
+};
+
+struct _Edje_Part_Description_Text
+{
+ Edje_Part_Description_Common common;
+ Edje_Part_Description_Spec_Text text;
+};
+
+struct _Edje_Part_Description_Box
+{
+ Edje_Part_Description_Common common;
+ Edje_Part_Description_Spec_Box box;
+};
+
+struct _Edje_Part_Description_Table
+{
+ Edje_Part_Description_Common common;
+ Edje_Part_Description_Spec_Table table;
+};
+
+struct _Edje_Part_Description_External
+{
+ Edje_Part_Description_Common common;
+ Eina_List *external_params; /* parameters for external objects */
+};
/*----------*/
@@ -802,12 +875,22 @@ struct _Edje_Signal_Source_Char
};
struct _Edje_Signals_Sources_Patterns
+
{
Edje_Patterns *signals_patterns;
Edje_Patterns *sources_patterns;
Eina_Rbtree *exact_match;
- Eina_List *globing;
+
+ union {
+ struct {
+ Edje_Program **globing;
+ unsigned int count;
+ } programs;
+ struct {
+ Eina_List *globing;
+ } callbacks;
+ } u;
};
typedef struct _Edje_Signals_Sources_Patterns Edje_Signals_Sources_Patterns;
@@ -842,8 +925,8 @@ struct _Edje
Eina_List *text_insert_filter_callbacks;
void *script_only_data;
int table_programs_size;
- int table_parts_size;
-
+ unsigned int table_parts_size;
+
Edje_Perspective *persp;
struct {
@@ -923,10 +1006,6 @@ struct _Edje_Calc_Params
struct {
int l, r, t, b; // 16
} image; // 16
- struct {
- int id; // 4
- char *type; // 4
- } gradient; // 8
} spec; // 16
} common; // 40
struct {
@@ -950,7 +1029,7 @@ struct _Edje_Real_Part_Set
struct _Edje_Real_Part_State
{
- Edje_Part_Description *description; // 4
+ Edje_Part_Description_Common *description; // 4
Edje_Real_Part *rel1_to_x; // 4
Edje_Real_Part *rel1_to_y; // 4
Edje_Real_Part *rel2_to_x; // 4
@@ -1024,7 +1103,7 @@ struct _Edje_Real_Part
// text to front and have smaller struct for textblock
FLOAT_T description_pos; // 8
- Edje_Part_Description *chosen_description; // 4
+ Edje_Part_Description_Common *chosen_description; // 4
Edje_Real_Part_State param1; // 20
// WITH EDJE_CALC_CACHE: 140
Edje_Real_Part_State *param2, *custom; // 8
@@ -1038,7 +1117,6 @@ struct _Edje_Real_Part
Edje_Running_Program *program; // 4
int clicked_button; // 4
- int gradient_id; // 4 // FIXME: only for gradient
unsigned char calculated; // 1
unsigned char calculating; // 1
@@ -1232,11 +1310,13 @@ struct _Edje_Patterns
size_t finals[];
};
-Edje_Patterns *edje_match_collection_dir_init(Eina_List *lst);
-Edje_Patterns *edje_match_programs_signal_init(Eina_List *lst);
-Edje_Patterns *edje_match_programs_source_init(Eina_List *lst);
-Edje_Patterns *edje_match_callback_signal_init(Eina_List *lst);
-Edje_Patterns *edje_match_callback_source_init(Eina_List *lst);
+Edje_Patterns *edje_match_collection_dir_init(const Eina_List *lst);
+Edje_Patterns *edje_match_programs_signal_init(Edje_Program * const *array,
+ unsigned int count);
+Edje_Patterns *edje_match_programs_source_init(Edje_Program * const *array,
+ unsigned int count);
+Edje_Patterns *edje_match_callback_signal_init(const Eina_List *lst);
+Edje_Patterns *edje_match_callback_source_init(const Eina_List *lst);
Eina_Bool edje_match_collection_dir_exec(const Edje_Patterns *ppat,
const char *string);
@@ -1244,7 +1324,7 @@ Eina_Bool edje_match_programs_exec(const Edje_Patterns *ppat_signal,
const Edje_Patterns *ppat_source,
const char *signal,
const char *source,
- Eina_List *programs,
+ Edje_Program **programs,
Eina_Bool (*func)(Edje_Program *pr, void *data),
void *data);
int edje_match_callback_exec(Edje_Patterns *ppat_signal,
@@ -1256,7 +1336,8 @@ int edje_match_callback_exec(Edje_Patterns *ppat_signal,
void edje_match_patterns_free(Edje_Patterns *ppat);
-Eina_List *edje_match_program_hash_build(const Eina_List *callbacks,
+Eina_List *edje_match_program_hash_build(Edje_Program * const * programs,
+ unsigned int count,
Eina_Rbtree **tree);
Eina_List *edje_match_callback_hash_build(const Eina_List *callbacks,
Eina_Rbtree **tree);
@@ -1266,24 +1347,7 @@ const Eina_List *edje_match_signal_source_hash_get(const char *signal,
void edje_match_signal_source_free(Edje_Signal_Source_Char *key, void *data);
EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_style;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_style_tag;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_data;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_font_directory;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_image_directory;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_spectrum_directory;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_spectrum_directory_entry;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_program;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_program_target;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection_directory;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection_directory_entry;
EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_description;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_image_id;
-EAPI extern Eet_Data_Descriptor *_edje_edd_edje_spectrum_color;
extern int _edje_anim_count;
extern Ecore_Animator *_edje_timer;
@@ -1299,8 +1363,21 @@ extern Eina_List *_edje_freeze_calc_list;
extern Eina_Mempool *_edje_real_part_mp;
extern Eina_Mempool *_edje_real_part_state_mp;
+extern Eina_Mempool *_emp_RECTANGLE;
+extern Eina_Mempool *_emp_TEXT;
+extern Eina_Mempool *_emp_IMAGE;
+extern Eina_Mempool *_emp_SWALLOW;
+extern Eina_Mempool *_emp_TEXTBLOCK;
+extern Eina_Mempool *_emp_GROUP;
+extern Eina_Mempool *_emp_BOX;
+extern Eina_Mempool *_emp_TABLE;
+extern Eina_Mempool *_emp_EXTERNAL;
+extern Eina_Mempool *_emp_part;
+
void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos);
-Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val);
+Edje_Part_Description_Common *_edje_part_description_find(Edje *ed,
+ Edje_Real_Part *rp,
+ const char *name, double val);
void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2);
void _edje_recalc(Edje *ed);
void _edje_recalc_do(Edje *ed);
@@ -1308,8 +1385,8 @@ void _edje_part_recalc_1(Edje *ed, Edje_Real_Part *ep);
int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, FLOAT_T *x, FLOAT_T *y);
void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T y);
-int _edje_timer_cb(void *data);
-int _edje_pending_timer_cb(void *data);
+Eina_Bool _edje_timer_cb(void *data);
+Eina_Bool _edje_pending_timer_cb(void *data);
void _edje_callbacks_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
void _edje_callbacks_focus_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
void _edje_callbacks_del(Evas_Object *obj, Edje *ed);
@@ -1324,8 +1401,16 @@ void _edje_file_add(Edje *ed);
void _edje_file_del(Edje *ed);
void _edje_file_free(Edje_File *edf);
void _edje_file_cache_shutdown(void);
-void _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec);
-void _edje_collection_free_part_description_free(Edje_Part_Description *desc, Eina_Bool free_strings);
+void _edje_collection_free(Edje_File *edf,
+ Edje_Part_Collection *ec,
+ Edje_Part_Collection_Directory_Entry *ce);
+void _edje_collection_free_part_description_clean(int type,
+ Edje_Part_Description_Common *desc,
+ Eina_Bool free_strings);
+void _edje_collection_free_part_description_free(int type,
+ Edje_Part_Description_Common *desc,
+ Edje_Part_Collection_Directory_Entry *ce,
+ Eina_Bool free_strings);
void _edje_object_smart_set(Edje_Smart_Api *sc);
const Edje_Smart_Api * _edje_object_smart_class_get(void);
@@ -1350,9 +1435,14 @@ void _edje_callbacks_patterns_clean(Edje *ed);
void _edje_text_init(void);
void _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep);
void _edje_text_part_on_del(Edje *ed, Edje_Part *ep);
-void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
+void _edje_text_recalc_apply(Edje *ed,
+ Edje_Real_Part *ep,
+ Edje_Calc_Params *params,
+ Edje_Part_Description_Text *chosen_desc);
Evas_Font_Size _edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc);
-const char * _edje_text_class_font_get(Edje *ed, Edje_Part_Description *chosen_desc, int *size, char **free_later);
+const char * _edje_text_class_font_get(Edje *ed,
+ Edje_Part_Description_Text *chosen_desc,
+ int *size, char **free_later);
Edje_Real_Part *_edje_real_part_get(Edje *ed, const char *part);
@@ -1395,6 +1485,7 @@ Eina_Bool _edje_real_part_box_remove_all(Edje_Real_Part *rp, Eina_Bool c
Eina_Bool _edje_real_part_table_pack(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan);
Eina_Bool _edje_real_part_table_unpack(Edje_Real_Part *rp, Evas_Object *child_obj);
void _edje_real_part_table_clear(Edje_Real_Part *rp, Eina_Bool clear);
+Evas_Object *_edje_children_get(Edje_Real_Part *rp, const char *partid);
Eina_Bool _edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text);
char *_edje_text_escape(const char *text);
@@ -1517,18 +1608,20 @@ void _edje_embryo_globals_init(Edje *ed);
Embryo_Cell *___cptr; \
if ((___cptr = embryo_data_address_get(ep, (par)))) { \
embryo_data_string_set(ep, str, ___cptr); } }
-#define SETSTRALLOCATE(s) { \
- if (s) { \
- if (strlen((s)) < params[4]) { \
- SETSTR((s), params[3]); } \
- else { \
- char *ss; \
- ss = alloca(strlen((s)) + 1); \
- strcpy(ss, (s)); \
- ss[params[4] - 2] = 0; \
- SETSTR(ss, params[3]); } } \
- else \
- SETSTR("", params[3]); }
+#define SETSTRALLOCATE(s) \
+ { \
+ if (s) { \
+ if ((int) strlen((s)) < params[4]) { \
+ SETSTR((s), params[3]); } \
+ else { \
+ char *ss; \
+ ss = alloca(strlen((s)) + 1); \
+ strcpy(ss, (s)); \
+ ss[params[4] - 2] = 0; \
+ SETSTR(ss, params[3]); } } \
+ else \
+ SETSTR("", params[3]); \
+ }
#define SETFLOAT(val, par) { \
float *___cptr; \
if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
@@ -1625,22 +1718,47 @@ Evas_Object *_edje_external_type_add(const char *type_name, Evas *evas, Evas_Obj
void _edje_external_signal_emit(Evas_Object *obj, const char *emission, const char *source);
Eina_Bool _edje_external_param_set(Evas_Object *obj, const Edje_External_Param *param) EINA_ARG_NONNULL(1, 2);
Eina_Bool _edje_external_param_get(const Evas_Object *obj, Edje_External_Param *param) EINA_ARG_NONNULL(1, 2);
+Evas_Object *_edje_external_content_get(const Evas_Object *obj, const char *content) EINA_ARG_NONNULL(1, 2);
void _edje_external_params_free(Eina_List *params, Eina_Bool free_strings);
-void _edje_external_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params, Edje_Part_Description *chosen_desc);
+void _edje_external_recalc_apply(Edje *ed, Edje_Real_Part *ep,
+ Edje_Calc_Params *params,
+ Edje_Part_Description_Common *chosen_desc);
void *_edje_external_params_parse(Evas_Object *obj, const Eina_List *params);
void _edje_external_parsed_params_free(Evas_Object *obj, void *params);
-void _edje_module_init();
-void _edje_module_shutdown();
-
+EAPI void _edje_module_init();
+EAPI void _edje_module_shutdown();
+static inline Eina_Bool
+edje_program_is_strncmp(const char *str)
+{
+ unsigned int length;
+ length = strlen(str);
+ if (strpbrk(str, "*?[\\") != str + length)
+ return EINA_FALSE;
+ if (str[length] == '['
+ || str[length] == '\\')
+ return EINA_FALSE;
+ return EINA_TRUE;
+}
+static inline Eina_Bool
+edje_program_is_strrncmp(const char *str)
+{
+ if (*str != '*' && *str != '?')
+ return EINA_FALSE;
+ if (strpbrk(str + 1, "*?[\\") != NULL)
+ return EINA_FALSE;
+ return EINA_TRUE;
+}
+EAPI void _edje_program_insert(Edje_Part_Collection *ed, Edje_Program *p);
+EAPI void _edje_program_remove(Edje_Part_Collection *ed, Edje_Program *p);
// new lua stuff - supercedes the old
-//#define LUA2 1
+#define LUA2 1
#ifdef LUA2
void _edje_lua2_error_full(const char *file, const char *fnc, int line, lua_State *L, int err_code);
@@ -1649,6 +1767,17 @@ void _edje_lua2_script_init(Edje *ed);
void _edje_lua2_script_shutdown(Edje *ed);
void _edje_lua2_script_load(Edje_Part_Collection *edc, void *data, int size);
void _edje_lua2_script_unload(Edje_Part_Collection *edc);
+
+void _edje_lua2_script_func_shutdown(Edje *ed);
+void _edje_lua2_script_func_show(Edje *ed);
+void _edje_lua2_script_func_hide(Edje *ed);
+void _edje_lua2_script_func_move(Edje *ed);
+void _edje_lua2_script_func_resize(Edje *ed);
+void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em);
+void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src);
#endif
+const char *edje_string_get(const Edje_String *es);
+const char *edje_string_id_get(const Edje_String *es);
+
#endif
diff --git a/src/lib/edje_program.c b/src/lib/edje_program.c
index f1e7219..fdaaf23 100644
--- a/src/lib/edje_program.c
+++ b/src/lib/edje_program.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
@@ -119,7 +115,7 @@ edje_frametime_get(void)
* a callback is attached using:
*
* @code
- * edje_object_callback_add(obj, "a_signal", "a_source", cb_signal, data);
+ * edje_object_signal_callback_add(obj, "a_signal", "a_source", cb_signal, data);
* @endcode
*
* Here, @a data is an arbitrary pointer to be used as desired. Note
@@ -130,7 +126,7 @@ edje_frametime_get(void)
* in either the emission or source name, e.g.
*
* @code
- * edje_object_callback_add(obj, "mouse,down,*", "button.*", NULL);
+ * edje_object_signal_callback_add(obj, "mouse,down,*", "button.*", NULL);
* @endcode
*
* Here, any mouse down events on an edje part whose name begins with
@@ -286,7 +282,7 @@ edje_object_play_set(Evas_Object *obj, Eina_Bool play)
double t;
Eina_List *l;
Edje_Running_Program *runp;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return;
@@ -360,7 +356,7 @@ edje_object_animation_set(Evas_Object *obj, Eina_Bool on)
{
Edje *ed;
Eina_List *l;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return;
@@ -538,7 +534,7 @@ _edje_program_end(Edje *ed, Edje_Running_Program *runp)
{
Eina_List *l;
Edje_Program_Target *pt;
- const char *pname = NULL;
+// const char *pname = NULL;
int free_runp = 0;
if (ed->delete_me) return;
@@ -566,7 +562,7 @@ _edje_program_end(Edje *ed, Edje_Running_Program *runp)
}
_edje_recalc(ed);
runp->delete_me = 1;
- pname = runp->program->name;
+// pname = runp->program->name;
if (!ed->walking_actions)
{
_edje_anim_count--;
@@ -916,7 +912,7 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig,
focused = evas_focus_get(evas_object_evas_get(ed->obj));
if (focused)
{
- int i;
+ unsigned int i;
/* Check if the current swallowed object is one of my child. */
for (i = 0; i < ed->table_parts_size; ++i)
@@ -1012,9 +1008,14 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
if (ed->delete_me) return;
- sep = strchr(sig, ':');
+ sep = strchr(sig, EDJE_PART_PATH_SEPARATOR);
+
+ /* If we are not sending the signal to a part of the child, the
+ * signal if for ourself
+ */
if (sep)
{
+ char *idx;
size_t length;
char *part;
/* the signal contains a colon, split the signal into "part:signal",
@@ -1025,18 +1026,25 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
if (part)
{
char *newsig;
- int i;
+ unsigned int i;
+
+ memcpy(part, sig, length);
+
+ /* The part contain a [index], retrieve it */
+ idx = strchr(sig, EDJE_PART_PATH_SEPARATOR_INDEXL);
+ if (idx == NULL || sep < idx) newsig = part + (sep - sig);
+ else newsig = part + (idx - sig);
- memcpy(part, sig, length);
- newsig = part + (sep - sig);
*newsig = '\0';
newsig++;
for (i = 0; i < ed->table_parts_size; i++)
{
Edje_Real_Part *rp = ed->table_parts[i];
- if ((rp->part->type == EDJE_PART_TYPE_GROUP || rp->part->type == EDJE_PART_TYPE_EXTERNAL) &&
- (rp->swallowed_object) &&
+ if ((((rp->part->type == EDJE_PART_TYPE_GROUP
+ || rp->part->type == EDJE_PART_TYPE_EXTERNAL)
+ && (rp->swallowed_object))
+ || rp->part->type == EDJE_PART_TYPE_BOX || rp->part->type == EDJE_PART_TYPE_TABLE) &&
(rp->part) && (rp->part->name) &&
(strcmp(rp->part->name, part) == 0))
{
@@ -1054,7 +1062,33 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
_edje_external_signal_emit(rp->swallowed_object, newsig, src);
return;
}
- }
+ else if (rp->part->type == EDJE_PART_TYPE_BOX
+ || rp->part->type == EDJE_PART_TYPE_TABLE)
+ {
+ const char *partid;
+ Evas_Object *child;
+ Edje *ed2 = NULL;
+
+ idx = strchr(newsig, EDJE_PART_PATH_SEPARATOR_INDEXR);
+
+ if (!idx) return ;
+ if (idx[1] != ':') return ;
+ if (!rp->object) return;
+
+ partid = newsig;
+ newsig = idx;
+
+ *newsig = '\0';
+ newsig += 2; /* we jump over ']' and ':' */
+
+ child = _edje_children_get(rp, partid);
+
+ if (child) ed2 = _edje_fetch(child);
+ if (ed2) _edje_emit(ed2, newsig, src);
+
+ return;
+ }
+ }
}
}
}
@@ -1131,7 +1165,7 @@ _edje_callbacks_patterns_clean(Edje *ed)
NULL);
ed->patterns.callbacks.exact_match = NULL;
- ed->patterns.callbacks.globing = eina_list_free(ed->patterns.callbacks.globing);
+ ed->patterns.callbacks.u.callbacks.globing = eina_list_free(ed->patterns.callbacks.u.callbacks.globing);
}
static void
@@ -1140,14 +1174,14 @@ _edje_callbacks_patterns_init(Edje *ed)
Edje_Signals_Sources_Patterns *ssp = &ed->patterns.callbacks;
if ((ssp->signals_patterns) || (ssp->sources_patterns) ||
- (ssp->globing) || (ssp->exact_match))
+ (ssp->u.callbacks.globing) || (ssp->exact_match))
return;
- ssp->globing = edje_match_callback_hash_build(ed->callbacks,
- &ssp->exact_match);
+ ssp->u.callbacks.globing = edje_match_callback_hash_build(ed->callbacks,
+ &ssp->exact_match);
- ssp->signals_patterns = edje_match_callback_signal_init(ssp->globing);
- ssp->sources_patterns = edje_match_callback_source_init(ssp->globing);
+ ssp->signals_patterns = edje_match_callback_signal_init(ssp->u.callbacks.globing);
+ ssp->sources_patterns = edje_match_callback_source_init(ssp->u.callbacks.globing);
}
/* FIXME: what if we delete the evas object??? */
@@ -1161,17 +1195,21 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src)
_edje_block(ed);
_edje_ref(ed);
_edje_freeze(ed);
+#ifdef LUA2
+ if (ed->collection && ed->L)
+ _edje_lua2_script_func_signal(ed, sig, src);
+#endif
if (ed->collection)
{
- Edje_Part_Collection *ec;
#ifdef EDJE_PROGRAM_CACHE
+ Edje_Part_Collection *ec;
char *tmps;
int l1, l2;
#endif
int done;
- ec = ed->collection;
#ifdef EDJE_PROGRAM_CACHE
+ ec = ed->collection;
l1 = strlen(sig);
l2 = strlen(src);
tmps = alloca(l1 + l2 + 3); /* \0, \337, \0 */
@@ -1216,18 +1254,18 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src)
data.matched = 0;
data.matches = NULL;
#endif
- if (ed->collection->programs)
+ if (ed->table_programs_size > 0)
{
const Eina_List *match;
const Eina_List *l;
Edje_Program *pr;
- if (ed->patterns.programs.globing)
+ if (ed->patterns.programs.u.programs.globing)
if (edje_match_programs_exec(ed->patterns.programs.signals_patterns,
ed->patterns.programs.sources_patterns,
sig,
src,
- ed->patterns.programs.globing,
+ ed->patterns.programs.u.programs.globing,
_edje_glob_callback,
&data) == 0)
goto break_prog;
@@ -1292,12 +1330,12 @@ _edje_emit_cb(Edje *ed, const char *sig, const char *src)
int r = 1;
_edje_callbacks_patterns_init(ed);
- if (ed->patterns.callbacks.globing)
+ if (ed->patterns.callbacks.u.callbacks.globing)
r = edje_match_callback_exec(ed->patterns.callbacks.signals_patterns,
ed->patterns.callbacks.sources_patterns,
sig,
src,
- ed->patterns.callbacks.globing,
+ ed->patterns.callbacks.u.callbacks.globing,
ed);
if (!r)
@@ -1806,6 +1844,7 @@ _edje_param_convert(Edje_External_Param *param, const Edje_External_Param_Info *
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
case EDJE_EXTERNAL_PARAM_TYPE_INT:
i = param->i;
+ break;
default:
return NULL;
}
@@ -1830,6 +1869,7 @@ _edje_param_convert(Edje_External_Param *param, const Edje_External_Param_Info *
break;
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
d = (double)param->i;
+ break;
default:
return NULL;
}
diff --git a/src/lib/edje_script_only.c b/src/lib/edje_script_only.c
index 3b1b916..6a57c02 100644
--- a/src/lib/edje_script_only.c
+++ b/src/lib/edje_script_only.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
diff --git a/src/lib/edje_smart.c b/src/lib/edje_smart.c
index ba6f1b8..72ce6ec 100644
--- a/src/lib/edje_smart.c
+++ b/src/lib/edje_smart.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "edje_private.h"
static void _edje_smart_add(Evas_Object * obj);
@@ -151,7 +147,6 @@ static void
_edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
{
Edje *ed;
- int i;
ed = evas_object_smart_data_get(obj);
if (!ed) return;
@@ -178,6 +173,8 @@ _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
}
else
{
+ unsigned int i;
+
for (i = 0; i < ed->table_parts_size; i++)
{
Edje_Real_Part *ep;
@@ -234,6 +231,7 @@ _edje_smart_show(Evas_Object * obj)
ed = evas_object_smart_data_get(obj);
if (!ed) return;
+ if (evas_object_visible_get(obj)) return;
if (evas_object_visible_get(ed->clipper)) return;
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
evas_object_show(ed->clipper);
@@ -257,6 +255,7 @@ _edje_smart_hide(Evas_Object * obj)
ed = evas_object_smart_data_get(obj);
if (!ed) return;
+ if (!evas_object_visible_get(obj)) return;
if (!evas_object_visible_get(ed->clipper)) return;
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
evas_object_hide(ed->clipper);
diff --git a/src/lib/edje_text.c b/src/lib/edje_text.c
index ea59e16..23dd35f 100644
--- a/src/lib/edje_text.c
+++ b/src/lib/edje_text.c
@@ -1,7 +1,3 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "edje_private.h"
@@ -40,34 +36,46 @@ _edje_text_init(void)
void
_edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep)
{
- Eina_List *tmp;
Edje_Part *pt = ep->part;
- Edje_Part_Description *desc;
+ Edje_Part_Description_Text *desc;
+ unsigned int i;
if (ep->part->type != EDJE_PART_TYPE_TEXT) return;
/* if text class exists for this part, add the edje to the tc member list */
- if ((pt->default_desc) && (pt->default_desc->text.text_class))
- _edje_text_class_member_add(ed, pt->default_desc->text.text_class);
+ desc = (Edje_Part_Description_Text *) pt->default_desc;
+ if ((pt->default_desc) && (desc->text.text_class))
+ _edje_text_class_member_add(ed, desc->text.text_class);
/* If any other classes exist add them */
- EINA_LIST_FOREACH(pt->other_desc, tmp, desc)
- if ((desc) && (desc->text.text_class))
- _edje_text_class_member_add(ed, desc->text.text_class);
+ for (i = 0; i < pt->other.desc_count; ++i)
+ {
+ desc = (Edje_Part_Description_Text *) pt->other.desc[i];
+ if ((desc) && (desc->text.text_class))
+ _edje_text_class_member_add(ed, desc->text.text_class);
+ }
}
void
_edje_text_part_on_del(Edje *ed, Edje_Part *pt)
{
- Eina_List *tmp;
- Edje_Part_Description *desc;
+ Edje_Part_Description_Text *desc;
+ unsigned int i;
+
+ if (pt->type != EDJE_PART_TYPE_TEXT
+ && pt->type != EDJE_PART_TYPE_TEXTBLOCK)
+ return ;
- if ((pt->default_desc) && (pt->default_desc->text.text_class))
- _edje_text_class_member_del(ed, pt->default_desc->text.text_class);
+ desc = (Edje_Part_Description_Text *) pt->default_desc;
+ if ((pt->default_desc) && (desc->text.text_class))
+ _edje_text_class_member_del(ed, desc->text.text_class);
- EINA_LIST_FOREACH(pt->other_desc, tmp, desc)
- if (desc->text.text_class)
- _edje_text_class_member_del(ed, desc->text.text_class);
+ for (i = 0; i < pt->other.desc_count; ++i)
+ {
+ desc = (Edje_Part_Description_Text *) pt->other.desc[i];
+ if (desc->text.text_class)
+ _edje_text_class_member_del(ed, desc->text.text_class);
+ }
}
static void
@@ -118,7 +126,7 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
sc = ed->scale;
if (sc == ZERO) sc = _edje_scale;
-
+
*free_text = 0;
if (sw <= 1) return "";
@@ -161,7 +169,7 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
* FIXME: we might want to set a max string length somewhere...
*/
extra = 1 + 3 + 3; /* terminator, leading and trailing ellipsis */
- orig_len = MIN(orig_len, 8192 - extra);
+ orig_len = MIN(orig_len, ((size_t) 8192 - extra));
if (!(buf = malloc(orig_len + extra)))
return text;
@@ -216,7 +224,7 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
break;
}
}
- else if ((c1 > 0 && c1 >= orig_len) || c2 == 0)
+ else if ((c1 > 0 && (size_t) c1 >= orig_len) || c2 == 0)
{
buf[0] = 0;
break;
@@ -256,7 +264,7 @@ _edje_text_font_get(const char *base, const char *new, char **free_later)
font_len = strlen(new);
aux = strchr(base_style, ',');
- style_len = (aux) ? (aux - base_style) : strlen(base_style);
+ style_len = (aux) ? (aux - base_style) : (int) strlen(base_style);
*free_later = malloc(font_len + style_len + 1);
memcpy(*free_later, new, font_len);
@@ -267,12 +275,12 @@ _edje_text_font_get(const char *base, const char *new, char **free_later)
}
const char *
-_edje_text_class_font_get(Edje *ed, Edje_Part_Description *chosen_desc, int *size, char **free_later)
+_edje_text_class_font_get(Edje *ed, Edje_Part_Description_Text *chosen_desc, int *size, char **free_later)
{
Edje_Text_Class *tc;
const char *text_class_name, *font;
- font = chosen_desc->text.font;
+ font = edje_string_get(&chosen_desc->text.font);
*size = chosen_desc->text.size;
text_class_name = chosen_desc->text.text_class;
@@ -283,7 +291,7 @@ _edje_text_class_font_get(Edje *ed, Edje_Part_Description *chosen_desc, int *siz
if (!tc)
return font;
- font = _edje_text_font_get(chosen_desc->text.font, tc->font, free_later);
+ font = _edje_text_font_get(edje_string_get(&chosen_desc->text.font), tc->font, free_later);
*size = _edje_text_size_calc(*size, tc);
return font;
@@ -292,7 +300,7 @@ _edje_text_class_font_get(Edje *ed, Edje_Part_Description *chosen_desc, int *siz
void
_edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
Edje_Calc_Params *params,
- Edje_Part_Description *chosen_desc)
+ Edje_Part_Description_Text *chosen_desc)
{
const char *text;
const char *font;
@@ -306,7 +314,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
sc = ed->scale;
if (sc == 0.0) sc = _edje_scale;
- text = chosen_desc->text.text;
+ text = edje_string_get(&chosen_desc->text.text);
font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
if (ep->text.text) text = (char *) ep->text.text;
@@ -315,13 +323,13 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
if (ep->text.text_source)
{
- text = ep->text.text_source->chosen_description->text.text;
+ text = edje_string_get(&(((Edje_Part_Description_Text *)ep->text.text_source->chosen_description)->text.text));
if (ep->text.text_source->text.text) text = ep->text.text_source->text.text;
}
if (ep->text.source)
{
- font = ep->text.source->chosen_description->text.font;
- size = ep->text.source->chosen_description->text.size;
+ font = edje_string_get(&(((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.font));
+ size = ((Edje_Part_Description_Text *)ep->text.source->chosen_description)->text.size;
if (ep->text.source->text.font) font = ep->text.source->text.font;
if (ep->text.source->text.size > 0) size = ep->text.source->text.size;
}
@@ -330,13 +338,15 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
if (!font) font = "";
/* check if the font is embedded in the .eet */
- if (ed->file->font_hash)
+ if (ed->file->fonts)
{
- Edje_Font_Directory_Entry *fnt = eina_hash_find(ed->file->font_hash, font);
+ Edje_Font_Directory_Entry *fnt = eina_hash_find(ed->file->fonts, font);
if (fnt)
{
- font = fnt->path;
+ int len = strlen(fnt->entry) + sizeof("edje/fonts/") + 1;
+ font = alloca(len);
+ sprintf((char *)font, "edje/fonts/%s", fnt->entry);
inlined_font = 1;
}
}
@@ -384,7 +394,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
if (ep->text.cache.in_str) eina_stringshare_del(ep->text.cache.in_str);
ep->text.cache.in_str = eina_stringshare_add(text);
ep->text.cache.in_size = size;
- if (chosen_desc->text.fit_x)
+ if (chosen_desc->text.fit_x && (ep->text.cache.in_str != NULL && eina_stringshare_strlen(ep->text.cache.in_str) > 0))
{
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
else evas_object_text_font_source_set(ep->object, NULL);
@@ -395,12 +405,9 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
part_get_geometry(ep, &tw, &th);
if (tw > sw)
{
- int psize;
-
- psize = size;
while ((tw > sw) && (size > 0) && (tw != 0))
{
- psize = size;
+ int psize = size;
size = (size * sw) / tw;
if ((psize - size) <= 0) size = psize - 1;
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
@@ -414,13 +421,11 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
}
else if (tw < sw)
{
- int psize;
-
- psize = size;
while ((tw < sw) && (size > 0) && (tw != 0))
{
- psize = size;
+ int psize = size;
size = (size * sw) / tw;
+ /* fprintf(stderr, "size = %i (%i, %i)\n", size, sw, tw); */
if ((psize - size) >= 0) size = psize + 1;
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
else evas_object_text_font_source_set(ep->object, NULL);
@@ -432,7 +437,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
}
}
}
- if (chosen_desc->text.fit_y)
+ if (chosen_desc->text.fit_y && (ep->text.cache.in_str != NULL && eina_stringshare_strlen(ep->text.cache.in_str) > 0))
{
/* if we fit in the x axis, too, size already has a somewhat
* meaningful value, so don't overwrite it with the starting
@@ -485,13 +490,8 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
{
int bottom, top;
- if (th < sh)
- bottom = 10;
- else if (th > sh)
- {
- bottom = 1;
- top = 10;
- }
+ if (th < sh) bottom = 10;
+ else if (th > sh) bottom = 1;
else bottom = 0; /* XXX shut up GCC, th == sh is handled before! */
top = size;
diff --git a/src/lib/edje_textblock_styles.c b/src/lib/edje_textblock_styles.c
index c1b1305..d2013af 100644
--- a/src/lib/edje_textblock_styles.c
+++ b/src/lib/edje_textblock_styles.c
@@ -1,15 +1,11 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "edje_private.h"
static int
-_edje_font_is_embedded(Edje_File *edf, char *font __UNUSED__)
+_edje_font_is_embedded(Edje_File *edf, char *font)
{
- if (!edf->font_dir) return 0;
+ if (!eina_hash_find(edf->fonts, font)) return 0;
return 1;
}
@@ -119,7 +115,7 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret)
{
if (!tmp)
tmp = eina_strbuf_new();
- eina_strbuf_append(tmp, "fonts/");
+ eina_strbuf_append(tmp, "edje/fonts/");
eina_strbuf_append(tmp, val);
(*tag_ret)->font = eina_stringshare_add(eina_strbuf_string_get(tmp));
eina_strbuf_reset(tmp);
diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c
index 21fd78c..04c556c 100644
--- a/src/lib/edje_util.c
+++ b/src/lib/edje_util.c
@@ -1,8 +1,5 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
+#include <ctype.h>
#include "edje_private.h"
@@ -78,7 +75,7 @@ edje_freeze(void)
static void
_edje_thaw_edje(Edje *ed)
{
- int i;
+ unsigned int i;
for (i = 0; i < ed->table_parts_size; i++)
{
@@ -122,7 +119,7 @@ edje_thaw(void)
ed->freeze_calc = 0;
}
}
-#else
+#else
Evas_Object *data;
// FIXME: could just have a global freeze instead of per object
@@ -294,17 +291,13 @@ EAPI const char *
edje_object_data_get(const Evas_Object *obj, const char *key)
{
Edje *ed;
- Eina_List *l;
- Edje_Data *di;
ed = _edje_fetch(obj);
if ((!ed) || (!key))
return NULL;
if (!ed->collection) return NULL;
- EINA_LIST_FOREACH(ed->collection->data, l, di)
- if ((di->key) && (!strcmp(di->key, key)))
- return (const char *)di->value;
- return NULL;
+ if (!ed->collection->data) return NULL;
+ return edje_string_get(eina_hash_find(ed->collection->data, key));
}
/**
@@ -321,7 +314,7 @@ EAPI int
edje_object_freeze(Evas_Object *obj)
{
Edje *ed;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return 0;
@@ -348,7 +341,7 @@ EAPI int
edje_object_thaw(Evas_Object *obj)
{
Edje *ed;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return 0;
@@ -418,7 +411,7 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
free(cc);
return EINA_FALSE;
}
- if (!_edje_color_class_hash)
+ if (!_edje_color_class_hash)
_edje_color_class_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(_edje_color_class_hash, color_class, cc);
}
@@ -649,7 +642,7 @@ edje_object_color_class_set(Evas_Object *obj, const char *color_class, int r, in
Edje *ed;
Eina_List *l;
Edje_Color_Class *cc;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if ((!ed) || (!color_class)) return EINA_FALSE;
@@ -727,8 +720,8 @@ edje_object_color_class_set(Evas_Object *obj, const char *color_class, int r, in
rp = ed->table_parts[i];
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
- edje_object_color_class_set(rp->swallowed_object, color_class,
- r, g, b, a, r2, g2, b2, a2, r3, g3, b3,
+ edje_object_color_class_set(rp->swallowed_object, color_class,
+ r, g, b, a, r2, g2, b2, a2, r3, g3, b3,
a3);
}
@@ -817,7 +810,7 @@ edje_object_color_class_del(Evas_Object *obj, const char *color_class)
Edje *ed;
Eina_List *l;
Edje_Color_Class *cc = NULL;
- int i;
+ unsigned int i;
if (!color_class) return;
@@ -1014,7 +1007,7 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
Edje *ed;
Eina_List *l;
Edje_Text_Class *tc;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if ((!ed) || (!text_class)) return EINA_FALSE;
@@ -1067,7 +1060,7 @@ edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char
rp = ed->table_parts[i];
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
- edje_object_text_class_set(rp->swallowed_object, text_class,
+ edje_object_text_class_set(rp->swallowed_object, text_class,
font, size);
}
@@ -1191,11 +1184,11 @@ edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coo
/**
* @brief Set the function that provides item objects for named items in an edje entry text
- *
+ *
* @param obj A valid Evas Object handle
* @param func The function to call (or NULL to disable) to get item objects
* @param data The data pointer to pass to the @p func callback
- *
+ *
* Item objects may be deleted any time by Edje, and will be deleted when the
* Edje object is deleted (or file is set to a new file).
*/
@@ -1228,7 +1221,7 @@ EAPI void
edje_object_text_change_cb_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, const char *part), void *data)
{
Edje *ed;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return;
@@ -1856,7 +1849,7 @@ edje_object_part_text_select_extend(const Evas_Object *obj, const char *part)
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -1879,7 +1872,7 @@ edje_object_part_text_cursor_next(const Evas_Object *obj, const char *part, Edje
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -1902,7 +1895,7 @@ edje_object_part_text_cursor_prev(const Evas_Object *obj, const char *part, Edje
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -1925,7 +1918,7 @@ edje_object_part_text_cursor_up(const Evas_Object *obj, const char *part, Edje_C
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -1948,7 +1941,7 @@ edje_object_part_text_cursor_down(const Evas_Object *obj, const char *part, Edje
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -1970,7 +1963,7 @@ edje_object_part_text_cursor_begin_set(const Evas_Object *obj, const char *part,
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -1992,7 +1985,7 @@ edje_object_part_text_cursor_end_set(const Evas_Object *obj, const char *part, E
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -2014,7 +2007,7 @@ edje_object_part_text_cursor_copy(const Evas_Object *obj, const char *part, Edje
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -2036,7 +2029,7 @@ edje_object_part_text_cursor_line_begin_set(const Evas_Object *obj, const char *
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -2058,7 +2051,7 @@ edje_object_part_text_cursor_line_end_set(const Evas_Object *obj, const char *pa
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -2081,7 +2074,7 @@ edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *p
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -2104,7 +2097,7 @@ edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const
/**
* @brief XX
- *
+ *
* @param obj A valid Evas_Object handle
* @param part The part name
*/
@@ -2137,7 +2130,7 @@ edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part,
cb->part = eina_stringshare_add(part);
cb->func = func;
cb->data = (void*) data;
- ed->text_insert_filter_callbacks =
+ ed->text_insert_filter_callbacks =
eina_list_append(ed->text_insert_filter_callbacks, cb);
}
@@ -2147,14 +2140,14 @@ edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part,
Edje *ed;
Edje_Text_Insert_Filter_Callback *cb;
Eina_List *l;
-
+
ed = _edje_fetch(obj);
if ((!ed) || (!part)) return;
EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
{
if ((!strcmp(cb->part, part)) && (cb->func == func) && (cb->data == data))
{
- ed->text_insert_filter_callbacks =
+ ed->text_insert_filter_callbacks =
eina_list_remove_list(ed->text_insert_filter_callbacks, l);
eina_stringshare_del(cb->part);
free(cb);
@@ -2411,7 +2404,7 @@ _edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data,
return EINA_TRUE;
}
-void
+static void
_edje_box_layout_external_free(Eina_Rbtree *node, __UNUSED__ void *data)
{
Edje_Box_Layout *l = (Edje_Box_Layout *)node;
@@ -2700,12 +2693,12 @@ edje_object_calc_force(Evas_Object *obj)
pf2 = _edje_freeze_val;
pf = ed->freeze;
-
+
_edje_freeze_val = 0;
ed->freeze = 0;
-
+
_edje_recalc_do(ed);
-
+
ed->freeze = pf;
_edje_freeze_val = pf2;
}
@@ -2740,7 +2733,7 @@ edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, E
Edje *ed;
Evas_Coord x1 = INT_MAX, y1 = INT_MAX;
Evas_Coord x2 = 0, y2 = 0;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed)
@@ -2794,7 +2787,9 @@ edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, E
* @param restrictedw Do not allow object min width calc to be less than this
* @param restrictedh Do not allow object min height calc to be less than this
*
- * Calculates the object's minimum size ?!
+ * Calculates the object's minimum size ?! Be carefull the behaviour of this
+ * fonction is not really defined when a TEXTBLOCK part is present in the
+ * Edje_Object. This may change in futur implementation.
*/
EAPI void
edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh)
@@ -2828,7 +2823,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co
ok = 1;
while (ok)
{
- int i;
+ unsigned int i;
ok = 0;
ed->dirty = 1;
@@ -2871,7 +2866,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co
if (!ep->chosen_description->fixed.h)
{
if (!((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
- (!ep->chosen_description->text.min_x) &&
+ (!((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x) &&
(didw)))
{
if (h > maxh)
@@ -3935,15 +3930,15 @@ edje_object_part_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear
}
static void
-_edje_perspective_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_edje_perspective_obj_del(void *data, __UNUSED__ Evas *e, __UNUSED__ Evas_Object *obj, __UNUSED__ void *event_info)
{
- Edje_Perspective *ps = data;
+ Edje_Perspective *ps = data;
Evas_Object *o;
-
+
EINA_LIST_FREE(ps->users, o)
{
Edje *ed;
-
+
ed = evas_object_smart_data_get(o);
if (!ed) continue;
ed->persp = NULL;
@@ -3958,7 +3953,7 @@ edje_perspective_new(Evas *e)
{
Edje_Perspective *ps;
Evas_Coord vx, vy, vw, vh;
-
+
if (!e) return NULL;
ps = calloc(1, sizeof(Edje_Perspective));
ps->obj = evas_object_rectangle_add(e);
@@ -3985,7 +3980,7 @@ edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Co
{
Eina_List *l;
Evas_Object *o;
-
+
if (!ps) return;
if ((ps->px == px) && (ps->py == py) && (ps->z0 == z0) && (ps->foc == foc)) return;
ps->px = px;
@@ -3995,7 +3990,7 @@ edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Co
EINA_LIST_FOREACH(ps->users, l, o)
{
Edje *ed;
-
+
ed = evas_object_smart_data_get(o);
if (!ed) continue;
if (!ed->persp)
@@ -4009,7 +4004,7 @@ edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Co
EINA_LIST_FOREACH(_edje_edjes, l, o)
{
Edje *ed;
-
+
ed = evas_object_smart_data_get(o);
if (!ed) continue;
if (!ed->persp)
@@ -4026,12 +4021,12 @@ edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global)
{
Evas_Object *o;
Eina_List *l;
-
+
if (!ps) return;
if (ps->global == global) return;
if (global)
{
- o = evas_object_name_find(evas_object_evas_get(ps->obj),
+ o = evas_object_name_find(evas_object_evas_get(ps->obj),
"_edje_perspective");
if (o) evas_object_name_set(o, NULL);
evas_object_name_set(ps->obj, "_edje_perspective");
@@ -4042,7 +4037,7 @@ edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global)
EINA_LIST_FOREACH(_edje_edjes, l, o)
{
Edje *ed;
-
+
ed = evas_object_smart_data_get(o);
if (!ed) continue;
if (!ed->persp)
@@ -4064,7 +4059,7 @@ EAPI const Edje_Perspective *
edje_evas_global_perspective_get(const Evas *e)
{
Evas_Object *obj;
-
+
if (!e) return NULL;
obj = evas_object_name_find(e, "_edje_perspective");
if (!obj) return NULL;
@@ -4075,7 +4070,7 @@ EAPI void
edje_object_perspective_set(Evas_Object *obj, Edje_Perspective *ps)
{
Edje *ed;
-
+
ed = evas_object_smart_data_get(obj);
if (!ed) return;
if (ed->persp == ps) return;
@@ -4094,7 +4089,7 @@ EAPI const Edje_Perspective *
edje_object_perspective_get(const Evas_Object *obj)
{
Edje *ed;
-
+
ed = evas_object_smart_data_get(obj);
if (!ed) return NULL;
return ed->persp;
@@ -4108,7 +4103,7 @@ edje_object_preload(Evas_Object *obj, Eina_Bool cancel)
{
Edje *ed;
int count;
- int i;
+ unsigned int i;
ed = _edje_fetch(obj);
if (!ed) return EINA_FALSE;
@@ -4182,7 +4177,7 @@ edje_object_preload(Evas_Object *obj, Eina_Bool cancel)
Eina_Bool
_edje_real_part_table_pack(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
{
- Eina_Bool ret =
+ Eina_Bool ret =
evas_object_table_pack(rp->object, child_obj, col, row, colspan, rowspan);
_edje_table_child_add(rp, child_obj);
@@ -4239,39 +4234,117 @@ _edje_real_part_recursive_get(Edje *ed, const char *part)
return rp;
}
+Evas_Object *
+_edje_children_get(Edje_Real_Part *rp, const char *partid)
+{
+ Evas_Object *child;
+ Eina_List *l;
+ long int v;
+ char *p;
+
+ if (!partid) return NULL;
+
+ switch (rp->part->type)
+ {
+ case EDJE_PART_TYPE_EXTERNAL:
+ return _edje_external_content_get(rp->swallowed_object, partid);
+ case EDJE_PART_TYPE_BOX:
+ l = evas_object_box_children_get(rp->object);
+ break;
+ case EDJE_PART_TYPE_TABLE:
+ l = evas_object_table_children_get(rp->object);
+ break;
+ default:
+ return NULL;
+ }
+
+ v = strtol(partid, &p, 10);
+ if ((*p == '\0') && (v >= 0))
+ {
+ child = eina_list_nth(l, v);
+ }
+ else
+ {
+ Evas_Object *cur;
+ child = NULL;
+ EINA_LIST_FREE(l, cur)
+ {
+ const char *name = evas_object_name_get(cur);
+ if ((name) && (!strcmp(name, partid)))
+ {
+ child = cur;
+ break;
+ }
+ }
+ }
+ eina_list_free(l);
+
+ return child;
+}
+
Edje_Real_Part *
_edje_real_part_recursive_get_helper(Edje *ed, char **path)
{
Edje_Real_Part *rp;
- Evas_Object *o;
- Eina_List *l;
+ Evas_Object *child;
+ const char *alias = NULL;
+ char *idx = NULL;
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
- rp = _edje_real_part_get(ed, path[0]);
- if (path[1] == NULL) return rp;
+ if (path[0])
+ idx = strchr(path[0], EDJE_PART_PATH_SEPARATOR_INDEXL);
+ if (idx)
+ {
+ char *end;
+
+ end = strchr(idx + 1, EDJE_PART_PATH_SEPARATOR_INDEXR);
+ if (end)
+ {
+ *end = '\0';
+ *idx = '\0';
+ idx++;
+ }
+ }
+
+ if (ed->collection && ed->collection->alias)
+ alias = eina_hash_find(ed->collection->alias, path[0]);
+ if (alias)
+ {
+ rp = _edje_real_part_recursive_get(ed, alias);
+ if (path[1] == NULL) return rp;
+ if (!rp) return NULL;
+ }
+ else
+ {
+ rp = _edje_real_part_get(ed, path[0]);
+ if (path[1] == NULL) return rp;
+ if (!rp) return NULL;
+ }
- if (!rp) return NULL;
switch (rp->part->type)
{
case EDJE_PART_TYPE_GROUP:
- if (!rp->swallowed_object) return NULL;
- ed = _edje_fetch(rp->swallowed_object);
- if (!ed) return NULL;
- path++;
- return _edje_real_part_recursive_get_helper(ed, path);
- case EDJE_PART_TYPE_BOX: case EDJE_PART_TYPE_TABLE:
- if (!rp->items) return NULL;
- path++;
- EINA_LIST_FOREACH(rp->items, l, o)
- {
- ed = _edje_fetch(o);
- if (!ed) return NULL;
- if ((rp = _edje_real_part_recursive_get_helper(ed, path)))
- return rp;
- }
- return NULL;
+ if (!rp->swallowed_object) return NULL;
+ ed = _edje_fetch(rp->swallowed_object);
+ if (!ed) return NULL;
+ path++;
+ return _edje_real_part_recursive_get_helper(ed, path);
+ case EDJE_PART_TYPE_BOX:
+ case EDJE_PART_TYPE_TABLE:
+ case EDJE_PART_TYPE_EXTERNAL:
+ if (!idx) return rp;
+ path++;
+
+ child = _edje_children_get(rp, idx);
+
+ ed = _edje_fetch(child);
+ if (!ed) return NULL;
+ if ((rp = _edje_real_part_recursive_get_helper(ed, path)))
+ return rp;
+
+ return NULL;
default:
- return NULL;
+ return NULL;
}
}
@@ -4281,7 +4354,9 @@ _edje_real_part_recursive_get_helper(Edje *ed, char **path)
Edje_Real_Part *
_edje_real_part_get(Edje *ed, const char *part)
{
- int i;
+ unsigned int i;
+
+ if (!part) return NULL;
for (i = 0; i < ed->table_parts_size; i++)
{
@@ -4389,15 +4464,14 @@ _edje_color_class_hash_free(void)
void
_edje_color_class_on_del(Edje *ed, Edje_Part *ep)
{
- Eina_List *tmp;
- Edje_Part_Description *desc;
+ unsigned int i;
if ((ep->default_desc) && (ep->default_desc->color_class))
_edje_color_class_member_del(ed, ep->default_desc->color_class);
- EINA_LIST_FOREACH(ep->other_desc, tmp, desc)
- if (desc->color_class)
- _edje_color_class_member_del(ed, desc->color_class);
+ for (i = 0; i < ep->other.desc_count; ++i)
+ if (ep->other.desc[i]->color_class)
+ _edje_color_class_member_del(ed, ep->other.desc[i]->color_class);
}
Edje_Text_Class *
@@ -4430,7 +4504,7 @@ _edje_text_class_member_add(Edje *ed, const char *text_class)
members = eina_list_prepend(members, ed);
/* Add the member list back */
- if (!_edje_text_class_member_hash)
+ if (!_edje_text_class_member_hash)
_edje_text_class_member_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(_edje_text_class_member_hash, text_class, members);
}
@@ -4552,7 +4626,7 @@ _edje_block_violate(Edje *ed)
{
if (ed->block > 0) ed->block_break = 1;
}
-
+
void
_edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
@@ -4571,7 +4645,7 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
char *type;
type = (char *)evas_object_type_get(rp->swallowed_object);
-
+
rp->swallow_params.min.w = 0;
rp->swallow_params.min.h = 0;
rp->swallow_params.max.w = -1;
@@ -4611,22 +4685,22 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
if (h2 > 0) rp->swallow_params.max.h = h2;
switch (am)
{
- case EVAS_ASPECT_CONTROL_NONE:
- rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE;
+ case EVAS_ASPECT_CONTROL_NONE:
+ rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE;
break;
- case EVAS_ASPECT_CONTROL_NEITHER:
- rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER;
+ case EVAS_ASPECT_CONTROL_NEITHER:
+ rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER;
break;
- case EVAS_ASPECT_CONTROL_HORIZONTAL:
- rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL;
+ case EVAS_ASPECT_CONTROL_HORIZONTAL:
+ rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL;
break;
- case EVAS_ASPECT_CONTROL_VERTICAL:
+ case EVAS_ASPECT_CONTROL_VERTICAL:
rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_VERTICAL;
break;
- case EVAS_ASPECT_CONTROL_BOTH:
- rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH;
+ case EVAS_ASPECT_CONTROL_BOTH:
+ rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH;
break;
- default:
+ default:
break;
}
rp->swallow_params.aspect.w = aw;
@@ -4640,17 +4714,15 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
}
void
-_edje_object_part_swallow_changed_hints_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_edje_object_part_swallow_changed_hints_cb(void *data, __UNUSED__ Evas *e, __UNUSED__ Evas_Object *obj, __UNUSED__ void *event_info)
{
Edje_Real_Part *rp;
-
+
rp = data;
_edje_real_part_swallow_hints_update(rp);
rp->edje->dirty = 1;
_edje_recalc(rp->edje);
return;
- e = NULL;
- event_info = NULL;
}
void
@@ -4681,17 +4753,17 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow)
evas_object_clip_set(rp->swallowed_object, rp->clip_to->object);
else evas_object_clip_set(rp->swallowed_object, rp->edje->clipper);
evas_object_stack_above(rp->swallowed_object, rp->object);
- evas_object_event_callback_add(rp->swallowed_object,
+ evas_object_event_callback_add(rp->swallowed_object,
EVAS_CALLBACK_FREE,
_edje_object_part_swallow_free_cb,
rp->edje->obj);
- evas_object_event_callback_add(rp->swallowed_object,
+ evas_object_event_callback_add(rp->swallowed_object,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_edje_object_part_swallow_changed_hints_cb,
rp);
-
+
_edje_real_part_swallow_hints_update(rp);
-
+
if (rp->part->mouse_events)
{
_edje_callbacks_add(obj_swallow, rp->edje, rp);
@@ -4740,7 +4812,7 @@ _edje_object_preload(Edje *ed)
}
static void
-_edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+_edje_object_image_preload_cb(void *data, __UNUSED__ Evas *e, Evas_Object *obj, __UNUSED__ void *event_info)
{
Edje *ed = data;
@@ -4749,10 +4821,110 @@ _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event
}
static void
-_edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+_edje_object_signal_preload_cb(void *data, Evas_Object *obj, __UNUSED__ const char *emission, __UNUSED__ const char *source)
{
Edje *ed = data;
edje_object_signal_callback_del(obj, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb);
_edje_object_preload(ed);
}
+
+EAPI void
+_edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p)
+{
+ Edje_Program ***array;
+ unsigned int *count;
+ unsigned int i;
+
+ if (!p->signal && !p->source)
+ {
+ array = &edc->programs.nocmp;
+ count = &edc->programs.nocmp_count;
+ }
+ else if (p->signal && strpbrk(p->signal, "*?[\\") == NULL
+ && p->source && strpbrk(p->source, "*?[\\") == NULL)
+ {
+ array = &edc->programs.strcmp;
+ count = &edc->programs.strcmp_count;
+ }
+ else if (p->signal && edje_program_is_strncmp(p->signal)
+ && p->source && edje_program_is_strncmp(p->source))
+ {
+ array = &edc->programs.strncmp;
+ count = &edc->programs.strncmp_count;
+ }
+ else if (p->signal && edje_program_is_strrncmp(p->signal)
+ && p->source && edje_program_is_strrncmp(p->source))
+ {
+ array = &edc->programs.strrncmp;
+ count = &edc->programs.strrncmp_count;
+ }
+ else
+ {
+ array = &edc->programs.fnmatch;
+ count = &edc->programs.fnmatch_count;
+ }
+
+ for (i = 0; i < *count; ++i)
+ if ((*array)[i] == p)
+ {
+ memmove(*array + i, *array + i + 1, sizeof (Edje_Program *) * (*count - i -1));
+ (*count)--;
+ break;
+ }
+}
+
+EAPI void
+_edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p)
+{
+ Edje_Program ***array;
+ unsigned int *count;
+
+ if (!p->signal && !p->source)
+ {
+ array = &edc->programs.nocmp;
+ count = &edc->programs.nocmp_count;
+ }
+ else if (p->signal && strpbrk(p->signal, "*?[\\") == NULL
+ && p->source && strpbrk(p->source, "*?[\\") == NULL)
+ {
+ array = &edc->programs.strcmp;
+ count = &edc->programs.strcmp_count;
+ }
+ else if (p->signal && edje_program_is_strncmp(p->signal)
+ && p->source && edje_program_is_strncmp(p->source))
+ {
+ array = &edc->programs.strncmp;
+ count = &edc->programs.strncmp_count;
+ }
+ else if (p->signal && edje_program_is_strrncmp(p->signal)
+ && p->source && edje_program_is_strrncmp(p->source))
+ {
+ array = &edc->programs.strrncmp;
+ count = &edc->programs.strrncmp_count;
+ }
+ else
+ {
+ array = &edc->programs.fnmatch;
+ count = &edc->programs.fnmatch_count;
+ }
+
+ *array = realloc(*array, sizeof (Edje_Program *) * (*count + 1));
+ (*array)[(*count)++] = p;
+}
+
+const char *
+edje_string_get(const Edje_String *es)
+{
+ /* FIXME: Handle localization here */
+ if (!es) return NULL;
+ return es->str;
+}
+
+const char *
+edje_string_id_get(const Edje_String *es)
+{
+ /* FIXME: Handle localization here */
+ if (!es) return NULL;
+ return es->str;
+}
diff --git a/src/lib/edje_var.c b/src/lib/edje_var.c
index 4ba8b36..2bd87e4 100644
--- a/src/lib/edje_var.c
+++ b/src/lib/edje_var.c
@@ -1,18 +1,14 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "edje_private.h"
-static int _edje_var_timer_cb(void *data);
-static int _edje_var_anim_cb(void *data);
+static Eina_Bool _edje_var_timer_cb(void *data);
+static Eina_Bool _edje_var_anim_cb(void *data);
static Ecore_Animator *_edje_animator = NULL;
static Eina_List *_edje_anim_list = NULL;
-static int
+static Eina_Bool
_edje_var_timer_cb(void *data)
{
Edje_Var_Timer *et;
@@ -20,7 +16,7 @@ _edje_var_timer_cb(void *data)
Embryo_Function fn;
et = data;
- if (!et) return 0;
+ if (!et) return ECORE_CALLBACK_CANCEL;
ed = et->edje;
// _edje_embryo_script_reset(ed);
embryo_program_vm_push(ed->collection->script);
@@ -40,10 +36,10 @@ _edje_var_timer_cb(void *data)
embryo_program_vm_pop(ed->collection->script);
_edje_recalc(ed);
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_edje_var_anim_cb(void *data __UNUSED__)
{
Eina_List *l, *tl = NULL;