2008-03-06 11:48:11 -08:00
|
|
|
/*
|
|
|
|
* TODO
|
|
|
|
* -----------------------------------------------------------------
|
2009-08-17 07:49:26 -07:00
|
|
|
* Add LUA Support :)
|
2008-03-06 11:48:11 -08:00
|
|
|
* Remove images/fonts
|
2009-08-17 07:49:26 -07:00
|
|
|
* Clean the saving routines
|
2008-03-13 12:01:53 -07:00
|
|
|
*
|
2008-03-06 11:48:11 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "edje_private.h"
|
2009-08-17 07:49:26 -07:00
|
|
|
|
2010-09-22 07:52:23 -07:00
|
|
|
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
|
|
|
|
#include "Edje_Edit.h"
|
|
|
|
|
2012-10-21 03:46:58 -07:00
|
|
|
#include <Eo.h>
|
|
|
|
|
2012-10-22 02:36:23 -07:00
|
|
|
#ifdef MY_CLASS
|
|
|
|
# undef MY_CLASS
|
|
|
|
#endif
|
|
|
|
|
2012-10-21 03:46:58 -07:00
|
|
|
#define MY_CLASS EDJE_EDIT_CLASS
|
|
|
|
|
2010-09-01 10:15:52 -07:00
|
|
|
static const char EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED_STR[] = "Current group cannot be deleted";
|
|
|
|
static const char EDJE_EDIT_ERROR_GROUP_REFERENCED_STR[] = "Group still in use";
|
|
|
|
static const char EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST_STR[] = "Group does not exist";
|
|
|
|
|
2013-10-11 00:49:13 -07:00
|
|
|
EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_CURRENTLY_USED = 0;
|
2010-09-01 10:15:52 -07:00
|
|
|
EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_REFERENCED = 0;
|
|
|
|
EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST = 0;
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2012-01-16 04:34:13 -08:00
|
|
|
/* Get eed(Edje_Edit*) from obj(Evas_Object*) */
|
|
|
|
#define GET_EED_OR_RETURN(RET) \
|
2010-04-22 10:56:00 -07:00
|
|
|
Edje_Edit *eed; \
|
2012-10-21 03:46:58 -07:00
|
|
|
if (!eo_isa(obj, MY_CLASS)) \
|
2010-04-22 10:56:00 -07:00
|
|
|
return RET; \
|
2013-05-02 00:47:16 -07:00
|
|
|
eed = eo_data_scope_get(obj, MY_CLASS); \
|
2012-01-16 04:34:13 -08:00
|
|
|
if (!eed) return RET;
|
|
|
|
|
|
|
|
/* Get ed(Edje*) from obj(Evas_Object*) */
|
|
|
|
#define GET_ED_OR_RETURN(RET) \
|
|
|
|
Edje *ed; \
|
2014-06-02 06:47:59 -07:00
|
|
|
if (!eo_isa(obj, EDJE_CLASS)) \
|
2012-10-25 02:56:31 -07:00
|
|
|
return RET; \
|
2014-06-02 06:47:59 -07:00
|
|
|
ed = eo_data_scope_get(obj, EDJE_CLASS);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
/* Get rp(Edje_Real_Part*) from obj(Evas_Object*) and part(char*) */
|
|
|
|
#define GET_RP_OR_RETURN(RET) \
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_ED_OR_RETURN(RET) \
|
2008-03-06 11:48:11 -08:00
|
|
|
Edje_Real_Part *rp; \
|
|
|
|
rp = _edje_real_part_get(ed, part); \
|
|
|
|
if (!rp) return RET;
|
|
|
|
|
|
|
|
/* Get pd(Edje_Part_Description*) from obj(Evas_Object*), part(char*) and state (char*) */
|
|
|
|
#define GET_PD_OR_RETURN(RET) \
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_EED_OR_RETURN(RET) \
|
|
|
|
GET_ED_OR_RETURN(RET) \
|
2010-08-09 16:09:24 -07:00
|
|
|
Edje_Real_Part *rp; \
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *pd; \
|
2010-08-09 16:09:24 -07:00
|
|
|
rp = _edje_real_part_get(ed, part); \
|
|
|
|
if (!rp) return RET; \
|
2010-04-22 10:56:00 -07:00
|
|
|
pd = _edje_part_description_find_byname(eed, part, state, value); \
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!pd) return RET;
|
|
|
|
|
|
|
|
/* Get epr(Edje_Program*) from obj(Evas_Object*) and prog(char*)*/
|
|
|
|
#define GET_EPR_OR_RETURN(RET) \
|
|
|
|
Edje_Program *epr; \
|
2012-10-21 03:46:58 -07:00
|
|
|
if (!eo_isa(obj, MY_CLASS)) \
|
2010-04-22 10:56:00 -07:00
|
|
|
return RET; \
|
2008-03-06 11:48:11 -08:00
|
|
|
epr = _edje_program_get_byname(obj, prog); \
|
|
|
|
if (!epr) return RET;
|
|
|
|
|
2009-08-17 06:54:17 -07:00
|
|
|
static void *
|
|
|
|
_alloc(size_t size)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
|
|
|
void *mem;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
mem = calloc(1, size);
|
|
|
|
if (mem) return mem;
|
2009-12-22 05:46:00 -08:00
|
|
|
ERR("Edje_Edit: Error. memory allocation of %i bytes failed. %s",
|
|
|
|
(int)size, strerror(errno));
|
2008-03-06 11:48:11 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************/
|
|
|
|
/* INTERNALS */
|
|
|
|
/*************/
|
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
/* Edje_Edit smart! Overloads the edje one adding some more control stuff */
|
|
|
|
static const char _edje_edit_type[] = "edje_edit";
|
2009-09-17 15:38:35 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
typedef struct _Edje_Edit Edje_Edit;
|
|
|
|
struct _Edje_Edit
|
|
|
|
{
|
2012-10-21 06:35:16 -07:00
|
|
|
Edje *base;
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
void *bytecode;
|
|
|
|
int bytecode_size;
|
|
|
|
|
|
|
|
char *embryo_source;
|
|
|
|
char *embryo_processed;
|
|
|
|
Eina_Hash *program_scripts;
|
|
|
|
|
2010-12-07 11:06:53 -08:00
|
|
|
Eina_List *errors;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
Eina_Bool bytecode_dirty:1;
|
|
|
|
Eina_Bool embryo_source_dirty:1;
|
|
|
|
Eina_Bool all_dirty:1;
|
|
|
|
Eina_Bool script_need_recompile:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Program_Script Program_Script;
|
|
|
|
struct _Program_Script
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
char *code;
|
|
|
|
char *processed;
|
|
|
|
Eina_Bool dirty:1;
|
|
|
|
Eina_Bool delete_me:1;
|
2010-04-22 10:56:00 -07:00
|
|
|
};
|
|
|
|
|
2010-04-29 11:52:55 -07:00
|
|
|
static Eina_Bool _edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef);
|
2010-04-22 10:56:00 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
static void
|
|
|
|
_edje_edit_data_clean(Edje_Edit *eed)
|
|
|
|
{
|
2010-12-07 11:06:53 -08:00
|
|
|
Edje_Edit_Script_Error *se;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
free(eed->bytecode);
|
|
|
|
free(eed->embryo_source);
|
|
|
|
free(eed->embryo_processed);
|
|
|
|
|
|
|
|
if (eed->program_scripts)
|
|
|
|
eina_hash_free(eed->program_scripts);
|
|
|
|
|
2010-12-07 11:06:53 -08:00
|
|
|
EINA_LIST_FREE(eed->errors, se)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(se->program_name);
|
|
|
|
eina_stringshare_del(se->error_str);
|
|
|
|
free(se);
|
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
eed->bytecode = NULL;
|
|
|
|
eed->embryo_source = NULL;
|
|
|
|
eed->embryo_processed = NULL;
|
|
|
|
eed->program_scripts = NULL;
|
|
|
|
eed->bytecode_size = 0;
|
|
|
|
eed->bytecode_dirty = EINA_FALSE;
|
|
|
|
eed->embryo_source_dirty = EINA_FALSE;
|
|
|
|
eed->all_dirty = EINA_FALSE;
|
|
|
|
eed->script_need_recompile = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2014-06-02 06:47:59 -07:00
|
|
|
_edje_edit_evas_object_smart_del(Eo *obj, Edje_Edit *eed)
|
2010-04-22 10:56:00 -07:00
|
|
|
{
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_data_clean(eed);
|
2010-04-22 10:56:00 -07:00
|
|
|
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
|
2010-04-22 10:56:00 -07:00
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
static void
|
|
|
|
_edje_edit_program_script_free(Program_Script *ps)
|
|
|
|
{
|
|
|
|
free(ps->code);
|
|
|
|
free(ps->processed);
|
|
|
|
free(ps);
|
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_edje_edit_edje_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *group)
|
2010-04-22 10:56:00 -07:00
|
|
|
{
|
2014-03-18 07:00:14 -07:00
|
|
|
Eina_Bool ret;
|
2010-12-02 10:20:34 -08:00
|
|
|
Eet_File *ef;
|
|
|
|
char **keys, buf[64];
|
|
|
|
int count, i;
|
|
|
|
int len = strlen("edje/scripts/embryo/source/");
|
2010-04-22 10:56:00 -07:00
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
ret = EINA_FALSE;
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
_edje_edit_data_clean(eed);
|
|
|
|
|
|
|
|
/* TODO and maybes:
|
2010-04-22 10:56:00 -07:00
|
|
|
* * The whole point of this thing is keep track of stuff such as
|
|
|
|
* strings to free and who knows what, so we need to take care
|
|
|
|
* of those if the file/group changes.
|
|
|
|
* * Maybe have the possibility to open just files, not always with
|
|
|
|
* a group given.
|
|
|
|
* * A way to skip the cache? Could help avoid some issues when editing
|
|
|
|
* a group being used by the application in some other way, or multiple
|
|
|
|
* opens of the same file.
|
|
|
|
* * Here we probably want to allow opening groups with broken references
|
2010-09-08 04:50:05 -07:00
|
|
|
* (GROUP parts or BOX/TABLE items pointing to non-existent/renamed
|
2010-04-22 10:56:00 -07:00
|
|
|
* groups).
|
|
|
|
*/
|
2012-10-21 03:46:58 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2014-04-02 03:16:09 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = edje_obj_file_set(file, group));
|
2012-10-21 03:46:58 -07:00
|
|
|
if (!int_ret)
|
2014-03-18 07:00:14 -07:00
|
|
|
return ret;
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
eed->program_scripts = eina_hash_int32_new((Eina_Free_Cb)_edje_edit_program_script_free);
|
|
|
|
|
|
|
|
ef = eet_open(file, EET_FILE_MODE_READ);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
|
2012-10-21 06:35:16 -07:00
|
|
|
eed->base->collection->id);
|
2010-12-02 10:20:34 -08:00
|
|
|
eed->embryo_source = eet_read(ef, buf, &count);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/*",
|
2012-10-21 06:35:16 -07:00
|
|
|
eed->base->collection->id);
|
2010-12-02 10:20:34 -08:00
|
|
|
keys = eet_list(ef, buf, &count);
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
Program_Script *ps;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
ps = calloc(1, sizeof(Program_Script));
|
|
|
|
|
|
|
|
sscanf(keys[i] + len, "%*i/%i", &ps->id);
|
|
|
|
ps->code = eet_read(ef, keys[i], &size);
|
|
|
|
eina_hash_add(eed->program_scripts, &ps->id, ps);
|
|
|
|
}
|
2011-01-15 19:28:24 -08:00
|
|
|
if (keys) free(keys);
|
2012-09-04 14:43:32 -07:00
|
|
|
eet_close(ef);
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
ret = EINA_TRUE;
|
|
|
|
|
|
|
|
return ret;
|
2010-04-22 10:56:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
2012-10-21 03:46:58 -07:00
|
|
|
edje_edit_object_add(Evas *evas)
|
2010-04-22 10:56:00 -07:00
|
|
|
{
|
2012-10-21 03:46:58 -07:00
|
|
|
Evas_Object *e;
|
|
|
|
e = eo_add(MY_CLASS, evas);
|
|
|
|
eo_unref(e);
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_edje_edit_eo_base_constructor(Eo *obj, Edje_Edit *eed)
|
2012-10-21 03:46:58 -07:00
|
|
|
{
|
2014-06-02 06:47:59 -07:00
|
|
|
eed->base = eo_data_ref(obj, EDJE_CLASS);
|
2012-10-21 06:35:16 -07:00
|
|
|
|
2013-03-18 08:33:54 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
2010-04-22 10:56:00 -07:00
|
|
|
}
|
2013-05-02 00:47:16 -07:00
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_edje_edit_eo_base_destructor(Eo *obj, Edje_Edit *class_data EINA_UNUSED)
|
2013-05-02 00:47:16 -07:00
|
|
|
{
|
|
|
|
eo_do_super(obj, MY_CLASS, eo_destructor());
|
|
|
|
eo_data_unref(obj, class_data);
|
|
|
|
}
|
2014-03-18 07:00:14 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
/* End of Edje_Edit smart stuff */
|
2010-04-07 10:04:49 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
static Edje_Part_Description_Common *
|
2010-04-22 10:56:00 -07:00
|
|
|
_edje_part_description_find_byname(Edje_Edit *eed, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *pd;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
if (!eed || !part || !state) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-11-03 22:47:47 -08:00
|
|
|
rp = _edje_real_part_get(eed->base, part);
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!rp) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-12-22 16:51:43 -08:00
|
|
|
pd = _edje_part_description_find(eed->base, rp, state, value, EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
return pd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_image_id_find(Edje_Edit *eed, const char *image_name)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2012-10-21 06:35:16 -07:00
|
|
|
if (!eed->base->file) return -1;
|
|
|
|
if (!eed->base->file->image_dir) return -1;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-13 12:08:14 -07:00
|
|
|
//printf("SEARCH IMAGE %s\n", image_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2012-10-21 06:35:16 -07:00
|
|
|
for (i = 0; i < eed->base->file->image_dir->entries_count; ++i)
|
|
|
|
if (eed->base->file->image_dir->entries[i].entry
|
|
|
|
&& !strcmp(image_name, eed->base->file->image_dir->entries[i].entry))
|
2010-06-29 06:48:03 -07:00
|
|
|
return i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2008-03-13 12:08:14 -07:00
|
|
|
static const char *
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_image_name_find(Edje_Edit *eed, int image_id)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2012-10-21 06:35:16 -07:00
|
|
|
if (!eed->base->file) return NULL;
|
|
|
|
if (!eed->base->file->image_dir) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
/* Special case for external image */
|
|
|
|
if (image_id < 0) image_id = -image_id - 1;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
//printf("SEARCH IMAGE ID %d\n", image_id);
|
2012-10-21 06:35:16 -07:00
|
|
|
if ((unsigned int) image_id >= eed->base->file->image_dir->entries_count)
|
2010-12-02 10:20:34 -08:00
|
|
|
return NULL;
|
2012-10-21 06:35:16 -07:00
|
|
|
return eed->base->file->image_dir->entries[image_id].entry;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_real_part_free(Edje *ed, Edje_Real_Part *rp)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
|
|
|
if (!rp) return;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (rp->object)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-11-15 16:55:42 -08:00
|
|
|
_edje_callbacks_del(rp->object, ed);
|
|
|
|
evas_object_del(rp->object);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2013-11-15 16:55:42 -08:00
|
|
|
if ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)
|
|
|
|
&& (rp->typedata.swallow->swallowed_object))
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-11-15 16:55:42 -08:00
|
|
|
evas_object_smart_member_del(rp->typedata.swallow->swallowed_object);
|
|
|
|
evas_object_event_callback_del(rp->typedata.swallow->swallowed_object,
|
|
|
|
EVAS_CALLBACK_FREE, _edje_object_part_swallow_free_cb);
|
|
|
|
evas_object_clip_unset(rp->typedata.swallow->swallowed_object);
|
|
|
|
evas_object_data_del(rp->typedata.swallow->swallowed_object,
|
|
|
|
"\377 edje.swallowing_part");
|
|
|
|
if (rp->part->mouse_events)
|
|
|
|
_edje_callbacks_del(rp->typedata.swallow->swallowed_object, ed);
|
|
|
|
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP ||
|
|
|
|
rp->part->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
evas_object_del(rp->typedata.swallow->swallowed_object);
|
|
|
|
|
|
|
|
rp->typedata.swallow->swallowed_object = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2013-11-15 16:55:42 -08:00
|
|
|
if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) &&
|
|
|
|
(rp->typedata.text->text)) eina_stringshare_del(rp->typedata.text->text);
|
|
|
|
if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) &&
|
|
|
|
(rp->typedata.text->font)) eina_stringshare_del(rp->typedata.text->font);
|
|
|
|
if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) &&
|
|
|
|
(rp->typedata.text->cache.in_str)) eina_stringshare_del(rp->typedata.text->cache.in_str);
|
|
|
|
if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) &&
|
|
|
|
(rp->typedata.text->cache.out_str)) eina_stringshare_del(rp->typedata.text->cache.out_str);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
if (rp->custom)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2013-11-15 16:55:42 -08:00
|
|
|
_edje_collection_free_part_description_clean(rp->part->type, rp->custom->description, 0);
|
|
|
|
if (rp->custom) free(rp->custom->set);
|
|
|
|
eina_mempool_free(_edje_real_part_state_mp, rp->custom);
|
|
|
|
rp->custom = NULL;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2009-08-14 10:19:42 -07:00
|
|
|
|
|
|
|
free(rp->drag);
|
2010-06-01 06:31:07 -07:00
|
|
|
|
2011-01-15 19:59:53 -08:00
|
|
|
if (rp->param2) free(rp->param2->set);
|
2009-08-14 10:19:42 -07:00
|
|
|
eina_mempool_free(_edje_real_part_state_mp, rp->param2);
|
2010-06-01 06:31:07 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_unref(ed);
|
2009-08-14 10:19:42 -07:00
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
static Eina_Bool
|
2014-06-12 09:46:30 -07:00
|
|
|
_edje_edit_file_import(Edje *ed, const char *path, const char *entry, int compress)
|
2010-04-26 11:19:46 -07:00
|
|
|
{
|
2012-01-12 03:08:19 -08:00
|
|
|
Eina_File *f;
|
|
|
|
Eet_File *eetf = NULL;
|
2010-04-26 11:19:46 -07:00
|
|
|
void *fdata = NULL;
|
|
|
|
long fsize = 0;
|
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
/* Read data from file */
|
2012-01-12 03:08:19 -08:00
|
|
|
f = eina_file_open(path, 0);
|
|
|
|
if (!f)
|
|
|
|
{
|
2014-06-12 09:46:30 -07:00
|
|
|
ERR("Unable to open file \"%s\"", path);
|
2012-01-12 03:08:19 -08:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fsize = eina_file_size_get(f);
|
|
|
|
fdata = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
|
|
|
|
if (!fdata)
|
|
|
|
{
|
2014-06-12 09:46:30 -07:00
|
|
|
ERR("Unable to map file \"%s\"", path);
|
2012-01-12 03:08:19 -08:00
|
|
|
goto on_error;
|
|
|
|
}
|
2010-04-26 11:19:46 -07:00
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
/* Write file data to edje file */
|
2012-01-12 03:08:19 -08:00
|
|
|
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
|
|
|
{
|
|
|
|
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
|
|
goto on_error;
|
|
|
|
}
|
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
if (eet_write(eetf, entry, fdata, fsize, compress) <= 0)
|
2012-01-12 03:08:19 -08:00
|
|
|
{
|
2014-06-12 09:46:30 -07:00
|
|
|
ERR("Unable to write \"%s\" as \"%s\" part entry",
|
2012-01-12 03:08:19 -08:00
|
|
|
path, entry);
|
|
|
|
goto on_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write the edje_file */
|
|
|
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
|
|
|
goto on_error;
|
|
|
|
|
|
|
|
eet_close(eetf);
|
|
|
|
|
|
|
|
eina_file_map_free(f, fdata);
|
|
|
|
eina_file_close(f);
|
2010-04-26 11:19:46 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2012-01-12 03:08:19 -08:00
|
|
|
|
|
|
|
on_error:
|
|
|
|
if (eetf) eet_close(eetf);
|
|
|
|
eina_file_map_free(f, fdata);
|
|
|
|
eina_file_close(f);
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
2010-04-26 11:19:46 -07:00
|
|
|
}
|
|
|
|
|
2010-04-26 11:19:39 -07:00
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
static Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
_edje_import_image_file(Edje *ed, const char *path, int id)
|
|
|
|
{
|
2010-04-26 11:19:39 -07:00
|
|
|
char entry[PATH_MAX];
|
2008-03-06 11:48:11 -08:00
|
|
|
Evas_Object *im;
|
|
|
|
Eet_File *eetf;
|
2008-05-30 01:00:25 -07:00
|
|
|
void *im_data;
|
|
|
|
int im_w, im_h;
|
|
|
|
int im_alpha;
|
|
|
|
int bytes;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Try to load the file */
|
2012-10-21 03:46:58 -07:00
|
|
|
im = evas_object_image_add(ed->base->evas);
|
2010-04-26 11:19:39 -07:00
|
|
|
if (!im) return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
evas_object_image_file_set(im, path, NULL);
|
|
|
|
if (evas_object_image_load_error_get(im) != EVAS_LOAD_ERROR_NONE)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2009-12-22 05:46:00 -08:00
|
|
|
ERR("Edje_Edit: unable to load image \"%s\"."
|
|
|
|
"Missing PNG or JPEG loader modules for Evas or "
|
|
|
|
"file does not exist, or is not readable.", path);
|
|
|
|
evas_object_del(im);
|
2008-03-13 12:01:53 -07:00
|
|
|
im = NULL;
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Write the loaded image to the edje file */
|
|
|
|
|
|
|
|
evas_object_image_size_get(im, &im_w, &im_h);
|
|
|
|
im_alpha = evas_object_image_alpha_get(im);
|
|
|
|
im_data = evas_object_image_data_get(im, 0);
|
|
|
|
if ((!im_data) || !(im_w > 0) || !(im_h > 0))
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
evas_object_del(im);
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
/* open the eet file */
|
|
|
|
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-04-26 11:19:39 -07:00
|
|
|
ERR("Unable to open \"%s\" for writing output", ed->path);
|
2008-03-13 12:01:53 -07:00
|
|
|
evas_object_del(im);
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2010-08-11 09:23:43 -07:00
|
|
|
snprintf(entry, sizeof(entry), "edje/images/%i", id);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* write the image data */
|
2010-04-26 11:19:39 -07:00
|
|
|
bytes = eet_data_image_write(eetf, entry,
|
2008-03-13 12:01:53 -07:00
|
|
|
im_data, im_w, im_h,
|
2008-03-24 01:22:01 -07:00
|
|
|
im_alpha,
|
|
|
|
0, 100, 1);
|
2008-03-06 11:48:11 -08:00
|
|
|
if (bytes <= 0)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-04-26 11:19:39 -07:00
|
|
|
ERR("Unable to write image part \"%s\" part entry to %s",
|
|
|
|
entry, ed->path);
|
|
|
|
eet_close(eetf);
|
2008-03-13 12:01:53 -07:00
|
|
|
evas_object_del(im);
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
evas_object_del(im);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 11:19:39 -07:00
|
|
|
/* write the edje_file */
|
2010-04-29 11:52:55 -07:00
|
|
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-04-26 11:19:39 -07:00
|
|
|
eet_delete(eetf, entry);
|
2008-03-13 12:01:53 -07:00
|
|
|
eet_close(eetf);
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
eet_close(eetf);
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
static int
|
|
|
|
_edje_part_id_find(Edje *ed, const char *part)
|
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int id;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
for (id = 0; id < ed->table_parts_size; id++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = ed->table_parts[id];
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
if (!strcmp(rp->part->name, part))
|
|
|
|
return id;
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
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.
|
|
|
|
* All the depedency will be updated too.
|
2008-03-13 12:01:53 -07:00
|
|
|
* Also the table_parts is updated, and the current *rp in the table
|
2008-03-06 11:48:11 -08:00
|
|
|
* is lost.
|
|
|
|
* If new Id = -1 then all the depencies will be deleted
|
|
|
|
*/
|
|
|
|
Edje_Part *part;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int j;
|
2010-08-04 07:25:40 -07:00
|
|
|
int old_id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
part = rp->part;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!part) return;
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("CHANGE ID OF PART %s TO %d\n", part->name, new_id);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-13 19:05:47 -07:00
|
|
|
if (!ed || new_id < -1) return;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (part->id == new_id) return;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
old_id = part->id;
|
|
|
|
part->id = new_id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Fix all the dependecies in all parts... */
|
2010-07-29 05:02:36 -07:00
|
|
|
for (j = 0; j < ed->collection->parts_count; ++j)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *p;
|
|
|
|
unsigned int k;
|
|
|
|
|
|
|
|
p = ed->collection->parts[j];
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
//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 */
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_part_description_id_set(p->type, p->default_desc, old_id, new_id);
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
/* ...and in all other descriptions */
|
2010-08-09 10:34:03 -07:00
|
|
|
for (k = 0; k < p->other.desc_count; ++k)
|
|
|
|
_edje_part_description_id_set(p->type, p->other.desc[k], old_id, new_id);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/*...and also in programs targets */
|
2010-08-04 07:25:40 -07:00
|
|
|
#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);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
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);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Adjust table_parts */
|
|
|
|
if (new_id >= 0)
|
2008-03-13 12:01:53 -07:00
|
|
|
ed->table_parts[new_id] = rp;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
static void
|
|
|
|
_edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2)
|
|
|
|
{
|
|
|
|
/* This function switch the id of two parts.
|
|
|
|
* All the depedency will be updated too.
|
|
|
|
* Also the table_parts is updated,
|
|
|
|
* The parts list isn't touched
|
|
|
|
*/
|
|
|
|
int id1;
|
|
|
|
int id2;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("SWITCH ID OF PART %d AND %d\n", rp1->part->id, rp2->part->id);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!ed || !rp1 || !rp2) return;
|
|
|
|
if (rp1 == rp2) return;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
id1 = rp1->part->id;
|
|
|
|
id2 = rp2->part->id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Switch ids */
|
|
|
|
rp1->part->id = id2;
|
|
|
|
rp2->part->id = id1;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* adjust table_parts */
|
|
|
|
ed->table_parts[id1] = rp2;
|
|
|
|
ed->table_parts[id2] = rp1;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
// Fix all the dependecies in all parts...
|
2010-07-29 05:02:36 -07:00
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int j;
|
|
|
|
Edje_Part *p;
|
|
|
|
|
|
|
|
p = ed->collection->parts[i];
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
//printf(" search id: %d in %s\n", old_id, p->name);
|
|
|
|
if (p->clip_to_id == id1) p->clip_to_id = id2;
|
|
|
|
else if (p->clip_to_id == id2) p->clip_to_id = id1;
|
|
|
|
if (p->dragable.confine_id == id1) p->dragable.confine_id = id2;
|
|
|
|
else if (p->dragable.confine_id == id2) p->dragable.confine_id = id1;
|
|
|
|
|
|
|
|
// ...in default description
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_part_description_id_switch(p->type, p->default_desc, id1, id2);
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
// ...and in all other descriptions
|
2010-08-09 10:34:03 -07:00
|
|
|
for (j = 0; j < p->other.desc_count; ++j)
|
|
|
|
_edje_part_description_id_switch(p->type, p->other.desc[j], id1, id2);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//...and also in programs targets
|
2010-08-04 07:25:40 -07:00
|
|
|
#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);
|
2008-03-06 11:48:11 -08:00
|
|
|
//TODO Real part dependencies are ok?
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_fix_parts_id(Edje *ed)
|
|
|
|
{
|
|
|
|
/* We use this to clear the id hole leaved when a part is removed.
|
|
|
|
* After the execution of this function all parts will have a right
|
|
|
|
* (uniqe & ordered) id. The table_parts is also updated.
|
|
|
|
*/
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2008-03-06 11:48:11 -08:00
|
|
|
int correct_id;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int count;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("FIXING PARTS ID \n");
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//TODO order the list first to be more robust
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Give a correct id to all the parts */
|
|
|
|
correct_id = 0;
|
2010-07-29 05:02:36 -07:00
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *p;
|
|
|
|
|
|
|
|
p = ed->collection->parts[i];
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
//printf(" [%d]Checking part: %s id: %d\n", correct_id, p->name, p->id);
|
|
|
|
if (p->id != correct_id)
|
2010-07-30 02:08:37 -07:00
|
|
|
if (ed->table_parts[p->id])
|
|
|
|
_edje_part_id_set(ed, ed->table_parts[p->id], correct_id);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
correct_id++;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* If we have removed some parts realloc table_parts */
|
2010-07-29 05:02:36 -07:00
|
|
|
count = ed->collection->parts_count;
|
2008-03-06 11:48:11 -08:00
|
|
|
if (count != ed->table_parts_size)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-08-06 12:16:46 -07:00
|
|
|
ed->table_parts = realloc(ed->table_parts, sizeof(Edje_Real_Part *) * count);
|
|
|
|
ed->table_parts_size = count;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("\n");
|
|
|
|
}
|
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
static void
|
|
|
|
_edje_if_string_free(Edje *ed, const char *str)
|
|
|
|
{
|
|
|
|
Eet_Dictionary *dict;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
if (!ed || !str) return;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
dict = eet_dictionary_get(ed->file->ef);
|
2008-03-12 02:48:04 -07:00
|
|
|
if (eet_dictionary_string_check(dict, str)) return;
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(str);
|
2008-03-08 15:11:32 -08:00
|
|
|
str = NULL;
|
|
|
|
}
|
2008-07-13 07:29:18 -07:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
static Edje_Style *
|
|
|
|
_edje_edit_style_get(Edje *ed, const char *name)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Style *s;
|
|
|
|
|
|
|
|
if (!ed || !ed->file || !ed->file->styles || !name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->file->styles, l, s)
|
|
|
|
if (s->name && !strcmp(s->name, name))
|
|
|
|
return s;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Edje_Style_Tag *
|
|
|
|
_edje_edit_style_tag_get(Edje *ed, const char *style, const char *name)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Style *s;
|
|
|
|
Edje_Style_Tag *t;
|
|
|
|
|
|
|
|
if (!ed || !ed->file || !ed->file->styles || !name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
s = _edje_edit_style_get(ed, style);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
EINA_LIST_FOREACH(s->tags, l, t)
|
|
|
|
if (t->key && !strcmp(t->key, name))
|
|
|
|
return t;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-11-26 09:01:31 -08:00
|
|
|
static Edje_External_Directory_Entry *
|
|
|
|
_edje_edit_external_get(Edje *ed, const char *name)
|
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
if (!ed || !ed->file || !ed->file->external_dir || !name)
|
|
|
|
return NULL;
|
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
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;
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-08-17 05:10:06 -07:00
|
|
|
static void
|
2010-04-20 15:12:15 -07:00
|
|
|
_edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, const char *new_group_name)
|
|
|
|
{
|
2010-06-28 06:56:30 -07:00
|
|
|
Eina_Iterator *i;
|
|
|
|
Eina_List *pll, *pl;
|
2010-07-30 22:01:54 -07:00
|
|
|
// Edje_Part_Collection *pc;
|
2010-04-20 15:12:15 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
|
|
|
char *part_name;
|
|
|
|
const char *source, *old;
|
|
|
|
Edje_Part_Type type;
|
|
|
|
Evas_Object *part_obj;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN();
|
|
|
|
|
2010-07-30 22:01:54 -07:00
|
|
|
// pc = ed->collection;
|
2010-04-20 15:12:15 -07:00
|
|
|
|
2012-10-21 03:46:58 -07:00
|
|
|
part_obj = edje_edit_object_add(ed->base->evas);
|
2010-04-20 15:12:15 -07:00
|
|
|
|
|
|
|
old = eina_stringshare_add(old_group_name);
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
i = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(i, pce)
|
2010-04-20 15:12:15 -07:00
|
|
|
{
|
|
|
|
edje_object_file_set(part_obj, ed->file->path, pce->entry);
|
|
|
|
|
|
|
|
pl = edje_edit_parts_list_get(part_obj);
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(pl, pll, part_name)
|
|
|
|
{
|
|
|
|
source = edje_edit_part_source_get(part_obj, part_name);
|
|
|
|
type = edje_edit_part_type_get(part_obj, part_name);
|
|
|
|
|
|
|
|
if (type == EDJE_PART_TYPE_GROUP && source == old)
|
|
|
|
edje_edit_part_source_set(part_obj, part_name, new_group_name);
|
|
|
|
|
|
|
|
if (source)
|
|
|
|
eina_stringshare_del(source);
|
|
|
|
}
|
|
|
|
}
|
2010-06-28 06:56:30 -07:00
|
|
|
|
|
|
|
eina_iterator_free(i);
|
|
|
|
|
2010-04-20 15:12:15 -07:00
|
|
|
eina_stringshare_del(old);
|
|
|
|
|
|
|
|
evas_object_del(part_obj);
|
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
static void
|
|
|
|
_edje_edit_flag_script_dirty(Edje_Edit *eed, Eina_Bool all)
|
|
|
|
{
|
|
|
|
eed->script_need_recompile = EINA_TRUE;
|
|
|
|
if (all)
|
|
|
|
eed->all_dirty = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/*****************/
|
|
|
|
/* GENERAL API */
|
|
|
|
/*****************/
|
|
|
|
|
|
|
|
EAPI void
|
2008-10-22 04:34:42 -07:00
|
|
|
edje_edit_string_list_free(Eina_List *lst)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
|
|
|
//printf("FREE LIST: \n");
|
|
|
|
while (lst)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
if (eina_list_data_get(lst)) eina_stringshare_del(eina_list_data_get(lst));
|
|
|
|
//printf("FREE: %s\n", eina_list_data_get(lst));
|
|
|
|
lst = eina_list_remove(lst, eina_list_data_get(lst));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_edit_string_free(const char *str)
|
|
|
|
{
|
2008-10-15 07:11:11 -07:00
|
|
|
if (str) eina_stringshare_del(str);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2008-10-08 17:04:18 -07:00
|
|
|
EAPI const char*
|
|
|
|
edje_edit_compiler_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(0);
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(ed->file->compiler);
|
2008-10-08 17:04:18 -07:00
|
|
|
}
|
|
|
|
|
2014-06-10 08:14:59 -07:00
|
|
|
/****************/
|
|
|
|
/* SOUNDS API */
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
static Eina_Bool _edje_edit_collection_save(Eet_File *eetf, Edje_Part_Collection *epc);
|
|
|
|
|
2014-06-11 17:14:38 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_delete_play_actions(Evas_Object *obj, const char* name, int action_type, Eet_File *eetf)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
Eina_Iterator *it = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, pce)
|
|
|
|
{
|
|
|
|
Eina_Bool is_collection_changed = EINA_FALSE;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (pce->group_alias)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Evas_Object *obj = edje_edit_object_add(ed->base->evas);
|
|
|
|
if (!edje_object_file_set(obj, ed->file->path, pce->entry))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Eina_List *programs_list = edje_edit_programs_list_get(obj);
|
|
|
|
if (!programs_list)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
for (i = 0; i < ed->collection->patterns.table_programs_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Program *program;
|
|
|
|
|
|
|
|
program = ed->collection->patterns.table_programs[i];
|
|
|
|
if (program->action != action_type)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((action_type == EDJE_ACTION_TYPE_SOUND_SAMPLE) &&
|
|
|
|
!strcmp(program->sample_name, name))
|
|
|
|
{
|
|
|
|
program->speed = 0;
|
|
|
|
program->channel = EDJE_CHANNEL_EFFECT;
|
|
|
|
_edje_if_string_free(ed, program->sample_name);
|
|
|
|
program->sample_name = NULL;
|
|
|
|
program->action = EDJE_ACTION_TYPE_NONE;
|
|
|
|
is_collection_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if ((action_type == EDJE_ACTION_TYPE_SOUND_TONE) &&
|
|
|
|
!strcmp(program->tone_name, name))
|
|
|
|
{
|
|
|
|
program->duration = 0;
|
|
|
|
_edje_if_string_free(ed, program->tone_name);
|
|
|
|
program->tone_name = NULL;
|
|
|
|
program->action = EDJE_ACTION_TYPE_NONE;
|
|
|
|
is_collection_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (is_collection_changed)
|
|
|
|
_edje_edit_collection_save(eetf, ed->collection);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
static void
|
|
|
|
_initialize_sound_dir(Edje *ed)
|
|
|
|
{
|
|
|
|
if (ed->file->sound_dir)
|
|
|
|
return;
|
|
|
|
ed->file->sound_dir = _alloc(sizeof(Edje_Sound_Directory));
|
|
|
|
ed->file->sound_dir->samples = NULL;
|
|
|
|
ed->file->sound_dir->tones = NULL;
|
|
|
|
ed->file->sound_dir->samples_count = 0;
|
|
|
|
ed->file->sound_dir->tones_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_sound_sample_add(Evas_Object *obj, const char* name, const char* snd_src)
|
|
|
|
{
|
|
|
|
if (!name) return EINA_FALSE;
|
|
|
|
if (!snd_src) return EINA_FALSE;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
Edje_Sound_Sample *sound_sample = NULL;
|
|
|
|
unsigned int i = 0;
|
|
|
|
char sample[PATH_MAX];
|
|
|
|
int id = 0;
|
|
|
|
|
|
|
|
_initialize_sound_dir(ed);
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->samples_count; ++i)
|
|
|
|
{
|
|
|
|
sound_sample = ed->file->sound_dir->samples + i;
|
|
|
|
if (!strcmp(name, sound_sample->name))
|
|
|
|
{
|
|
|
|
WRN("Can not add new sound sample because"
|
|
|
|
"sample named \"%s\" already exists.", name);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ed->file->sound_dir->samples)
|
|
|
|
{
|
|
|
|
sound_sample = ed->file->sound_dir->samples +
|
|
|
|
ed->file->sound_dir->samples_count - 1;
|
|
|
|
id = sound_sample->id + 1;
|
|
|
|
snprintf(sample, sizeof(sample), "edje/sounds/%i", id);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strcpy(sample, "edje/sounds/0");
|
|
|
|
|
|
|
|
if (!_edje_edit_file_import(ed, snd_src, sample, 0))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (sound_sample)
|
|
|
|
sound_sample++;
|
|
|
|
++ed->file->sound_dir->samples_count;
|
|
|
|
|
|
|
|
ed->file->sound_dir->samples = realloc(ed->file->sound_dir->samples,
|
|
|
|
sizeof(Edje_Sound_Sample) *
|
|
|
|
ed->file->sound_dir->samples_count);
|
|
|
|
|
|
|
|
sound_sample = ed->file->sound_dir->samples +
|
|
|
|
ed->file->sound_dir->samples_count - 1;
|
|
|
|
sound_sample->name = (char*)eina_stringshare_add(name);
|
|
|
|
sound_sample->snd_src = (char*)eina_stringshare_add(snd_src);
|
|
|
|
sound_sample->compression = EDJE_SOUND_SOURCE_TYPE_INLINE_RAW;
|
|
|
|
sound_sample->id = id;
|
|
|
|
sound_sample->mode = 0;
|
|
|
|
sound_sample->quality = 0;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-10 08:14:59 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_sound_sample_del(Evas_Object *obj, const char* name)
|
|
|
|
{
|
|
|
|
Edje_Sound_Sample *sound_sample = NULL;
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!name) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
|
|
|
|
|
|
|
if ((!ed->file->sound_dir) || (!ed->file->sound_dir->samples))
|
|
|
|
{
|
|
|
|
WRN("Unable to delete sample \"%s\". The samples list is empty.", name);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->samples_count; ++i)
|
|
|
|
{
|
|
|
|
sound_sample = ed->file->sound_dir->samples + i;
|
|
|
|
if (!strcmp(name, sound_sample->name))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == ed->file->sound_dir->samples_count)
|
|
|
|
{
|
|
|
|
WRN("Unable to delete sample \"%s\". It does not exist.", name);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
char sample[PATH_MAX];
|
|
|
|
Eet_File *eetf;
|
|
|
|
Edje_Sound_Sample *sound_sample_last;
|
|
|
|
|
|
|
|
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
|
|
|
{
|
|
|
|
WRN("Unable to open \"%s\" for writing output", ed->path);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(sample, sizeof(sample), "edje/sounds/%i", sound_sample->id);
|
|
|
|
|
|
|
|
if (eet_delete(eetf, sample) <= 0)
|
|
|
|
{
|
|
|
|
WRN("Unable to delete \"%s\" sound", sample);
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
_edje_if_string_free(ed, sound_sample->name);
|
|
|
|
--ed->file->sound_dir->samples_count;
|
|
|
|
|
2014-06-10 08:14:59 -07:00
|
|
|
sound_sample_last = ed->file->sound_dir->samples +
|
|
|
|
ed->file->sound_dir->samples_count - 1;
|
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
while (sound_sample <= sound_sample_last)
|
|
|
|
{
|
|
|
|
*sound_sample = *(sound_sample + 1);
|
|
|
|
sound_sample++;
|
|
|
|
}
|
2014-06-10 08:14:59 -07:00
|
|
|
|
|
|
|
ed->file->sound_dir->samples = realloc(ed->file->sound_dir->samples,
|
|
|
|
sizeof(Edje_Sound_Sample) *
|
|
|
|
ed->file->sound_dir->samples_count);
|
|
|
|
|
2014-06-11 17:14:38 -07:00
|
|
|
if (!_delete_play_actions(obj, name, EDJE_ACTION_TYPE_SOUND_SAMPLE, eetf))
|
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-06-10 08:14:59 -07:00
|
|
|
|
2014-06-11 17:14:38 -07:00
|
|
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
2014-06-10 08:14:59 -07:00
|
|
|
{
|
2014-06-11 17:14:38 -07:00
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
eet_close(eetf);
|
|
|
|
}
|
|
|
|
|
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_sound_tone_del(Evas_Object *obj, const char* name)
|
|
|
|
{
|
|
|
|
Edje_Sound_Tone *sound_tone = NULL;
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!name) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
|
|
|
|
|
|
|
if ((!ed->file->sound_dir) || (!ed->file->sound_dir->tones))
|
|
|
|
{
|
|
|
|
WRN("Unable to delete tone \"%s\". The tones list is empty.", name);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->tones_count; ++i)
|
|
|
|
{
|
|
|
|
sound_tone = ed->file->sound_dir->tones + i;
|
|
|
|
if (!strcmp(name, sound_tone->name))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == ed->file->sound_dir->tones_count)
|
|
|
|
{
|
|
|
|
WRN("Unable to delete tone \"%s\". It does not exist.", name);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
Eet_File *eetf;
|
|
|
|
|
|
|
|
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
|
|
|
{
|
|
|
|
WRN("Unable to open file \"%s\" for writing output", ed->path);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_edje_if_string_free(ed, sound_tone->name);
|
|
|
|
--ed->file->sound_dir->tones_count;
|
|
|
|
|
2014-06-12 09:46:30 -07:00
|
|
|
Edje_Sound_Tone *sound_tone_last = ed->file->sound_dir->tones +
|
|
|
|
ed->file->sound_dir->tones_count - 1;
|
|
|
|
|
|
|
|
while (sound_tone <= sound_tone_last)
|
|
|
|
{
|
|
|
|
*sound_tone = *(sound_tone + 1);
|
|
|
|
sound_tone++;
|
|
|
|
}
|
|
|
|
|
2014-06-11 17:14:38 -07:00
|
|
|
ed->file->sound_dir->tones = realloc(ed->file->sound_dir->tones,
|
|
|
|
sizeof(Edje_Sound_Tone) *
|
|
|
|
ed->file->sound_dir->tones_count);
|
|
|
|
|
|
|
|
if (!_delete_play_actions(obj, name, EDJE_ACTION_TYPE_SOUND_TONE, eetf))
|
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
2014-06-10 08:14:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
eet_close(eetf);
|
|
|
|
}
|
|
|
|
|
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-12 10:11:54 -07:00
|
|
|
EAPI double
|
|
|
|
edje_edit_sound_compression_rate_get(Evas_Object *obj, const char *sound)
|
|
|
|
{
|
|
|
|
Edje_Sound_Sample *ss = NULL;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(-1);
|
|
|
|
|
|
|
|
if ((!ed->file) || (!ed->file->sound_dir))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->samples_count; i++)
|
|
|
|
{
|
|
|
|
ss = ed->file->sound_dir->samples + i;
|
|
|
|
if ((ss->name) && (!strcmp(sound, ss->name)))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == ed->file->sound_dir->samples_count)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return ss->quality;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_sound_compression_rate_set(Evas_Object *obj, const char *sound, double rate)
|
|
|
|
{
|
|
|
|
Edje_Sound_Sample *ss = NULL;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if ((!ed->file) || (!ed->file->sound_dir))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->samples_count; i++)
|
|
|
|
{
|
|
|
|
ss = ed->file->sound_dir->samples + i;
|
|
|
|
if ((ss->name) && (!strcmp(sound, ss->name)))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == ed->file->sound_dir->samples_count)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
ss->quality = rate;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/****************/
|
|
|
|
/* GROUPS API */
|
|
|
|
/****************/
|
|
|
|
|
2013-12-18 22:15:34 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_name)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *e;
|
|
|
|
Edje_Part_Collection_Directory_Entry *de;
|
|
|
|
Edje_Part_Collection_Directory_Entry *d;
|
|
|
|
Edje_Part_Collection *epc;
|
|
|
|
int id;
|
|
|
|
int search;
|
|
|
|
Eet_File *eetf;
|
|
|
|
char buf[64];
|
|
|
|
int count, script_count;
|
|
|
|
void *data;
|
|
|
|
char **keys, **c;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!ed->file || !ed->file->collection)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
e = eina_hash_find(ed->file->collection, group_name);
|
|
|
|
if (!e) return EINA_FALSE;
|
|
|
|
if (eina_hash_find(ed->file->collection, copy_name))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
|
|
|
{
|
|
|
|
ERR("Edje_Edit: Error. unable to open \"%s\" "
|
|
|
|
"for writing output", ed->file->path);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
|
|
|
|
epc = eet_data_read(eetf, _edje_edd_edje_part_collection, buf);
|
|
|
|
|
|
|
|
/* Search first free id */
|
|
|
|
id = -1;
|
|
|
|
search = 0;
|
|
|
|
while (id == -1)
|
|
|
|
{
|
|
|
|
Eina_Iterator *i;
|
|
|
|
Eina_Bool found = 0;
|
|
|
|
|
|
|
|
i = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(i, d)
|
|
|
|
{
|
|
|
|
if (search == d->id)
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_iterator_free(i);
|
|
|
|
|
|
|
|
if (!found) id = search;
|
|
|
|
else search++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create structs */
|
|
|
|
de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
|
|
|
|
if (!de) return EINA_FALSE;
|
|
|
|
|
|
|
|
/* Init Edje_Part_Collection_Directory_Entry */
|
|
|
|
de->id = id;
|
|
|
|
de->entry = eina_stringshare_add(copy_name);
|
|
|
|
memcpy(&de->count, &e->count, sizeof (de->count));
|
|
|
|
|
|
|
|
#define EDIT_EMN(Tp, Sz, Ce) \
|
|
|
|
Ce->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8);
|
|
|
|
#define EDIT_EMNP(Tp, Sz, Ce) \
|
|
|
|
Ce->mp_rtl.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8);
|
|
|
|
|
|
|
|
eina_hash_direct_add(ed->file->collection, de->entry, de);
|
|
|
|
|
|
|
|
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(PROXY, Edje_Part_Description_Proxy, 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(SPACER, Edje_Part_Description_Common, de);
|
|
|
|
EDIT_EMN(part, Edje_Part, de);
|
|
|
|
|
|
|
|
EDIT_EMNP(RECTANGLE, Edje_Part_Description_Common, de);
|
|
|
|
EDIT_EMNP(TEXT, Edje_Part_Description_Text, de);
|
|
|
|
EDIT_EMNP(IMAGE, Edje_Part_Description_Image, de);
|
|
|
|
EDIT_EMNP(PROXY, Edje_Part_Description_Proxy, de);
|
|
|
|
EDIT_EMNP(SWALLOW, Edje_Part_Description_Common, de);
|
|
|
|
EDIT_EMNP(TEXTBLOCK, Edje_Part_Description_Text, de);
|
|
|
|
EDIT_EMNP(GROUP, Edje_Part_Description_Common, de);
|
|
|
|
EDIT_EMNP(BOX, Edje_Part_Description_Box, de);
|
|
|
|
EDIT_EMNP(TABLE, Edje_Part_Description_Table, de);
|
|
|
|
EDIT_EMNP(EXTERNAL, Edje_Part_Description_External, de);
|
|
|
|
EDIT_EMNP(SPACER, Edje_Part_Description_Common, de);
|
|
|
|
|
|
|
|
epc->id = id;
|
|
|
|
epc->part = eina_stringshare_add(copy_name);
|
|
|
|
ed->file->collection_cache = eina_list_prepend(ed->file->collection_cache, epc);
|
|
|
|
|
|
|
|
/* Copying Scripts */
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%d", e->id);
|
|
|
|
data = eet_read(eetf, buf, &count);
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%d", epc->id);
|
|
|
|
eet_write(eetf, buf, data, count, 1);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d", e->id);
|
|
|
|
data = eet_read(eetf, buf, &count);
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d", epc->id);
|
|
|
|
eet_write(eetf, buf, data, count, 0);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d/*", e->id);
|
|
|
|
keys = eet_list(eetf, buf, &count);
|
|
|
|
if (keys)
|
|
|
|
{
|
|
|
|
while(count)
|
|
|
|
{
|
|
|
|
count--;
|
|
|
|
data = eet_read(eetf, keys[count], &script_count);
|
|
|
|
/* we need to save id of every script we are going to copy. */
|
|
|
|
c = eina_str_split(keys[count], "/", 6);
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d/%s", epc->id, c[5]);
|
|
|
|
eet_write(eetf, buf, data, script_count, 0);
|
2013-12-19 02:04:07 -08:00
|
|
|
free(c[0]);
|
|
|
|
free(c);
|
2013-12-18 22:15:34 -08:00
|
|
|
}
|
|
|
|
free(keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
eet_close(eetf);
|
|
|
|
|
|
|
|
/* we need to save everything to make sure the file won't have broken
|
|
|
|
* references the next time is loaded */
|
|
|
|
edje_edit_save_all(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_group_add(Evas_Object *obj, const char *name)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *de;
|
2008-10-22 04:34:42 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *d;
|
2008-03-06 11:48:11 -08:00
|
|
|
Edje_Part_Collection *pc;
|
2008-05-30 01:00:25 -07:00
|
|
|
int id;
|
|
|
|
int search;
|
2008-03-06 11:48:11 -08:00
|
|
|
//Code *cd;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("ADD GROUP: %s \n", name);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* check if a group with the same name already exists */
|
2010-06-28 06:56:30 -07:00
|
|
|
if (eina_hash_find(ed->file->collection, name))
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Create structs */
|
2009-08-17 07:13:26 -07:00
|
|
|
de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!de) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-08-17 07:13:26 -07:00
|
|
|
pc = _alloc(sizeof(Edje_Part_Collection));
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!pc)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
free(de);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Search first free id */
|
2010-04-22 12:09:30 -07:00
|
|
|
id = -1;
|
2008-05-30 01:00:25 -07:00
|
|
|
search = 0;
|
2010-04-22 12:09:30 -07:00
|
|
|
while (id == -1)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-06-28 06:56:30 -07:00
|
|
|
Eina_Iterator *i;
|
2009-09-15 20:37:28 -07:00
|
|
|
Eina_Bool found = 0;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
i = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(i, d)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
// printf("search if %d is free [id %d]\n", search, d->id);
|
|
|
|
if (search == d->id)
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-28 06:56:30 -07:00
|
|
|
|
|
|
|
eina_iterator_free(i);
|
|
|
|
|
|
|
|
if (!found) id = search;
|
|
|
|
else search++;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Init Edje_Part_Collection_Directory_Entry */
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf(" new id: %d\n", id);
|
2008-03-06 11:48:11 -08:00
|
|
|
de->id = id;
|
2010-02-10 09:18:34 -08:00
|
|
|
de->entry = eina_stringshare_add(name);
|
2010-06-28 06:56:30 -07:00
|
|
|
eina_hash_direct_add(ed->file->collection, de->entry, de);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Init Edje_Part_Collection */
|
|
|
|
pc->id = id;
|
2010-01-27 12:43:44 -08:00
|
|
|
pc->references = 0;
|
2010-08-04 07:25:40 -07:00
|
|
|
memset(&pc->programs, 0, sizeof (pc->programs));
|
2008-03-06 11:48:11 -08:00
|
|
|
pc->parts = NULL;
|
|
|
|
pc->data = NULL;
|
|
|
|
pc->script = NULL;
|
2008-10-15 07:11:11 -07:00
|
|
|
pc->part = eina_stringshare_add(name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-08-17 07:13:26 -07:00
|
|
|
//cd = _alloc(sizeof(Code));
|
2008-10-22 04:34:42 -07:00
|
|
|
//codes = eina_list_append(codes, cd);
|
2010-08-02 05:41:28 -07:00
|
|
|
|
2010-08-02 12:06:07 -07:00
|
|
|
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);
|
2012-06-12 20:21:31 -07:00
|
|
|
EDIT_EMN(SPACER, Edje_Part_Description_Common, de);
|
2010-08-02 12:06:07 -07:00
|
|
|
EDIT_EMN(part, Edje_Part, de);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-01-27 12:43:44 -08:00
|
|
|
ed->file->collection_cache = eina_list_prepend(ed->file->collection_cache, pc);
|
|
|
|
_edje_cache_coll_clean(ed->file);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2010-01-29 12:44:34 -08:00
|
|
|
edje_edit_group_del(Evas_Object *obj, const char *group_name)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-12-14 01:40:26 -08:00
|
|
|
Edje_Part_Collection_Directory_Entry *e, *e_del;
|
2010-06-28 06:56:30 -07:00
|
|
|
Edje_Part_Collection *die = NULL;
|
2008-03-06 11:48:11 -08:00
|
|
|
Edje_Part_Collection *g;
|
2010-06-28 06:56:30 -07:00
|
|
|
Eina_List *l;
|
2008-05-30 01:00:25 -07:00
|
|
|
Eet_File *eetf;
|
2010-12-02 10:20:34 -08:00
|
|
|
char buf[64], **keys;
|
|
|
|
int count;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-02-10 09:18:34 -08:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-10-11 00:49:13 -07:00
|
|
|
if (strcmp(ed->group, group_name) == 0) return EINA_FALSE;
|
2010-06-28 06:56:30 -07:00
|
|
|
e = eina_hash_find(ed->file->collection, group_name);
|
2013-10-11 00:49:13 -07:00
|
|
|
if (!e) return EINA_FALSE;
|
|
|
|
if (e->id == ed->collection->id) return EINA_FALSE;
|
|
|
|
if (e->ref) return EINA_FALSE;
|
2010-01-29 12:44:34 -08:00
|
|
|
|
2010-09-01 10:15:52 -07:00
|
|
|
_edje_edit_group_references_update(obj, group_name, NULL);
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->collection_cache, l, g)
|
2013-12-14 01:40:26 -08:00
|
|
|
{
|
|
|
|
if (strcmp(g->part, e->entry) == 0)
|
|
|
|
{
|
|
|
|
ed->file->collection_cache =
|
|
|
|
eina_list_remove_list(ed->file->collection_cache, l);
|
|
|
|
die = g;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Remove collection/id from eet file */
|
|
|
|
eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2009-12-22 05:46:00 -08:00
|
|
|
ERR("Edje_Edit: Error. unable to open \"%s\" "
|
|
|
|
"for writing output", ed->file->path);
|
2010-02-10 09:18:34 -08:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2010-12-02 10:20:34 -08:00
|
|
|
snprintf(buf, sizeof(buf), "edje/collections/%d", e->id);
|
2008-03-06 11:48:11 -08:00
|
|
|
eet_delete(eetf, buf);
|
2010-12-02 10:20:34 -08:00
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%d", e->id);
|
|
|
|
eet_delete(eetf, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d", e->id);
|
|
|
|
eet_delete(eetf, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%d/*", e->id);
|
|
|
|
keys = eet_list(eetf, buf, &count);
|
|
|
|
if (keys)
|
2011-01-15 18:46:34 -08:00
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
count--;
|
|
|
|
eet_delete(eetf, keys[count]);
|
|
|
|
}
|
|
|
|
while(count);
|
|
|
|
free(keys);
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
eet_close(eetf);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-12-14 01:40:26 -08:00
|
|
|
l = NULL; g = NULL;
|
|
|
|
/* Free Group and all it's Aliases */
|
|
|
|
if (!e->group_alias)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(ed->file->collection_cache, l, g)
|
|
|
|
{
|
|
|
|
if (e->id == g->id)
|
|
|
|
{
|
|
|
|
ed->file->collection_cache =
|
|
|
|
eina_list_remove_list(ed->file->collection_cache, l);
|
|
|
|
e_del = eina_hash_find(ed->file->collection, g->part);
|
|
|
|
eina_hash_del(ed->file->collection, g->part, e_del);
|
2013-12-14 18:34:43 -08:00
|
|
|
_edje_collection_free(ed->file, g, e_del);
|
2013-12-14 01:40:26 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
if (die) _edje_collection_free(ed->file, die, e);
|
2010-08-17 09:37:32 -07:00
|
|
|
eina_hash_del(ed->file->collection, group_name, e);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-01-29 12:44:34 -08:00
|
|
|
/* we need to save everything to make sure the file won't have broken
|
|
|
|
* references the next time is loaded */
|
|
|
|
edje_edit_save_all(obj);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-02-10 09:18:34 -08:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_group_exist(Evas_Object *obj, const char *group)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
if (eina_hash_find(ed->file->collection, group))
|
|
|
|
return EINA_TRUE;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_group_name_set(Evas_Object *obj, const char *new_name)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
2010-06-28 06:56:30 -07:00
|
|
|
Edje_Part_Collection *pc;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!new_name) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
pc = ed->collection;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!strcmp(pc->part, new_name)) return EINA_TRUE;
|
2009-09-15 20:37:28 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (edje_edit_group_exist(obj, new_name)) return EINA_FALSE;
|
2009-09-15 20:37:28 -07:00
|
|
|
|
2010-04-20 15:12:15 -07:00
|
|
|
_edje_edit_group_references_update(obj, pc->part, new_name);
|
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("Set name of current group: %s [id: %d][new name: %s]\n",
|
|
|
|
// pc->part, pc->id, new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-10-15 07:11:11 -07:00
|
|
|
//if (pc->part && ed->file->free_strings) eina_stringshare_del(pc->part); TODO FIXME
|
2010-06-28 06:56:30 -07:00
|
|
|
pce = eina_hash_find(ed->file->collection, pc->part);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-30 02:08:37 -07:00
|
|
|
eina_hash_move(ed->file->collection, pce->entry, new_name);
|
2010-06-28 06:56:30 -07:00
|
|
|
|
|
|
|
pce->entry = eina_stringshare_add(new_name);
|
|
|
|
pc->part = pce->entry;
|
2010-08-18 07:38:27 -07:00
|
|
|
eina_stringshare_replace(&ed->group, new_name);
|
2010-06-28 06:56:30 -07:00
|
|
|
|
2010-08-03 11:36:42 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 06:11:22 -07:00
|
|
|
#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 Eina_Bool \
|
|
|
|
edje_edit_group_##Class##_##Value##_set(Evas_Object *obj, int v) \
|
|
|
|
{ \
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE); \
|
|
|
|
if (!ed->collection) return EINA_FALSE; \
|
|
|
|
if (v < 0) return EINA_FALSE; \
|
|
|
|
ed->collection->prop.Class.Value = v; \
|
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
FUNC_GROUP_ACCESSOR(min, w);
|
|
|
|
FUNC_GROUP_ACCESSOR(min, h);
|
|
|
|
FUNC_GROUP_ACCESSOR(max, w);
|
|
|
|
FUNC_GROUP_ACCESSOR(max, h);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2014-06-05 10:38:20 -07:00
|
|
|
EAPI unsigned char
|
|
|
|
edje_edit_group_orientation_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(-1);
|
|
|
|
if (!ed->collection) return -1;
|
|
|
|
return ed->collection->prop.orientation;
|
|
|
|
}
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_orientation_set(Evas_Object *obj, unsigned char orient)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!ed->collection) return EINA_FALSE;
|
|
|
|
if (orient > 2) return EINA_FALSE;
|
|
|
|
ed->collection->prop.orientation = orient;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-07 13:57:49 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_broadcast_signal_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(EINA_TRUE);
|
|
|
|
if (!ed->collection) return EINA_TRUE;
|
|
|
|
return ed->collection->broadcast_signal;
|
|
|
|
}
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_broadcast_signal_set(Evas_Object *obj, Eina_Bool bs)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!ed->collection) return EINA_FALSE;
|
|
|
|
ed->collection->broadcast_signal = bs ? 1 : 0;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-12-14 01:40:26 -08:00
|
|
|
/****************/
|
|
|
|
/* ALIAS API */
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_group_aliases_get(Evas_Object *obj, const char *group_name)
|
|
|
|
{
|
|
|
|
Eina_Iterator *i;
|
|
|
|
Edje_Part_Collection_Directory_Entry *e;
|
|
|
|
Edje_Part_Collection_Directory_Entry *d;
|
|
|
|
Eina_List *alias_list = NULL;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
if (!ed->file || !ed->file->collection)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
e = eina_hash_find(ed->file->collection, group_name);
|
|
|
|
if (!e) return NULL;
|
|
|
|
|
|
|
|
i = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
EINA_ITERATOR_FOREACH(i, d)
|
|
|
|
{
|
|
|
|
if ((e->id == d->id) && (d->group_alias))
|
|
|
|
alias_list = eina_list_append(alias_list, eina_stringshare_add(d->entry));
|
|
|
|
}
|
|
|
|
eina_iterator_free(i);
|
|
|
|
|
|
|
|
return alias_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_alias_is(Evas_Object *obj, const char *alias_name)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *e;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!ed->file || !ed->file->collection)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
e = eina_hash_find(ed->file->collection, alias_name);
|
|
|
|
if (!e) return EINA_FALSE;
|
|
|
|
|
|
|
|
return e->group_alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
edje_edit_group_aliased_get(Evas_Object *obj, const char *alias_name)
|
|
|
|
{
|
|
|
|
Eina_Iterator *i;
|
|
|
|
Edje_Part_Collection_Directory_Entry *e;
|
|
|
|
Edje_Part_Collection_Directory_Entry *d;
|
|
|
|
const char *group_name = NULL;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
if (!ed->file || !ed->file->collection)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
e = eina_hash_find(ed->file->collection, alias_name);
|
|
|
|
if (!e) return NULL;
|
|
|
|
if (!e->group_alias) return eina_stringshare_add(alias_name);
|
|
|
|
|
|
|
|
i = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
EINA_ITERATOR_FOREACH(i, d)
|
|
|
|
{
|
|
|
|
if ((e->id == d->id) && (!d->group_alias))
|
|
|
|
{
|
|
|
|
group_name = d->entry;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(i);
|
|
|
|
|
|
|
|
return eina_stringshare_add(group_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_alias_add(Evas_Object *obj, const char *group_name, const char *alias_name)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *e;
|
|
|
|
Edje_Part_Collection_Directory_Entry *de;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!ed->file || !ed->file->collection)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
/* check if a group with the same alias already exists */
|
|
|
|
if (eina_hash_find(ed->file->collection, alias_name))
|
|
|
|
return EINA_FALSE;
|
|
|
|
/* check if a group that is being aliased is really exists */
|
|
|
|
e = eina_hash_find(ed->file->collection, group_name);
|
|
|
|
if (!e) return EINA_FALSE;
|
|
|
|
/* check that a group that is being aliased is not an alias */
|
|
|
|
if (e->group_alias) return EINA_FALSE;
|
|
|
|
|
|
|
|
/* Create structs */
|
|
|
|
de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry));
|
|
|
|
if (!de) return EINA_FALSE;
|
|
|
|
|
|
|
|
/* Init Edje_Part_Collection_Directory_Entry */
|
|
|
|
de->id = e->id;
|
|
|
|
de->entry = eina_stringshare_add(alias_name);
|
|
|
|
de->group_alias = EINA_TRUE;
|
|
|
|
|
|
|
|
memcpy(&de->count, &e->count, sizeof (de->count));
|
|
|
|
eina_hash_direct_add(ed->file->collection, de->entry, de);
|
|
|
|
|
|
|
|
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(SPACER, Edje_Part_Description_Common, de);
|
|
|
|
EDIT_EMN(part, Edje_Part, de);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-09-14 15:30:15 -07:00
|
|
|
/***************/
|
|
|
|
/* DATA API */
|
|
|
|
/***************/
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_group_data_list_get(Evas_Object * obj)
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_Iterator *it;
|
2010-08-10 07:25:10 -07:00
|
|
|
Eina_List *datas = NULL;
|
2010-07-29 05:02:36 -07:00
|
|
|
const char *key;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2010-08-10 07:25:10 -07:00
|
|
|
if (!ed->file || !ed->collection || !ed->collection->data)
|
2010-02-05 08:39:06 -08:00
|
|
|
return NULL;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
it = eina_hash_iterator_key_new(ed->collection->data);
|
2010-08-10 07:25:10 -07:00
|
|
|
if (!it) return NULL;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, key)
|
|
|
|
datas = eina_list_append(datas, eina_stringshare_add(key));
|
|
|
|
|
|
|
|
eina_iterator_free(it);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
|
|
|
return datas;
|
|
|
|
}
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-09-14 15:30:15 -07:00
|
|
|
edje_edit_data_list_get(Evas_Object * obj)
|
|
|
|
{
|
2010-06-28 06:56:30 -07:00
|
|
|
Eina_Iterator *i;
|
2009-12-04 08:34:35 -08:00
|
|
|
Eina_List *datas = NULL;
|
2010-06-28 06:56:30 -07:00
|
|
|
const char *key;
|
2008-09-14 15:30:15 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (!ed->file || !ed->file->data)
|
|
|
|
return NULL;
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
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);
|
2008-09-14 15:30:15 -07:00
|
|
|
|
|
|
|
return datas;
|
|
|
|
}
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_data_add(Evas_Object *obj, const char *key, const char *value)
|
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *es;
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!key || !ed->file || !ed->collection)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (!ed->collection->data)
|
|
|
|
ed->collection->data = eina_hash_string_small_new(NULL);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (eina_hash_find(ed->collection->data, key))
|
|
|
|
return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
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;
|
2010-02-05 08:39:06 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-14 15:30:15 -07:00
|
|
|
edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value)
|
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *es;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-14 15:30:15 -07:00
|
|
|
|
|
|
|
if (!itemname || !ed->file)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-14 15:30:15 -07:00
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
if (eina_hash_find(ed->file->data, itemname))
|
|
|
|
return EINA_FALSE;
|
2008-09-14 15:30:15 -07:00
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
es = calloc(1, sizeof(Edje_String));
|
|
|
|
if (!es)
|
|
|
|
return EINA_FALSE;
|
|
|
|
es->str = eina_stringshare_add(value);
|
2008-09-14 15:30:15 -07:00
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
if (!eina_hash_add(ed->file->data, itemname, es))
|
|
|
|
{
|
|
|
|
eina_stringshare_del(es->str);
|
|
|
|
free(es);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-09-14 15:30:15 -07:00
|
|
|
}
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_data_del(Evas_Object *obj, const char *key)
|
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *value;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!key || !ed->file || !ed->collection)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
value = eina_hash_find(ed->collection->data, key);
|
|
|
|
if (!value) return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
eina_hash_del(ed->collection->data, key, value);
|
|
|
|
_edje_if_string_free(ed, value->str);
|
|
|
|
free(value);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2010-02-05 08:39:06 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-14 15:30:15 -07:00
|
|
|
edje_edit_data_del(Evas_Object *obj, const char *itemname)
|
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *value;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-14 15:30:15 -07:00
|
|
|
|
|
|
|
if (!itemname || !ed->file || !ed->file->data)
|
|
|
|
return 0;
|
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
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;
|
2008-09-14 15:30:15 -07:00
|
|
|
}
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
EAPI const char *
|
2010-11-16 00:18:12 -08:00
|
|
|
edje_edit_group_data_value_get(Evas_Object * obj, const char *key)
|
2010-02-05 08:39:06 -08:00
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *value;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (!key || !ed->file || !ed->collection)
|
|
|
|
return NULL;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
value = eina_hash_find(ed->collection->data, key);
|
2010-08-12 10:49:28 -07:00
|
|
|
if (!value)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return eina_stringshare_add(edje_string_get(value));
|
2010-02-05 08:39:06 -08:00
|
|
|
}
|
|
|
|
|
2008-09-14 15:30:15 -07:00
|
|
|
EAPI const char *
|
2010-11-16 00:18:12 -08:00
|
|
|
edje_edit_data_value_get(Evas_Object * obj, const char *itemname)
|
2008-09-14 15:30:15 -07:00
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *value;
|
|
|
|
|
2008-09-14 15:30:15 -07:00
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (!itemname || !ed->file || !ed->file->data)
|
|
|
|
return NULL;
|
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
value = eina_hash_find(ed->file->data, itemname);
|
|
|
|
if (!value)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return eina_stringshare_add(edje_string_get(value));
|
2008-09-14 15:30:15 -07:00
|
|
|
}
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *value)
|
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *es;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!key || !value || !ed->file || !ed->collection)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
es = eina_hash_find(ed->collection->data, key);
|
|
|
|
if (es)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
_edje_if_string_free(ed, es->str);
|
|
|
|
es->str = eina_stringshare_add(value);
|
|
|
|
es->id = 0;
|
2010-07-29 05:02:36 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-27 14:29:55 -07:00
|
|
|
edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value)
|
2008-09-14 15:30:15 -07:00
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
Edje_String *es;
|
2008-09-14 15:30:15 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-14 15:30:15 -07:00
|
|
|
|
|
|
|
if (!itemname || !value || !ed->file || !ed->file->data)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-14 15:30:15 -07:00
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
es = eina_hash_find(ed->file->data, itemname);
|
|
|
|
if (es)
|
2010-08-10 14:54:50 -07:00
|
|
|
{
|
2010-08-12 10:49:28 -07:00
|
|
|
_edje_if_string_free(ed, es->str);
|
|
|
|
es->str = eina_stringshare_add(value);
|
|
|
|
es->id = 0;
|
2010-08-10 14:54:50 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-14 15:30:15 -07:00
|
|
|
}
|
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *new_key)
|
|
|
|
{
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!key || !new_key || !ed->file || !ed->collection) {
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
return eina_hash_move(ed->collection->data, key, new_key);
|
2010-02-05 08:39:06 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-27 14:29:55 -07:00
|
|
|
edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-27 14:29:55 -07:00
|
|
|
|
|
|
|
if (!itemname || !newname || !ed->file || !ed->file->data)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-27 14:29:55 -07:00
|
|
|
|
2010-08-12 10:49:28 -07:00
|
|
|
return eina_hash_move(ed->file->data, itemname, newname);
|
2008-09-27 14:29:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************/
|
|
|
|
/* COLOR CLASSES API */
|
|
|
|
/***********************/
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-09-27 14:29:55 -07:00
|
|
|
edje_edit_color_classes_list_get(Evas_Object * obj)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *classes = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Color_Class *cc;
|
2008-09-27 14:29:55 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
|
|
|
if (!ed->file || !ed->file->color_classes)
|
2008-09-27 14:29:55 -07:00
|
|
|
return NULL;
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("GET CLASSES LIST %d %d\n", eina_list_count(ed->color_classes), eina_list_count(ed->file->color_classes));
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
classes = eina_list_append(classes, eina_stringshare_add(cc->name));
|
2008-09-27 14:29:55 -07:00
|
|
|
|
|
|
|
return classes;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-28 11:44:19 -07:00
|
|
|
edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Color_Class *cc;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
|
|
|
if (!ed->file || !ed->file->color_classes)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if (!strcmp(cc->name, class_name))
|
|
|
|
{
|
|
|
|
if (r) *r = cc->r;
|
|
|
|
if (g) *g = cc->g;
|
|
|
|
if (b) *b = cc->b;
|
|
|
|
if (a) *a = cc->a;
|
|
|
|
|
|
|
|
if (r2) *r2 = cc->r2;
|
|
|
|
if (g2) *g2 = cc->g2;
|
|
|
|
if (b2) *b2 = cc->b2;
|
|
|
|
if (a2) *a2 = cc->a2;
|
|
|
|
|
|
|
|
if (r3) *r3 = cc->r3;
|
|
|
|
if (g3) *g3 = cc->g3;
|
|
|
|
if (b3) *b3 = cc->b3;
|
|
|
|
if (a3) *a3 = cc->a3;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-22 04:34:42 -07:00
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-28 11:44:19 -07:00
|
|
|
edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Color_Class *cc;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
|
|
|
if (!ed->file || !ed->file->color_classes)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if (!strcmp(cc->name, class_name))
|
|
|
|
{
|
|
|
|
if (r > -1) cc->r = r;
|
|
|
|
if (g > -1) cc->g = g;
|
|
|
|
if (b > -1) cc->b = b;
|
|
|
|
if (a > -1) cc->a = a;
|
|
|
|
|
|
|
|
if (r2 > -1) cc->r2 = r2;
|
|
|
|
if (g2 > -1) cc->g2 = g2;
|
|
|
|
if (b2 > -1) cc->b2 = b2;
|
|
|
|
if (a2 > -1) cc->a2 = a2;
|
|
|
|
|
|
|
|
if (r3 > -1) cc->r3 = r3;
|
|
|
|
if (g3 > -1) cc->g3 = g3;
|
|
|
|
if (b3 > -1) cc->b3 = b3;
|
|
|
|
if (a3 > -1) cc->a3 = a3;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-22 04:34:42 -07:00
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-28 11:44:19 -07:00
|
|
|
edje_edit_color_class_add(Evas_Object *obj, const char *name)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2008-09-28 11:44:19 -07:00
|
|
|
Edje_Color_Class *c;
|
2008-10-22 04:34:42 -07:00
|
|
|
Edje_Color_Class *cc;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
|
|
|
if (!name || !ed->file)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if (strcmp(cc->name, name) == 0)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2009-08-17 06:54:17 -07:00
|
|
|
c = _alloc(sizeof(Edje_Color_Class));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2008-10-15 07:11:11 -07:00
|
|
|
c->name = (char*)eina_stringshare_add(name);
|
2008-09-28 11:44:19 -07:00
|
|
|
c->r = c->g = c->b = c->a = 255;
|
|
|
|
c->r2 = c->g2 = c->b2 = c->a2 = 255;
|
|
|
|
c->r3 = c->g3 = c->b3 = c->a3 = 255;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
ed->file->color_classes = eina_list_append(ed->file->color_classes, c);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-09-28 11:44:19 -07:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-28 11:44:19 -07:00
|
|
|
edje_edit_color_class_del(Evas_Object *obj, const char *name)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Color_Class *cc;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
|
|
|
if (!name || !ed->file || !ed->file->color_classes)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if (strcmp(cc->name, name) == 0)
|
|
|
|
{
|
|
|
|
_edje_if_string_free(ed, cc->name);
|
|
|
|
ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc);
|
|
|
|
free(cc);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-22 04:34:42 -07:00
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-09-28 11:44:19 -07:00
|
|
|
edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Color_Class *cc;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-09-28 11:44:19 -07:00
|
|
|
|
|
|
|
if (!ed->file || !ed->file->color_classes)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if (!strcmp(cc->name, name))
|
|
|
|
{
|
|
|
|
_edje_if_string_free(ed, cc->name);
|
|
|
|
cc->name = (char*)eina_stringshare_add(newname);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-22 04:34:42 -07:00
|
|
|
}
|
2008-09-28 11:44:19 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-09-28 11:44:19 -07:00
|
|
|
}
|
|
|
|
|
2008-09-14 15:30:15 -07:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
|
|
|
|
/*********************/
|
|
|
|
/* TEXT STYLES API */
|
|
|
|
/*********************/
|
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_styles_list_get(Evas_Object * obj)
|
|
|
|
{
|
|
|
|
Eina_List *styles = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Style *s;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (!ed->file || !ed->file->styles)
|
|
|
|
return NULL;
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles));
|
2008-11-02 06:10:11 -08:00
|
|
|
EINA_LIST_FOREACH(ed->file->styles, l, s)
|
|
|
|
styles = eina_list_append(styles, eina_stringshare_add(s->name));
|
|
|
|
|
|
|
|
return styles;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_style_add(Evas_Object * obj, const char* style)
|
|
|
|
{
|
|
|
|
Edje_Style *s;
|
2010-09-01 10:15:52 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("ADD STYLE '%s'\n", style);
|
2008-11-02 06:10:11 -08:00
|
|
|
|
|
|
|
s = _edje_edit_style_get(ed, style);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (s) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
|
2009-08-17 06:54:17 -07:00
|
|
|
s = _alloc(sizeof(Edje_Style));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!s) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
s->name = (char*)eina_stringshare_add(style);
|
|
|
|
s->tags = NULL;
|
|
|
|
s->style = NULL;
|
|
|
|
|
|
|
|
ed->file->styles = eina_list_append(ed->file->styles, s);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-29 16:40:11 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_style_del(Evas_Object * obj, const char* style)
|
|
|
|
{
|
|
|
|
Edje_Style *s;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2013-10-29 16:40:11 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
s = _edje_edit_style_get(ed, style);
|
2013-10-29 16:40:11 -07:00
|
|
|
if (!s) return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
ed->file->styles = eina_list_remove(ed->file->styles, s);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
_edje_if_string_free(ed, s->name);
|
|
|
|
//~ //s->style HOWTO FREE ???
|
|
|
|
while (s->tags)
|
|
|
|
{
|
|
|
|
Edje_Style_Tag *t;
|
|
|
|
|
|
|
|
t = s->tags->data;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
s->tags = eina_list_remove(s->tags, t);
|
|
|
|
_edje_if_string_free(ed, t->key);
|
|
|
|
_edje_if_string_free(ed, t->value);
|
|
|
|
_edje_if_string_free(ed, t->font);
|
|
|
|
_edje_if_string_free(ed, t->text_class);
|
|
|
|
free(t);
|
|
|
|
t = NULL;
|
|
|
|
}
|
|
|
|
free(s);
|
|
|
|
s = NULL;
|
|
|
|
s = NULL;
|
2013-10-29 16:40:11 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_style_tags_list_get(Evas_Object * obj, const char* style)
|
|
|
|
{
|
|
|
|
Eina_List *tags = NULL;
|
2009-08-24 09:40:42 -07:00
|
|
|
Eina_List *l;
|
2008-11-02 06:10:11 -08:00
|
|
|
Edje_Style *s;
|
|
|
|
Edje_Style_Tag *t;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
if (!ed->file || !ed->file->styles || !style)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
s = _edje_edit_style_get(ed, style);
|
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("GET STYLE TAG LIST %d\n", eina_list_count(s->tags));
|
2009-08-24 09:40:42 -07:00
|
|
|
EINA_LIST_FOREACH(s->tags, l, t)
|
2008-11-02 06:10:11 -08:00
|
|
|
tags = eina_list_append(tags, eina_stringshare_add(t->key));
|
|
|
|
|
|
|
|
return tags;
|
|
|
|
}
|
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* tag, const char*new_name)
|
|
|
|
{
|
|
|
|
Edje_Style_Tag *t;
|
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-11-02 06:10:11 -08:00
|
|
|
|
|
|
|
if (!ed->file || !ed->file->styles || !style || !tag)
|
2013-10-30 06:04:57 -07:00
|
|
|
return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
t = _edje_edit_style_tag_get(ed, style, tag);
|
2013-10-30 06:04:57 -07:00
|
|
|
if (!t) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
_edje_if_string_free(ed, t->key);
|
|
|
|
t->key = eina_stringshare_add(new_name);
|
2013-10-30 06:04:57 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char*
|
|
|
|
edje_edit_style_tag_value_get(Evas_Object * obj, const char* style, const char* tag)
|
|
|
|
{
|
|
|
|
Edje_Style_Tag *t;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("GET TAG '%s' FOR STYLE '%s'\n", tag, style);
|
2008-11-02 06:10:11 -08:00
|
|
|
|
|
|
|
if (!ed->file || !ed->file->styles || !style || !tag)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
t = _edje_edit_style_tag_get(ed, style, tag);
|
|
|
|
if (t && t->value)
|
|
|
|
return eina_stringshare_add(t->value);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* tag, const char*new_value)
|
|
|
|
{
|
|
|
|
Edje_Style_Tag *t;
|
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-11-02 06:10:11 -08:00
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
if (!ed->file || !ed->file->styles || !style || !tag || !new_value)
|
|
|
|
return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
t = _edje_edit_style_tag_get(ed, style, tag);
|
2013-10-30 06:04:57 -07:00
|
|
|
if (!t) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
_edje_if_string_free(ed, t->value);
|
|
|
|
t->value = eina_stringshare_add(new_value);
|
2013-10-30 06:04:57 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_name)
|
|
|
|
{
|
|
|
|
Edje_Style *s;
|
|
|
|
Edje_Style_Tag *t;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("ADD TAG '%s' IN STYLE '%s'\n", tag_name, style);
|
2008-11-02 06:10:11 -08:00
|
|
|
|
|
|
|
t = _edje_edit_style_tag_get(ed, style, tag_name);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (t) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
s = _edje_edit_style_get(ed, style);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!s) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
|
2009-08-17 06:54:17 -07:00
|
|
|
t = _alloc(sizeof(Edje_Style_Tag));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!t) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
t->key = eina_stringshare_add(tag_name);
|
|
|
|
t->value = NULL;
|
|
|
|
t->font = NULL;
|
|
|
|
t->text_class = NULL;
|
|
|
|
|
|
|
|
s->tags = eina_list_append(s->tags, t);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag)
|
|
|
|
{
|
|
|
|
Edje_Style *s;
|
|
|
|
Edje_Style_Tag *t;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2013-10-30 06:04:57 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!ed->file || !ed->file->styles || !style || !tag )
|
|
|
|
return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
s = _edje_edit_style_get(ed, style);
|
|
|
|
t = _edje_edit_style_tag_get(ed, style, tag);
|
2013-10-30 06:04:57 -07:00
|
|
|
if (!s || !t) return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
|
|
|
|
s->tags = eina_list_remove(s->tags, t);
|
|
|
|
_edje_if_string_free(ed, t->key);
|
|
|
|
_edje_if_string_free(ed, t->value);
|
|
|
|
_edje_if_string_free(ed, t->font);
|
|
|
|
_edje_if_string_free(ed, t->text_class);
|
|
|
|
free(t);
|
|
|
|
t = NULL;
|
2013-10-30 06:04:57 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
2009-11-26 09:01:31 -08:00
|
|
|
/*******************/
|
|
|
|
/* EXTERNALS API */
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_externals_list_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Eina_List *externals = NULL;
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
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));
|
2010-06-29 06:48:03 -07:00
|
|
|
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));
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
return externals;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_external_add(Evas_Object *obj, const char *external)
|
|
|
|
{
|
|
|
|
Edje_External_Directory_Entry *e;
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int freeid;
|
|
|
|
unsigned int i;
|
|
|
|
|
2010-03-05 09:31:29 -08:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
e = _edje_edit_external_get(ed, external);
|
2010-03-05 09:31:29 -08:00
|
|
|
if (e) return EINA_FALSE;
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
if (!ed->file->external_dir)
|
|
|
|
ed->file->external_dir = _alloc(sizeof(Edje_External_Directory));
|
2010-06-29 06:48:03 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2010-03-05 09:31:29 -08:00
|
|
|
return EINA_TRUE;
|
2009-11-26 09:01:31 -08:00
|
|
|
}
|
|
|
|
|
2010-03-05 09:31:29 -08:00
|
|
|
EAPI Eina_Bool
|
2009-11-26 09:01:31 -08:00
|
|
|
edje_edit_external_del(Evas_Object *obj, const char *external)
|
|
|
|
{
|
|
|
|
Edje_External_Directory_Entry *e;
|
|
|
|
|
2010-03-05 09:31:29 -08:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
e = _edje_edit_external_get(ed, external);
|
2010-03-05 09:31:29 -08:00
|
|
|
if (!e) return EINA_FALSE;
|
2009-11-26 09:01:31 -08:00
|
|
|
|
|
|
|
_edje_if_string_free(ed, e->entry);
|
2010-06-29 06:48:03 -07:00
|
|
|
e->entry = NULL;
|
2010-03-05 09:31:29 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2009-11-26 09:01:31 -08:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/***************/
|
|
|
|
/* PARTS API */
|
|
|
|
/***************/
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_parts_list_get(Evas_Object *obj)
|
|
|
|
{
|
2009-12-04 08:34:35 -08:00
|
|
|
Eina_List *parts = NULL;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("EE: Found %d parts\n", ed->table_parts_size);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
parts = NULL;
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
rp = ed->table_parts[i];
|
2008-10-22 04:34:42 -07:00
|
|
|
parts = eina_list_append(parts, eina_stringshare_add(rp->part->name));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
return parts;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name)
|
|
|
|
{
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!new_name) return EINA_FALSE;
|
|
|
|
if (!strcmp(part, new_name)) return EINA_TRUE;
|
|
|
|
if (_edje_real_part_get(ed, new_name)) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("Set name of part: %s [new name: %s]\n", part, new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, rp->part->name);
|
2008-10-15 07:11:11 -07:00
|
|
|
rp->part->name = (char *)eina_stringshare_add(new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
#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); \
|
2010-08-12 11:24:48 -07:00
|
|
|
_edje_if_string_free(ed, rp->part->api.Value); \
|
2010-07-16 06:58:35 -07:00
|
|
|
rp->part->api.Value = eina_stringshare_add(s); \
|
|
|
|
return EINA_TRUE; \
|
|
|
|
}
|
|
|
|
|
|
|
|
FUNC_PART_API_STRING(name);
|
|
|
|
FUNC_PART_API_STRING(description);
|
2010-06-14 18:51:46 -07:00
|
|
|
|
2010-08-17 05:10:06 -07:00
|
|
|
static Eina_Bool
|
2009-11-25 09:00:53 -08:00
|
|
|
_edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type, const char *source)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-30 01:29:13 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
2008-03-06 11:48:11 -08:00
|
|
|
Edje_Part_Collection *pc;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part **tmp;
|
2008-03-06 11:48:11 -08:00
|
|
|
Edje_Part *ep;
|
|
|
|
Edje_Real_Part *rp;
|
2010-07-29 05:02:36 -07:00
|
|
|
int id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("ADD PART: %s [type: %d]\n", name, type);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Check if part already exists */
|
|
|
|
if (_edje_real_part_get(ed, name))
|
2009-09-15 20:37:28 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2014-03-06 01:22:15 -08:00
|
|
|
if (!ed->file) return EINA_FALSE;
|
2014-02-19 19:21:55 -08:00
|
|
|
|
2010-11-24 07:26:54 -08:00
|
|
|
ce = eina_hash_find(ed->file->collection, ed->group);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Alloc Edje_Part or return */
|
2010-11-24 07:26:54 -08:00
|
|
|
ep = eina_mempool_malloc(ce->mp.part, sizeof(Edje_Part));
|
2009-09-15 20:37:28 -07:00
|
|
|
if (!ep) return EINA_FALSE;
|
2010-11-24 07:26:54 -08:00
|
|
|
memset(ep, 0, sizeof(Edje_Part));
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Alloc Edje_Real_Part or return */
|
2010-11-24 07:26:54 -08:00
|
|
|
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!rp)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2014-05-14 02:11:41 -07:00
|
|
|
eina_mempool_free(ce->mp.part, ep);
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2010-11-24 07:26:54 -08:00
|
|
|
memset(rp, 0, sizeof(Edje_Real_Part));
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Init Edje_Part */
|
|
|
|
pc = ed->collection;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
tmp = realloc(pc->parts, (pc->parts_count + 1) * sizeof (Edje_Part *));
|
|
|
|
if (!tmp)
|
|
|
|
{
|
2014-05-14 02:11:41 -07:00
|
|
|
eina_mempool_free(ce->mp.part, ep);
|
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
|
|
|
return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
id = pc->parts_count++;
|
|
|
|
|
|
|
|
pc->parts = tmp;
|
|
|
|
pc->parts[id] = ep;
|
|
|
|
|
|
|
|
ep->id = id;
|
2008-03-06 11:48:11 -08:00
|
|
|
ep->type = type;
|
2008-10-15 07:11:11 -07:00
|
|
|
ep->name = eina_stringshare_add(name);
|
2008-03-06 11:48:11 -08:00
|
|
|
ep->mouse_events = 1;
|
|
|
|
ep->repeat_events = 0;
|
2008-04-01 14:33:17 -07:00
|
|
|
ep->ignore_flags = EVAS_EVENT_FLAG_NONE;
|
2008-03-06 11:48:11 -08:00
|
|
|
ep->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
|
|
|
|
ep->precise_is_inside = 0;
|
|
|
|
ep->use_alternate_font_metrics = 0;
|
|
|
|
ep->clip_to_id = -1;
|
|
|
|
ep->dragable.confine_id = -1;
|
2010-07-16 06:58:35 -07:00
|
|
|
ep->dragable.event_id = -1;
|
2009-11-25 09:00:53 -08:00
|
|
|
if (source)
|
|
|
|
ep->source = eina_stringshare_add(source);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
ep->default_desc = NULL;
|
2010-08-09 10:34:03 -07:00
|
|
|
ep->other.desc = NULL;
|
|
|
|
ep->other.desc_count = 0;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Init Edje_Real_Part */
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_ref(ed);
|
2008-03-06 11:48:11 -08:00
|
|
|
rp->part = ep;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (ep->type == EDJE_PART_TYPE_RECTANGLE)
|
2012-10-21 03:46:58 -07:00
|
|
|
rp->object = evas_object_rectangle_add(ed->base->evas);
|
2011-03-13 08:41:12 -07:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_IMAGE || ep->type == EDJE_PART_TYPE_PROXY)
|
2012-10-21 03:46:58 -07:00
|
|
|
rp->object = evas_object_image_add(ed->base->evas);
|
2008-03-06 11:48:11 -08:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_TEXT)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2014-05-14 02:11:41 -07:00
|
|
|
rp->type = EDJE_RP_TYPE_TEXT;
|
|
|
|
rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text));
|
|
|
|
_edje_text_part_on_add(ed, rp);
|
|
|
|
rp->object = evas_object_text_add(ed->base->evas);
|
|
|
|
evas_object_text_font_source_set(rp->object, ed->path);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_SWALLOW ||
|
2014-05-14 02:11:41 -07:00
|
|
|
ep->type == EDJE_PART_TYPE_GROUP ||
|
|
|
|
ep->type == EDJE_PART_TYPE_EXTERNAL)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2014-05-14 02:11:41 -07:00
|
|
|
rp->type = EDJE_RP_TYPE_SWALLOW;
|
|
|
|
rp->typedata.swallow = calloc(1, sizeof(Edje_Real_Part_Swallow));
|
|
|
|
rp->object = evas_object_rectangle_add(ed->base->evas);
|
|
|
|
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
|
2014-05-14 02:11:41 -07:00
|
|
|
{
|
|
|
|
rp->type = EDJE_RP_TYPE_TEXT;
|
|
|
|
rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text));
|
|
|
|
rp->object = evas_object_textblock_add(ed->base->evas);
|
|
|
|
}
|
|
|
|
else if (ep->type == EDJE_PART_TYPE_BOX ||
|
|
|
|
ep->type == EDJE_PART_TYPE_TABLE)
|
|
|
|
{
|
|
|
|
rp->type = EDJE_RP_TYPE_CONTAINER;
|
|
|
|
rp->typedata.container = calloc(1, sizeof(Edje_Real_Part_Container));
|
|
|
|
}
|
2012-06-12 20:21:31 -07:00
|
|
|
else if (ep->type != EDJE_PART_TYPE_SPACER)
|
2010-03-25 11:05:42 -07:00
|
|
|
ERR("wrong part type %i!", ep->type);
|
2008-03-06 11:48:11 -08:00
|
|
|
if (rp->object)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2014-05-14 02:11:41 -07:00
|
|
|
evas_object_show(rp->object);
|
|
|
|
evas_object_smart_member_add(rp->object, ed->obj);
|
|
|
|
evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
|
|
|
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP)
|
|
|
|
{
|
|
|
|
if (ep->mouse_events)
|
|
|
|
{
|
|
|
|
_edje_callbacks_add(rp->object, ed, rp);
|
|
|
|
if (ep->repeat_events)
|
|
|
|
evas_object_repeat_events_set(rp->object, 1);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2014-05-14 02:11:41 -07:00
|
|
|
if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
|
|
|
|
evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
evas_object_pointer_mode_set(rp->object,
|
|
|
|
EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
|
|
}
|
|
|
|
if (ep->precise_is_inside)
|
|
|
|
evas_object_precise_is_inside_set(rp->object, 1);
|
|
|
|
}
|
|
|
|
if (ep->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
Evas_Object *child;
|
|
|
|
child = _edje_external_type_add(source, evas_object_evas_get(ed->obj), ed->obj, NULL, name);
|
|
|
|
if (child)
|
|
|
|
_edje_real_part_swallow(ed, rp, child, EINA_TRUE);
|
|
|
|
}
|
|
|
|
evas_object_clip_set(rp->object, ed->base->clipper);
|
|
|
|
evas_object_show(ed->base->clipper);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Update table_parts */
|
|
|
|
ed->table_parts_size++;
|
|
|
|
ed->table_parts = realloc(ed->table_parts,
|
2014-05-14 02:11:41 -07:00
|
|
|
sizeof(Edje_Real_Part *) * ed->table_parts_size);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
ed->table_parts[ep->id % ed->table_parts_size] = rp;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Create default description */
|
2010-08-11 09:23:50 -07:00
|
|
|
if (!edje_edit_state_add(obj, name, "default", 0.0))
|
|
|
|
{
|
2014-05-14 02:11:41 -07:00
|
|
|
_edje_if_string_free(ed, ep->name);
|
|
|
|
if (source)
|
|
|
|
_edje_if_string_free(ed, ep->source);
|
|
|
|
eina_mempool_free(ce->mp.part, ep);
|
|
|
|
eina_mempool_free(_edje_real_part_mp, rp);
|
|
|
|
return EINA_FALSE;
|
2010-08-11 09:23:50 -07:00
|
|
|
}
|
2010-04-19 13:37:35 -07:00
|
|
|
edje_edit_part_selected_state_set(obj, name, "default", 0.0);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-30 01:29:13 -07:00
|
|
|
ce->count.part++;
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-11-25 09:00:53 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type)
|
|
|
|
{
|
|
|
|
if (type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
return EINA_FALSE;
|
|
|
|
return _edje_edit_real_part_add(obj, name, type, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_external_add(Evas_Object *obj, const char *name, const char *source)
|
|
|
|
{
|
|
|
|
if (!source)
|
|
|
|
return EINA_FALSE;
|
|
|
|
return _edje_edit_real_part_add(obj, name, EDJE_PART_TYPE_EXTERNAL, source);
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_del(Evas_Object *obj, const char* part)
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
2008-05-30 01:00:25 -07:00
|
|
|
Edje_Part_Collection *pc;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int k;
|
2010-08-06 12:16:46 -07:00
|
|
|
unsigned int id;
|
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("REMOVE PART: %s\n", part);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
ep = rp->part;
|
|
|
|
id = ep->id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Unlik Edje_Real_Parts that link to the removed one */
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *real;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
|
|
|
if (i == id) continue; //don't check the deleted id
|
2010-08-11 05:51:39 -07:00
|
|
|
real = ed->table_parts[i];
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-11-03 22:39:44 -08:00
|
|
|
if ((real->typedata.text) && (real->typedata.text->source == rp))
|
|
|
|
real->typedata.text->source = NULL;
|
|
|
|
if ((real->typedata.text) && (real->typedata.text->text_source == rp))
|
|
|
|
real->typedata.text->text_source = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-04-06 19:39:20 -07:00
|
|
|
if (real->part->clip_to_id == rp->part->id)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2012-10-21 03:46:58 -07:00
|
|
|
evas_object_clip_set(real->object, ed->base->clipper);
|
2013-04-06 19:39:20 -07:00
|
|
|
real->part->clip_to_id = -1;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2009-08-14 10:19:42 -07:00
|
|
|
if (real->drag && real->drag->confine_to == rp)
|
edje: Edje_Edit - fix wrong behaviour on draggable.event processing while deleting parts.
Summary:
the draggable.event field (in edje) is pointing on the id of the part it is assigned to.
The main problem is about deleting parts.
After part being deleted, all other parts (that are below the deleted part) have their id shifted,
but event doesnt shift.
For example,
1) draggable.event at some part pointing at part with id=7,
2) some other part is being deleted
3) part with id=7 have new id now (id=6)
4) draggable.event DOESN'T change it's pointer and still points at part with id=7 (which is now has id=6)
5) if there is no parts with id=7 anymore, then it could give you SEGFAULT someday (or not, depending on luck).
This commit contains next changes:
1) after deleting part, draggable.event also shifts (if required)
2) after deleting part that is being pointed with event by someone, it will remove all event points at it
@fix
Reviewers: cedric, raster, seoz
CC: reutskiy.v.v, cedric
Differential Revision: https://phab.enlightenment.org/D878
Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-20 21:13:50 -07:00
|
|
|
{
|
|
|
|
real->drag->confine_to = NULL;
|
|
|
|
}
|
|
|
|
if (real->part->dragable.event_id != -1)
|
|
|
|
{
|
|
|
|
if (real->part->dragable.event_id == TO_INT(id))
|
|
|
|
real->part->dragable.event_id = -1;
|
|
|
|
else if (i > id)
|
|
|
|
real->part->dragable.event_id--;
|
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Unlink all the parts and descriptions that refer to id */
|
|
|
|
_edje_part_id_set(ed, rp, -1);
|
|
|
|
|
|
|
|
/* Remove part from parts list */
|
|
|
|
pc = ed->collection;
|
2010-08-06 12:16:46 -07:00
|
|
|
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;
|
2008-03-06 11:48:11 -08:00
|
|
|
_edje_fix_parts_id(ed);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Free Edje_Part and all descriptions */
|
2010-08-06 12:16:46 -07:00
|
|
|
ce = eina_hash_find(ed->file->collection, ed->group);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, ep->name);
|
2008-03-06 11:48:11 -08:00
|
|
|
if (ep->default_desc)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0);
|
2008-03-13 12:01:53 -07:00
|
|
|
ep->default_desc = NULL;
|
|
|
|
}
|
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
for (k = 0; k < ep->other.desc_count; ++k)
|
|
|
|
_edje_collection_free_part_description_free(ep->type, ep->other.desc[k], ce, 0);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
free(ep->other.desc);
|
2010-08-06 12:16:46 -07:00
|
|
|
eina_mempool_free(ce->mp.part, ep);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Free Edje_Real_Part */
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_real_part_free(ed, rp);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-12-14 09:38:45 -08:00
|
|
|
/* if all parts are gone, hide the clipper */
|
|
|
|
if (ed->table_parts_size == 0)
|
2012-10-21 03:46:58 -07:00
|
|
|
evas_object_hide(ed->base->clipper);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2010-07-30 01:29:13 -07:00
|
|
|
|
|
|
|
ce->count.part--;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:39:32 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_edit_part_state_copy(Evas_Object *obj, const char *part_from, const char *part_to, const char *from, double val_from, const char *to, double val_to);
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_copy(Evas_Object *obj, const char *part, const char *new_copy)
|
|
|
|
{
|
|
|
|
Edje_Part *ep, *epcopy;
|
|
|
|
unsigned int i, count;
|
|
|
|
Edje_Real_Part *rpcopy;
|
|
|
|
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
ep = rp->part;
|
|
|
|
|
|
|
|
/* Check if part doesn't exists */
|
|
|
|
if (_edje_real_part_get(ed, new_copy))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
|
|
|
|
/* Create part (EXTERNAL or not) */
|
|
|
|
if (!_edje_edit_real_part_add(obj, new_copy, ep->type, ep->source))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
/* Copy part's data */
|
|
|
|
rpcopy = _edje_real_part_get(ed, new_copy);
|
|
|
|
if (!rpcopy)
|
|
|
|
return EINA_FALSE;
|
|
|
|
epcopy = rpcopy->part;
|
|
|
|
|
|
|
|
#define _PARAM_PART_COPY(param) \
|
|
|
|
epcopy->param = ep->param;
|
|
|
|
|
|
|
|
_PARAM_PART_COPY(scale)
|
|
|
|
_PARAM_PART_COPY(mouse_events)
|
|
|
|
_PARAM_PART_COPY(repeat_events)
|
|
|
|
_PARAM_PART_COPY(ignore_flags)
|
|
|
|
_PARAM_PART_COPY(pointer_mode)
|
|
|
|
_PARAM_PART_COPY(precise_is_inside)
|
|
|
|
_PARAM_PART_COPY(use_alternate_font_metrics)
|
|
|
|
_PARAM_PART_COPY(clip_to_id)
|
|
|
|
_PARAM_PART_COPY(dragable.event_id)
|
|
|
|
_PARAM_PART_COPY(dragable.confine_id)
|
|
|
|
_PARAM_PART_COPY(dragable.threshold_id)
|
|
|
|
_PARAM_PART_COPY(dragable.step_x)
|
|
|
|
_PARAM_PART_COPY(dragable.step_y)
|
|
|
|
_PARAM_PART_COPY(dragable.count_x)
|
|
|
|
_PARAM_PART_COPY(dragable.count_y)
|
|
|
|
_PARAM_PART_COPY(dragable.x)
|
|
|
|
_PARAM_PART_COPY(dragable.y)
|
|
|
|
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
epcopy->source2 = (char *)eina_stringshare_add(ep->source2);
|
|
|
|
epcopy->source3 = (char *)eina_stringshare_add(ep->source3);
|
|
|
|
epcopy->source4 = (char *)eina_stringshare_add(ep->source4);
|
|
|
|
epcopy->source5 = (char *)eina_stringshare_add(ep->source5);
|
|
|
|
epcopy->source6 = (char *)eina_stringshare_add(ep->source6);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
_PARAM_PART_COPY(physics_body)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_PARAM_PART_COPY(effect)
|
|
|
|
_PARAM_PART_COPY(entry_mode)
|
|
|
|
_PARAM_PART_COPY(select_mode)
|
|
|
|
_PARAM_PART_COPY(cursor_mode)
|
|
|
|
_PARAM_PART_COPY(multiline)
|
|
|
|
_PARAM_PART_COPY(access)
|
|
|
|
|
|
|
|
if (ep->api.name)
|
|
|
|
epcopy->api.name = eina_stringshare_add(ep->api.name);
|
|
|
|
if (ep->api.description)
|
|
|
|
epcopy->api.description = eina_stringshare_add(ep->api.description);
|
|
|
|
|
|
|
|
#undef _PARAM_PART_COPY
|
|
|
|
|
|
|
|
/* Copy default state */
|
|
|
|
_edje_edit_part_state_copy(obj, part, new_copy, "default", 0.0, "default", 0.0);
|
|
|
|
|
|
|
|
/* Copy all other states */
|
|
|
|
count = rp->part->other.desc_count;
|
|
|
|
for (i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
_edje_edit_part_state_copy(obj, part, new_copy,
|
|
|
|
rp->part->other.desc[i]->state.name, rp->part->other.desc[i]->state.value,
|
|
|
|
rp->part->other.desc[i]->state.name, rp->part->other.desc[i]->state.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_exist(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-03-24 12:21:03 -07:00
|
|
|
EAPI const char*
|
2010-03-25 09:41:46 -07:00
|
|
|
edje_edit_part_below_get(Evas_Object *obj, const char* part)
|
2010-03-24 12:21:03 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *prev;
|
|
|
|
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
|
|
|
if (rp->part->id < 1) return NULL;
|
|
|
|
|
|
|
|
prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
|
|
|
|
|
|
|
|
return eina_stringshare_add(prev->part->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char*
|
2010-03-25 09:41:46 -07:00
|
|
|
edje_edit_part_above_get(Evas_Object *obj, const char* part)
|
2010-03-24 12:21:03 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *next;
|
|
|
|
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return 0;
|
2010-03-24 12:21:03 -07:00
|
|
|
|
|
|
|
next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
|
|
|
|
|
|
|
|
return eina_stringshare_add(next->part->name);
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_restack_below(Evas_Object *obj, const char* part)
|
|
|
|
{
|
2008-05-30 01:00:25 -07:00
|
|
|
Edje_Part_Collection *group;
|
|
|
|
Edje_Real_Part *prev;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *swap;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("RESTACK PART: %s BELOW\n", part);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (rp->part->id < 1) return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
group = ed->collection;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* update parts list */
|
|
|
|
prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
swap = group->parts[rp->part->id];
|
|
|
|
group->parts[rp->part->id] = group->parts[prev->part->id];
|
|
|
|
group->parts[prev->part->id] = swap;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
_edje_parts_id_switch(ed, rp, prev);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
evas_object_stack_below(rp->object, prev->object);
|
2013-11-11 18:18:22 -08:00
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
2012-09-11 06:14:51 -07:00
|
|
|
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-12-18 22:40:18 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char *below)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection *group;
|
|
|
|
Edje_Real_Part *rp, *rp_below, *prev;
|
|
|
|
Edje_Part *swap;
|
|
|
|
|
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
rp = _edje_real_part_get(ed, part);
|
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
rp_below = _edje_real_part_get(ed, below);
|
|
|
|
if (!rp_below) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (rp->part->id < 1) return EINA_FALSE;
|
|
|
|
if (rp_below->part->id < 1) return EINA_FALSE;
|
|
|
|
group = ed->collection;
|
|
|
|
|
|
|
|
while (rp->part->id != (rp_below->part->id - 1))
|
|
|
|
{
|
|
|
|
if (rp->part->id > rp_below->part->id)
|
|
|
|
prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
|
|
|
|
else
|
|
|
|
prev = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_stack_below(rp->object, rp_below->object);
|
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
|
|
|
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
|
|
|
|
|
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_restack_above(Evas_Object *obj, const char* part)
|
|
|
|
{
|
2008-05-30 01:00:25 -07:00
|
|
|
Edje_Part_Collection *group;
|
|
|
|
Edje_Real_Part *next;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *swap;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("RESTACK PART: %s ABOVE\n", part);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
group = ed->collection;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* update parts list */
|
|
|
|
next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
swap = group->parts[rp->part->id];
|
|
|
|
group->parts[rp->part->id] = group->parts[next->part->id];
|
|
|
|
group->parts[next->part->id] = swap;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* update ids */
|
|
|
|
_edje_parts_id_switch(ed, rp, next);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
evas_object_stack_above(rp->object, next->object);
|
2013-11-11 18:18:22 -08:00
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
2012-09-11 06:14:51 -07:00
|
|
|
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
|
2013-12-18 22:40:18 -08:00
|
|
|
|
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_restack_part_above(Evas_Object *obj, const char* part, const char *above)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection *group;
|
|
|
|
Edje_Real_Part *rp, *rp_above, *next;
|
|
|
|
Edje_Part *swap;
|
|
|
|
|
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
rp = _edje_real_part_get(ed, part);
|
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
rp_above = _edje_real_part_get(ed, above);
|
|
|
|
if (!rp_above) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (rp->part->id < 1) return EINA_FALSE;
|
|
|
|
if (rp_above->part->id < 1) return EINA_FALSE;
|
|
|
|
group = ed->collection;
|
|
|
|
|
|
|
|
while (rp->part->id != rp_above->part->id + 1)
|
|
|
|
{
|
|
|
|
if (rp->part->id > rp_above->part->id)
|
|
|
|
next = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
|
|
|
|
else
|
|
|
|
next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
|
|
|
|
swap = group->parts[rp->part->id];
|
|
|
|
group->parts[rp->part->id] = group->parts[next->part->id];
|
|
|
|
group->parts[next->part->id] = swap;
|
|
|
|
_edje_parts_id_switch(ed, rp, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_stack_above(rp->object, rp_above->object);
|
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
|
|
|
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Edje_Part_Type
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_type_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_RP_OR_RETURN(0);
|
2008-03-06 11:48:11 -08:00
|
|
|
return rp->part->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char *
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_part_selected_state_get(Evas_Object *obj, const char *part, double *value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_RP_OR_RETURN(NULL);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
if (!rp->chosen_description)
|
2010-04-07 10:04:49 -07:00
|
|
|
{
|
|
|
|
if (value) *value = 0.0; // FIXME: Make sure edje_edit supports correctly the default having any value
|
|
|
|
return eina_stringshare_add("default");
|
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (value) *value = rp->chosen_description->state.value;
|
|
|
|
return eina_stringshare_add(rp->chosen_description->state.name);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_part_selected_state_set(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *pd;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
pd = _edje_part_description_find_byname(eed, part, state, value);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!pd) return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-04-19 13:37:32 -07:00
|
|
|
//printf("EDJE: Set state: %s %f\n", pd->state.name, pd->state.value);
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, NULL, 0.0);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-06 09:26:16 -07:00
|
|
|
static const char *
|
|
|
|
_edje_part_clip_to_get(Edje *ed, Edje_Real_Part *rp)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
|
|
|
Edje_Real_Part *clip = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (rp->part->clip_to_id < 0) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
|
|
|
|
if (!clip || !clip->part || !clip->part->name) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(clip->part->name);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2014-06-06 09:26:16 -07:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_part_clip_to_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
return _edje_part_clip_to_get(ed, rp);
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_to)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *clip;
|
2010-01-28 12:44:03 -08:00
|
|
|
Evas_Object *o, *oo;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* unset clipping */
|
|
|
|
if (!clip_to)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-04-06 19:39:20 -07:00
|
|
|
if (rp->part->clip_to_id >= 0)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-04-06 19:39:20 -07:00
|
|
|
clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
|
|
|
|
|
|
|
|
evas_object_pointer_mode_set(clip->object,
|
2008-03-13 12:01:53 -07:00
|
|
|
EVAS_OBJECT_POINTER_MODE_AUTOGRAB);
|
|
|
|
evas_object_clip_unset(rp->object);
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2012-10-21 03:46:58 -07:00
|
|
|
evas_object_clip_set(rp->object, ed->base->clipper);
|
2013-11-11 18:18:22 -08:00
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
|
|
|
evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
rp->part->clip_to_id = -1;
|
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
/* set clipping */
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("Set clip_to for part: %s [to: %s]\n", part, clip_to);
|
2008-03-06 11:48:11 -08:00
|
|
|
clip = _edje_real_part_get(ed, clip_to);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!clip || !clip->part) return EINA_FALSE;
|
2010-01-28 12:44:03 -08:00
|
|
|
o = clip->object;
|
|
|
|
while ((oo = evas_object_clip_get(o)))
|
|
|
|
{
|
|
|
|
if (o == rp->object)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2010-01-28 12:44:03 -08:00
|
|
|
o = oo;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
rp->part->clip_to_id = clip->part->id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-04-06 19:39:20 -07:00
|
|
|
evas_object_pass_events_set(clip->object, 1);
|
|
|
|
evas_object_pointer_mode_set(clip->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
|
|
evas_object_clip_set(rp->object, clip->object);
|
2013-11-11 18:18:22 -08:00
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
2013-04-06 19:39:20 -07:00
|
|
|
evas_object_clip_set(rp->typedata.swallow->swallowed_object, clip->object);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_mouse_events_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-03-06 11:48:11 -08:00
|
|
|
return rp->part->mouse_events;
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
EAPI Eina_Bool
|
2009-09-15 20:37:28 -07:00
|
|
|
edje_edit_part_mouse_events_set(Evas_Object *obj, const char *part, Eina_Bool mouse_events)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-10-31 19:30:23 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
if (!rp->object) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
rp->part->mouse_events = mouse_events ? 1 : 0;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (mouse_events)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-10-31 19:30:23 -07:00
|
|
|
evas_object_pass_events_set(rp->object, 0);
|
|
|
|
_edje_callbacks_add(rp->object, ed, rp);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
else
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-10-31 19:30:23 -07:00
|
|
|
evas_object_pass_events_set(rp->object, 1);
|
|
|
|
_edje_callbacks_del(rp->object, ed);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2013-10-31 19:30:23 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_repeat_events_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-03-06 11:48:11 -08:00
|
|
|
return rp->part->repeat_events;
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
EAPI Eina_Bool
|
2009-09-15 20:37:28 -07:00
|
|
|
edje_edit_part_repeat_events_set(Evas_Object *obj, const char *part, Eina_Bool repeat_events)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-10-31 19:30:23 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
if (!rp->object) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
rp->part->repeat_events = repeat_events ? 1 : 0;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (repeat_events)
|
2008-03-13 12:01:53 -07:00
|
|
|
evas_object_repeat_events_set(rp->object, 1);
|
2008-03-06 11:48:11 -08:00
|
|
|
else
|
2008-03-13 12:01:53 -07:00
|
|
|
evas_object_repeat_events_set(rp->object, 0);
|
2013-10-31 19:30:23 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-05 10:43:02 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_multiline_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
return rp->part->multiline;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_multiline_set(Evas_Object *obj, const char *part, Eina_Bool multiline)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if ((!rp->object) ||
|
|
|
|
((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
rp->part->multiline = multiline;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-04 11:01:40 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_precise_is_inside_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
|
|
|
return rp->part->precise_is_inside;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_precise_is_inside_set(Evas_Object *obj, const char *part, Eina_Bool precise_is_inside)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!rp->object) return EINA_FALSE;
|
|
|
|
|
|
|
|
rp->part->precise_is_inside = precise_is_inside;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-04 11:03:39 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_access_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
|
|
|
return rp->part->access;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_access_set(Evas_Object *obj, const char *part, Eina_Bool access)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!rp->object) return EINA_FALSE;
|
|
|
|
|
|
|
|
rp->part->access = access;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-04-01 14:33:17 -07:00
|
|
|
EAPI Evas_Event_Flags
|
|
|
|
edje_edit_part_ignore_flags_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-04-01 14:33:17 -07:00
|
|
|
return rp->part->ignore_flags;
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
EAPI Eina_Bool
|
2008-04-01 14:33:17 -07:00
|
|
|
edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_Flags ignore_flags)
|
|
|
|
{
|
2013-10-31 19:30:23 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
if (!rp->object) return EINA_FALSE;
|
2008-04-01 14:33:17 -07:00
|
|
|
|
|
|
|
rp->part->ignore_flags = ignore_flags;
|
2013-10-31 19:30:23 -07:00
|
|
|
return EINA_TRUE;
|
2008-04-01 14:33:17 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:45:28 -07:00
|
|
|
EAPI Evas_Object_Pointer_Mode
|
|
|
|
edje_edit_part_pointer_mode_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
|
|
|
return rp->part->pointer_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_pointer_mode_set(Evas_Object *obj, const char *part, Evas_Object_Pointer_Mode pointer_mode)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!rp->object) return EINA_FALSE;
|
|
|
|
|
|
|
|
rp->part->pointer_mode = pointer_mode;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-05 10:43:49 -07:00
|
|
|
EAPI unsigned char
|
|
|
|
edje_edit_part_cursor_mode_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
|
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return rp->part->cursor_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_cursor_mode_set(Evas_Object *obj, const char *part, unsigned char cursor_mode)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if ((!rp->object) ||
|
|
|
|
((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
rp->part->cursor_mode = cursor_mode;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
EAPI Eina_Bool
|
2010-06-18 15:08:05 -07:00
|
|
|
edje_edit_part_scale_set(Evas_Object *obj, const char *part, Eina_Bool scale)
|
|
|
|
{
|
2013-10-31 19:30:23 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2010-06-18 15:08:05 -07:00
|
|
|
|
2013-10-31 19:30:23 -07:00
|
|
|
rp->part->scale = scale ? 1 : 0;
|
2010-06-18 15:08:05 -07:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-31 19:30:23 -07:00
|
|
|
return EINA_TRUE;
|
2010-06-18 15:08:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_scale_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
return rp->part->scale;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_part_source_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2008-05-30 01:00:25 -07:00
|
|
|
GET_RP_OR_RETURN(NULL);
|
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("Get source for part: %s\n", part);
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!rp->part->source) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(rp->part->source);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-28 11:40:05 -07:00
|
|
|
Evas_Object *child_obj;
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("Set source for part: %s [source: %s]\n", part, source);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2014-06-04 10:15:19 -07:00
|
|
|
switch(rp->part->type)
|
2010-04-28 11:40:05 -07:00
|
|
|
{
|
2014-06-04 10:15:19 -07:00
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
{
|
|
|
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
|
|
|
{
|
|
|
|
_edje_real_part_swallow_clear(ed, rp);
|
|
|
|
evas_object_del(rp->typedata.swallow->swallowed_object);
|
|
|
|
rp->typedata.swallow->swallowed_object = NULL;
|
|
|
|
}
|
|
|
|
if (source)
|
|
|
|
{
|
|
|
|
child_obj = edje_object_add(ed->base->evas);
|
|
|
|
edje_object_file_set(child_obj, ed->file->path, source);
|
|
|
|
_edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
|
|
|
{
|
|
|
|
_edje_if_string_free(ed, rp->part->source);
|
|
|
|
if (source)
|
|
|
|
rp->part->source = eina_stringshare_add(source);
|
|
|
|
else
|
|
|
|
rp->part->source = NULL;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL: //EXTERNAL part has source property but it cannot be changed
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-04-28 11:40:05 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:57:10 -07:00
|
|
|
#define TEXT_BLOCK_SOURCE_GET(N) \
|
|
|
|
EAPI const char * \
|
|
|
|
edje_edit_part_source ## N ## _get(Evas_Object *obj, const char *part) \
|
|
|
|
{ \
|
|
|
|
GET_RP_OR_RETURN(NULL); \
|
|
|
|
if (!rp->part->source ## N) return NULL; \
|
|
|
|
return eina_stringshare_add(rp->part->source ## N); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TEXT_BLOCK_SOURCE_SET(N) \
|
|
|
|
EAPI Eina_Bool \
|
|
|
|
edje_edit_part_source ## N ##_set(Evas_Object *obj, const char *part, const char *source) \
|
|
|
|
{ \
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE); \
|
|
|
|
\
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
\
|
|
|
|
eina_stringshare_del(rp->part->source ## N); \
|
|
|
|
if (source) \
|
|
|
|
rp->part->source ## N = eina_stringshare_add(source); \
|
|
|
|
else \
|
|
|
|
rp->part->source ## N = NULL; \
|
|
|
|
edje_object_calc_force(obj); \
|
|
|
|
return EINA_TRUE; \
|
|
|
|
}
|
|
|
|
TEXT_BLOCK_SOURCE_GET(2);
|
|
|
|
TEXT_BLOCK_SOURCE_GET(3);
|
|
|
|
TEXT_BLOCK_SOURCE_GET(4);
|
|
|
|
TEXT_BLOCK_SOURCE_GET(5);
|
|
|
|
TEXT_BLOCK_SOURCE_GET(6);
|
|
|
|
|
|
|
|
TEXT_BLOCK_SOURCE_SET(2);
|
|
|
|
TEXT_BLOCK_SOURCE_SET(3);
|
|
|
|
TEXT_BLOCK_SOURCE_SET(4);
|
|
|
|
TEXT_BLOCK_SOURCE_SET(5);
|
|
|
|
TEXT_BLOCK_SOURCE_SET(6);
|
|
|
|
|
2008-10-09 07:38:22 -07:00
|
|
|
EAPI int
|
|
|
|
edje_edit_part_drag_x_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
return rp->part->dragable.x;
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:03:30 -07:00
|
|
|
EAPI Eina_Bool
|
2008-10-09 07:38:22 -07:00
|
|
|
edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag)
|
|
|
|
{
|
2013-10-31 19:03:30 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-10-09 07:38:22 -07:00
|
|
|
rp->part->dragable.x = drag;
|
2009-08-11 05:47:00 -07:00
|
|
|
|
|
|
|
if (!drag && !rp->part->dragable.y)
|
|
|
|
{
|
2013-10-31 19:03:30 -07:00
|
|
|
free(rp->drag);
|
|
|
|
rp->drag = NULL;
|
|
|
|
return EINA_TRUE;
|
2009-08-11 05:47:00 -07:00
|
|
|
}
|
|
|
|
|
2013-10-31 19:03:30 -07:00
|
|
|
if (rp->drag) return EINA_TRUE;
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2009-08-17 06:54:17 -07:00
|
|
|
rp->drag = _alloc(sizeof (Edje_Real_Part_Drag));
|
2013-10-31 19:03:30 -07:00
|
|
|
if (!rp->drag) return EINA_FALSE;
|
2009-08-11 05:47:00 -07:00
|
|
|
|
|
|
|
rp->drag->step.x = rp->part->dragable.step_x;
|
|
|
|
rp->drag->step.y = rp->part->dragable.step_y;
|
2013-10-31 19:03:30 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-09 07:38:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
edje_edit_part_drag_y_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
GET_RP_OR_RETURN(0);
|
|
|
|
return rp->part->dragable.y;
|
|
|
|
}
|
|
|
|
|
2013-10-31 19:03:30 -07:00
|
|
|
EAPI Eina_Bool
|
2008-10-09 07:38:22 -07:00
|
|
|
edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag)
|
|
|
|
{
|
2013-10-31 19:03:30 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-10-09 07:38:22 -07:00
|
|
|
rp->part->dragable.y = drag;
|
2009-08-11 05:47:00 -07:00
|
|
|
|
|
|
|
if (!drag && !rp->part->dragable.x)
|
|
|
|
{
|
2013-10-31 19:03:30 -07:00
|
|
|
free(rp->drag);
|
|
|
|
rp->drag = NULL;
|
|
|
|
return EINA_TRUE;
|
2009-08-11 05:47:00 -07:00
|
|
|
}
|
|
|
|
|
2013-10-31 19:03:30 -07:00
|
|
|
if (rp->drag) return EINA_TRUE;
|
2009-08-11 05:47:00 -07:00
|
|
|
|
2009-08-17 06:54:17 -07:00
|
|
|
rp->drag = _alloc(sizeof (Edje_Real_Part_Drag));
|
2013-10-31 19:03:30 -07:00
|
|
|
if (!rp->drag) return EINA_FALSE;
|
2009-08-11 05:47:00 -07:00
|
|
|
|
|
|
|
rp->drag->step.x = rp->part->dragable.step_x;
|
|
|
|
rp->drag->step.y = rp->part->dragable.step_y;
|
2013-10-31 19:03:30 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-09 07:38:22 -07:00
|
|
|
}
|
|
|
|
|
2013-10-31 19:03:30 -07:00
|
|
|
#define FUNC_PART_DRAG_INT(Class, Value) \
|
|
|
|
EAPI int \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_part_drag_##Class##_##Value##_get(Evas_Object *obj, const char *part) \
|
2013-10-31 19:03:30 -07:00
|
|
|
{ \
|
|
|
|
GET_RP_OR_RETURN(0); \
|
|
|
|
return rp->part->dragable.Class##_##Value; \
|
|
|
|
} \
|
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_part_drag_##Class##_##Value##_set(Evas_Object *obj, const char *part, int v) \
|
2013-10-31 19:03:30 -07:00
|
|
|
{ \
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE); \
|
|
|
|
rp->part->dragable.Class##_##Value = v; \
|
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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); \
|
|
|
|
} \
|
2013-10-28 18:23:42 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_part_drag_##Id##_set(Evas_Object *obj, const char *part, const char *e) \
|
|
|
|
{ \
|
|
|
|
Edje_Real_Part *e_part; \
|
|
|
|
\
|
2013-10-28 18:23:42 -07:00
|
|
|
eina_error_set(0); \
|
|
|
|
if ((!obj) || (!part)) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
\
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE); \
|
|
|
|
if (!e) \
|
2010-07-16 06:58:35 -07:00
|
|
|
{ \
|
|
|
|
rp->part->dragable.Id##_id = -1; \
|
2013-10-28 18:23:42 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
|
|
|
e_part = _edje_real_part_get(ed, e); \
|
2013-10-28 18:23:42 -07:00
|
|
|
if (!e_part) return EINA_FALSE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
rp->part->dragable.Id##_id = e_part->part->id; \
|
2013-10-28 18:23:42 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
FUNC_PART_DRAG_ID(confine);
|
|
|
|
FUNC_PART_DRAG_ID(event);
|
2013-10-31 19:03:30 -07:00
|
|
|
FUNC_PART_DRAG_ID(threshold);
|
2008-10-09 07:38:22 -07:00
|
|
|
|
2014-06-10 08:22:24 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_part_item_append(Evas_Object *obj, const char *part, const char *item_name, const char *source_group)
|
|
|
|
{
|
|
|
|
|
|
|
|
Edje_Part *ep;
|
|
|
|
unsigned int i;
|
|
|
|
Edje_Pack_Element *item;
|
|
|
|
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
/* There is only Box and Table is allowed. */
|
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_BOX) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TABLE))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
ep = rp->part;
|
|
|
|
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
|
|
|
|
/* check if a source group is exists. */
|
|
|
|
if (!eina_hash_find(ed->file->collection, source_group))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < ep->items_count; ++i)
|
|
|
|
{
|
|
|
|
if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ep->items_count++;
|
|
|
|
ep->items = realloc(ep->items, sizeof (Edje_Pack_Element *) * ep->items_count);
|
|
|
|
item = _alloc(sizeof (Edje_Pack_Element));
|
|
|
|
ep->items[ep->items_count - 1] = item;
|
|
|
|
|
|
|
|
item->type = EDJE_PART_TYPE_GROUP;
|
|
|
|
item->name = eina_stringshare_add(item_name);
|
|
|
|
item->source = eina_stringshare_add(source_group);
|
|
|
|
item->min.w = 0;
|
|
|
|
item->min.h = 0;
|
|
|
|
item->prefer.w = 0;
|
|
|
|
item->prefer.h = 0;
|
|
|
|
item->max.w = -1;
|
|
|
|
item->max.h = -1;
|
|
|
|
item->padding.l = 0;
|
|
|
|
item->padding.r = 0;
|
|
|
|
item->padding.t = 0;
|
|
|
|
item->padding.b = 0;
|
|
|
|
item->align.x = FROM_DOUBLE(0.5);
|
|
|
|
item->align.y = FROM_DOUBLE(0.5);
|
|
|
|
item->weight.x = FROM_DOUBLE(0.0);
|
|
|
|
item->weight.y = FROM_DOUBLE(0.0);
|
|
|
|
item->aspect.w = 0;
|
|
|
|
item->aspect.h = 0;
|
|
|
|
item->aspect.mode = EDJE_ASPECT_CONTROL_NONE;
|
|
|
|
item->options = NULL;
|
|
|
|
item->col = -1;
|
|
|
|
item->row = -1;
|
|
|
|
item->colspan = 1;
|
|
|
|
item->rowspan = 1;
|
|
|
|
item->spread.w = 1;
|
|
|
|
item->spread.h = 1;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/*********************/
|
|
|
|
/* PART STATES API */
|
|
|
|
/*********************/
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_states_list_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2008-06-06 11:31:49 -07:00
|
|
|
char state_name[PATH_MAX];
|
2009-12-04 08:34:35 -08:00
|
|
|
Eina_List *states = NULL;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_RP_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Is there a better place to put this? maybe edje_edit_init() ?
|
|
|
|
setlocale(LC_NUMERIC, "C");
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
states = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//append default state
|
2008-06-06 11:31:49 -07:00
|
|
|
snprintf(state_name, PATH_MAX,
|
2010-07-29 05:02:36 -07:00
|
|
|
"%s %.2f",
|
|
|
|
rp->part->default_desc->state.name,
|
|
|
|
rp->part->default_desc->state.value);
|
2008-10-22 04:34:42 -07:00
|
|
|
states = eina_list_append(states, eina_stringshare_add(state_name));
|
2008-03-13 12:01:53 -07:00
|
|
|
//printf("NEW STATE def: %s\n", state->state.name);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//append other states
|
2010-08-09 10:34:03 -07:00
|
|
|
for (i = 0; i < rp->part->other.desc_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
snprintf(state_name, sizeof(state_name),
|
2010-07-29 05:02:36 -07:00
|
|
|
"%s %.2f",
|
2010-08-09 10:34:03 -07:00
|
|
|
rp->part->other.desc[i]->state.name,
|
|
|
|
rp->part->other.desc[i]->state.value);
|
2008-10-22 04:34:42 -07:00
|
|
|
states = eina_list_append(states, eina_stringshare_add(state_name));
|
2008-03-13 12:01:53 -07:00
|
|
|
//printf("NEW STATE: %s\n", state_name);
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
return states;
|
|
|
|
}
|
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, double value, const char *new_name, double new_value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2008-05-30 01:00:25 -07:00
|
|
|
int part_id;
|
|
|
|
int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("Set name of state: %s in part: %s [new name: %s]\n",
|
|
|
|
// part, state, new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
if (!new_name) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* update programs */
|
|
|
|
/* update the 'state' field in all programs. update only if program has
|
|
|
|
a single target */
|
2008-05-30 01:00:25 -07:00
|
|
|
part_id = _edje_part_id_find(ed, part);
|
2013-02-13 19:36:13 -08:00
|
|
|
for (i = 0; i < ed->collection->patterns.table_programs_size; i++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-02-13 19:36:13 -08:00
|
|
|
Edje_Program *epr = ed->collection->patterns.table_programs[i];
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
if (eina_list_count(epr->targets) == 1)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Edje_Program_Target *t = eina_list_data_get(epr->targets);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
if (t->id == part_id &&
|
2010-07-29 05:02:36 -07:00
|
|
|
!strcmp(epr->state, pd->state.name) &&
|
|
|
|
pd->state.value == epr->value)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
_edje_if_string_free(ed, epr->state);
|
2008-10-15 07:11:11 -07:00
|
|
|
epr->state = eina_stringshare_add(new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
epr->value = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* set name */
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_if_string_free(ed, pd->state.name);
|
|
|
|
pd->state.name = (char *)eina_stringshare_add(new_name);
|
2008-03-06 11:48:11 -08:00
|
|
|
/* set value */
|
2010-07-29 05:02:36 -07:00
|
|
|
pd->state.value = new_value;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-08-11 09:23:50 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
|
|
|
Edje_Part_Description_Common *pd;
|
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-08-11 09:23:50 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!edje_edit_state_exist(obj, part, state, value))
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
pd = _edje_part_description_find_byname(eed, part, state, value);
|
2010-08-11 09:23:50 -07:00
|
|
|
if (!pd) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 15:51:24 -07:00
|
|
|
/* Don't allow to delete default state, for now at least; */
|
|
|
|
if (pd == rp->part->default_desc)
|
2010-08-11 09:23:50 -07:00
|
|
|
return EINA_FALSE;
|
2010-04-26 15:51:24 -07:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2010-08-03 15:22:31 -07:00
|
|
|
ce = eina_hash_find(ed->file->collection, ed->group);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
for (i = 0; i < rp->part->other.desc_count; ++i)
|
|
|
|
if (pd == rp->part->other.desc[i])
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2010-08-09 10:34:03 -07:00
|
|
|
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--;
|
2010-07-29 05:02:36 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_edje_collection_free_part_description_free(rp->part->type, pd, ce, 0);
|
2010-08-11 09:23:50 -07:00
|
|
|
return EINA_TRUE;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
2010-08-02 05:41:28 -07:00
|
|
|
ce->count.RECTANGLE++;
|
2010-07-29 05:02:36 -07:00
|
|
|
break;
|
2012-06-12 20:21:31 -07:00
|
|
|
case EDJE_PART_TYPE_SPACER:
|
|
|
|
pd = eina_mempool_malloc(ce->mp.SPACER, sizeof (Edje_Part_Description_Common));
|
|
|
|
ce->count.SPACER++;
|
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
|
|
|
pd = eina_mempool_malloc(ce->mp.SWALLOW, sizeof (Edje_Part_Description_Common));
|
2010-08-02 05:41:28 -07:00
|
|
|
ce->count.SWALLOW++;
|
2010-07-29 05:02:36 -07:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
pd = eina_mempool_malloc(ce->mp.GROUP, sizeof (Edje_Part_Description_Common));
|
2010-08-02 05:41:28 -07:00
|
|
|
ce->count.GROUP++;
|
2010-07-29 05:02:36 -07:00
|
|
|
break;
|
|
|
|
|
2010-08-02 05:41:28 -07:00
|
|
|
#define EDIT_ALLOC_POOL(Short, Type, Name) \
|
2010-07-29 05:02:36 -07:00
|
|
|
case EDJE_PART_TYPE_##Short: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_##Type *Name; \
|
|
|
|
\
|
2010-07-30 02:53:20 -07:00
|
|
|
Name = eina_mempool_malloc(ce->mp.Short, \
|
|
|
|
sizeof (Edje_Part_Description_##Type)); \
|
2010-08-11 09:23:40 -07:00
|
|
|
memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \
|
2010-07-29 05:02:36 -07:00
|
|
|
pd = &Name->common; \
|
2010-08-02 05:41:28 -07:00
|
|
|
ce->count.Short++; \
|
2010-07-29 05:02:36 -07:00
|
|
|
break; \
|
|
|
|
}
|
|
|
|
|
2010-07-30 18:21:30 -07:00
|
|
|
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);
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return pd;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-08-11 09:23:50 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *pd;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-11 09:23:50 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (edje_edit_state_exist(obj, part, name, value))
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("ADD STATE: %s TO PART: %s\n", name , part);
|
2010-07-29 05:02:36 -07:00
|
|
|
pd = _edje_edit_state_alloc(rp->part->type, ed);
|
2010-08-11 09:23:50 -07:00
|
|
|
if (!pd) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!rp->part->default_desc)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
|
|
|
rp->part->default_desc = pd;
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
else
|
2009-11-25 09:00:53 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common **tmp;
|
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
tmp = realloc(rp->part->other.desc,
|
|
|
|
sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1));
|
2010-08-03 15:15:02 -07:00
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
free(pd);
|
2010-08-11 09:23:50 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-03 15:15:02 -07:00
|
|
|
}
|
2010-08-09 10:34:03 -07:00
|
|
|
rp->part->other.desc = tmp;
|
|
|
|
rp->part->other.desc[rp->part->other.desc_count++] = pd;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
|
2010-08-09 15:28:53 -07:00
|
|
|
memset(pd, 0, sizeof (*pd));
|
2010-07-30 02:53:20 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
pd->state.name = eina_stringshare_add(name);
|
|
|
|
pd->state.value = value;
|
|
|
|
pd->visible = 1;
|
|
|
|
pd->align.x = 0.5;
|
|
|
|
pd->align.y = 0.5;
|
|
|
|
pd->min.w = 0;
|
|
|
|
pd->min.h = 0;
|
|
|
|
pd->fixed.w = 0;
|
|
|
|
pd->fixed.h = 0;
|
|
|
|
pd->max.w = -1;
|
|
|
|
pd->max.h = -1;
|
|
|
|
pd->rel1.relative_x = 0.0;
|
|
|
|
pd->rel1.relative_y = 0.0;
|
|
|
|
pd->rel1.offset_x = 0;
|
|
|
|
pd->rel1.offset_y = 0;
|
|
|
|
pd->rel1.id_x = -1;
|
|
|
|
pd->rel1.id_y = -1;
|
|
|
|
pd->rel2.relative_x = 1.0;
|
|
|
|
pd->rel2.relative_y = 1.0;
|
|
|
|
pd->rel2.offset_x = -1;
|
|
|
|
pd->rel2.offset_y = -1;
|
|
|
|
pd->rel2.id_x = -1;
|
|
|
|
pd->rel2.id_y = -1;
|
|
|
|
pd->color_class = NULL;
|
|
|
|
pd->color.r = 255;
|
|
|
|
pd->color.g = 255;
|
|
|
|
pd->color.b = 255;
|
|
|
|
pd->color.a = 255;
|
|
|
|
pd->color2.r = 0;
|
|
|
|
pd->color2.g = 0;
|
|
|
|
pd->color2.b = 0;
|
|
|
|
pd->color2.a = 255;
|
2010-07-30 02:53:20 -07:00
|
|
|
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);
|
2013-06-06 02:18:36 -07:00
|
|
|
pd->map.colors = NULL;
|
2013-06-03 22:42:52 -07:00
|
|
|
pd->map.on = EINA_FALSE;
|
|
|
|
pd->map.smooth = EINA_TRUE;
|
|
|
|
pd->map.alpha = EINA_TRUE;
|
|
|
|
pd->map.backcull = EINA_FALSE;
|
|
|
|
pd->map.persp_on = EINA_FALSE;
|
|
|
|
pd->persp.zplane = EINA_FALSE;
|
2010-07-30 02:53:20 -07:00
|
|
|
pd->persp.focal = 1000;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2010-07-30 02:53:20 -07:00
|
|
|
memset(&text->text, 0, sizeof (text->text));
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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;
|
|
|
|
|
2010-07-30 02:53:20 -07:00
|
|
|
memset(&img->image, 0, sizeof (img->image));
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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;
|
|
|
|
}
|
2011-03-13 08:41:12 -07:00
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_PROXY)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Proxy *pro;
|
|
|
|
|
|
|
|
pro = (Edje_Part_Description_Proxy*) pd;
|
|
|
|
|
|
|
|
memset(&pro->proxy, 0, sizeof (pro->proxy));
|
|
|
|
|
|
|
|
pro->proxy.id = -1;
|
2013-05-31 01:35:30 -07:00
|
|
|
pro->proxy.source_visible = EINA_TRUE;
|
2013-05-31 04:08:59 -07:00
|
|
|
pro->proxy.source_clip = EINA_TRUE;
|
2011-03-13 08:41:12 -07:00
|
|
|
pro->proxy.fill.smooth = 1;
|
|
|
|
pro->proxy.fill.pos_rel_x = 0.0;
|
|
|
|
pro->proxy.fill.pos_abs_x = 0;
|
|
|
|
pro->proxy.fill.rel_x = 1.0;
|
|
|
|
pro->proxy.fill.abs_x = 0;
|
|
|
|
pro->proxy.fill.pos_rel_y = 0.0;
|
|
|
|
pro->proxy.fill.pos_abs_y = 0;
|
|
|
|
pro->proxy.fill.rel_y = 1.0;
|
|
|
|
pro->proxy.fill.abs_y = 0;
|
|
|
|
pro->proxy.fill.angle = 0;
|
|
|
|
pro->proxy.fill.spread = 0;
|
|
|
|
pro->proxy.fill.type = EDJE_FILL_TYPE_SCALE;
|
|
|
|
}
|
2010-07-30 02:53:20 -07:00
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Description_External *external;
|
2009-11-25 09:00:53 -08:00
|
|
|
Edje_External_Param_Info *pi;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External*) pd;
|
2010-07-30 02:53:20 -07:00
|
|
|
|
2010-08-11 09:23:40 -07:00
|
|
|
external->external_params = NULL;
|
2010-07-30 02:53:20 -07:00
|
|
|
|
|
|
|
if (rp->part->source)
|
2009-11-25 09:00:53 -08:00
|
|
|
{
|
2010-07-30 02:53:20 -07:00
|
|
|
pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source);
|
|
|
|
while (pi && pi->name)
|
2009-11-25 09:00:53 -08:00
|
|
|
{
|
2010-07-30 02:53:20 -07:00
|
|
|
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++;
|
2009-11-25 09:00:53 -08:00
|
|
|
}
|
2014-02-18 19:18:42 -08:00
|
|
|
if (external->external_params && rp->typedata.swallow)
|
2012-09-11 06:14:51 -07:00
|
|
|
rp->param1.external_params = _edje_external_params_parse(rp->typedata.swallow->swallowed_object, external->external_params);
|
2009-11-25 09:00:53 -08:00
|
|
|
}
|
2010-07-30 02:53:20 -07:00
|
|
|
}
|
|
|
|
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));
|
2009-11-25 09:00:53 -08:00
|
|
|
}
|
2010-08-11 09:23:50 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_exist(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2014-06-04 10:39:32 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_edit_part_state_copy(Evas_Object *obj, const char *part, const char *part_to, const char *from, double val_from, const char *to, double val_to)
|
2009-10-20 23:19:02 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *pdfrom, *pdto;
|
2009-11-17 16:27:49 -08:00
|
|
|
Edje_External_Param *p;
|
2014-06-04 10:39:32 -07:00
|
|
|
Edje_Real_Part *rpto;
|
2010-08-03 05:58:31 -07:00
|
|
|
|
2013-07-16 10:21:28 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2009-10-20 23:19:02 -07:00
|
|
|
|
2010-04-22 10:56:00 -07:00
|
|
|
pdfrom = _edje_part_description_find_byname(eed, part, from, val_from);
|
2009-10-20 23:19:02 -07:00
|
|
|
if (!pdfrom)
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-10-20 23:19:02 -07:00
|
|
|
|
2014-06-04 10:39:32 -07:00
|
|
|
rpto = _edje_real_part_get(ed, part_to);
|
|
|
|
if (!rpto)
|
|
|
|
return EINA_FALSE;
|
|
|
|
pdto = _edje_part_description_find_byname(eed, part_to, to, val_to);
|
2009-10-20 23:19:02 -07:00
|
|
|
if (!pdto)
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common **tmp;
|
|
|
|
|
2014-06-04 10:39:32 -07:00
|
|
|
pdto = _edje_edit_state_alloc(rpto->part->type, ed);
|
2010-07-29 05:02:36 -07:00
|
|
|
if (!pdto) return EINA_FALSE;
|
2009-10-20 23:19:02 -07:00
|
|
|
/* No need to check for default desc, at this point it must exist */
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2014-06-04 10:39:32 -07:00
|
|
|
tmp = realloc(rpto->part->other.desc,
|
|
|
|
sizeof (Edje_Part_Description_Common *) * (rpto->part->other.desc_count + 1));
|
2010-08-03 15:15:02 -07:00
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
free(pdto);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2014-06-04 10:39:32 -07:00
|
|
|
rpto->part->other.desc = tmp;
|
|
|
|
rpto->part->other.desc[rpto->part->other.desc_count++] = pdto;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#define PD_STRING_COPY(To, From, _x) \
|
|
|
|
_edje_if_string_free(ed, To->_x); \
|
|
|
|
To->_x = (char *)eina_stringshare_add(From->_x);
|
|
|
|
|
|
|
|
/* Copy all value */
|
|
|
|
*pdto = *pdfrom;
|
2010-08-06 14:18:58 -07:00
|
|
|
/* Keeping the pdto state name and value */
|
|
|
|
pdto->state.name = eina_stringshare_add(to);
|
|
|
|
pdto->state.value = val_to;
|
2010-07-29 05:02:36 -07:00
|
|
|
/* Update pointer. */
|
|
|
|
PD_STRING_COPY(pdto, pdfrom, color_class);
|
|
|
|
|
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
2011-03-13 08:41:12 -07:00
|
|
|
case EDJE_PART_TYPE_PROXY:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Proxy *pro_to = (Edje_Part_Description_Proxy*) pdto;
|
|
|
|
Edje_Part_Description_Proxy *pro_from = (Edje_Part_Description_Proxy*) pdfrom;
|
|
|
|
|
|
|
|
pro_to->proxy = pro_from->proxy;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
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;
|
2010-08-03 05:58:31 -07:00
|
|
|
unsigned int i;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
img_to->image = img_from->image;
|
|
|
|
|
|
|
|
/* Update pointers. */
|
2010-08-03 05:58:31 -07:00
|
|
|
for (i = 0; i < img_to->image.tweens_count; ++i)
|
|
|
|
free(img_to->image.tweens[i]);
|
2010-08-06 14:21:16 -07:00
|
|
|
if (img_to->image.tweens_count > 0)
|
|
|
|
free(img_to->image.tweens);
|
2010-08-03 05:58:31 -07:00
|
|
|
|
|
|
|
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;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-03 05:58:31 -07:00
|
|
|
for (i = 0; i < img_to->image.tweens_count; ++i)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Image_Id *new_i;
|
|
|
|
new_i = _alloc(sizeof(Edje_Part_Image_Id));
|
2010-08-03 05:58:31 -07:00
|
|
|
if (!new_i) continue ;
|
|
|
|
|
|
|
|
*new_i = *img_from->image.tweens[i];
|
|
|
|
|
|
|
|
img_to->image.tweens[i] = new_i;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2010-08-06 14:16:57 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
|
|
|
text_to->text = text_from->text;
|
|
|
|
|
|
|
|
/* Update pointers. */
|
2010-08-12 05:58:54 -07:00
|
|
|
PD_STRING_COPY(text_to, text_from, text.text.str);
|
2010-07-29 05:02:36 -07:00
|
|
|
PD_STRING_COPY(text_to, text_from, text.text_class);
|
2010-08-12 05:58:54 -07:00
|
|
|
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);
|
2010-08-06 14:16:57 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
|
|
|
box_to->box = box_from->box;
|
|
|
|
|
|
|
|
PD_STRING_COPY(box_to, box_from, box.layout);
|
|
|
|
PD_STRING_COPY(box_to, box_from, box.alt_layout);
|
2010-08-06 14:16:57 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
|
|
|
table_to->table = table_from->table;
|
2010-08-06 14:16:57 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
|
|
|
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;
|
2010-08-03 05:58:31 -07:00
|
|
|
Eina_List *l;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
}
|
2010-08-06 14:16:57 -07:00
|
|
|
break;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2009-11-17 16:27:49 -08:00
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
#undef PD_STRING_COPY
|
2009-10-20 23:19:02 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2009-10-20 23:19:02 -07:00
|
|
|
}
|
|
|
|
|
2014-06-04 10:39:32 -07:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
return _edje_edit_part_state_copy(obj, part, part, from, val_from, to, val_to);
|
|
|
|
}
|
|
|
|
|
2013-10-30 05:54:23 -07:00
|
|
|
#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \
|
|
|
|
EAPI double \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
|
2013-10-30 05:54:23 -07:00
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(0); \
|
|
|
|
return TO_DOUBLE(pd->Sub.relative_##Value); \
|
|
|
|
} \
|
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
|
2013-10-30 05:54:23 -07:00
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
|
|
|
pd->Sub.relative_##Value = FROM_DOUBLE(v); \
|
|
|
|
edje_object_calc_force(obj); \
|
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
FUNC_STATE_RELATIVE_DOUBLE(rel1, x);
|
|
|
|
FUNC_STATE_RELATIVE_DOUBLE(rel1, y);
|
|
|
|
FUNC_STATE_RELATIVE_DOUBLE(rel2, x);
|
|
|
|
FUNC_STATE_RELATIVE_DOUBLE(rel2, y);
|
|
|
|
|
2010-09-01 10:15:52 -07:00
|
|
|
#define FUNC_STATE_OFFSET_INT(Sub, Value) \
|
2013-10-30 05:54:23 -07:00
|
|
|
EAPI int \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
|
2013-10-30 05:54:23 -07:00
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(0); \
|
|
|
|
return pd->Sub.offset_##Value; \
|
|
|
|
} \
|
|
|
|
EAPI Eina_Bool \
|
2014-04-24 19:09:35 -07:00
|
|
|
edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \
|
2013-10-30 05:54:23 -07:00
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2014-04-24 19:09:35 -07:00
|
|
|
pd->Sub.offset_##Value = v; \
|
2013-10-30 05:54:23 -07:00
|
|
|
edje_object_calc_force(obj); \
|
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
FUNC_STATE_OFFSET_INT(rel1, x);
|
|
|
|
FUNC_STATE_OFFSET_INT(rel1, y);
|
|
|
|
FUNC_STATE_OFFSET_INT(rel2, x);
|
|
|
|
FUNC_STATE_OFFSET_INT(rel2, y);
|
|
|
|
|
2013-10-30 05:54:23 -07:00
|
|
|
#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; \
|
2010-07-29 05:02:36 -07:00
|
|
|
rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \
|
2013-10-30 05:54:23 -07:00
|
|
|
if (rel->part->name) return eina_stringshare_add(rel->part->name); \
|
|
|
|
return NULL; \
|
|
|
|
} \
|
|
|
|
EAPI Eina_Bool \
|
|
|
|
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(EINA_FALSE); \
|
|
|
|
if ((to) && (strcmp(to, ""))) \
|
|
|
|
{ \
|
|
|
|
relp = _edje_real_part_get(ed, to); \
|
|
|
|
if (!relp) return EINA_FALSE; \
|
|
|
|
pd->Sub.id_##Value = relp->part->id; \
|
|
|
|
return EINA_TRUE; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
pd->Sub.id_##Value = -1; \
|
2013-12-14 01:26:30 -08:00
|
|
|
return EINA_TRUE; \
|
2013-10-30 05:54:23 -07:00
|
|
|
} \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
|
|
|
|
//_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
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
FUNC_STATE_REL(rel1, x);
|
|
|
|
FUNC_STATE_REL(rel1, y);
|
|
|
|
FUNC_STATE_REL(rel2, x);
|
|
|
|
FUNC_STATE_REL(rel2, y);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
//colors
|
2010-07-29 05:02:36 -07:00
|
|
|
#define FUNC_COLOR(Code) \
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI void \
|
2010-07-29 05:02:36 -07:00
|
|
|
edje_edit_state_##Code##_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a) \
|
2010-07-16 06:58:35 -07:00
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(); \
|
|
|
|
\
|
2010-07-29 05:02:36 -07:00
|
|
|
if (r) *r = pd->Code.r; \
|
|
|
|
if (g) *g = pd->Code.g; \
|
|
|
|
if (b) *b = pd->Code.b; \
|
|
|
|
if (a) *a = pd->Code.a; \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-30 05:49:32 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-29 05:02:36 -07:00
|
|
|
edje_edit_state_##Code##_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) \
|
2010-07-16 06:58:35 -07:00
|
|
|
{ \
|
2013-10-30 05:49:32 -07:00
|
|
|
if ((!obj) || (!part) || (!state)) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2010-07-16 06:58:35 -07:00
|
|
|
\
|
2013-10-30 05:49:32 -07:00
|
|
|
if (r > -1 && r < 256) pd->Code.r = r; \
|
|
|
|
else return EINA_FALSE; \
|
|
|
|
if (g > -1 && g < 256) pd->Code.g = g; \
|
|
|
|
else return EINA_FALSE; \
|
|
|
|
if (b > -1 && b < 256) pd->Code.b = b; \
|
|
|
|
else return EINA_FALSE; \
|
|
|
|
if (a > -1 && a < 256) pd->Code.a = a; \
|
|
|
|
else return EINA_FALSE; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-30 05:49:32 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN();
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text*) pd;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-10-30 05:49:32 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-29 05:02:36 -07:00
|
|
|
edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
2013-10-30 05:49:32 -07:00
|
|
|
if ((!obj) || (!part) || (!state))
|
|
|
|
return EINA_FALSE;
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
2013-10-30 05:49:32 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text*) pd;
|
|
|
|
|
|
|
|
if (r > -1 && r < 256) txt->text.color3.r = r;
|
2013-10-30 05:49:32 -07:00
|
|
|
else return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
if (g > -1 && g < 256) txt->text.color3.g = g;
|
2013-10-30 05:49:32 -07:00
|
|
|
else return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
if (b > -1 && b < 256) txt->text.color3.b = b;
|
2013-10-30 05:49:32 -07:00
|
|
|
else return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
if (a > -1 && a < 256) txt->text.color3.a = a;
|
2013-10-30 05:49:32 -07:00
|
|
|
else return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 05:49:32 -07:00
|
|
|
return EINA_TRUE;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2010-07-16 06:58:35 -07:00
|
|
|
|
|
|
|
#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) \
|
|
|
|
{ \
|
2014-04-24 19:09:35 -07:00
|
|
|
GET_PD_OR_RETURN(0); \
|
2010-07-29 05:02:36 -07:00
|
|
|
return TO_DOUBLE(pd->Class.Value); \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-31 19:17:24 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
|
|
|
|
{ \
|
2013-10-31 19:17:24 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
|
|
|
pd->Class.Value = FROM_DOUBLE(v); \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-31 19:17:24 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
2013-10-30 05:45:00 -07:00
|
|
|
#define FUNC_STATE_INT(Class, Value, Min) \
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI int \
|
|
|
|
edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
|
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(0); \
|
2010-07-29 05:02:36 -07:00
|
|
|
return pd->Class.Value; \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-30 05:45:00 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \
|
|
|
|
{ \
|
2013-10-30 05:45:00 -07:00
|
|
|
if ((!obj) || (!part) || (!state)) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
if (v < Min) return EINA_FALSE; \
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
|
|
|
pd->Class.Value = v; \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-30 05:45:00 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
2013-12-01 21:54:28 -08:00
|
|
|
#define FUNC_STATE_BOOL(Class, Value) \
|
|
|
|
EAPI Eina_Bool \
|
|
|
|
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 Eina_Bool \
|
|
|
|
edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v) \
|
|
|
|
{ \
|
|
|
|
if ((!obj) || (!part) || (!state)) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
|
|
|
pd->Class.Value = v; \
|
|
|
|
edje_object_calc_force(obj); \
|
|
|
|
return EINA_TRUE; \
|
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
FUNC_STATE_DOUBLE(align, x);
|
|
|
|
FUNC_STATE_DOUBLE(align, y);
|
2013-10-30 05:45:00 -07:00
|
|
|
FUNC_STATE_INT(min, w, 0);
|
|
|
|
FUNC_STATE_INT(min, h, 0);
|
|
|
|
FUNC_STATE_INT(max, w, -1);
|
|
|
|
FUNC_STATE_INT(max, h, -1);
|
2013-12-01 21:54:28 -08:00
|
|
|
FUNC_STATE_BOOL(fixed, w);
|
|
|
|
FUNC_STATE_BOOL(fixed, h);
|
2010-07-16 06:58:35 -07:00
|
|
|
FUNC_STATE_DOUBLE(aspect, min);
|
|
|
|
FUNC_STATE_DOUBLE(aspect, max);
|
2014-06-10 08:23:24 -07:00
|
|
|
FUNC_STATE_DOUBLE(minmul, w);
|
|
|
|
FUNC_STATE_DOUBLE(minmul, h);
|
2010-07-16 06:58:35 -07:00
|
|
|
|
2013-12-19 05:48:03 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_fill_smooth_get(Evas_Object *obj, const char *part, const char *state, double value)
|
|
|
|
{
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE)
|
|
|
|
|
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
img = (Edje_Part_Description_Image*) pd;
|
|
|
|
return img->image.fill.smooth;
|
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_PROXY:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Proxy *pro;
|
|
|
|
pro = (Edje_Part_Description_Proxy*) pd;
|
|
|
|
return pro->proxy.fill.smooth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_fill_smooth_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool smooth)
|
|
|
|
{
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE)
|
|
|
|
|
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
img = (Edje_Part_Description_Image*) pd;
|
|
|
|
img->image.fill.smooth = smooth;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_PROXY:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Proxy *pro;
|
|
|
|
pro = (Edje_Part_Description_Proxy*) pd;
|
|
|
|
pro->proxy.fill.smooth = smooth;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
#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) \
|
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(0); \
|
2010-08-09 16:09:24 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
switch (rp->part->type) \
|
|
|
|
{ \
|
|
|
|
case EDJE_PART_TYPE_IMAGE: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Image *img; \
|
|
|
|
\
|
|
|
|
img = (Edje_Part_Description_Image*) pd; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
return TO_DOUBLE(img->image.fill.Class##rel_##Value); \
|
|
|
|
} \
|
|
|
|
case EDJE_PART_TYPE_PROXY: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Proxy *pro; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
pro = (Edje_Part_Description_Proxy*) pd; \
|
|
|
|
\
|
|
|
|
return TO_DOUBLE(pro->proxy.fill.Class##rel_##Value); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
return 0; \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-31 19:17:24 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_fill_##Type##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
|
|
|
|
{ \
|
2013-10-31 19:17:24 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2010-08-09 16:09:24 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
switch (rp->part->type) \
|
|
|
|
{ \
|
|
|
|
case EDJE_PART_TYPE_IMAGE: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Image *img; \
|
|
|
|
\
|
|
|
|
img = (Edje_Part_Description_Image*) pd; \
|
|
|
|
\
|
|
|
|
img->image.fill.Class##rel_##Value = FROM_DOUBLE(v); \
|
|
|
|
\
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
case EDJE_PART_TYPE_PROXY: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Proxy *pro; \
|
|
|
|
\
|
|
|
|
pro = (Edje_Part_Description_Proxy*) pd; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
pro->proxy.fill.Class##rel_##Value = FROM_DOUBLE(v); \
|
|
|
|
\
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
default: \
|
2013-10-31 19:17:24 -07:00
|
|
|
return EINA_FALSE; \
|
2011-03-13 08:41:12 -07:00
|
|
|
} \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-31 19:17:24 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#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) \
|
|
|
|
{ \
|
|
|
|
GET_PD_OR_RETURN(0); \
|
2010-08-09 16:09:24 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
switch (rp->part->type) \
|
|
|
|
{ \
|
|
|
|
case EDJE_PART_TYPE_IMAGE: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Image *img; \
|
|
|
|
\
|
|
|
|
img = (Edje_Part_Description_Image*) pd; \
|
|
|
|
\
|
|
|
|
return img->image.fill.Class##abs_##Value; \
|
|
|
|
} \
|
|
|
|
case EDJE_PART_TYPE_PROXY: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Proxy *pro; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
pro = (Edje_Part_Description_Proxy*) pd; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
return pro->proxy.fill.Class##abs_##Value; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
return 0; \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-31 19:17:24 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_fill_##Type##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
|
|
|
|
{ \
|
2013-10-31 19:17:24 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2010-08-09 16:09:24 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
switch (rp->part->type) \
|
|
|
|
{ \
|
|
|
|
case EDJE_PART_TYPE_IMAGE: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Image *img; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2011-03-13 08:41:12 -07:00
|
|
|
img = (Edje_Part_Description_Image*) pd; \
|
|
|
|
\
|
|
|
|
img->image.fill.Class##abs_##Value = FROM_DOUBLE(v); \
|
2013-10-31 19:17:24 -07:00
|
|
|
break; \
|
2011-03-13 08:41:12 -07:00
|
|
|
} \
|
|
|
|
case EDJE_PART_TYPE_PROXY: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_Proxy *pro; \
|
|
|
|
\
|
|
|
|
pro = (Edje_Part_Description_Proxy*) pd; \
|
|
|
|
\
|
|
|
|
pro->proxy.fill.Class##abs_##Value = FROM_DOUBLE(v); \
|
2013-10-31 19:17:24 -07:00
|
|
|
break; \
|
2011-03-13 08:41:12 -07:00
|
|
|
} \
|
|
|
|
default: \
|
2013-10-31 19:17:24 -07:00
|
|
|
return EINA_FALSE; \
|
2011-03-13 08:41:12 -07:00
|
|
|
} \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-31 19:17:24 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2010-09-01 10:15:52 -07:00
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
//printf("Get state visible flag of part: %s state: %s\n", part, state);
|
2010-07-29 05:02:36 -07:00
|
|
|
return pd->visible;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-31 19:01:37 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool visible)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-10-31 19:01:37 -07:00
|
|
|
if ((!obj) || (!part) || (!state))
|
|
|
|
return EINA_FALSE;
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (visible) pd->visible = 1;
|
|
|
|
else pd->visible = 0;
|
2013-10-31 19:01:37 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-31 19:01:37 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI unsigned char
|
|
|
|
edje_edit_state_aspect_pref_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(0);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
//printf("GET ASPECT_PREF of state '%s' [%d]\n", state, pd->aspect.prefer);
|
2010-07-29 05:02:36 -07:00
|
|
|
return pd->aspect.prefer;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-31 19:17:24 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char pref)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-10-31 19:17:24 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
if ((!pref) || (pref > 3)) return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
pd->aspect.prefer = pref;
|
2013-10-31 19:17:24 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI const char*
|
|
|
|
edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
//printf("Get ColorClass of part: %s state: %s\n", part, state);
|
2010-07-29 05:02:36 -07:00
|
|
|
return eina_stringshare_add(pd->color_class);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-31 19:01:37 -07:00
|
|
|
EAPI Eina_Bool
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *color_class)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-12-18 22:42:23 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Color_Class *cc;
|
2013-10-31 19:01:37 -07:00
|
|
|
|
2013-12-18 22:42:23 -08:00
|
|
|
if ((!obj) || (!part) || (!state)) return EINA_FALSE;
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2013-10-31 19:01:37 -07:00
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!color_class)
|
|
|
|
{
|
|
|
|
pd->color_class = NULL;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-12-18 22:42:23 -08:00
|
|
|
if (!ed->file->color_classes) return EINA_FALSE;
|
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
{
|
|
|
|
if (strcmp(cc->name, color_class) == 0)
|
|
|
|
{
|
|
|
|
pd->color.r = cc->r;
|
|
|
|
pd->color.g = cc->g;
|
|
|
|
pd->color.b = cc->b;
|
|
|
|
pd->color.a = cc->a;
|
|
|
|
pd->color2.r = cc->r2;
|
|
|
|
pd->color2.g = cc->g2;
|
|
|
|
pd->color2.b = cc->b2;
|
|
|
|
pd->color2.a = cc->a2;
|
|
|
|
if ((rp->type == EDJE_PART_TYPE_TEXT) || (rp->type == EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt = (Edje_Part_Description_Text *)pd;
|
|
|
|
txt->text.color3.r = cc->r3;
|
|
|
|
txt->text.color3.g = cc->g3;
|
|
|
|
txt->text.color3.b = cc->b3;
|
|
|
|
txt->text.color3.a = cc->a3;
|
|
|
|
}
|
|
|
|
pd->color_class = (char *)eina_stringshare_add(color_class);
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pd->color_class = NULL;
|
|
|
|
return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI const Eina_List *
|
|
|
|
edje_edit_state_external_params_list_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(NULL);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
return NULL;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
return external->external_params;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
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)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
2010-07-16 06:58:35 -07:00
|
|
|
Edje_External_Param *p;
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2010-07-16 06:58:35 -07:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
|
|
|
if (type) *type = p->type;
|
|
|
|
if (val)
|
|
|
|
switch (p->type)
|
|
|
|
{
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
|
|
|
*val = &p->i;
|
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
|
|
|
*val = &p->d;
|
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
|
|
|
*val = (void *)p->s;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("unknown external parameter type '%d'", p->type);
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
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)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
2010-07-16 06:58:35 -07:00
|
|
|
Edje_External_Param *p;
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2009-11-17 16:27:49 -08:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
if (val) *val = 0;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2009-11-17 16:27:49 -08:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
|
|
|
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_INT)
|
|
|
|
return EINA_FALSE;
|
2010-04-07 10:04:49 -07:00
|
|
|
if (val)
|
|
|
|
*val = p->i;
|
2009-11-17 16:27:49 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-03-31 20:48:07 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool *val)
|
2010-03-31 20:48:07 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
2010-03-31 20:48:07 -07:00
|
|
|
Edje_External_Param *p;
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2010-03-31 20:48:07 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
if (val) *val = 0;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2010-03-31 20:48:07 -07:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
2010-04-08 12:21:54 -07:00
|
|
|
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
2010-03-31 20:48:07 -07:00
|
|
|
return EINA_FALSE;
|
2010-04-07 10:04:49 -07:00
|
|
|
if (val)
|
|
|
|
*val = p->i;
|
2010-03-31 20:48:07 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double *val)
|
2009-11-17 16:27:49 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
2009-11-17 16:27:49 -08:00
|
|
|
Edje_External_Param *p;
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
if (val) *val = 0;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2009-11-17 16:27:49 -08:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
|
|
|
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
|
|
|
|
return EINA_FALSE;
|
2010-04-07 10:04:49 -07:00
|
|
|
if (val)
|
|
|
|
*val = p->d;
|
2009-11-17 16:27:49 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_string_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val)
|
2009-11-17 16:27:49 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
2009-11-17 16:27:49 -08:00
|
|
|
Edje_External_Param *p;
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
if (val) *val = NULL;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2009-11-17 16:27:49 -08:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
|
|
|
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
|
|
|
return EINA_FALSE;
|
2010-04-07 10:04:49 -07:00
|
|
|
if (val)
|
|
|
|
*val = p->s;
|
2009-11-17 16:27:49 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-03-29 14:51:40 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char **val)
|
2010-03-29 14:51:40 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
2010-03-29 14:51:40 -07:00
|
|
|
Edje_External_Param *p;
|
2010-07-29 05:02:36 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
2010-03-29 14:51:40 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
if (val) *val = NULL;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2010-03-29 14:51:40 -07:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
|
|
|
if (p->type != EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
|
|
|
|
return EINA_FALSE;
|
2010-04-07 10:04:49 -07:00
|
|
|
if (val)
|
|
|
|
*val = p->s;
|
2010-03-29 14:51:40 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
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, ...)
|
2009-11-17 16:27:49 -08:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
Eina_List *l;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_External *external;
|
|
|
|
Edje_External_Param *p = NULL, old_p = { 0, 0, 0, 0, 0 };
|
2009-11-17 16:27:49 -08:00
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
return EINA_FALSE;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2014-03-12 18:26:20 -07:00
|
|
|
if (!param)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
external = (Edje_Part_Description_External *) pd;
|
2009-11-27 09:57:35 -08:00
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
va_start(ap, type);
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
EINA_LIST_FOREACH(external->external_params, l, p)
|
2009-11-17 16:27:49 -08:00
|
|
|
if (!strcmp(p->name, param))
|
|
|
|
{
|
|
|
|
found = 1;
|
2010-06-18 15:07:54 -07:00
|
|
|
old_p = *p;
|
2009-11-17 16:27:49 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
{
|
|
|
|
p = _alloc(sizeof(Edje_External_Param));
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
va_end(ap);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
p->name = eina_stringshare_add(param);
|
|
|
|
}
|
|
|
|
|
|
|
|
p->type = type;
|
|
|
|
p->i = 0;
|
|
|
|
p->d = 0;
|
|
|
|
_edje_if_string_free(ed, p->s);
|
|
|
|
p->s = NULL;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
2009-12-21 08:39:24 -08:00
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
2009-11-17 16:27:49 -08:00
|
|
|
p->i = (int)va_arg(ap, int);
|
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
|
|
|
p->d = (double)va_arg(ap, double);
|
|
|
|
break;
|
2010-03-29 14:51:40 -07:00
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
2009-11-17 16:27:49 -08:00
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
|
|
|
p->s = eina_stringshare_add((const char *)va_arg(ap, char *));
|
|
|
|
break;
|
2009-12-21 08:39:24 -08:00
|
|
|
default:
|
2010-03-25 11:05:42 -07:00
|
|
|
ERR("unknown external parameter type '%d'", type);
|
2010-06-18 15:07:54 -07:00
|
|
|
va_end(ap);
|
|
|
|
if (!found) free(p);
|
|
|
|
else *p = old_p;
|
|
|
|
return EINA_FALSE;
|
2009-11-17 16:27:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
|
2010-06-18 15:07:54 -07:00
|
|
|
//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);
|
|
|
|
}
|
|
|
|
|
2014-03-06 22:01:36 -08:00
|
|
|
if (!found)
|
|
|
|
{
|
2014-03-12 18:29:27 -07:00
|
|
|
external->external_params = eina_list_append(external->external_params, p);
|
2014-03-06 22:01:36 -08:00
|
|
|
}
|
2009-11-17 16:27:49 -08:00
|
|
|
|
2014-03-06 01:26:51 -08:00
|
|
|
if (rp->typedata.swallow && rp->param1.external_params)
|
2014-03-06 22:01:36 -08:00
|
|
|
_edje_external_parsed_params_free(rp->typedata.swallow->swallowed_object,
|
|
|
|
rp->param1.external_params);
|
2014-03-06 01:26:51 -08:00
|
|
|
if (rp->typedata.swallow && external->external_params)
|
|
|
|
rp->param1.external_params = \
|
2014-03-06 22:01:36 -08:00
|
|
|
_edje_external_params_parse(rp->typedata.swallow->swallowed_object,
|
|
|
|
external->external_params);
|
2009-11-27 09:57:35 -08:00
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_int_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, int val)
|
2009-11-17 16:27:49 -08:00
|
|
|
{
|
2010-04-07 10:04:49 -07:00
|
|
|
return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_INT, val);
|
2009-11-17 16:27:49 -08:00
|
|
|
}
|
|
|
|
|
2010-03-31 20:48:07 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_bool_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, Eina_Bool val)
|
2010-03-31 20:48:07 -07:00
|
|
|
{
|
2010-04-07 10:04:49 -07:00
|
|
|
return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_BOOL, (int)val);
|
2010-03-31 20:48:07 -07:00
|
|
|
}
|
|
|
|
|
2009-11-17 16:27:49 -08:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_double_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, double val)
|
2009-11-17 16:27:49 -08:00
|
|
|
{
|
2010-04-07 10:04:49 -07:00
|
|
|
return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_DOUBLE, val);
|
2009-11-17 16:27:49 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_string_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val)
|
2009-11-17 16:27:49 -08:00
|
|
|
{
|
2010-04-07 10:04:49 -07:00
|
|
|
return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_STRING, val);
|
2009-11-17 16:27:49 -08:00
|
|
|
}
|
|
|
|
|
2010-03-29 14:51:40 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_external_param_choice_set(Evas_Object *obj, const char *part, const char *state, double value, const char *param, const char *val)
|
2010-03-29 14:51:40 -07:00
|
|
|
{
|
2010-04-07 10:04:49 -07:00
|
|
|
return edje_edit_state_external_param_set(obj, part, state, value, param, EDJE_EXTERNAL_PARAM_TYPE_CHOICE, val);
|
2010-03-29 14:51:40 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/**************/
|
|
|
|
/* TEXT API */
|
|
|
|
/**************/
|
|
|
|
|
2008-03-13 09:01:35 -07:00
|
|
|
EAPI const char *
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_text_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_PD_OR_RETURN(NULL);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return NULL;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
return eina_stringshare_add(edje_string_get(&txt->text.text));
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 19:04:11 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
2014-06-10 08:19:40 -07:00
|
|
|
|
|
|
|
if (!text)
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
_edje_if_string_free(ed, txt->text.text.str);
|
|
|
|
txt->text.text.str = (char *)eina_stringshare_add(text);
|
|
|
|
txt->text.text.id = 0;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_text_size_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_PD_OR_RETURN(-1);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return -1;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
2013-10-30 19:04:11 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
return txt->text.size;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 19:04:11 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, double value, int size)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
2013-10-30 19:04:11 -07:00
|
|
|
if (size < 0) return EINA_FALSE;
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
|
|
|
|
|
|
|
txt->text.size = size;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 19:04:11 -07:00
|
|
|
#define FUNC_TEXT_DOUBLE(Name, Value, Min) \
|
2010-07-16 06:58:35 -07:00
|
|
|
EAPI double \
|
|
|
|
edje_edit_state_text_##Name##_get(Evas_Object *obj, const char *part, const char *state, double value) \
|
|
|
|
{ \
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt; \
|
|
|
|
\
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(0); \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
|
|
|
|
return 0; \
|
|
|
|
\
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd; \
|
|
|
|
return TO_DOUBLE(txt->text.Value); \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-30 19:04:11 -07:00
|
|
|
EAPI Eina_Bool \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_edit_state_text_##Name##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
|
|
|
|
{ \
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt; \
|
2013-10-30 19:04:11 -07:00
|
|
|
if ((!obj) || (!part) || (!state)) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
if ((v < Min) || (v > 1.0)) \
|
|
|
|
return EINA_FALSE; \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2013-10-30 19:04:11 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2010-07-29 05:02:36 -07:00
|
|
|
\
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_FALSE; \
|
2010-08-09 16:09:24 -07:00
|
|
|
\
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd; \
|
|
|
|
txt->text.Value = FROM_DOUBLE(v); \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_TRUE; \
|
|
|
|
}
|
2010-07-16 06:58:35 -07:00
|
|
|
|
2013-10-30 19:04:11 -07:00
|
|
|
FUNC_TEXT_DOUBLE(align_x, align.x, -1.0);
|
|
|
|
FUNC_TEXT_DOUBLE(align_y, align.y, 0.0);
|
2014-05-13 13:20:41 -07:00
|
|
|
FUNC_TEXT_DOUBLE(elipsis, ellipsis, -1.0);
|
2010-07-16 06:58:35 -07:00
|
|
|
|
2013-09-25 00:18:05 -07:00
|
|
|
#define FUNC_TEXT_BOOL(Name, Type) \
|
|
|
|
EAPI Eina_Bool \
|
|
|
|
edje_edit_state_text_##Name##_##Type##_get(Evas_Object *obj, const char *part, const char *state, double value) \
|
2010-07-16 06:58:35 -07:00
|
|
|
{ \
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt; \
|
|
|
|
\
|
2010-07-16 06:58:35 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2013-09-25 00:18:05 -07:00
|
|
|
\
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
|
|
|
|
return EINA_FALSE; \
|
2013-09-25 00:18:05 -07:00
|
|
|
\
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd; \
|
2013-09-25 00:18:05 -07:00
|
|
|
return txt->text.Name##_##Type; \
|
2010-07-16 06:58:35 -07:00
|
|
|
} \
|
2013-10-30 19:04:11 -07:00
|
|
|
EAPI Eina_Bool \
|
2013-09-25 00:18:05 -07:00
|
|
|
edje_edit_state_text_##Name##_##Type##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v) \
|
2010-07-16 06:58:35 -07:00
|
|
|
{ \
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt; \
|
2013-10-30 19:04:11 -07:00
|
|
|
if ((!obj) || (!part) || (!state)) \
|
|
|
|
return EINA_FALSE; \
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE); \
|
2013-09-25 00:18:05 -07:00
|
|
|
\
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_FALSE; \
|
2013-09-25 00:18:05 -07:00
|
|
|
\
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text *) pd; \
|
2013-09-25 00:18:05 -07:00
|
|
|
txt->text.Name##_##Type = v ? 1 : 0; \
|
2010-07-16 06:58:35 -07:00
|
|
|
edje_object_calc_force(obj); \
|
2013-10-30 19:04:11 -07:00
|
|
|
return EINA_TRUE; \
|
2010-07-16 06:58:35 -07:00
|
|
|
}
|
|
|
|
|
2013-09-25 00:18:05 -07:00
|
|
|
FUNC_TEXT_BOOL(fit, x);
|
|
|
|
FUNC_TEXT_BOOL(fit, y);
|
|
|
|
FUNC_TEXT_BOOL(min, x);
|
|
|
|
FUNC_TEXT_BOOL(min, y);
|
|
|
|
FUNC_TEXT_BOOL(max, x);
|
|
|
|
FUNC_TEXT_BOOL(max, y);
|
2008-10-07 09:01:56 -07:00
|
|
|
|
2013-12-18 22:29:51 -08:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *state, double value)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
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(txt->text.style.str);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!style) 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;
|
|
|
|
txt->text.style.str = eina_stringshare_add(style);
|
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_fonts_list_get(Evas_Object *obj)
|
|
|
|
{
|
2010-08-10 07:25:10 -07:00
|
|
|
Eina_Iterator *it;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *fonts = NULL;
|
2010-08-10 07:25:10 -07:00
|
|
|
Edje_Font_Directory_Entry *f;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2010-08-10 07:25:10 -07:00
|
|
|
if (!ed->file || !ed->file->fonts) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-10 07:25:10 -07:00
|
|
|
it = eina_hash_iterator_data_new(ed->file->fonts);
|
|
|
|
if (!it) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-10 07:25:10 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, f)
|
2010-08-24 07:36:07 -07:00
|
|
|
fonts = eina_list_append(fonts, eina_stringshare_add(f->entry));
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-10 07:25:10 -07:00
|
|
|
eina_iterator_free(it);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
return fonts;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-26 11:19:46 -07:00
|
|
|
edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-04-26 11:19:46 -07:00
|
|
|
char entry[PATH_MAX];
|
2010-08-13 13:07:12 -07:00
|
|
|
char *new_path;
|
2008-03-06 11:48:11 -08:00
|
|
|
struct stat st;
|
2010-04-26 11:19:46 -07:00
|
|
|
Edje_Font_Directory_Entry *fnt;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("ADD FONT: %s", path);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
if (!path) return EINA_FALSE;
|
|
|
|
if (stat(path, &st) || !S_ISREG(st.st_mode)) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
/* Alias */
|
2010-08-13 13:07:12 -07:00
|
|
|
if (alias)
|
|
|
|
{
|
|
|
|
if ((new_path = strrchr(path, '/'))) new_path ++;
|
|
|
|
else new_path = (char *)path;
|
|
|
|
}
|
|
|
|
else
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-04-26 11:19:46 -07:00
|
|
|
if ((alias = strrchr(path, '/'))) alias ++;
|
|
|
|
else alias = (char *)path;
|
2010-08-13 13:07:12 -07:00
|
|
|
new_path = (char *)alias;
|
2010-04-26 11:19:46 -07:00
|
|
|
}
|
2010-08-11 07:24:03 -07:00
|
|
|
snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-13 13:07:12 -07:00
|
|
|
/* Initializing a new font hash, if no exist */
|
|
|
|
if (!ed->file->fonts)
|
|
|
|
{
|
|
|
|
ed->file->fonts = eina_hash_string_small_new(NULL);
|
|
|
|
if (!ed->file->fonts) return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
/* Check if exists */
|
2010-06-28 06:56:30 -07:00
|
|
|
fnt = eina_hash_find(ed->file->fonts, alias);
|
2010-04-26 11:19:46 -07:00
|
|
|
if (fnt)
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
/* Create Edje_Font_Directory_Entry */
|
|
|
|
fnt = _alloc(sizeof(Edje_Font_Directory_Entry));
|
|
|
|
if (!fnt)
|
|
|
|
{
|
|
|
|
ERR("Unable to alloc font entry part \"%s\"", alias);
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2010-08-13 13:07:12 -07:00
|
|
|
fnt->file = eina_stringshare_add(new_path);
|
2010-06-28 06:56:30 -07:00
|
|
|
fnt->entry = eina_stringshare_add(alias);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);
|
2010-04-26 11:19:46 -07:00
|
|
|
|
|
|
|
/* Import font */
|
2014-06-12 09:46:30 -07:00
|
|
|
if (!_edje_edit_file_import(ed, path, entry, 1))
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-06-28 06:56:30 -07:00
|
|
|
eina_hash_del(ed->file->fonts, fnt->entry, fnt);
|
2010-08-24 07:36:29 -07:00
|
|
|
eina_stringshare_del(fnt->file);
|
|
|
|
eina_stringshare_del(fnt->entry);
|
2010-04-26 11:19:46 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2010-04-26 11:19:46 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-04-26 11:19:49 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_font_del(Evas_Object *obj, const char* alias)
|
|
|
|
{
|
|
|
|
Edje_Font_Directory_Entry *fnt;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("DEL FONT: %s", alias);
|
2010-04-26 11:19:49 -07:00
|
|
|
|
|
|
|
if (!alias) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
fnt = eina_hash_find(ed->file->fonts, alias);
|
2010-04-26 11:19:49 -07:00
|
|
|
if (!fnt)
|
|
|
|
{
|
|
|
|
WRN("Unable to find font entry part \"%s\"", alias);
|
2010-08-24 07:35:37 -07:00
|
|
|
return EINA_FALSE;
|
2010-04-26 11:19:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Erase font to edje file */
|
|
|
|
{
|
|
|
|
char entry[PATH_MAX];
|
|
|
|
Eet_File *eetf;
|
|
|
|
|
|
|
|
/* open the eet file */
|
|
|
|
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
|
|
|
{
|
|
|
|
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-08-11 09:23:45 -07:00
|
|
|
snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
|
2010-04-26 11:19:49 -07:00
|
|
|
|
|
|
|
if (eet_delete(eetf, entry) <= 0)
|
|
|
|
{
|
|
|
|
ERR("Unable to delete \"%s\" font entry", entry);
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write the edje_file */
|
2010-04-29 11:52:55 -07:00
|
|
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
2010-04-26 11:19:49 -07:00
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
eet_close(eetf);
|
|
|
|
}
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
eina_hash_del(ed->file->fonts, alias, fnt);
|
2010-04-26 11:19:49 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-11-22 14:07:41 -08:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_font_path_get(Evas_Object *obj, const char *alias)
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_Font_Directory_Entry *f;
|
|
|
|
const char *str = NULL;
|
|
|
|
|
|
|
|
if (!alias) return NULL;
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (!ed->file || !ed->file->fonts) return NULL;
|
|
|
|
|
|
|
|
it = eina_hash_iterator_data_new(ed->file->fonts);
|
|
|
|
if (!it) return NULL;
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, f)
|
|
|
|
if (!strcmp(f->entry, alias))
|
|
|
|
{
|
|
|
|
str = f->file;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_iterator_free(it);
|
|
|
|
return eina_stringshare_add(str);
|
|
|
|
}
|
|
|
|
|
2008-03-13 12:08:14 -07:00
|
|
|
EAPI const char *
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_PD_OR_RETURN(NULL);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return NULL;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text*) pd;
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
return eina_stringshare_add(edje_string_get(&txt->text.font));
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 19:05:42 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
2013-10-30 19:05:42 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
2013-10-30 19:05:42 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
txt = (Edje_Part_Description_Text*) pd;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
_edje_if_string_free(ed, txt->text.font.str);
|
|
|
|
txt->text.font.str = (char *)eina_stringshare_add(font);
|
|
|
|
txt->text.font.id = 0;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 19:05:42 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Edje_Text_Effect
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_part_effect_get(Evas_Object *obj, const char *part)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_RP_OR_RETURN(0);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("GET EFFECT of part: %s\n", part);
|
2008-03-06 11:48:11 -08:00
|
|
|
return rp->part->effect;
|
|
|
|
}
|
|
|
|
|
2013-10-30 19:05:42 -07:00
|
|
|
EAPI Eina_Bool
|
2009-09-15 20:37:28 -07:00
|
|
|
edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2013-10-30 19:05:42 -07:00
|
|
|
if ((!obj) || (!part)) return EINA_FALSE;
|
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-10-30 19:05:42 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
rp->part->effect = effect;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 19:05:42 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-10 08:21:10 -07:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_state_text_text_source_get(Evas_Object *obj, const char *part, const char *state, double value)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rel;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
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.id_text_source == -1) return NULL;
|
|
|
|
rel = ed->table_parts[txt->text.id_text_source % ed->table_parts_size];
|
|
|
|
if (rel->part->name) return eina_stringshare_add(rel->part->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *spd;
|
|
|
|
Edje_Part_Description_Text *txt, *source_txt;
|
|
|
|
const char *text_source;
|
|
|
|
int id_text_source;
|
|
|
|
|
|
|
|
if (!source) return EINA_FALSE;
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
spd = _edje_part_description_find_byname(eed, source, state, value);
|
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
|
|
|
source_txt = (Edje_Part_Description_Text *) spd;
|
|
|
|
|
|
|
|
id_text_source = _edje_part_id_find(ed, source);
|
|
|
|
txt->text.id_text_source = id_text_source;
|
|
|
|
|
|
|
|
text_source = source_txt->text.text.str;
|
|
|
|
_edje_if_string_free(ed, txt->text.text.str);
|
|
|
|
txt->text.text.str = eina_stringshare_add(text_source);
|
|
|
|
txt->text.text.id = 0;
|
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-12-18 22:33:53 -08:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *state, double value)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rel;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
|
|
|
|
(rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
{
|
2014-06-09 11:54:34 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
|
|
|
if (txt->text.id_source == -1) return NULL;
|
|
|
|
rel = ed->table_parts[txt->text.id_source % ed->table_parts_size];
|
2013-12-18 22:33:53 -08:00
|
|
|
if (rel->part->name) return eina_stringshare_add(rel->part->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source)
|
|
|
|
{
|
2014-06-09 11:54:34 -07:00
|
|
|
Edje_Part_Description_Common *spd;
|
|
|
|
Edje_Part_Description_Text *txt, *source_style;
|
|
|
|
const char *style_source;
|
|
|
|
int id_source;
|
|
|
|
|
2013-12-18 22:33:53 -08:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
|
|
|
if (!source) return EINA_FALSE;
|
|
|
|
|
2014-06-09 11:54:34 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
2013-12-18 22:33:53 -08:00
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2014-06-09 11:54:34 -07:00
|
|
|
spd = _edje_part_description_find_byname(eed, source, state, value);
|
2013-12-18 22:33:53 -08:00
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
2014-06-09 11:54:34 -07:00
|
|
|
source_style = (Edje_Part_Description_Text *) spd;
|
|
|
|
|
|
|
|
id_source = _edje_part_id_find(ed, source);
|
|
|
|
txt->text.id_source = id_source;
|
|
|
|
|
|
|
|
style_source = source_style->text.text.str;
|
|
|
|
_edje_if_string_free(ed, txt->text.text.str);
|
|
|
|
txt->text.text.str = eina_stringshare_add(style_source);
|
|
|
|
txt->text.text.id = 0;
|
2013-12-18 22:33:53 -08:00
|
|
|
|
|
|
|
/* need to recalc, because the source part can has a text */
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
return EINA_TRUE;
|
2014-06-10 08:12:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const char*
|
|
|
|
edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *state, double value)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
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(txt->text.text_class);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text_class)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
if (!text_class) return EINA_FALSE;
|
|
|
|
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;
|
|
|
|
|
|
|
|
txt->text.text_class = (char *) eina_stringshare_add(text_class);
|
|
|
|
return EINA_TRUE;
|
2013-12-18 22:33:53 -08:00
|
|
|
}
|
2014-06-09 11:54:34 -07:00
|
|
|
|
2014-06-11 17:15:21 -07:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_state_text_repch_get(Evas_Object *obj, const char *part, const char *state, double value)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
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.repch));
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_repch_set(Evas_Object *obj, const char *part, const char *state, double value, const char *repch)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
|
|
|
if (!repch) return EINA_FALSE;
|
|
|
|
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;
|
|
|
|
_edje_if_string_free(ed, txt->text.repch.str);
|
|
|
|
txt->text.repch.str = eina_stringshare_add(repch);
|
|
|
|
txt->text.repch.id = 0;
|
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-11 17:20:57 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_size_range_min_max_get(Evas_Object *obj, const char *part, const char *state, double value, int *min, int *max)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
if (min) *min = txt->text.size_range_min;
|
|
|
|
if (max) *max = txt->text.size_range_max;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_state_text_size_range_min_max_set(Evas_Object *obj, const char *part, const char *state, double value, int min, int max)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
txt->text.size_range_min = min;
|
|
|
|
txt->text.size_range_max = max;
|
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/****************/
|
|
|
|
/* IMAGES API */
|
|
|
|
/****************/
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_images_list_get(Evas_Object *obj)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *images = NULL;
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!ed->file) return NULL;
|
|
|
|
if (!ed->file->image_dir) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("GET IMAGES LIST for %s\n", ed->file->path);
|
2010-06-29 06:48:03 -07:00
|
|
|
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));
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
return images;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_image_add(Evas_Object *obj, const char* path)
|
|
|
|
{
|
|
|
|
Edje_Image_Directory_Entry *de;
|
2010-06-29 06:48:03 -07:00
|
|
|
unsigned int i;
|
|
|
|
int free_id = -1;
|
2008-03-06 11:48:11 -08:00
|
|
|
char *name;
|
|
|
|
|
2010-04-26 11:19:39 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-04-26 11:19:39 -07:00
|
|
|
if (!path) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Create Image_Directory if not exist */
|
|
|
|
if (!ed->file->image_dir)
|
2009-08-17 06:54:17 -07:00
|
|
|
{
|
|
|
|
ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory));
|
2010-04-26 11:19:39 -07:00
|
|
|
if (!ed->file->image_dir) return EINA_FALSE;
|
2009-08-17 06:54:17 -07:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 11:19:39 -07:00
|
|
|
/* Image name */
|
|
|
|
if ((name = strrchr(path, '/'))) name++;
|
|
|
|
else name = (char *)path;
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Loop trough image directory to find if image exist */
|
2010-06-29 06:48:03 -07:00
|
|
|
for (i = 0; i < ed->file->image_dir->entries_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
de = ed->file->image_dir->entries + i;
|
|
|
|
|
|
|
|
if (!de->entry)
|
|
|
|
free_id = i;
|
|
|
|
else if (!strcmp(name, de->entry))
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
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);
|
2008-03-06 11:48:11 -08:00
|
|
|
de->id = free_id;
|
|
|
|
de->source_type = 1;
|
|
|
|
de->source_param = 1;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-26 11:19:39 -07:00
|
|
|
/* Import image */
|
|
|
|
if (!_edje_import_image_file(ed, path, free_id))
|
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
eina_stringshare_del(de->entry);
|
|
|
|
de->entry = NULL;
|
2010-04-26 11:19:39 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-12-18 22:47:25 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name)
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
|
|
|
Edje_Part *part;
|
|
|
|
Edje_Part_Description_Image *part_desc_image;
|
|
|
|
unsigned int i, j, k;
|
|
|
|
int image_id, new_image_id;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
image_id = edje_edit_image_id_get(obj, name);
|
|
|
|
new_image_id = edje_edit_image_id_get(obj, new_name);
|
|
|
|
if ((image_id < 0) || (new_image_id < 0))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
it = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, pce)
|
|
|
|
{
|
|
|
|
for (i = 0; i < pce->ref->parts_count; i++)
|
|
|
|
{
|
|
|
|
part = pce->ref->parts[i];
|
|
|
|
if (part->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->default_desc;
|
|
|
|
if (part_desc_image->image.id == image_id)
|
|
|
|
part_desc_image->image.id = new_image_id;
|
|
|
|
for (k = 0; k < part_desc_image->image.tweens_count; k++)
|
|
|
|
if (part_desc_image->image.tweens[k]->id == image_id)
|
|
|
|
part_desc_image->image.id = new_image_id;
|
|
|
|
for (j = 0; j < part->other.desc_count; j++)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j];
|
|
|
|
if (part_desc_image->image.id == image_id)
|
|
|
|
part_desc_image->image.id = new_image_id;
|
|
|
|
for (k = 0; k < part_desc_image->image.tweens_count; k++)
|
|
|
|
if (part_desc_image->image.tweens[k]->id == image_id)
|
|
|
|
part_desc_image->image.id = new_image_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_List*
|
|
|
|
edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool first_only)
|
|
|
|
{
|
|
|
|
Eina_List *result = NULL;
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
|
|
|
Edje_Part_Image_Use *item;
|
|
|
|
Edje_Part *part;
|
|
|
|
Edje_Part_Description_Image *part_desc_image;
|
|
|
|
unsigned int i, j, k;
|
|
|
|
int image_id;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
image_id = edje_edit_image_id_get(obj, name);
|
|
|
|
if (image_id < 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
it = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
|
|
|
|
#define ITEM_ADD() \
|
|
|
|
item = (Edje_Part_Image_Use *) calloc(1, sizeof(Edje_Part_Image_Use)); \
|
|
|
|
item->group = eina_stringshare_add(pce->entry); \
|
|
|
|
item->part = eina_stringshare_add(part->name); \
|
|
|
|
item->state.name = eina_stringshare_add(part_desc_image->common.state.name); \
|
|
|
|
item->state.value = part_desc_image->common.state.value; \
|
|
|
|
result = eina_list_append(result, item);
|
|
|
|
|
|
|
|
#define FIND_IN_PART_DESCRIPTION() \
|
|
|
|
if (part_desc_image->image.id == image_id) \
|
|
|
|
{ \
|
|
|
|
ITEM_ADD(); \
|
|
|
|
if (first_only) \
|
|
|
|
return result; \
|
|
|
|
else \
|
|
|
|
continue; \
|
|
|
|
} \
|
|
|
|
for (k = 0; k < part_desc_image->image.tweens_count; k++) \
|
|
|
|
{ \
|
|
|
|
if (part_desc_image->image.tweens[k]->id == image_id) \
|
|
|
|
{ \
|
|
|
|
ITEM_ADD(); \
|
|
|
|
if (first_only) \
|
|
|
|
return result; \
|
|
|
|
else \
|
|
|
|
continue; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, pce)
|
|
|
|
{
|
2014-04-17 10:40:34 -07:00
|
|
|
if (!pce->ref) continue;
|
2013-12-18 22:47:25 -08:00
|
|
|
for (i = 0; i < pce->ref->parts_count; i++)
|
|
|
|
{
|
2014-04-17 10:40:34 -07:00
|
|
|
if (!pce->ref->parts) continue;
|
2013-12-18 22:47:25 -08:00
|
|
|
part = pce->ref->parts[i];
|
|
|
|
if (part->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->default_desc;
|
|
|
|
FIND_IN_PART_DESCRIPTION();
|
|
|
|
for (j = 0; j < part->other.desc_count; j++)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j];
|
|
|
|
FIND_IN_PART_DESCRIPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#undef ITEM_ADD
|
|
|
|
#undef FIND_IN_PART_DESCRIPTION
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_edit_image_usage_list_free(Eina_List *list)
|
|
|
|
{
|
|
|
|
Edje_Part_Image_Use *item;
|
|
|
|
EINA_LIST_FREE(list, item)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(item->group);
|
|
|
|
eina_stringshare_del(item->part);
|
|
|
|
eina_stringshare_del(item->state.name);
|
|
|
|
free(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-26 11:19:43 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_image_del(Evas_Object *obj, const char* name)
|
|
|
|
{
|
2013-12-18 22:47:25 -08:00
|
|
|
Edje_Image_Directory_Entry *de, *de_last;
|
|
|
|
unsigned int i, j, k;
|
|
|
|
Eina_List *used;
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
2010-04-26 11:19:43 -07:00
|
|
|
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-04-26 11:19:43 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!name) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
|
|
|
|
2013-12-18 22:47:25 -08:00
|
|
|
used = edje_edit_image_usage_list_get(obj, name, EINA_TRUE);
|
|
|
|
if (used)
|
|
|
|
{
|
|
|
|
edje_edit_image_usage_list_free(used);
|
|
|
|
WRN("Image \"%s\" is used", name);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
edje_edit_image_usage_list_free(used);
|
|
|
|
|
2010-04-26 11:19:43 -07:00
|
|
|
/* Create Image_Directory if not exist */
|
|
|
|
if (!ed->file->image_dir)
|
2010-08-24 07:35:37 -07:00
|
|
|
goto invalid_image;
|
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
for (i = 0; i < ed->file->image_dir->entries_count; ++i)
|
2010-04-26 11:19:43 -07:00
|
|
|
{
|
2013-12-18 22:47:25 -08:00
|
|
|
de = ed->file->image_dir->entries + i;
|
2010-06-29 06:48:03 -07:00
|
|
|
|
2013-12-18 22:47:25 -08:00
|
|
|
if ((de->entry) && (!strcmp(name, de->entry)))
|
|
|
|
break;
|
2010-04-26 11:19:43 -07:00
|
|
|
}
|
2010-06-29 06:48:03 -07:00
|
|
|
if (i == ed->file->image_dir->entries_count)
|
2010-08-24 07:35:37 -07:00
|
|
|
goto invalid_image;
|
2010-04-26 11:19:43 -07:00
|
|
|
|
2013-12-18 22:47:25 -08:00
|
|
|
de_last = ed->file->image_dir->entries + ed->file->image_dir->entries_count - 1;
|
|
|
|
|
2010-04-26 11:19:43 -07:00
|
|
|
{
|
|
|
|
char entry[PATH_MAX];
|
2013-12-18 22:47:25 -08:00
|
|
|
char last_entry[PATH_MAX];
|
2010-04-26 11:19:43 -07:00
|
|
|
Eet_File *eetf;
|
2013-12-18 22:47:25 -08:00
|
|
|
void *data;
|
|
|
|
int size = 0;
|
2010-04-26 11:19:43 -07:00
|
|
|
|
|
|
|
/* open the eet file */
|
|
|
|
eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
2013-12-18 22:47:25 -08:00
|
|
|
{
|
|
|
|
ERR("Unable to open \"%s\" for writing output", ed->path);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-04-26 11:19:43 -07:00
|
|
|
|
2010-08-11 09:23:43 -07:00
|
|
|
snprintf(entry, sizeof(entry), "edje/images/%i", de->id);
|
2010-04-26 11:19:43 -07:00
|
|
|
|
|
|
|
if (eet_delete(eetf, entry) <= 0)
|
|
|
|
{
|
|
|
|
ERR("Unable to delete \"%s\" font entry", entry);
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-12-18 22:47:25 -08:00
|
|
|
if (de_last->id != de->id)
|
|
|
|
{
|
|
|
|
snprintf(last_entry, sizeof(last_entry), "edje/images/%i", de_last->id);
|
|
|
|
data = eet_read(eetf, last_entry, &size);
|
|
|
|
eet_delete(eetf, last_entry);
|
|
|
|
eet_write(eetf, entry, data, size, 0);
|
|
|
|
}
|
2014-04-17 10:40:34 -07:00
|
|
|
|
|
|
|
_edje_if_string_free(ed, de->entry);
|
|
|
|
--ed->file->image_dir->entries_count;
|
|
|
|
|
|
|
|
if (de_last->id != de->id)
|
|
|
|
{
|
|
|
|
Edje_Part *part;
|
|
|
|
Edje_Part_Description_Image *part_desc_image;
|
|
|
|
|
|
|
|
de->entry = de_last->entry;
|
|
|
|
it = eina_hash_iterator_data_new(ed->file->collection);
|
|
|
|
EINA_ITERATOR_FOREACH(it, pce)
|
|
|
|
{
|
|
|
|
if (!pce->ref) continue;
|
|
|
|
for (i = 0; i < pce->ref->parts_count; i++)
|
|
|
|
{
|
|
|
|
if (!pce->ref->parts) continue;
|
|
|
|
part = pce->ref->parts[i];
|
|
|
|
if (part->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->default_desc;
|
|
|
|
if (part_desc_image->image.id == de_last->id)
|
|
|
|
part_desc_image->image.id = de->id;
|
|
|
|
for (k = 0; k < part_desc_image->image.tweens_count; k++)
|
|
|
|
if (part_desc_image->image.id == de_last->id)
|
|
|
|
part_desc_image->image.id = de->id;
|
|
|
|
|
|
|
|
for (j = 0; j < part->other.desc_count; j++)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j];
|
|
|
|
if (part_desc_image->image.id == de_last->id)
|
|
|
|
part_desc_image->image.id = de->id;
|
|
|
|
for (k = 0; k < part_desc_image->image.tweens_count; k++)
|
|
|
|
if (part_desc_image->image.id == de_last->id)
|
|
|
|
part_desc_image->image.id = de->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
}
|
|
|
|
ed->file->image_dir->entries = realloc(ed->file->image_dir->entries,
|
|
|
|
sizeof(Edje_Image_Directory_Entry) *
|
|
|
|
ed->file->image_dir->entries_count);
|
2010-04-26 11:19:43 -07:00
|
|
|
/* write the edje_file */
|
2010-04-29 11:52:55 -07:00
|
|
|
if (!_edje_edit_edje_file_save(eetf, ed->file))
|
2013-12-18 22:47:25 -08:00
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-04-26 11:19:43 -07:00
|
|
|
|
|
|
|
eet_close(eetf);
|
|
|
|
}
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2010-04-26 11:19:43 -07:00
|
|
|
return EINA_TRUE;
|
2010-08-24 07:35:37 -07:00
|
|
|
|
|
|
|
invalid_image:
|
|
|
|
WRN("Unable to find image entry part \"%s\"", name);
|
|
|
|
return EINA_FALSE;
|
2010-04-26 11:19:43 -07:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2009-07-13 12:17:35 -07:00
|
|
|
edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
|
|
|
|
{
|
|
|
|
Edje_Image_Directory_Entry *de;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2009-07-13 12:17:35 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!name) return EINA_FALSE;
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->path) return EINA_FALSE;
|
2009-07-13 12:17:35 -07:00
|
|
|
|
|
|
|
/* Create Image_Directory if not exist */
|
|
|
|
if (!ed->file->image_dir)
|
2009-08-17 06:54:17 -07:00
|
|
|
{
|
|
|
|
ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!ed->file->image_dir) return EINA_FALSE;
|
2009-08-17 06:54:17 -07:00
|
|
|
}
|
2009-07-13 12:17:35 -07:00
|
|
|
|
|
|
|
/* Loop trough image directory to find if image exist */
|
2010-06-29 06:48:03 -07:00
|
|
|
if (id < 0) id = - id - 1;
|
|
|
|
if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE;
|
2009-07-13 12:17:35 -07:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
de = ed->file->image_dir->entries + id;
|
2013-01-11 17:15:45 -08:00
|
|
|
_edje_if_string_free(ed, de->entry);
|
|
|
|
de->entry = eina_stringshare_add(name);
|
2009-07-13 12:17:35 -07:00
|
|
|
de->source_type = 1;
|
|
|
|
de->source_param = 1;
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2009-07-13 12:17:35 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
EAPI int
|
|
|
|
edje_edit_image_id_get(Evas_Object *obj, const char *image_name)
|
|
|
|
{
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN(-1);
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
return _edje_image_id_find(eed, image_name);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Edje_Edit_Image_Comp
|
2008-07-30 15:41:04 -07:00
|
|
|
edje_edit_image_compression_type_get(Evas_Object *obj, const char *image)
|
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
Edje_Image_Directory_Entry *de = NULL;
|
|
|
|
unsigned int i;
|
2008-07-30 15:41:04 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(-1);
|
|
|
|
|
|
|
|
if (!ed->file) return -1;
|
|
|
|
if (!ed->file->image_dir) return -1;
|
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
for (i = 0; i < ed->file->image_dir->entries_count; ++i)
|
2008-07-30 15:41:04 -07:00
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
de = ed->file->image_dir->entries + i;
|
|
|
|
|
|
|
|
if (de->entry
|
|
|
|
&& !strcmp(image, de->entry))
|
2008-07-30 15:41:04 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
if (i == ed->file->image_dir->entries_count) return -1;
|
2008-07-30 15:41:04 -07:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
switch(de->source_type)
|
2008-07-30 15:41:04 -07:00
|
|
|
{
|
2014-04-18 00:39:37 -07:00
|
|
|
case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT:
|
|
|
|
if (de->source_param == 0) // RAW
|
|
|
|
return EDJE_EDIT_IMAGE_COMP_RAW;
|
|
|
|
else // COMP
|
|
|
|
return EDJE_EDIT_IMAGE_COMP_COMP;
|
|
|
|
case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY: // LOSSY
|
|
|
|
return EDJE_EDIT_IMAGE_COMP_LOSSY;
|
|
|
|
case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1: // LOSSY_ETC1
|
|
|
|
return EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1;
|
|
|
|
case EDJE_IMAGE_SOURCE_TYPE_EXTERNAL: // USER
|
|
|
|
return EDJE_EDIT_IMAGE_COMP_USER;
|
2008-07-30 15:41:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-06-03 15:38:27 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_image_compression_type_set(Evas_Object *obj, const char *image, Edje_Edit_Image_Comp ic)
|
|
|
|
{
|
|
|
|
Edje_Image_Directory_Entry *de = NULL;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (!ed->file) return EINA_FALSE;
|
|
|
|
if (!ed->file->image_dir) return EINA_FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->image_dir->entries_count; ++i)
|
|
|
|
{
|
|
|
|
de = ed->file->image_dir->entries + i;
|
|
|
|
if ((de->entry) && (!strcmp(image, de->entry)))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == ed->file->image_dir->entries_count) return EINA_FALSE;
|
|
|
|
|
|
|
|
switch(ic)
|
|
|
|
{
|
|
|
|
case EDJE_EDIT_IMAGE_COMP_RAW: // RAW
|
|
|
|
if (de->source_param == 0)
|
|
|
|
{
|
|
|
|
de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
case EDJE_EDIT_IMAGE_COMP_COMP: // COMP
|
|
|
|
if (de->source_param == 1)
|
|
|
|
{
|
|
|
|
de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
case EDJE_EDIT_IMAGE_COMP_LOSSY: // LOSSY
|
|
|
|
{
|
|
|
|
de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
case EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1: // LOSSY_ETC1
|
|
|
|
{
|
|
|
|
de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
case EDJE_EDIT_IMAGE_COMP_USER: // USER
|
|
|
|
{
|
|
|
|
de->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-07-30 15:41:04 -07:00
|
|
|
EAPI int
|
|
|
|
edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image)
|
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
Edje_Image_Directory_Entry *de;
|
|
|
|
unsigned int i;
|
2008-07-30 15:41:04 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(-1);
|
|
|
|
|
|
|
|
// Gets the Image Entry
|
2010-06-29 06:48:03 -07:00
|
|
|
for (i = 0; i < ed->file->image_dir->entries_count; ++i)
|
2008-07-30 15:41:04 -07:00
|
|
|
{
|
2010-06-29 06:48:03 -07:00
|
|
|
de = ed->file->image_dir->entries + i;
|
|
|
|
if (de->entry
|
|
|
|
&& !strcmp(de->entry, image))
|
|
|
|
break;
|
2008-07-30 15:41:04 -07:00
|
|
|
}
|
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
if (i == ed->file->image_dir->entries_count) return -1;
|
2014-04-18 00:39:37 -07:00
|
|
|
if ((de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY)
|
|
|
|
&& (de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1))
|
|
|
|
return -2;
|
2008-07-30 15:41:04 -07:00
|
|
|
|
2010-06-29 06:48:03 -07:00
|
|
|
return de->source_param;
|
2008-07-30 15:41:04 -07:00
|
|
|
}
|
|
|
|
|
2008-03-13 12:08:14 -07:00
|
|
|
EAPI const char *
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
2010-12-02 10:20:34 -08:00
|
|
|
const char *image;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_PD_OR_RETURN(NULL);
|
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
|
|
|
return NULL;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
image = _edje_image_name_find(eed, img->image.id);
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!image) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET IMAGE for %s [%s]\n", state, image);
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(image);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, double value, const char *image)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
2008-03-06 11:48:11 -08:00
|
|
|
int id;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
if ((!obj) || (!part) || (!state) || (!image))
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
eina_error_set(0);
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
id = _edje_image_id_find(eed, image);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
|
|
|
if (id > -1) img->image.id = id;
|
2013-10-30 06:00:11 -07:00
|
|
|
else return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
2010-08-03 05:58:31 -07:00
|
|
|
Eina_List *tweens = NULL;
|
2008-03-06 11:48:11 -08:00
|
|
|
const char *name;
|
2010-08-03 05:58:31 -07:00
|
|
|
unsigned int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_PD_OR_RETURN(NULL);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
|
|
|
return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2010-08-03 05:58:31 -07:00
|
|
|
for (i = 0; i < img->image.tweens_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-12-02 10:20:34 -08:00
|
|
|
name = _edje_image_name_find(eed, img->image.tweens[i]->id);
|
2008-03-13 12:01:53 -07:00
|
|
|
//printf(" t: %s\n", name);
|
2008-10-22 04:34:42 -07:00
|
|
|
tweens = eina_list_append(tweens, eina_stringshare_add(name));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
return tweens;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
2010-08-03 05:58:31 -07:00
|
|
|
Edje_Part_Image_Id **tmp;
|
2008-03-06 11:48:11 -08:00
|
|
|
Edje_Part_Image_Id *i;
|
|
|
|
int id;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
id = _edje_image_id_find(eed, tween);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (id < EINA_FALSE) return 0;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* alloc Edje_Part_Image_Id */
|
2009-08-17 07:13:26 -07:00
|
|
|
i = _alloc(sizeof(Edje_Part_Image_Id));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!i) return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
i->id = id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* add to tween list */
|
2010-08-03 05:58:31 -07:00
|
|
|
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;
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
2010-08-03 05:58:31 -07:00
|
|
|
unsigned int i;
|
|
|
|
int search;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2010-08-03 05:58:31 -07:00
|
|
|
if (!img->image.tweens_count) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
search = _edje_image_id_find(eed, tween);
|
2010-08-03 05:58:31 -07:00
|
|
|
if (search < 0) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-03 05:58:31 -07:00
|
|
|
for (i = 0; i < img->image.tweens_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-08-03 05:58:31 -07:00
|
|
|
if (img->image.tweens[i]->id == search)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-08-03 05:58:31 -07:00
|
|
|
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));
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-04-07 10:04:49 -07:00
|
|
|
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)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_PD_OR_RETURN();
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
if (l) *l = 0;
|
|
|
|
if (r) *r = 0;
|
|
|
|
if (t) *t = 0;
|
|
|
|
if (b) *b = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET IMAGE_BORDER of state '%s'\n", state);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
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)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
if ((!obj) || (!part) || (!state))
|
|
|
|
return EINA_FALSE;
|
|
|
|
if ((l < -1) || (r < -1) || (t < -1) || (b < -1))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
eina_error_set(0);
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
img->image.border.l = l;
|
|
|
|
img->image.border.r = r;
|
|
|
|
img->image.border.t = t;
|
|
|
|
img->image.border.b = b;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2008-10-07 14:13:27 -07:00
|
|
|
EAPI unsigned char
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const char *state, double value)
|
2008-10-07 14:13:27 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
|
2008-10-26 21:10:31 -07:00
|
|
|
GET_PD_OR_RETURN(0);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
|
|
|
return 0;
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
if (img->image.border.no_fill == 2) return 2;
|
|
|
|
else return !img->image.border.no_fill;
|
|
|
|
|
2009-02-12 05:39:15 -08:00
|
|
|
return 0;
|
2008-10-07 14:13:27 -07:00
|
|
|
}
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
EAPI Eina_Bool
|
2010-04-07 10:04:49 -07:00
|
|
|
edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill)
|
2008-10-07 14:13:27 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
if ((!obj) || (!part) || (!state))
|
|
|
|
return EINA_FALSE;
|
2013-10-31 19:01:37 -07:00
|
|
|
if (fill > 2)
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
eina_error_set(0);
|
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 16:09:24 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_FALSE;
|
2010-08-09 16:09:24 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2013-10-30 06:00:11 -07:00
|
|
|
if (fill == 2) img->image.border.no_fill = 2;
|
|
|
|
else img->image.border.no_fill = !fill;
|
2008-10-07 14:13:27 -07:00
|
|
|
|
|
|
|
edje_object_calc_force(obj);
|
2013-10-30 06:00:11 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-07 14:13:27 -07:00
|
|
|
}
|
|
|
|
|
2014-06-03 15:44:42 -07:00
|
|
|
/****************/
|
|
|
|
/* SOUNDS API */
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_sounds_samples_list_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Eina_List *sounds_samples = NULL;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if ((!ed->file) || (!ed->file->sound_dir))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->samples_count; ++i)
|
|
|
|
sounds_samples = eina_list_append(sounds_samples,
|
|
|
|
eina_stringshare_add(ed->file->sound_dir->samples[i].name));
|
|
|
|
|
|
|
|
return sounds_samples;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_sounds_tones_list_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Eina_List *sounds_tones = NULL;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if ((!ed->file) || (!ed->file->sound_dir))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->file->sound_dir->tones_count; ++i)
|
|
|
|
sounds_tones = eina_list_append(sounds_tones,
|
|
|
|
eina_stringshare_add(ed->file->sound_dir->tones[i].name));
|
|
|
|
|
|
|
|
return sounds_tones;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/******************/
|
|
|
|
/* PROGRAMS API */
|
|
|
|
/******************/
|
2010-12-02 10:20:34 -08:00
|
|
|
static int
|
|
|
|
_edje_program_id_find(Edje_Edit *eed, const char *program)
|
|
|
|
{
|
|
|
|
Edje_Program *epr;
|
|
|
|
int i;
|
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
for (i = 0; i < eed->base->collection->patterns.table_programs_size; i++)
|
2010-12-02 10:20:34 -08:00
|
|
|
{
|
2013-02-13 19:36:13 -08:00
|
|
|
epr = eed->base->collection->patterns.table_programs[i];
|
2010-12-02 10:20:34 -08:00
|
|
|
if (epr->name && !strcmp(epr->name, program))
|
|
|
|
return epr->id;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-08-17 05:10:06 -07:00
|
|
|
static Edje_Program *
|
2008-03-06 11:48:11 -08:00
|
|
|
_edje_program_get_byname(Evas_Object *obj, const char *prog_name)
|
|
|
|
{
|
|
|
|
Edje_Program *epr;
|
|
|
|
int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!prog_name) return NULL;
|
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
for (i = 0; i < ed->collection->patterns.table_programs_size; i++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-02-13 19:36:13 -08:00
|
|
|
epr = ed->collection->patterns.table_programs[i];
|
2008-11-05 08:08:39 -08:00
|
|
|
if ((epr->name) && (strcmp(epr->name, prog_name) == 0))
|
2008-03-13 12:01:53 -07:00
|
|
|
return epr;
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EAPI Eina_List *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_programs_list_get(Evas_Object *obj)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *progs = NULL;
|
2008-03-06 11:48:11 -08:00
|
|
|
int i;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("EE: Found %d programs\n", ed->table_programs_size);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
for (i = 0; i < ed->collection->patterns.table_programs_size; i++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Program *epr;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
epr = ed->collection->patterns.table_programs[i];
|
2010-09-03 07:37:42 -07:00
|
|
|
/* XXX: bad, we miss programs this way, but since you can't access
|
|
|
|
* them in any way without a name, better ignore them. */
|
|
|
|
if (!epr->name) continue;
|
2008-10-22 04:34:42 -07:00
|
|
|
progs = eina_list_append(progs, eina_stringshare_add(epr->name));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
|
|
|
|
return progs;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_add(Evas_Object *obj, const char *name)
|
|
|
|
{
|
|
|
|
Edje_Program *epr;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("ADD PROGRAM [new name: %s]\n", name);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Check if program already exists
|
|
|
|
if (_edje_program_get_byname(obj, name))
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Alloc Edje_Program or return
|
2009-08-17 07:13:26 -07:00
|
|
|
epr = _alloc(sizeof(Edje_Program));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!epr) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Add program to group
|
2012-01-16 04:34:13 -08:00
|
|
|
// pc = ed->collection;
|
2010-08-04 07:25:40 -07:00
|
|
|
|
|
|
|
/* By default, source and signal are empty, so they fill in nocmp category */
|
|
|
|
ed->collection->programs.nocmp = realloc(ed->collection->programs.nocmp,
|
2010-08-06 01:59:51 -07:00
|
|
|
sizeof (Edje_Program*) * (ed->collection->programs.nocmp_count + 1));
|
2010-08-04 07:25:40 -07:00
|
|
|
ed->collection->programs.nocmp[ed->collection->programs.nocmp_count++] = epr;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Init Edje_Program
|
2013-02-13 19:36:13 -08:00
|
|
|
epr->id = ed->collection->patterns.table_programs_size;
|
2008-10-15 07:11:11 -07:00
|
|
|
epr->name = eina_stringshare_add(name);
|
2008-03-06 11:48:11 -08:00
|
|
|
epr->signal = NULL;
|
|
|
|
epr->source = NULL;
|
2010-02-19 10:30:46 -08:00
|
|
|
epr->filter.part = NULL;
|
|
|
|
epr->filter.state = NULL;
|
2008-03-06 11:48:11 -08:00
|
|
|
epr->in.from = 0.0;
|
|
|
|
epr->in.range = 0.0;
|
|
|
|
epr->action = 0;
|
|
|
|
epr->state = NULL;
|
|
|
|
epr->value = 0.0;
|
|
|
|
epr->state2 = NULL;
|
|
|
|
epr->value2 = 0.0;
|
|
|
|
epr->tween.mode = 1;
|
2010-02-24 07:37:16 -08:00
|
|
|
epr->tween.time = ZERO;
|
2008-03-06 11:48:11 -08:00
|
|
|
epr->targets = NULL;
|
|
|
|
epr->after = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Update table_programs
|
2013-02-13 19:36:13 -08:00
|
|
|
ed->collection->patterns.table_programs_size++;
|
|
|
|
ed->collection->patterns.table_programs = realloc(ed->collection->patterns.table_programs,
|
|
|
|
sizeof(Edje_Program *) * ed->collection->patterns.table_programs_size);
|
|
|
|
ed->collection->patterns.table_programs[epr->id % ed->collection->patterns.table_programs_size] = epr;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Update patterns
|
2013-02-13 19:36:13 -08:00
|
|
|
_edje_programs_patterns_clean(ed->collection);
|
|
|
|
_edje_programs_patterns_init(ed->collection);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_del(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2010-08-04 07:25:40 -07:00
|
|
|
Eina_List *l, *l_next;
|
|
|
|
Edje_Program_Target *prt;
|
|
|
|
Edje_Program_After *pa;
|
2010-04-26 15:35:49 -07:00
|
|
|
Edje_Program *p;
|
2010-12-02 10:20:34 -08:00
|
|
|
Program_Script *ps, *old_ps;
|
2008-03-06 11:48:11 -08:00
|
|
|
int id, i;
|
2010-04-26 15:35:49 -07:00
|
|
|
int old_id = -1;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-04-26 15:35:49 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2012-01-16 04:34:13 -08:00
|
|
|
//pc = ed->collection;
|
2010-04-26 15:35:49 -07:00
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
//Remove program from programs list
|
|
|
|
id = epr->id;
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_remove(ed->collection, epr);
|
2010-08-04 07:25:40 -07:00
|
|
|
|
|
|
|
/* fix table program */
|
2013-02-13 19:36:13 -08:00
|
|
|
if (epr->id != ed->collection->patterns.table_programs_size - 1)
|
2010-04-26 15:35:49 -07:00
|
|
|
{
|
|
|
|
/* 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 */
|
2013-02-13 19:36:13 -08:00
|
|
|
ed->collection->patterns.table_programs[epr->id] = ed->collection->patterns.table_programs[ed->collection->patterns.table_programs_size - 1];
|
|
|
|
old_id = ed->collection->patterns.table_programs_size - 1;
|
|
|
|
ed->collection->patterns.table_programs[epr->id]->id = epr->id;
|
2010-04-26 15:35:49 -07:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
ps = eina_hash_find(eed->program_scripts, &id);
|
|
|
|
old_ps = eina_hash_find(eed->program_scripts, &old_id);
|
|
|
|
if (old_ps)
|
|
|
|
{
|
|
|
|
if (!ps)
|
|
|
|
{
|
|
|
|
ps = _alloc(sizeof(Program_Script));
|
|
|
|
ps->id = id;
|
|
|
|
eina_hash_add(eed->program_scripts, &id, ps);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free(ps->code);
|
|
|
|
free(ps->processed);
|
|
|
|
ps->processed = NULL;
|
|
|
|
ps->delete_me = EINA_FALSE;
|
|
|
|
}
|
|
|
|
ps->code = old_ps->code;
|
|
|
|
old_ps->code = NULL;
|
|
|
|
free(old_ps->processed);
|
|
|
|
old_ps->processed = NULL;
|
|
|
|
ps->dirty = EINA_TRUE;
|
|
|
|
old_ps->dirty = EINA_FALSE;
|
|
|
|
old_ps->delete_me = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (ps)
|
|
|
|
{
|
|
|
|
ps->dirty = EINA_FALSE;
|
|
|
|
ps->delete_me = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Free Edje_Program
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->name);
|
|
|
|
_edje_if_string_free(ed, epr->signal);
|
|
|
|
_edje_if_string_free(ed, epr->source);
|
2010-02-19 10:30:46 -08:00
|
|
|
_edje_if_string_free(ed, epr->filter.part);
|
|
|
|
_edje_if_string_free(ed, epr->filter.state);
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->state);
|
|
|
|
_edje_if_string_free(ed, epr->state2);
|
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
EINA_LIST_FREE(epr->targets, prt)
|
|
|
|
free(prt);
|
|
|
|
EINA_LIST_FREE(epr->after, pa)
|
|
|
|
free(pa);
|
2008-03-06 11:48:11 -08:00
|
|
|
free(epr);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
ed->collection->patterns.table_programs_size--;
|
|
|
|
ed->collection->patterns.table_programs = realloc(ed->collection->patterns.table_programs,
|
|
|
|
sizeof(Edje_Program *) * ed->collection->patterns.table_programs_size);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//We also update all other programs that point to old_id and id
|
2013-02-13 19:36:13 -08:00
|
|
|
for (i = 0; i < ed->collection->patterns.table_programs_size; i++)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2013-02-13 19:36:13 -08:00
|
|
|
p = ed->collection->patterns.table_programs[i];
|
2010-04-26 15:35:49 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
/* check in afters */
|
2010-03-29 00:03:36 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(p->after, l, l_next, pa)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
if (pa->id == old_id)
|
2010-04-26 15:35:49 -07:00
|
|
|
pa->id = id;
|
2008-03-13 12:01:53 -07:00
|
|
|
else if (pa->id == id)
|
2010-12-02 10:20:34 -08:00
|
|
|
{
|
|
|
|
p->after = eina_list_remove_list(p->after, l);
|
|
|
|
free(pa);
|
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
/* check in targets */
|
|
|
|
if (p->action == EDJE_ACTION_TYPE_ACTION_STOP)
|
|
|
|
{
|
2010-03-29 00:03:36 -07:00
|
|
|
Edje_Program_Target *pt;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-03-29 00:03:36 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(p->targets, l, l_next, pt)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
if (pt->id == old_id)
|
2010-04-26 15:35:49 -07:00
|
|
|
pt->id = id;
|
2008-03-13 12:01:53 -07:00
|
|
|
else if (pt->id == id)
|
2010-12-02 10:20:34 -08:00
|
|
|
{
|
|
|
|
p->targets = eina_list_remove_list(p->targets, l);
|
|
|
|
free(pt);
|
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2010-04-26 15:35:49 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_exist(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_run(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
_edje_program_run(ed, epr, 0, "", "");
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_name)
|
|
|
|
{
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!new_name) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (_edje_program_get_byname(obj, new_name)) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("SET NAME for program: %s [new name: %s]\n", prog, new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->name);
|
2008-10-15 07:11:11 -07:00
|
|
|
epr->name = eina_stringshare_add(new_name);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2008-03-13 12:08:14 -07:00
|
|
|
EAPI const char *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_source_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!epr->source) return NULL;
|
|
|
|
//printf("GET SOURCE for program: %s [%s]\n", prog, epr->source);
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(epr->source);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *source)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!source) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
/* Remove from program array */
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_remove(ed->collection, epr);
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->source);
|
2010-08-04 07:25:40 -07:00
|
|
|
|
|
|
|
/* Insert it back */
|
2008-10-15 07:11:11 -07:00
|
|
|
epr->source = eina_stringshare_add(source);
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_insert(ed->collection, epr);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Update patterns
|
2013-02-13 19:36:13 -08:00
|
|
|
_edje_programs_patterns_clean(ed->collection);
|
|
|
|
_edje_programs_patterns_init(ed->collection);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-02-19 10:30:46 -08:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (!epr->filter.part) return NULL;
|
|
|
|
return eina_stringshare_add(epr->filter.part);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_program_filter_part_set(Evas_Object *obj, const char *prog, const char *filter_part)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2010-02-19 10:30:46 -08:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!filter_part) return EINA_FALSE;
|
2010-02-19 10:30:46 -08:00
|
|
|
|
|
|
|
_edje_if_string_free(ed, epr->filter.part);
|
|
|
|
epr->filter.part = eina_stringshare_add(filter_part);
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2010-02-19 10:30:46 -08:00
|
|
|
}
|
|
|
|
|
2010-02-10 07:07:17 -08:00
|
|
|
EAPI const char *
|
|
|
|
edje_edit_program_filter_state_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
2010-02-19 10:30:46 -08:00
|
|
|
if (!epr->filter.state) return NULL;
|
|
|
|
return eina_stringshare_add(epr->filter.state);
|
2010-02-10 07:07:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_program_filter_state_set(Evas_Object *obj, const char *prog, const char *filter_state)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2010-02-10 07:07:17 -08:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!filter_state) return EINA_FALSE;
|
2010-02-10 07:07:17 -08:00
|
|
|
|
2010-02-19 10:30:46 -08:00
|
|
|
_edje_if_string_free(ed, epr->filter.state);
|
|
|
|
epr->filter.state = eina_stringshare_add(filter_state);
|
2010-02-10 07:07:17 -08:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2010-02-10 07:07:17 -08:00
|
|
|
}
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
EAPI const char *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_signal_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!epr->signal) return NULL;
|
|
|
|
//printf("GET SIGNAL for program: %s [%s]\n", prog, epr->signal);
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(epr->signal);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2011-08-18 03:59:34 -07:00
|
|
|
edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *sig)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2011-08-18 03:59:34 -07:00
|
|
|
if (!sig) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-04 07:25:40 -07:00
|
|
|
/* Remove from program array */
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_remove(ed->collection, epr);
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->signal);
|
2010-08-04 07:25:40 -07:00
|
|
|
|
|
|
|
/* Insert it back */
|
2011-08-18 03:59:34 -07:00
|
|
|
epr->signal = eina_stringshare_add(sig);
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_insert(ed->collection, epr);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//Update patterns
|
2013-02-13 19:36:13 -08:00
|
|
|
_edje_programs_patterns_clean(ed->collection);
|
|
|
|
_edje_programs_patterns_init(ed->collection);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
EAPI const char *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_state_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!epr->state) return NULL;
|
|
|
|
//printf("GET STATE for program: %s [%s %.2f]\n", prog, epr->state, epr->value);
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(epr->state);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_state_set(Evas_Object *obj, const char *prog, const char *state)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("SET STATE for program: %s\n", prog);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->state);
|
2008-10-15 07:11:11 -07:00
|
|
|
epr->state = eina_stringshare_add(state);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2008-03-13 12:08:14 -07:00
|
|
|
EAPI const char *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_state2_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!epr->state2) return NULL;
|
|
|
|
//printf("GET STATE2 for program: %s [%s %.2f]\n", prog, epr->state2, epr->value2);
|
2008-10-15 07:11:11 -07:00
|
|
|
return eina_stringshare_add(epr->state2);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_state2_set(Evas_Object *obj, const char *prog, const char *state2)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf("SET STATE2 for program: %s\n", prog);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-08 15:11:32 -08:00
|
|
|
_edje_if_string_free(ed, epr->state2);
|
2008-10-15 07:11:11 -07:00
|
|
|
epr->state2 = eina_stringshare_add(state2);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
edje_edit_program_value_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(-1);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET VALUE for program: %s [%s %.2f]\n", prog, epr->state, epr->value);
|
|
|
|
return epr->value;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_value_set(Evas_Object *obj, const char *prog, double value)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("SET VALUE for program: %s [%.2f]\n", prog, value);
|
|
|
|
epr->value = value;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
edje_edit_program_value2_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(-1);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET VALUE2 for program: %s [%s %.2f]\n", prog, epr->state2, epr->value2);
|
|
|
|
return epr->value2;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_value2_set(Evas_Object *obj, const char *prog, double value)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("SET VALUE for program: %s [%.2f]\n", prog, value);
|
|
|
|
epr->value2 = value;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
EAPI double
|
|
|
|
edje_edit_program_in_from_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(0);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET IN.FROM for program: %s [%f]\n", prog, epr->in.from);
|
|
|
|
return epr->in.from;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_in_from_set(Evas_Object *obj, const char *prog, double seconds)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("SET IN.FROM for program: %s [%f]\n", prog, epr->in.from);
|
|
|
|
epr->in.from = seconds;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
edje_edit_program_in_range_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(0);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET IN.RANGE for program: %s [%f]\n", prog, epr->in.range);
|
|
|
|
return epr->in.range;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_in_range_set(Evas_Object *obj, const char *prog, double seconds)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("SET IN.RANGE for program: %s [%f]\n", prog, epr->in.range);
|
|
|
|
epr->in.range = seconds;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Edje_Tween_Mode
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_transition_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(-1);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode);
|
|
|
|
return epr->tween.mode;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_program_transition_set(Evas_Object *obj, const char *prog, Edje_Tween_Mode transition)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode);
|
|
|
|
epr->tween.mode = transition;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-11 17:16:36 -07:00
|
|
|
#define FUNC_PROGRAM_TRANSITION_VALUE(Num) \
|
|
|
|
EAPI double \
|
|
|
|
edje_edit_program_transition_value##Num##_get(Evas_Object *obj, const char *prog) \
|
|
|
|
{ \
|
|
|
|
eina_error_set(0); \
|
|
|
|
\
|
|
|
|
GET_EPR_OR_RETURN(-1); \
|
|
|
|
\
|
|
|
|
return TO_DOUBLE(epr->tween.v##Num); \
|
|
|
|
} \
|
|
|
|
EAPI Eina_Bool \
|
|
|
|
edje_edit_program_transition_value##Num##_set(Evas_Object *obj, const char *prog, double value) \
|
|
|
|
{ \
|
|
|
|
eina_error_set(0); \
|
|
|
|
\
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE); \
|
|
|
|
\
|
|
|
|
epr->tween.v##Num = FROM_DOUBLE(value); \
|
|
|
|
return EINA_TRUE; \
|
|
|
|
}
|
2013-10-13 20:09:11 -07:00
|
|
|
|
2014-06-11 17:16:36 -07:00
|
|
|
FUNC_PROGRAM_TRANSITION_VALUE(1)
|
|
|
|
FUNC_PROGRAM_TRANSITION_VALUE(2)
|
|
|
|
FUNC_PROGRAM_TRANSITION_VALUE(3)
|
|
|
|
FUNC_PROGRAM_TRANSITION_VALUE(4)
|
2013-10-13 20:09:11 -07:00
|
|
|
|
2014-06-11 17:16:36 -07:00
|
|
|
#undef FUNC_PROGRAM_TRANSITION_VALUE
|
2013-10-13 20:09:11 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
EAPI double
|
|
|
|
edje_edit_program_transition_time_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(-1);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time);
|
2010-02-24 07:37:16 -08:00
|
|
|
return TO_DOUBLE(epr->tween.time);
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time);
|
2010-02-24 07:37:16 -08:00
|
|
|
epr->tween.time = FROM_DOUBLE(seconds);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Edje_Action_Type
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_action_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_EPR_OR_RETURN(-1);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("GET ACTION for program: %s [%d]\n", prog, epr->action);
|
|
|
|
return epr->action;
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_program_action_set(Evas_Object *obj, const char *prog, Edje_Action_Type action)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-12-02 10:20:34 -08:00
|
|
|
Program_Script *ps;
|
|
|
|
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
//printf("SET ACTION for program: %s [%d]\n", prog, action);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (action >= EDJE_ACTION_TYPE_LAST) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
if ((Edje_Action_Type)epr->action == action)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
if (action == EDJE_ACTION_TYPE_SCRIPT)
|
|
|
|
{
|
|
|
|
ps = eina_hash_find(eed->program_scripts, &epr->id);
|
|
|
|
if (!ps)
|
|
|
|
{
|
|
|
|
ps = _alloc(sizeof(Program_Script));
|
|
|
|
if (!ps)
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
ps->id = epr->id;
|
|
|
|
ps->code = strdup("");
|
|
|
|
ps->dirty = EINA_TRUE;
|
|
|
|
ps->delete_me = EINA_FALSE;
|
|
|
|
eina_hash_set(eed->program_scripts, &ps->id, ps);
|
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_FALSE);
|
|
|
|
}
|
|
|
|
if (epr->action == EDJE_ACTION_TYPE_SCRIPT)
|
|
|
|
{
|
|
|
|
ps = eina_hash_find(eed->program_scripts, &epr->id);
|
|
|
|
if (ps)
|
|
|
|
{
|
|
|
|
free(ps->code);
|
|
|
|
free(ps->processed);
|
|
|
|
ps->code = ps->processed = NULL;
|
|
|
|
ps->dirty = EINA_FALSE;
|
|
|
|
ps->delete_me = EINA_TRUE;
|
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
epr->action = action;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2014-06-05 10:41:46 -07:00
|
|
|
static Eina_List *
|
|
|
|
_edje_program_targets_get(Evas_Object *obj, Edje_Program *epr)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *targets = NULL;
|
|
|
|
Edje_Program_Target *t;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
//printf("GET TARGETS for program: %s [count: %d]\n", prog, eina_list_count(epr->targets));
|
|
|
|
EINA_LIST_FOREACH(epr->targets, l, t)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
if (epr->action == EDJE_ACTION_TYPE_STATE_SET)
|
|
|
|
{
|
|
|
|
/* the target is a part */
|
|
|
|
Edje_Real_Part *p = NULL;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
p = ed->table_parts[t->id % ed->table_parts_size];
|
|
|
|
if (p && p->part && p->part->name)
|
2008-10-22 04:34:42 -07:00
|
|
|
targets = eina_list_append(targets,
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_add(p->part->name));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP)
|
|
|
|
{
|
|
|
|
/* the target is a program */
|
|
|
|
Edje_Program *p;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
p = ed->collection->patterns.table_programs[t->id % ed->collection->patterns.table_programs_size];
|
2008-03-13 12:01:53 -07:00
|
|
|
if (p && p->name)
|
2008-10-22 04:34:42 -07:00
|
|
|
targets = eina_list_append(targets,
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_add(p->name));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
return targets;
|
|
|
|
}
|
|
|
|
|
2014-06-05 10:41:46 -07:00
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_program_targets_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
return _edje_program_targets_get(obj, epr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_targets_clear(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
while (epr->targets)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Program_Target *prt;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
prt = eina_list_data_get(epr->targets);
|
|
|
|
epr->targets = eina_list_remove_list(epr->targets, epr->targets);
|
2008-03-13 12:01:53 -07:00
|
|
|
free(prt);
|
|
|
|
}
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *target)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
Edje_Program_Target *t;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (epr->action == EDJE_ACTION_TYPE_STATE_SET)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
/* the target is a part */
|
|
|
|
Edje_Real_Part *rp;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
rp = _edje_real_part_get(ed, target);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
id = rp->part->id;
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
/* the target is a program */
|
|
|
|
Edje_Program *tar;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-03-13 12:01:53 -07:00
|
|
|
tar = _edje_program_get_byname(obj, target);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!tar) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
id = tar->id;
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
else
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-08-17 07:13:26 -07:00
|
|
|
t = _alloc(sizeof(Edje_Program_Target));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!t) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
t->id = id;
|
2008-10-22 04:34:42 -07:00
|
|
|
epr->targets = eina_list_append(epr->targets, t);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-03-25 04:19:46 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_program_target_del(Evas_Object *obj, const char *prog, const char *target)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Program_Target *t;
|
|
|
|
|
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
if (epr->action == EDJE_ACTION_TYPE_STATE_SET)
|
|
|
|
{
|
|
|
|
/* the target is a part */
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = _edje_real_part_get(ed, target);
|
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
id = rp->part->id;
|
|
|
|
}
|
|
|
|
else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP)
|
|
|
|
{
|
|
|
|
/* the target is a program */
|
|
|
|
Edje_Program *tar;
|
|
|
|
|
|
|
|
tar = _edje_program_get_byname(obj, target);
|
|
|
|
if (!tar) return EINA_FALSE;
|
|
|
|
id = tar->id;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(epr->targets, l, t)
|
|
|
|
if (t->id == id)
|
|
|
|
break;
|
|
|
|
epr->targets = eina_list_remove_list(epr->targets, l);
|
|
|
|
free(t);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-05 10:41:46 -07:00
|
|
|
static Eina_List *
|
|
|
|
_edje_program_afters_get(Evas_Object *obj, Edje_Program *epr)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *afters = NULL;
|
|
|
|
Edje_Program_After *a;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
// printf("GET AFTERS for program: %s [count: %d]\n", prog, eina_list_count(epr->after));
|
|
|
|
EINA_LIST_FOREACH(epr->after, l, a)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Program *p = NULL;
|
|
|
|
|
2013-02-13 19:36:13 -08:00
|
|
|
p = ed->collection->patterns.table_programs[a->id % ed->collection->patterns.table_programs_size];
|
2008-03-13 12:01:53 -07:00
|
|
|
if (p && p->name)
|
|
|
|
{
|
2009-10-26 14:28:39 -07:00
|
|
|
//printf(" a: %d name: %s\n", a->id, p->name);
|
2008-10-22 04:34:42 -07:00
|
|
|
afters = eina_list_append(afters, eina_stringshare_add(p->name));
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
return afters;
|
|
|
|
}
|
|
|
|
|
2014-06-05 10:41:46 -07:00
|
|
|
EAPI Eina_List *
|
|
|
|
edje_edit_program_afters_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
return _edje_program_afters_get(obj, epr);
|
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_afters_clear(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
while (epr->after)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Program_After *pa;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
pa = eina_list_data_get(epr->after);
|
|
|
|
epr->after = eina_list_remove_list(epr->after, epr->after);
|
2008-03-13 12:01:53 -07:00
|
|
|
free(pa);
|
|
|
|
}
|
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2009-09-15 20:37:28 -07:00
|
|
|
EAPI Eina_Bool
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *after)
|
|
|
|
{
|
|
|
|
Edje_Program *af;
|
|
|
|
Edje_Program_After *a;
|
2008-05-30 01:00:25 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
af = _edje_program_get_byname(obj, after);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!af) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-08-17 07:13:26 -07:00
|
|
|
a = _alloc(sizeof(Edje_Program_After));
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!a) return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
a->id = af->id;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
epr->after = eina_list_append(epr->after, a);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-04-20 12:57:17 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_program_after_del(Evas_Object *obj, const char *prog, const char *after)
|
|
|
|
{
|
|
|
|
Edje_Program *af;
|
|
|
|
Edje_Program_After *a;
|
2010-04-21 09:36:55 -07:00
|
|
|
Eina_List *l;
|
2010-04-20 12:57:17 -07:00
|
|
|
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
|
|
|
|
|
|
|
af = _edje_program_get_byname(obj, after);
|
|
|
|
if (!af) return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(epr->after, l, a)
|
|
|
|
if (a->id == af->id)
|
|
|
|
{
|
|
|
|
epr->after = eina_list_remove_list(epr->after, l);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-06-14 18:51:46 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/*************************/
|
|
|
|
/* EMBRYO SCRIPTS API */
|
|
|
|
/*************************/
|
2010-12-02 10:20:34 -08:00
|
|
|
EAPI char *
|
2008-03-06 11:48:11 -08:00
|
|
|
edje_edit_script_get(Evas_Object *obj)
|
|
|
|
{
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_EED_OR_RETURN(NULL);
|
2008-03-13 12:01:53 -07:00
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
if (!ed->collection) return NULL;
|
2010-12-02 10:20:34 -08:00
|
|
|
if (!eed->embryo_source) return NULL;
|
|
|
|
|
|
|
|
return strdup(eed->embryo_source);
|
|
|
|
}
|
|
|
|
|
2013-11-02 05:26:18 -07:00
|
|
|
EAPI Eina_Bool
|
2010-12-02 10:20:34 -08:00
|
|
|
edje_edit_script_set(Evas_Object *obj, const char *code)
|
|
|
|
{
|
2013-11-02 05:26:18 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
free(eed->embryo_source);
|
|
|
|
free(eed->embryo_processed);
|
|
|
|
|
|
|
|
if (code)
|
|
|
|
eed->embryo_source = strdup(code);
|
|
|
|
else
|
|
|
|
eed->embryo_source = NULL;
|
|
|
|
eed->embryo_processed = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
eed->embryo_source_dirty = EINA_TRUE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_FALSE);
|
2013-11-02 05:26:18 -07:00
|
|
|
return EINA_TRUE;
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI char *
|
|
|
|
edje_edit_script_program_get(Evas_Object *obj, const char *prog)
|
|
|
|
{
|
|
|
|
Program_Script *ps;
|
|
|
|
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN(NULL);
|
2010-12-02 10:20:34 -08:00
|
|
|
GET_EPR_OR_RETURN(NULL);
|
|
|
|
|
|
|
|
if (epr->action != EDJE_ACTION_TYPE_SCRIPT)
|
|
|
|
return NULL;
|
|
|
|
|
2013-11-02 05:26:18 -07:00
|
|
|
ps = eina_hash_find(eed->program_scripts, &epr->id);
|
2010-12-02 10:20:34 -08:00
|
|
|
if (!ps) /* mmm? it should be there, even if empty */
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return ps->code ? strdup(ps->code) : NULL;
|
|
|
|
}
|
|
|
|
|
2013-11-02 05:26:18 -07:00
|
|
|
EAPI Eina_Bool
|
2010-12-02 10:20:34 -08:00
|
|
|
edje_edit_script_program_set(Evas_Object *obj, const char *prog, const char *code)
|
|
|
|
{
|
|
|
|
Program_Script *ps;
|
|
|
|
|
2013-11-02 05:26:18 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
|
|
|
GET_EPR_OR_RETURN(EINA_FALSE);
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
if (epr->action != EDJE_ACTION_TYPE_SCRIPT)
|
2013-11-02 05:26:18 -07:00
|
|
|
return EINA_FALSE;
|
2010-12-02 10:20:34 -08:00
|
|
|
|
2013-11-02 05:26:18 -07:00
|
|
|
ps = eina_hash_find(eed->program_scripts, &epr->id);
|
2010-12-02 10:20:34 -08:00
|
|
|
if (!ps) /* ???? how so? */
|
2013-11-02 05:26:18 -07:00
|
|
|
return EINA_FALSE;
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
free(ps->code);
|
|
|
|
free(ps->processed);
|
|
|
|
|
|
|
|
if (code)
|
|
|
|
ps->code = strdup(code);
|
|
|
|
else
|
|
|
|
ps->code = NULL;
|
|
|
|
ps->processed = NULL;
|
|
|
|
ps->dirty = EINA_TRUE;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
_edje_edit_flag_script_dirty(eed, EINA_FALSE);
|
2013-11-02 05:26:18 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
static int
|
|
|
|
__part_replace(Edje_Edit *eed, char *pcode, char *name)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
|
|
|
|
id = _edje_part_id_find((Edje *)eed, name);
|
|
|
|
if (id < 0)
|
|
|
|
return 0;
|
|
|
|
return eina_convert_itoa(id, pcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
__program_replace(Edje_Edit *eed, char *pcode, char *name)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
|
|
|
|
id = _edje_program_id_find(eed, name);
|
|
|
|
if (id < 0)
|
|
|
|
return 0;
|
|
|
|
return eina_convert_itoa(id, pcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2013-01-03 18:08:14 -08:00
|
|
|
__group_replace(Edje_Edit *eed EINA_UNUSED, char *pcode, char *name)
|
2010-12-02 10:20:34 -08:00
|
|
|
{
|
|
|
|
strcpy(pcode, name);
|
|
|
|
return strlen(name) + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
__image_replace(Edje_Edit *eed, char *pcode, char *name)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
|
|
|
|
id = _edje_image_id_find(eed, name);
|
|
|
|
if (id < 0)
|
|
|
|
return 0;
|
|
|
|
return eina_convert_itoa(id, pcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2010-12-07 11:06:53 -08:00
|
|
|
_edje_edit_script_process(Edje_Edit *eed, const char *progname, char *code)
|
2010-12-02 10:20:34 -08:00
|
|
|
{
|
|
|
|
char *pcode, *psrc, *pdst;
|
|
|
|
int codesize, pcodesize;
|
|
|
|
int quoted = 0, escaped = 0;
|
2010-12-07 11:06:53 -08:00
|
|
|
int line = 1;
|
2010-12-02 10:20:34 -08:00
|
|
|
Eina_Bool success = EINA_TRUE;
|
|
|
|
|
|
|
|
codesize = strlen(code);
|
|
|
|
pcode = malloc(codesize + 1);
|
|
|
|
if (!pcode)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pcodesize = 0;
|
|
|
|
psrc = code;
|
|
|
|
pdst = pcode;
|
|
|
|
while (*psrc)
|
|
|
|
{
|
|
|
|
if (!quoted)
|
|
|
|
{
|
|
|
|
char *ptr = NULL;
|
2010-12-07 11:06:53 -08:00
|
|
|
const char *what = NULL;
|
2010-12-02 10:20:34 -08:00
|
|
|
int (*func)(Edje_Edit *, char *, char *);
|
|
|
|
|
|
|
|
if (*psrc == 'P')
|
|
|
|
{
|
|
|
|
if (!strncmp(psrc, "PART:\"", 6))
|
|
|
|
{
|
|
|
|
psrc += 6;
|
|
|
|
ptr = psrc;
|
|
|
|
func = __part_replace;
|
2010-12-07 11:06:53 -08:00
|
|
|
what = "part";
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
else if (!strncmp(psrc, "PROGRAM:\"", 9))
|
|
|
|
{
|
|
|
|
psrc += 9;
|
|
|
|
ptr = psrc;
|
|
|
|
func = __program_replace;
|
2010-12-07 11:06:53 -08:00
|
|
|
what = "program";
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (*psrc == 'G')
|
|
|
|
{
|
|
|
|
if (!strncmp(psrc, "GROUP:\"", 7))
|
|
|
|
{
|
|
|
|
psrc += 7;
|
|
|
|
ptr = psrc;
|
|
|
|
func = __group_replace;
|
2010-12-07 11:06:53 -08:00
|
|
|
what = "group";
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (*psrc == 'I')
|
|
|
|
{
|
|
|
|
if (!strncmp(psrc, "IMAGE:\"", 7))
|
|
|
|
{
|
|
|
|
psrc += 7;
|
|
|
|
ptr = psrc;
|
|
|
|
func = __image_replace;
|
2010-12-07 11:06:53 -08:00
|
|
|
what = "image";
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (*psrc == '#')
|
|
|
|
{
|
|
|
|
while (*psrc)
|
|
|
|
if (*psrc == '\n')
|
|
|
|
break;
|
2010-12-07 11:06:53 -08:00
|
|
|
line++;
|
2010-12-02 10:20:34 -08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (*psrc == '\"')
|
|
|
|
quoted = 1;
|
2010-12-07 11:06:53 -08:00
|
|
|
else if (*psrc == '\n')
|
|
|
|
line++;
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
if (ptr)
|
|
|
|
{
|
|
|
|
int i = 0, inesc = 0;
|
|
|
|
char *name;
|
|
|
|
while (*psrc)
|
|
|
|
{
|
|
|
|
if (!inesc)
|
|
|
|
{
|
|
|
|
if (*psrc == '\\')
|
|
|
|
inesc = 1;
|
|
|
|
else if (*psrc == '\"')
|
|
|
|
{
|
|
|
|
/* string concatenation as in "foo""bar" */
|
|
|
|
if (*(psrc + 1) != '\"')
|
|
|
|
{
|
|
|
|
psrc++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
psrc++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
inesc = 0;
|
|
|
|
psrc++;
|
|
|
|
}
|
|
|
|
name = alloca(psrc - ptr);
|
|
|
|
inesc = 0;
|
|
|
|
while (*ptr)
|
|
|
|
{
|
|
|
|
if (!inesc)
|
|
|
|
{
|
|
|
|
if (*ptr == '\\')
|
|
|
|
inesc = 1;
|
|
|
|
else if (*ptr == '\"')
|
|
|
|
{
|
|
|
|
if (*(ptr + 1) == '\"')
|
|
|
|
ptr++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
name[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
name[i] = *ptr;
|
|
|
|
name[i + 1] = 0;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
inesc = 0;
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
i = func(eed, pdst, name);
|
|
|
|
if (!i)
|
|
|
|
{
|
2010-12-07 11:06:53 -08:00
|
|
|
Edje_Edit_Script_Error *se;
|
|
|
|
se = malloc(sizeof(Edje_Edit_Script_Error));
|
|
|
|
se->program_name = progname ?
|
|
|
|
eina_stringshare_add(progname) : NULL;
|
|
|
|
se->line = line;
|
|
|
|
se->error_str = eina_stringshare_printf(
|
|
|
|
"Referenced %s '%s' could not be found in object.",
|
|
|
|
what, name);
|
|
|
|
eed->errors = eina_list_append(eed->errors, se);
|
2010-12-02 10:20:34 -08:00
|
|
|
success = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pcodesize += i;
|
|
|
|
pdst += i;
|
|
|
|
}
|
|
|
|
/* replaced reference for the right value, now go
|
|
|
|
* to the next iteration */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!escaped)
|
|
|
|
{
|
|
|
|
if (*psrc == '\"')
|
|
|
|
quoted = 0;
|
|
|
|
else if (*psrc == '\\')
|
|
|
|
escaped = 1;
|
|
|
|
}
|
|
|
|
else if (escaped)
|
|
|
|
escaped = 0;
|
|
|
|
}
|
|
|
|
*pdst = *psrc;
|
|
|
|
pdst++;
|
|
|
|
psrc++;
|
|
|
|
pcodesize++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!success)
|
|
|
|
{
|
|
|
|
free(pcode);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pcodesize < codesize)
|
|
|
|
pcode = realloc(pcode, pcodesize + 1);
|
|
|
|
pcode[pcodesize] = 0;
|
|
|
|
|
|
|
|
return pcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_edit_embryo_rebuild(Edje_Edit *eed)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
int fd, size, ret;
|
|
|
|
const char *tmp_dir;
|
|
|
|
char tmp_in[PATH_MAX];
|
|
|
|
char tmp_out[PATH_MAX];
|
2013-01-04 09:19:43 -08:00
|
|
|
char embryo_cc_path[PATH_MAX] = "";
|
|
|
|
char inc_path[PATH_MAX] = "";
|
2010-12-02 10:20:34 -08:00
|
|
|
char buf[4096];
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Program_Script *ps;
|
|
|
|
Edje_Part_Collection *edc;
|
|
|
|
Eina_Bool success = EINA_TRUE; /* we are optimists! */
|
2010-12-07 11:06:53 -08:00
|
|
|
Edje_Edit_Script_Error *se;
|
2013-01-04 09:19:43 -08:00
|
|
|
Eina_Prefix *pfx;
|
2010-12-07 11:06:53 -08:00
|
|
|
|
|
|
|
EINA_LIST_FREE(eed->errors, se)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(se->program_name);
|
|
|
|
eina_stringshare_del(se->error_str);
|
|
|
|
free(se);
|
|
|
|
}
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_EVIL
|
|
|
|
tmp_dir = evil_tmpdir_get();
|
|
|
|
#else
|
|
|
|
tmp_dir = "/tmp";
|
|
|
|
#endif
|
|
|
|
|
2013-01-04 09:19:43 -08:00
|
|
|
pfx = eina_prefix_new(NULL, /* argv[0] value (optional) */
|
|
|
|
edje_init, /* an optional symbol to check path of */
|
|
|
|
"EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
|
|
|
|
"edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */
|
|
|
|
"include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
|
|
|
|
PACKAGE_BIN_DIR, /* package bin dir @ compile time */
|
|
|
|
PACKAGE_LIB_DIR, /* package lib dir @ compile time */
|
|
|
|
PACKAGE_DATA_DIR, /* package data dir @ compile time */
|
|
|
|
PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */
|
|
|
|
);
|
|
|
|
#ifdef _WIN32
|
|
|
|
# define BIN_EXT ".exe"
|
|
|
|
#else
|
|
|
|
# define BIN_EXT
|
|
|
|
#endif
|
2014-01-08 05:06:41 -08:00
|
|
|
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
|
|
|
|
if (getuid() == geteuid())
|
|
|
|
#endif
|
2013-01-04 09:19:43 -08:00
|
|
|
{
|
2014-01-08 02:46:23 -08:00
|
|
|
if (getenv("EFL_RUN_IN_TREE"))
|
|
|
|
{
|
|
|
|
snprintf(embryo_cc_path, sizeof(embryo_cc_path),
|
|
|
|
"%s/src/bin/embryo/embryo_cc" BIN_EXT,
|
|
|
|
PACKAGE_BUILD_DIR);
|
|
|
|
snprintf(inc_path, sizeof(inc_path),
|
|
|
|
"%s/data/edje/include", PACKAGE_BUILD_DIR);
|
|
|
|
if (!ecore_file_exists(embryo_cc_path))
|
|
|
|
embryo_cc_path[0] = '\0';
|
|
|
|
}
|
2013-01-04 09:19:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (embryo_cc_path[0] == '\0')
|
|
|
|
{
|
|
|
|
snprintf(embryo_cc_path, sizeof(embryo_cc_path),
|
|
|
|
"%s/embryo_cc" BIN_EXT,
|
|
|
|
eina_prefix_bin_get(pfx));
|
|
|
|
snprintf(inc_path, sizeof(inc_path),
|
|
|
|
"%s/include",
|
|
|
|
eina_prefix_data_get(pfx));
|
|
|
|
}
|
|
|
|
#undef BIN_EXT
|
|
|
|
|
|
|
|
eina_prefix_free(pfx);
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
snprintf(tmp_in, sizeof(tmp_in), "%s/edje_edit.sma-tmp-XXXXXX", tmp_dir);
|
|
|
|
snprintf(tmp_out, sizeof(tmp_out), "%s/edje_edit.amx-tmp-XXXXXX", tmp_dir);
|
|
|
|
|
|
|
|
fd = mkstemp(tmp_in);
|
|
|
|
if (fd < 0)
|
|
|
|
return EINA_FALSE; /* FIXME: report something */
|
|
|
|
|
|
|
|
f = fdopen(fd, "w");
|
|
|
|
if (!f)
|
|
|
|
{
|
|
|
|
close(fd);
|
|
|
|
unlink(tmp_in);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(f, "#include <edje>\n");
|
|
|
|
if (eed->embryo_source)
|
|
|
|
{
|
|
|
|
if (eed->all_dirty)
|
|
|
|
{
|
|
|
|
free(eed->embryo_processed);
|
|
|
|
eed->embryo_processed = NULL;
|
|
|
|
}
|
|
|
|
if (!eed->embryo_processed)
|
2010-12-07 11:06:53 -08:00
|
|
|
eed->embryo_processed = _edje_edit_script_process(eed, NULL,
|
2010-12-02 10:20:34 -08:00
|
|
|
eed->embryo_source);
|
|
|
|
if (!eed->embryo_processed)
|
|
|
|
{
|
|
|
|
/* oops.. an error finding references parts or something.
|
|
|
|
* we could flag it and do some lighter processing of the
|
|
|
|
* rest of the scripts, in order to find all the errors of
|
|
|
|
* this kind and report them at once, but knowing already
|
|
|
|
* that the script will not compile we can avoid some work
|
|
|
|
*/
|
|
|
|
success = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
2010-12-03 10:21:56 -08:00
|
|
|
fprintf(f, "%s", eed->embryo_processed);
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
it = eina_hash_iterator_data_new(eed->program_scripts);
|
|
|
|
EINA_ITERATOR_FOREACH(it, ps)
|
|
|
|
{
|
2010-12-07 11:06:53 -08:00
|
|
|
Edje_Program *epr;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
if (ps->delete_me)
|
|
|
|
continue;
|
|
|
|
if (eed->all_dirty)
|
|
|
|
{
|
|
|
|
free(ps->processed);
|
|
|
|
ps->processed = NULL;
|
|
|
|
}
|
2013-02-13 19:36:13 -08:00
|
|
|
epr = eed->base->collection->patterns.table_programs[ps->id];
|
2010-12-02 10:20:34 -08:00
|
|
|
if (!ps->processed)
|
2010-12-07 11:06:53 -08:00
|
|
|
ps->processed = _edje_edit_script_process(eed, epr->name, ps->code);
|
2010-12-02 10:20:34 -08:00
|
|
|
if (!ps->processed)
|
|
|
|
{
|
|
|
|
/* oops.. an error finding references parts or something.
|
|
|
|
* we could flag it and do some lighter processing of the
|
|
|
|
* rest of the scripts, in order to find all the errors of
|
|
|
|
* this kind and report them at once, but knowing already
|
|
|
|
* that the script will not compile we can avoid some work
|
|
|
|
*/
|
|
|
|
success = EINA_FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
fprintf(f, "public _p%i(sig[], src[]) {\n", ps->id);
|
2010-12-03 10:21:56 -08:00
|
|
|
fprintf(f, "%s", ps->processed);
|
2010-12-02 10:20:34 -08:00
|
|
|
fprintf(f, "}\n");
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
|
2010-12-03 06:00:04 -08:00
|
|
|
if (!success)
|
|
|
|
goto almost_out;
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
fd = mkstemp(tmp_out);
|
|
|
|
if (fd < 0)
|
|
|
|
{
|
|
|
|
success = EINA_FALSE;
|
|
|
|
goto almost_out;
|
|
|
|
}
|
|
|
|
|
2013-01-04 09:19:43 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s -i %s -o %s %s",
|
|
|
|
embryo_cc_path, inc_path, tmp_out, tmp_in);
|
2010-12-02 10:20:34 -08:00
|
|
|
ret = system(buf);
|
|
|
|
|
|
|
|
if ((ret < 0) || (ret > 1))
|
|
|
|
{
|
|
|
|
success = EINA_FALSE;
|
|
|
|
close(fd);
|
2010-12-03 06:00:04 -08:00
|
|
|
goto the_doorway;
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
f = fdopen(fd, "rb");
|
|
|
|
if (!f)
|
|
|
|
{
|
|
|
|
success = EINA_FALSE;
|
|
|
|
close(fd);
|
2010-12-03 06:00:04 -08:00
|
|
|
goto the_doorway;
|
2010-12-02 10:20:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fseek(f, 0, SEEK_END);
|
|
|
|
size = ftell(f);
|
|
|
|
rewind(f);
|
|
|
|
|
|
|
|
free(eed->bytecode);
|
|
|
|
if (size > 0)
|
|
|
|
{
|
|
|
|
eed->bytecode = malloc(size);
|
|
|
|
if (!eed->bytecode)
|
|
|
|
{
|
|
|
|
success = EINA_FALSE;
|
|
|
|
goto the_way_out;
|
|
|
|
}
|
|
|
|
if (fread(eed->bytecode, size, 1, f) != 1)
|
|
|
|
{
|
|
|
|
success = EINA_FALSE;
|
|
|
|
goto the_way_out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
eed->bytecode = NULL; /* correctness mostly, I don't see why we
|
|
|
|
would get a 0 sized program */
|
|
|
|
|
|
|
|
eed->bytecode_size = size;
|
|
|
|
eed->bytecode_dirty = EINA_TRUE;
|
|
|
|
eed->script_need_recompile = EINA_FALSE;
|
|
|
|
eed->all_dirty = EINA_FALSE;
|
|
|
|
|
2012-10-21 06:35:16 -07:00
|
|
|
edc = eed->base->collection;
|
2010-12-02 10:20:34 -08:00
|
|
|
embryo_program_free(edc->script);
|
|
|
|
edc->script = embryo_program_new(eed->bytecode, eed->bytecode_size);
|
|
|
|
_edje_embryo_script_init(edc);
|
|
|
|
_edje_var_init((Edje *)eed);
|
|
|
|
|
|
|
|
the_way_out:
|
|
|
|
fclose(f);
|
2010-12-03 06:00:04 -08:00
|
|
|
the_doorway:
|
2010-12-02 10:20:34 -08:00
|
|
|
unlink(tmp_out);
|
|
|
|
almost_out:
|
|
|
|
unlink(tmp_in);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_edit_script_compile(Evas_Object *obj)
|
|
|
|
{
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-12-02 10:20:34 -08:00
|
|
|
|
|
|
|
if (!eed->script_need_recompile)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return _edje_edit_embryo_rebuild(eed);
|
|
|
|
}
|
2008-10-08 17:04:18 -07:00
|
|
|
|
2010-12-07 11:06:53 -08:00
|
|
|
EAPI const Eina_List *
|
|
|
|
edje_edit_script_error_list_get(Evas_Object *obj)
|
|
|
|
{
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN(NULL);
|
2010-12-07 11:06:53 -08:00
|
|
|
return eed->errors;
|
|
|
|
}
|
|
|
|
|
2008-10-08 17:04:18 -07:00
|
|
|
/***************************/
|
|
|
|
/* EDC SOURCE GENERATION */
|
|
|
|
/***************************/
|
2008-06-13 18:13:16 -07:00
|
|
|
#define I0 ""
|
|
|
|
#define I1 " "
|
|
|
|
#define I2 " "
|
|
|
|
#define I3 " "
|
|
|
|
#define I4 " "
|
|
|
|
#define I5 " "
|
|
|
|
#define I6 " "
|
2008-10-07 07:11:11 -07:00
|
|
|
#define I7 " "
|
2008-06-13 18:13:16 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
#define BUF_APPEND(STR) \
|
|
|
|
ret &= eina_strbuf_append(buf, STR)
|
|
|
|
|
|
|
|
#define BUF_APPENDF(FMT, ...) \
|
|
|
|
ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__)
|
|
|
|
|
2014-03-24 00:05:25 -07:00
|
|
|
#define COLLECT_RESOURCE(condition_data, list) \
|
|
|
|
if (condition_data) \
|
|
|
|
{ \
|
|
|
|
if (!eina_list_data_find(list, condition_data)) \
|
|
|
|
list = eina_list_append(list, condition_data); \
|
|
|
|
}
|
|
|
|
|
2013-12-22 16:47:51 -08:00
|
|
|
static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "PROXY", "SPACER"};
|
2014-04-01 03:11:27 -07:00
|
|
|
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 *shadow_direction[] = {"BOTTOM_RIGHT", "BOTTOM", "BOTTOM_LEFT", "LEFT", "TOP_LEFT", "TOP", "TOP_RIGHT", "RIGHT"};
|
2010-08-17 05:15:04 -07:00
|
|
|
static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"};
|
2014-06-06 09:26:16 -07:00
|
|
|
static const char *entry_mode[] = {"NONE", "PLAIN", "EDITABLE", "PASSWORD"};
|
2008-09-23 10:47:31 -07:00
|
|
|
|
2014-03-24 00:05:25 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf);
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf);
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf);
|
|
|
|
|
2014-06-05 14:28:25 -07:00
|
|
|
static Eina_Strbuf *
|
2014-03-24 00:05:25 -07:00
|
|
|
_edje_generate_image_source(Evas_Object *obj, const char *entry)
|
|
|
|
{
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
Eina_Bool ret = EINA_TRUE;
|
|
|
|
if (!buf) return NULL;
|
|
|
|
|
|
|
|
int comp = edje_edit_image_compression_type_get(obj, entry);
|
2014-06-05 14:28:25 -07:00
|
|
|
if (comp < 0) goto error;
|
2014-03-24 00:05:25 -07:00
|
|
|
|
|
|
|
BUF_APPENDF("image: \"%s\" ", entry);
|
|
|
|
|
|
|
|
if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY)
|
|
|
|
BUF_APPENDF("LOSSY %d;\n",
|
|
|
|
edje_edit_image_compression_rate_get(obj, entry));
|
2014-04-18 00:39:37 -07:00
|
|
|
else if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1)
|
|
|
|
BUF_APPENDF("LOSSY_ETC1 %d;\n",
|
|
|
|
edje_edit_image_compression_rate_get(obj, entry));
|
2014-03-24 00:05:25 -07:00
|
|
|
else if (comp == EDJE_EDIT_IMAGE_COMP_RAW)
|
|
|
|
BUF_APPEND("RAW;\n");
|
|
|
|
else if (comp == EDJE_EDIT_IMAGE_COMP_USER)
|
|
|
|
BUF_APPEND("USER;\n");
|
|
|
|
else
|
|
|
|
BUF_APPEND("COMP;\n");
|
|
|
|
|
2014-06-05 14:28:25 -07:00
|
|
|
if (!ret) goto error;
|
2014-03-24 00:05:25 -07:00
|
|
|
|
2014-06-05 14:28:25 -07:00
|
|
|
return buf;
|
|
|
|
|
|
|
|
error:
|
|
|
|
ERR("Generating EDC for Image");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
2014-03-24 00:05:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EAPI const char *
|
|
|
|
edje_edit_source_generate(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
|
|
|
Edje_Part *part;
|
|
|
|
Edje_Part_Description_Common *part_desc;
|
|
|
|
Edje_Part_Description_Image *part_desc_image;
|
|
|
|
Edje_Part_Description_Text *part_desc_text;
|
|
|
|
unsigned int i, j;
|
|
|
|
const char *entry;
|
2014-06-05 15:05:06 -07:00
|
|
|
const char *str;
|
|
|
|
Eina_Strbuf *buf = NULL;
|
2014-03-24 00:05:25 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
|
|
|
Eina_List *images = NULL, *color_classes = NULL, *styles = NULL, *fonts = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
|
2014-05-07 08:32:49 -07:00
|
|
|
GET_ED_OR_RETURN(NULL);
|
|
|
|
GET_EED_OR_RETURN(NULL);
|
2014-03-24 00:05:25 -07:00
|
|
|
|
|
|
|
if (!ed->file) return NULL;
|
|
|
|
|
|
|
|
ce = eina_hash_find(ed->file->collection, ed->group);
|
2014-05-07 08:32:49 -07:00
|
|
|
if (!ce) return NULL;
|
2014-03-24 00:05:25 -07:00
|
|
|
|
|
|
|
/* Go through all of group's parts to find all resources needed for that group. */
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
part = ed->table_parts[i]->part;
|
|
|
|
part_desc = (Edje_Part_Description_Common *)part->default_desc;
|
|
|
|
|
|
|
|
/* find all image parts and collect all images required by those parts. */
|
|
|
|
if (part->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
/* parse "default" description of this part. */
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->default_desc;
|
|
|
|
/* find image name according to it's id that is in description */
|
|
|
|
entry = _edje_image_name_find(eed, part_desc_image->image.id);
|
|
|
|
COLLECT_RESOURCE(entry, images);
|
|
|
|
/* look through all other's descriptions. */
|
|
|
|
for (j = 0; j < part->other.desc_count; j++)
|
|
|
|
{
|
|
|
|
part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j];
|
|
|
|
entry = _edje_image_name_find(eed, part_desc_image->image.id);
|
|
|
|
COLLECT_RESOURCE(entry, images);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* find all text, textblock part and fonts, styles required by those parts. */
|
|
|
|
if ((part->type == EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(part->type == EDJE_PART_TYPE_TEXT))
|
|
|
|
{
|
|
|
|
part_desc_text = (Edje_Part_Description_Text *)part->default_desc;
|
|
|
|
COLLECT_RESOURCE(part_desc_text->text.style.str, styles);
|
|
|
|
if (part_desc_text->text.font.str)
|
|
|
|
{
|
|
|
|
Edje_Font_Directory_Entry *fnt;
|
|
|
|
fnt = eina_hash_find(ed->file->fonts, part_desc_text->text.font.str);
|
|
|
|
COLLECT_RESOURCE(fnt, fonts);
|
|
|
|
}
|
|
|
|
for (j = 0; j < part->other.desc_count; j++)
|
|
|
|
{
|
|
|
|
part_desc_text = (Edje_Part_Description_Text *)part->other.desc[j];
|
|
|
|
COLLECT_RESOURCE(part_desc_text->text.style.str, styles);
|
|
|
|
if (part_desc_text->text.font.str)
|
|
|
|
{
|
|
|
|
Edje_Font_Directory_Entry *fnt;
|
|
|
|
fnt = eina_hash_find(ed->file->fonts, part_desc_text->text.font.str);
|
|
|
|
COLLECT_RESOURCE(fnt, fonts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* find all color_classes required by those every part. */
|
|
|
|
COLLECT_RESOURCE(part_desc->color_class, color_classes);
|
|
|
|
for (j = 0; j < part->other.desc_count; j++)
|
|
|
|
{
|
|
|
|
part_desc = part->other.desc[j];
|
|
|
|
COLLECT_RESOURCE(part_desc->color_class, color_classes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-05 15:05:06 -07:00
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
2014-03-24 00:05:25 -07:00
|
|
|
/* if images were found, print them */
|
|
|
|
if (images)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I0"images {\n");
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(images, l, entry)
|
|
|
|
{
|
2014-06-07 23:42:27 -07:00
|
|
|
Eina_Strbuf *gen_buf = _edje_generate_image_source(obj, entry);
|
|
|
|
if (!gen_buf) continue;
|
2014-06-05 14:28:25 -07:00
|
|
|
|
2014-06-07 23:42:27 -07:00
|
|
|
BUF_APPENDF(I1"%s", eina_strbuf_string_get(gen_buf));
|
|
|
|
eina_strbuf_free(gen_buf);
|
2014-03-24 00:05:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
BUF_APPEND(I0"}\n\n");
|
|
|
|
}
|
|
|
|
/* if styles were found, print them */
|
|
|
|
if (styles)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I0 "styles {\n");
|
|
|
|
EINA_LIST_FOREACH(styles, l, entry)
|
|
|
|
_edje_generate_source_of_style(ed, entry, buf);
|
|
|
|
BUF_APPEND(I0 "}\n\n");
|
|
|
|
}
|
|
|
|
/* if fonts were found, print them */
|
|
|
|
if (fonts)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I0 "fonts {\n");
|
|
|
|
Edje_Font_Directory_Entry *fnt;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(fonts, l, fnt)
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I1"font: \"%s\" \"%s\";\n", fnt->file,
|
|
|
|
fnt->entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
BUF_APPEND(I0 "}\n\n");
|
|
|
|
}
|
|
|
|
/* if color_classes were found, print them */
|
|
|
|
if (color_classes)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I0 "color_classes {\n");
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(color_classes, l, entry)
|
|
|
|
_edje_generate_source_of_colorclass(ed, entry, buf);
|
|
|
|
|
|
|
|
BUF_APPEND(I0 "}\n\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* print the main code of group collections */
|
|
|
|
BUF_APPEND(I0"collections {\n");
|
|
|
|
_edje_generate_source_of_group(ed, ce, buf);
|
|
|
|
BUF_APPEND(I0"}");
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for This Group.");
|
2014-06-05 15:05:06 -07:00
|
|
|
eina_strbuf_free(buf);
|
2014-03-24 00:05:25 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return resulted source code of the group */
|
2014-06-05 15:05:06 -07:00
|
|
|
str = eina_stringshare_add(eina_strbuf_string_get(buf));
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return str;
|
2014-03-24 00:05:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef COLLECT_RESOURCE
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf)
|
2008-09-28 15:45:47 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2008-09-28 15:45:47 -07:00
|
|
|
Edje_Color_Class *cc;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2008-09-28 15:45:47 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if (!strcmp(cc->name, name))
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I1 "color_class { name: \"%s\";\n", cc->name);
|
|
|
|
BUF_APPENDF(I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a);
|
|
|
|
BUF_APPENDF(I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2);
|
|
|
|
BUF_APPENDF(I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3);
|
|
|
|
BUF_APPEND(I1 "}\n");
|
2008-10-22 04:34:42 -07:00
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
return ret;
|
2008-09-28 15:45:47 -07:00
|
|
|
}
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf)
|
2008-11-02 06:10:11 -08:00
|
|
|
{
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
Edje_Style *s;
|
|
|
|
Edje_Style_Tag *t;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2008-11-02 06:10:11 -08:00
|
|
|
|
2013-12-22 16:47:51 -08:00
|
|
|
int len, i;
|
|
|
|
#define ESCAPE_VAL(VAL) \
|
|
|
|
for (i = 0, len = strlen(VAL); i < len; i++) \
|
|
|
|
switch(VAL[i]) \
|
|
|
|
{ \
|
|
|
|
case '\n': \
|
|
|
|
{ \
|
|
|
|
BUF_APPENDF("%s", "\\n"); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
case '\t': \
|
|
|
|
{ \
|
|
|
|
BUF_APPENDF("%s", "\\t"); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
case '"': \
|
|
|
|
{ \
|
|
|
|
BUF_APPENDF("%s", "\\\""); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
case '\\': \
|
|
|
|
{ \
|
|
|
|
BUF_APPENDF("%s", "\\\\"); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
default: BUF_APPENDF("%c", VAL[i]); \
|
|
|
|
}
|
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
EINA_LIST_FOREACH(ed->file->styles, l, s)
|
|
|
|
if (!strcmp(s->name, name))
|
|
|
|
{
|
|
|
|
t = s->tags ? s->tags->data : NULL;
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I1 "style { name:\"%s\";\n", s->name);
|
|
|
|
if (t && t->value)
|
2013-12-22 16:47:51 -08:00
|
|
|
{
|
|
|
|
BUF_APPEND(I2 "base: \"");
|
|
|
|
ESCAPE_VAL(t->value);
|
|
|
|
BUF_APPEND("\";\n");
|
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
|
2008-11-02 06:10:11 -08:00
|
|
|
EINA_LIST_FOREACH(s->tags, ll, t)
|
|
|
|
if (ll->prev && t && t->value)
|
2013-12-22 16:47:51 -08:00
|
|
|
{
|
|
|
|
BUF_APPENDF(I2 "tag: \"%s\" \"", t->key);
|
|
|
|
ESCAPE_VAL(t->value);
|
|
|
|
BUF_APPEND("\";\n");
|
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I1 "}\n");
|
|
|
|
return ret;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
2013-12-22 16:47:51 -08:00
|
|
|
#undef ESCAPE_VAL
|
2010-04-09 09:05:17 -07:00
|
|
|
return EINA_FALSE;
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Strbuf *buf)
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *ll;
|
2008-09-23 10:47:31 -07:00
|
|
|
const char *s, *s2;
|
|
|
|
double db, db2;
|
2008-10-22 04:34:42 -07:00
|
|
|
char *data;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2010-06-14 18:51:46 -07:00
|
|
|
const char *api_name, *api_description;
|
2010-12-02 10:20:34 -08:00
|
|
|
Edje_Program *epr;
|
2008-09-23 10:47:31 -07:00
|
|
|
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2008-09-23 10:47:31 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
epr = _edje_program_get_byname(obj, program);
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I3"program { name: \"%s\";\n", program);
|
2008-09-23 10:47:31 -07:00
|
|
|
|
|
|
|
/* Signal */
|
2014-06-05 10:41:46 -07:00
|
|
|
if ((s = eina_stringshare_add(epr->signal)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"signal: \"%s\";\n", s);
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_free(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Source */
|
2014-06-05 10:41:46 -07:00
|
|
|
if ((s = eina_stringshare_add(epr->source)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"source: \"%s\";\n", s);
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_free(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Action */
|
2014-06-05 10:41:46 -07:00
|
|
|
switch (epr->action)
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
|
|
|
case EDJE_ACTION_TYPE_ACTION_STOP:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I4"action: ACTION_STOP;\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
break;
|
|
|
|
case EDJE_ACTION_TYPE_STATE_SET:
|
2014-06-05 10:41:46 -07:00
|
|
|
if ((s = eina_stringshare_add(epr->state)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"action: STATE_SET \"%s\" %.2f;\n", s,
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_program_value_get(obj, program));
|
|
|
|
edje_edit_string_free(s);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDJE_ACTION_TYPE_SIGNAL_EMIT:
|
2014-06-05 10:41:46 -07:00
|
|
|
s = eina_stringshare_add(epr->state);
|
|
|
|
s2 = eina_stringshare_add(epr->state2);
|
2008-09-23 10:47:31 -07:00
|
|
|
if (s && s2)
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"action: SIGNAL_EMIT \"%s\" \"%s\";\n", s, s2);
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_free(s);
|
|
|
|
edje_edit_string_free(s2);
|
|
|
|
}
|
|
|
|
break;
|
2010-12-02 10:20:34 -08:00
|
|
|
case EDJE_ACTION_TYPE_SCRIPT:
|
|
|
|
{
|
|
|
|
Program_Script *ps;
|
|
|
|
|
|
|
|
ps = eina_hash_find(eed->program_scripts, &epr->id);
|
|
|
|
if (ps && !ps->delete_me)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I4"script {\n");
|
|
|
|
BUF_APPEND(ps->code);
|
|
|
|
BUF_APPEND(I4"}\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2014-06-10 08:14:59 -07:00
|
|
|
case EDJE_ACTION_TYPE_SOUND_SAMPLE:
|
|
|
|
{
|
|
|
|
BUF_APPEND(I4"action: PLAY_SAMPLE ");
|
|
|
|
BUF_APPENDF("\"%s\" %.000f", epr->sample_name, epr->speed);
|
|
|
|
switch (epr->channel)
|
|
|
|
{
|
|
|
|
case EDJE_CHANNEL_BACKGROUND:
|
|
|
|
{
|
|
|
|
BUF_APPEND(" BACKGROUND");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_CHANNEL_MUSIC:
|
|
|
|
{
|
|
|
|
BUF_APPEND(" MUSIC");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_CHANNEL_FOREGROUND:
|
|
|
|
{
|
|
|
|
BUF_APPEND(" FOREGROUND");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_CHANNEL_INTERFACE:
|
|
|
|
{
|
|
|
|
BUF_APPEND(" INTERFACE");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_CHANNEL_INPUT:
|
|
|
|
{
|
|
|
|
BUF_APPEND(" INPUT");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_CHANNEL_ALERT:
|
|
|
|
{
|
|
|
|
BUF_APPEND(" ALERT");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
BUF_APPENDF(";\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_ACTION_TYPE_SOUND_TONE:
|
|
|
|
{
|
|
|
|
BUF_APPEND(I4"action: PLAY_TONE ");
|
|
|
|
BUF_APPENDF("\"%s\" %.000f\n;", epr->tone_name, epr->duration);
|
|
|
|
break;
|
|
|
|
}
|
2008-10-07 14:13:27 -07:00
|
|
|
//TODO Support Drag
|
2008-09-23 10:47:31 -07:00
|
|
|
//~ case EDJE_ACTION_TYPE_DRAG_VAL_SET:
|
2010-04-09 09:05:17 -07:00
|
|
|
//~ eina_strbuf_append(buf, I4"action: DRAG_VAL_SET TODO;\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
//~ break;
|
|
|
|
//~ case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
|
2010-04-09 09:05:17 -07:00
|
|
|
//~ eina_strbuf_append(buf, I4"action: DRAG_VAL_STEP TODO;\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
//~ break;
|
|
|
|
//~ case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
|
2010-04-09 09:05:17 -07:00
|
|
|
//~ eina_strbuf_append(buf, I4"action: DRAG_VAL_PAGE TODO;\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
//~ break;
|
2010-04-09 09:05:17 -07:00
|
|
|
default:
|
|
|
|
break;
|
2008-09-23 10:47:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Transition */
|
2014-06-05 10:41:46 -07:00
|
|
|
db = TO_DOUBLE(epr->tween.time);
|
|
|
|
switch (epr->tween.mode)
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
|
|
|
case EDJE_TWEEN_MODE_LINEAR:
|
2010-08-11 09:23:48 -07:00
|
|
|
if (db)
|
|
|
|
BUF_APPENDF(I4"transition: LINEAR %.5f;\n", db);
|
2008-09-23 10:47:31 -07:00
|
|
|
break;
|
|
|
|
case EDJE_TWEEN_MODE_ACCELERATE:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"transition: ACCELERATE %.5f;\n", db);
|
2008-09-23 10:47:31 -07:00
|
|
|
break;
|
|
|
|
case EDJE_TWEEN_MODE_DECELERATE:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"transition: DECELERATE %.5f;\n", db);
|
2008-09-23 10:47:31 -07:00
|
|
|
break;
|
|
|
|
case EDJE_TWEEN_MODE_SINUSOIDAL:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"transition: SINUSOIDAL %.5f;\n", db);
|
|
|
|
break;
|
|
|
|
default:
|
2008-09-23 10:47:31 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In */
|
2014-06-05 10:41:46 -07:00
|
|
|
db = epr->in.from;
|
|
|
|
db2 = epr->in.range;
|
2008-09-23 10:47:31 -07:00
|
|
|
if (db || db2)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"in: %.5f %.5f;\n", db, db2);
|
2008-09-23 10:47:31 -07:00
|
|
|
|
|
|
|
/* Targets */
|
2014-06-05 10:41:46 -07:00
|
|
|
if ((ll = _edje_program_targets_get(obj, epr)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, data)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"target: \"%s\";\n", data);
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Afters */
|
2014-06-05 10:41:46 -07:00
|
|
|
if ((ll = _edje_program_afters_get(obj, epr)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, data)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"after: \"%s\";\n", data);
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
|
|
|
}
|
|
|
|
|
2008-10-07 14:13:27 -07:00
|
|
|
// TODO Support script {}
|
2010-06-14 18:51:46 -07:00
|
|
|
/* api */
|
2014-06-05 10:41:46 -07:00
|
|
|
api_name = eina_stringshare_add(epr->api.name);
|
|
|
|
api_description = eina_stringshare_add(epr->api.description);
|
2010-06-14 18:51:46 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2008-09-23 10:47:31 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I3 "}\n");
|
|
|
|
return ret;
|
2008-09-23 10:47:31 -07:00
|
|
|
}
|
2008-06-13 18:13:16 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *state, double value, Eina_Strbuf *buf)
|
2008-10-02 17:20:19 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *ll;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
GET_PD_OR_RETURN(EINA_FALSE);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
BUF_APPENDF(I4"description { state: \"%s\" %g;\n", pd->state.name, pd->state.value);
|
2008-10-02 17:20:19 -07:00
|
|
|
//TODO Support inherit
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (!pd->visible)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"visible: 0;\n");
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->align.x != 0.5 || pd->align.y != 0.5)
|
|
|
|
BUF_APPENDF(I5"align: %g %g;\n", TO_DOUBLE(pd->align.x), TO_DOUBLE(pd->align.y));
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//TODO Support fixed
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->min.w || pd->min.h)
|
|
|
|
BUF_APPENDF(I5"min: %d %d;\n", pd->min.w, pd->min.h);
|
|
|
|
if (pd->max.w != -1 || pd->max.h != -1)
|
|
|
|
BUF_APPENDF(I5"max: %d %d;\n", pd->max.w, pd->max.h);
|
2014-06-10 08:23:24 -07:00
|
|
|
if (pd->minmul.w != 0 || pd->minmul.h != 0)
|
|
|
|
BUF_APPENDF(I5"minmul: %g %g;\n", TO_DOUBLE(pd->minmul.w), TO_DOUBLE(pd->minmul.h));
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//TODO Support step
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->aspect.min || pd->aspect.max)
|
|
|
|
BUF_APPENDF(I5"aspect: %g %g;\n", TO_DOUBLE(pd->aspect.min), TO_DOUBLE(pd->aspect.max));
|
|
|
|
if (pd->aspect.prefer)
|
2012-01-19 00:17:12 -08:00
|
|
|
BUF_APPENDF(I5"aspect_preference: %s;\n", prefers[(int) pd->aspect.prefer]);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->color_class)
|
|
|
|
BUF_APPENDF(I5"color_class: \"%s\";\n", pd->color_class);
|
2010-07-16 09:00:26 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->color.r != 255 || pd->color.g != 255 ||
|
|
|
|
pd->color.b != 255 || pd->color.a != 255)
|
2010-07-16 09:00:26 -07:00
|
|
|
BUF_APPENDF(I5"color: %d %d %d %d;\n",
|
2010-07-29 05:02:36 -07:00
|
|
|
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)
|
2010-07-16 09:00:26 -07:00
|
|
|
BUF_APPENDF(I5"color2: %d %d %d %d;\n",
|
2010-07-29 05:02:36 -07:00
|
|
|
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);
|
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//Rel1
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->rel1.relative_x || pd->rel1.relative_y || pd->rel1.offset_x ||
|
|
|
|
pd->rel1.offset_y || pd->rel1.id_x != -1 || pd->rel1.id_y != -1)
|
2008-10-02 17:20:19 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"rel1 {\n");
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->rel1.relative_x || pd->rel1.relative_y)
|
|
|
|
BUF_APPENDF(I6"relative: %g %g;\n", TO_DOUBLE(pd->rel1.relative_x), TO_DOUBLE(pd->rel1.relative_y));
|
|
|
|
if (pd->rel1.offset_x || pd->rel1.offset_y)
|
|
|
|
BUF_APPENDF(I6"offset: %d %d;\n", pd->rel1.offset_x, pd->rel1.offset_y);
|
|
|
|
if (pd->rel1.id_x != -1 && pd->rel1.id_x == pd->rel1.id_y)
|
|
|
|
BUF_APPENDF(I6"to: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name);
|
2008-10-07 07:11:11 -07:00
|
|
|
else
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->rel1.id_x != -1)
|
|
|
|
BUF_APPENDF(I6"to_x: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name);
|
|
|
|
if (pd->rel1.id_y != -1)
|
|
|
|
BUF_APPENDF(I6"to_y: \"%s\";\n", ed->table_parts[pd->rel1.id_y]->part->name);
|
2008-10-07 07:11:11 -07:00
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"}\n");//rel1
|
2008-10-02 17:20:19 -07:00
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//Rel2
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->rel2.relative_x != 1.0 || pd->rel2.relative_y != 1.0 ||
|
|
|
|
pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1 ||
|
|
|
|
pd->rel2.id_x != -1 || pd->rel2.id_y != -1)
|
2008-10-02 17:20:19 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"rel2 {\n");
|
2010-07-29 05:02:36 -07:00
|
|
|
if (TO_DOUBLE(pd->rel2.relative_x) != 1.0 || TO_DOUBLE(pd->rel2.relative_y) != 1.0)
|
|
|
|
BUF_APPENDF(I6"relative: %g %g;\n", TO_DOUBLE(pd->rel2.relative_x), TO_DOUBLE(pd->rel2.relative_y));
|
|
|
|
if (pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1)
|
|
|
|
BUF_APPENDF(I6"offset: %d %d;\n", pd->rel2.offset_x, pd->rel2.offset_y);
|
|
|
|
if (pd->rel2.id_x != -1 && pd->rel2.id_x == pd->rel2.id_y)
|
|
|
|
BUF_APPENDF(I6"to: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name);
|
2008-10-07 07:11:11 -07:00
|
|
|
else
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
if (pd->rel2.id_x != -1)
|
|
|
|
BUF_APPENDF(I6"to_x: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name);
|
|
|
|
if (pd->rel2.id_y != -1)
|
|
|
|
BUF_APPENDF(I6"to_y: \"%s\";\n", ed->table_parts[pd->rel2.id_y]->part->name);
|
2008-10-07 07:11:11 -07:00
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"}\n");//rel2
|
2008-10-02 17:20:19 -07:00
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//Image
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_IMAGE)
|
2008-10-07 07:11:11 -07:00
|
|
|
{
|
2010-08-11 09:23:48 -07:00
|
|
|
char *data;
|
|
|
|
const char *image_name;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *img;
|
|
|
|
|
|
|
|
img = (Edje_Part_Description_Image *) pd;
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"image {\n");
|
2010-08-11 09:23:48 -07:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
image_name = _edje_image_name_find(eed, img->image.id);
|
2010-08-11 09:23:48 -07:00
|
|
|
if (image_name)
|
|
|
|
BUF_APPENDF(I6"normal: \"%s\";\n", image_name);
|
2008-10-07 07:11:11 -07:00
|
|
|
|
2010-04-07 10:04:49 -07:00
|
|
|
ll = edje_edit_state_tweens_list_get(obj, part, state, value);
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, data)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I6"tween: \"%s\";\n", data);
|
2008-10-07 07:11:11 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
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)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I6"middle: NONE;\n");
|
2010-07-29 05:02:36 -07:00
|
|
|
else if (img->image.border.no_fill == 0)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I6"middle: DEFAULT;\n");
|
2010-07-29 05:02:36 -07:00
|
|
|
else if (img->image.border.no_fill == 2)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I6"middle: SOLID;\n");
|
2008-10-07 14:13:27 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"}\n");//image
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
//Fill
|
|
|
|
|
2013-12-22 16:47:51 -08:00
|
|
|
if (!img->image.fill.smooth || img->image.fill.pos_rel_x ||
|
|
|
|
img->image.fill.pos_rel_y || img->image.fill.pos_abs_x ||
|
|
|
|
img->image.fill.pos_abs_y || 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(I5"fill {\n");
|
|
|
|
if (!img->image.fill.smooth)
|
|
|
|
BUF_APPEND(I6"smooth: 0;\n");
|
|
|
|
//TODO Support spread
|
|
|
|
|
|
|
|
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 (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(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 (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");
|
|
|
|
}
|
|
|
|
|
|
|
|
BUF_APPEND(I5"}\n");
|
|
|
|
}
|
2008-10-07 07:11:11 -07:00
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2011-03-13 08:41:12 -07:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_PROXY)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Proxy *pro;
|
|
|
|
|
|
|
|
pro = (Edje_Part_Description_Proxy *) pd;
|
|
|
|
|
|
|
|
//Fill
|
|
|
|
|
|
|
|
BUF_APPEND(I5"fill {\n");
|
|
|
|
if (!pro->proxy.fill.smooth)
|
|
|
|
BUF_APPEND(I6"smooth: 0;\n");
|
|
|
|
//TODO Support spread
|
|
|
|
//TODO Support source
|
|
|
|
|
|
|
|
if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y ||
|
|
|
|
pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I6"origin {\n");
|
|
|
|
if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y)
|
|
|
|
BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(pro->proxy.fill.pos_rel_x), TO_DOUBLE(pro->proxy.fill.pos_rel_y));
|
|
|
|
if (pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y)
|
|
|
|
BUF_APPENDF(I7"offset: %d %d;\n", pro->proxy.fill.pos_abs_x, pro->proxy.fill.pos_abs_y);
|
|
|
|
BUF_APPEND(I6"}\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TO_DOUBLE(pro->proxy.fill.rel_x) != 1.0 || TO_DOUBLE(pro->proxy.fill.rel_y) != 1.0 ||
|
|
|
|
pro->proxy.fill.abs_x || pro->proxy.fill.abs_y)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I6"size {\n");
|
|
|
|
if (pro->proxy.fill.rel_x != 1.0 || pro->proxy.fill.rel_y != 1.0)
|
|
|
|
BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(pro->proxy.fill.rel_x), TO_DOUBLE(pro->proxy.fill.rel_y));
|
|
|
|
if (pro->proxy.fill.abs_x || pro->proxy.fill.abs_y)
|
|
|
|
BUF_APPENDF(I7"offset: %d %d;\n", pro->proxy.fill.abs_x, pro->proxy.fill.abs_y);
|
|
|
|
BUF_APPEND(I6"}\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
BUF_APPEND(I5"}\n");
|
|
|
|
}
|
|
|
|
|
2008-10-07 07:11:11 -07:00
|
|
|
//Text
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT)
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
|
|
|
|
|
|
|
txt = (Edje_Part_Description_Text *) pd;
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"text {\n");
|
2010-08-12 05:58:54 -07:00
|
|
|
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));
|
|
|
|
}
|
2010-08-11 09:23:48 -07:00
|
|
|
if (txt->text.size)
|
|
|
|
BUF_APPENDF(I6"size: %d;\n", txt->text.size);
|
2010-07-29 05:02:36 -07:00
|
|
|
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);
|
2013-09-25 00:18:05 -07:00
|
|
|
if (txt->text.min_x || txt->text.min_y)
|
|
|
|
BUF_APPENDF(I6"min: \"%d\" \"%d\";\n", txt->text.min_x, txt->text.min_y);
|
|
|
|
if (txt->text.max_x || txt->text.max_y)
|
|
|
|
BUF_APPENDF(I6"max: %d %d;\n", txt->text.max_x, txt->text.max_y);
|
2010-07-29 05:02:36 -07:00
|
|
|
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));
|
2008-10-07 07:11:11 -07:00
|
|
|
//TODO Support source
|
|
|
|
//TODO Support text_source
|
2014-05-13 13:20:41 -07:00
|
|
|
if (txt->text.ellipsis)
|
|
|
|
BUF_APPENDF(I6"ellipsis: %g;\n", txt->text.ellipsis);
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"}\n");
|
2008-10-07 07:11:11 -07:00
|
|
|
}
|
|
|
|
|
2009-11-26 09:01:31 -08:00
|
|
|
//External
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
2010-04-07 10:04:49 -07:00
|
|
|
if ((ll = (Eina_List *)edje_edit_state_external_params_list_get(obj, part, state, value)))
|
2009-11-26 09:01:31 -08:00
|
|
|
{
|
|
|
|
Edje_External_Param *p;
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"params {\n");
|
2009-11-26 09:01:31 -08:00
|
|
|
EINA_LIST_FOREACH(ll, l, p)
|
|
|
|
{
|
|
|
|
switch (p->type)
|
|
|
|
{
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I6"int: \"%s\" \"%d\";\n", p->name, p->i);
|
2009-11-26 09:01:31 -08:00
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I6"double: \"%s\" \"%g\";\n", p->name, p->d);
|
2009-11-26 09:01:31 -08:00
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
|
|
|
if (p->s)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I6"string: \"%s\" \"%s\";\n", p->name,
|
|
|
|
p->s);
|
2010-03-29 14:51:40 -07:00
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I6"bool: \"%s\" \"%d\";\n", p->name, p->i);
|
2010-03-29 14:51:40 -07:00
|
|
|
break;
|
|
|
|
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
|
|
|
if (p->s)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I6"choice: \"%s\" \"%s\";\n", p->name,
|
|
|
|
p->s);
|
2009-11-26 09:01:31 -08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I5"}\n");
|
2009-11-26 09:01:31 -08:00
|
|
|
}
|
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I4"}\n");//description
|
|
|
|
return ret;
|
2008-10-02 17:20:19 -07:00
|
|
|
}
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
2010-08-11 05:51:39 -07:00
|
|
|
_edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
|
2008-06-13 18:13:16 -07:00
|
|
|
{
|
2010-08-11 05:51:39 -07:00
|
|
|
const char *part = ep->name;
|
2008-10-02 17:20:19 -07:00
|
|
|
const char *str;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *ll;
|
|
|
|
char *data;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2010-06-14 18:51:46 -07:00
|
|
|
const char *api_name, *api_description;
|
2014-06-10 08:22:24 -07:00
|
|
|
unsigned int i = 0;
|
|
|
|
Edje_Pack_Element *item;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2014-06-06 09:26:16 -07:00
|
|
|
GET_RP_OR_RETURN(EINA_FALSE);
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I3"part { name: \"%s\";\n", part);
|
2014-06-06 09:26:16 -07:00
|
|
|
BUF_APPENDF(I4"type: %s;\n", types[rp->part->type]);
|
|
|
|
if (!rp->part->mouse_events)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I4"mouse_events: 0;\n");
|
2014-06-06 09:26:16 -07:00
|
|
|
if (rp->part->repeat_events)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I4"repeat_events: 1;\n");
|
2014-06-06 09:26:16 -07:00
|
|
|
if (rp->part->scale)
|
2010-06-18 15:08:05 -07:00
|
|
|
BUF_APPEND(I4"scale: 1;\n");
|
2014-06-06 09:26:16 -07:00
|
|
|
|
|
|
|
if (rp->part->ignore_flags)
|
|
|
|
BUF_APPENDF(I4"ignore_flags: \"ON_HOLD\";\n");
|
|
|
|
if (rp->part->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB)
|
2014-06-04 10:45:28 -07:00
|
|
|
BUF_APPEND(I4"pointer_mode: NOGRAB;\n");
|
2014-06-06 09:26:16 -07:00
|
|
|
if (rp->part->precise_is_inside)
|
2014-06-04 11:01:40 -07:00
|
|
|
BUF_APPEND(I4"precise_is_inside: 1;\n");
|
2014-06-06 09:26:16 -07:00
|
|
|
if (rp->part->access)
|
2014-06-04 11:03:39 -07:00
|
|
|
BUF_APPEND(I4"access: 1;\n");
|
2014-06-06 09:26:16 -07:00
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//TODO Support use_alternate_font_metrics
|
2014-06-06 09:26:16 -07:00
|
|
|
if ((str = _edje_part_clip_to_get(ed, rp)))
|
2008-10-02 17:20:19 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I4"clip_to: \"%s\";\n", str);
|
2008-10-02 17:20:19 -07:00
|
|
|
edje_edit_string_free(str);
|
|
|
|
}
|
2014-06-06 09:26:16 -07:00
|
|
|
|
|
|
|
if ((rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->type == EDJE_PART_TYPE_GROUP))
|
2008-10-02 17:20:19 -07:00
|
|
|
{
|
2014-06-06 09:26:16 -07:00
|
|
|
if ((str = eina_stringshare_add(rp->part->source)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"source: \"%s\";\n", str);
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
if ((str = eina_stringshare_add(rp->part->source2)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"source2: \"%s\";\n", str);
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
|
|
|
if ((str = eina_stringshare_add(rp->part->source3)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"source3: \"%s\";\n", str);
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
|
|
|
if ((str = eina_stringshare_add(rp->part->source4)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"source4: \"%s\";\n", str);
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
|
|
|
if ((str = eina_stringshare_add(rp->part->source5)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"source5: \"%s\";\n", str);
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
|
|
|
if ((str = eina_stringshare_add(rp->part->source6)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"source6: \"%s\";\n", str);
|
|
|
|
eina_stringshare_del(str);
|
|
|
|
}
|
|
|
|
if (rp->part->entry_mode)
|
|
|
|
BUF_APPENDF(I4"entry_mode: \"%s\";\n",
|
|
|
|
entry_mode[rp->part->entry_mode]);
|
|
|
|
if (rp->part->select_mode)
|
|
|
|
BUF_APPENDF(I4"select_mode: \"EXPLICIT\";\n");
|
|
|
|
if (rp->part->cursor_mode)
|
|
|
|
BUF_APPENDF(I4"cursor_mode: \"BEFORE\";\n");
|
|
|
|
if (rp->part->multiline)
|
|
|
|
BUF_APPEND(I4"multiline: 1;\n");
|
|
|
|
}
|
2008-10-02 17:20:19 -07:00
|
|
|
}
|
2014-06-06 09:26:16 -07:00
|
|
|
|
|
|
|
if (rp->part->effect)
|
2014-04-01 03:11:27 -07:00
|
|
|
{
|
2014-06-06 09:26:16 -07:00
|
|
|
int effect = rp->part->effect;
|
2014-04-01 03:11:27 -07:00
|
|
|
if (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION)
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"effect: %s %s;\n",
|
|
|
|
effects[effect & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION],
|
|
|
|
shadow_direction[effect >> 4]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
BUF_APPENDF(I4"effect: %s;\n",
|
|
|
|
effects[effect]);
|
|
|
|
}
|
2008-10-09 07:38:22 -07:00
|
|
|
|
2014-06-10 08:22:24 -07:00
|
|
|
//Box
|
|
|
|
if ((edje_edit_part_type_get(obj, part) == EDJE_PART_TYPE_BOX) ||
|
|
|
|
(edje_edit_part_type_get(obj, part) == EDJE_PART_TYPE_TABLE))
|
|
|
|
{
|
|
|
|
if (ep->items_count != 0)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I4"box {\n");
|
|
|
|
BUF_APPEND(I5"items {\n");
|
|
|
|
for (i = 0; i < ep->items_count; ++i)
|
|
|
|
{
|
|
|
|
item = ep->items[i];
|
|
|
|
BUF_APPEND(I6"item {\n");
|
|
|
|
BUF_APPENDF(I7"type: %s;\n", types[item->type]);
|
|
|
|
if (item->name)
|
|
|
|
BUF_APPENDF(I7"name: \"%s\";\n", item->name);
|
|
|
|
if (item->source)
|
|
|
|
BUF_APPENDF(I7"source: \"%s\";\n", item->source);
|
|
|
|
//TODO min
|
|
|
|
//TODO prefer
|
|
|
|
//TODO max
|
|
|
|
//TODO padding
|
|
|
|
//TODO align
|
|
|
|
//TODO weight
|
|
|
|
//TODO aspect
|
|
|
|
//TODO aspect mode
|
|
|
|
//TODO options
|
|
|
|
//TODO col
|
|
|
|
//TODO row
|
|
|
|
//TODO colspan
|
|
|
|
//TODO rowspan
|
|
|
|
//TODO spread
|
|
|
|
BUF_APPEND(I6"}\n");
|
|
|
|
}
|
|
|
|
BUF_APPEND(I5"}\n");
|
|
|
|
BUF_APPEND(I4"}\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-09 07:38:22 -07:00
|
|
|
//Dragable
|
2014-06-06 09:26:16 -07:00
|
|
|
str = edje_edit_part_drag_event_get(obj, part);
|
|
|
|
if (rp->part->dragable.x || rp->part->dragable.y || str)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I4"dragable {\n");
|
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I5"events: \"%s\";\n", str);
|
|
|
|
edje_edit_string_free(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rp->part->dragable.x || rp->part->dragable.y)
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I5"x: %d %d %d;\n",
|
|
|
|
rp->part->dragable.x,
|
|
|
|
rp->part->dragable.step_x,
|
|
|
|
rp->part->dragable.count_x);
|
|
|
|
BUF_APPENDF(I5"y: %d %d %d;\n",
|
|
|
|
rp->part->dragable.y,
|
|
|
|
rp->part->dragable.step_y,
|
|
|
|
rp->part->dragable.count_y);
|
|
|
|
if ((str = edje_edit_part_drag_confine_get(obj, part)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I5"confine: \"%s\";\n", str);
|
|
|
|
edje_edit_string_free(str);
|
|
|
|
}
|
|
|
|
if ((str = edje_edit_part_drag_threshold_get(obj, part)))
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I5"threshold: \"%s\";\n", str);
|
|
|
|
edje_edit_string_free(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BUF_APPEND(I4"}\n");
|
2008-10-09 07:38:22 -07:00
|
|
|
}
|
|
|
|
|
2008-10-02 17:20:19 -07:00
|
|
|
//Descriptions
|
|
|
|
ll = edje_edit_part_states_list_get(obj, part);
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, data)
|
2010-04-07 10:04:49 -07:00
|
|
|
{
|
|
|
|
char state[512], *delim;
|
|
|
|
double value;
|
|
|
|
strncpy(state, data, sizeof(state) - 1); /* if we go over it, too bad.. the list of states may need to change to provide name and value separated */
|
2014-03-20 00:51:48 -07:00
|
|
|
delim = strchr(state, ' ');
|
|
|
|
if (!delim) continue;
|
2010-04-07 10:04:49 -07:00
|
|
|
*delim = '\0';
|
|
|
|
delim++;
|
|
|
|
value = strtod(delim, NULL);
|
2010-04-09 09:05:17 -07:00
|
|
|
ret &= _edje_generate_source_of_state(obj, part, state, value, buf);
|
2010-04-07 10:04:49 -07:00
|
|
|
}
|
2008-10-02 17:20:19 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2014-06-06 09:26:16 -07:00
|
|
|
api_name = eina_stringshare_add(rp->part->api.name);
|
|
|
|
api_description =eina_stringshare_add(rp->part->api.description);
|
2010-06-14 18:51:46 -07:00
|
|
|
if (api_name || api_description)
|
|
|
|
{
|
2014-06-06 09:26:16 -07:00
|
|
|
if (api_name && api_description)
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description);
|
|
|
|
eina_stringshare_del(api_name);
|
|
|
|
eina_stringshare_del(api_description);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (api_name)
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name);
|
|
|
|
eina_stringshare_del(api_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description);
|
|
|
|
eina_stringshare_del(api_description);
|
|
|
|
}
|
2010-06-14 18:51:46 -07:00
|
|
|
}
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I3"}\n");//part
|
|
|
|
return ret;
|
2008-06-13 18:13:16 -07:00
|
|
|
}
|
|
|
|
|
2014-06-10 08:14:59 -07:00
|
|
|
static void
|
|
|
|
_edje_generate_source_of_sounds(Edje_Sound_Directory *sound_directory, Eina_Strbuf *buf)
|
|
|
|
{
|
|
|
|
unsigned int i = 0;
|
|
|
|
Eina_Bool ret = EINA_TRUE;
|
|
|
|
Edje_Sound_Sample *current_sample = sound_directory->samples;
|
|
|
|
Edje_Sound_Tone *current_tone = sound_directory->tones;
|
|
|
|
BUF_APPEND(I1"sounds {\n");
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < sound_directory->samples_count; i++, current_sample++)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I2"sample {\n");
|
|
|
|
BUF_APPENDF(I3"name: \"%s\" ", current_sample->name);
|
|
|
|
switch (current_sample->compression)
|
|
|
|
{
|
|
|
|
case EDJE_SOUND_SOURCE_TYPE_INLINE_RAW:
|
|
|
|
{
|
|
|
|
BUF_APPEND("RAW;\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_SOUND_SOURCE_TYPE_INLINE_COMP:
|
|
|
|
{
|
|
|
|
BUF_APPEND("COMP;\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY:
|
|
|
|
{
|
|
|
|
BUF_APPENDF("LOSSY %f;\n", current_sample->quality);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS:
|
|
|
|
{
|
|
|
|
BUF_APPEND("AS_IS;\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
BUF_APPENDF(I3"source: \"%s\";\n", current_sample->snd_src);
|
|
|
|
BUF_APPEND(I2"}\n");
|
|
|
|
}
|
|
|
|
for (i = 0; i < sound_directory->tones_count ; i++, current_tone++)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I2"tone: ");
|
|
|
|
BUF_APPENDF("\"%s\" %d;\n", current_tone->name, current_tone->value);
|
|
|
|
}
|
|
|
|
|
|
|
|
BUF_APPEND(I1"}\n");
|
|
|
|
}
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
2010-08-11 05:51:39 -07:00
|
|
|
_edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf)
|
2008-06-13 18:13:16 -07:00
|
|
|
{
|
2010-12-02 10:20:34 -08:00
|
|
|
Edje_Edit *eed;
|
|
|
|
Eet_File *ef;
|
2008-06-13 18:13:16 -07:00
|
|
|
Evas_Object *obj;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *ll;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2014-06-05 10:38:20 -07:00
|
|
|
int w, h, orient;
|
2008-10-22 04:34:42 -07:00
|
|
|
char *data;
|
2010-08-11 05:51:39 -07:00
|
|
|
const char *group = pce->entry;
|
2010-12-02 10:20:34 -08:00
|
|
|
Edje_Part_Collection *pc;
|
2014-06-07 13:57:49 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE, broadcast;
|
2013-12-18 22:26:07 -08:00
|
|
|
Eina_List *alias_list = NULL;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2012-10-21 03:46:58 -07:00
|
|
|
obj = edje_edit_object_add(ed->base->evas);
|
2010-04-09 09:05:17 -07:00
|
|
|
if (!edje_object_file_set(obj, ed->file->path, group)) return EINA_FALSE;
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
ef = eet_open(ed->file->path, EET_FILE_MODE_READ);
|
|
|
|
if (!ef)
|
|
|
|
{
|
|
|
|
evas_object_del(obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-05-02 00:47:16 -07:00
|
|
|
eed = eo_data_scope_get(obj, MY_CLASS);
|
2012-10-21 06:35:16 -07:00
|
|
|
pc = eed->base->collection;
|
2013-12-18 22:26:07 -08:00
|
|
|
alias_list = edje_edit_group_aliases_get(obj, group);
|
2010-12-02 10:20:34 -08:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I1"group { name: \"%s\";\n", group);
|
2013-12-18 22:26:07 -08:00
|
|
|
EINA_LIST_FOREACH(alias_list, l, data)
|
|
|
|
BUF_APPENDF(I2"alias: \"%s\";\n", data);
|
|
|
|
edje_edit_string_list_free(alias_list);
|
|
|
|
|
2008-12-05 19:08:17 -08:00
|
|
|
w = edje_edit_group_min_w_get(obj);
|
|
|
|
h = edje_edit_group_min_h_get(obj);
|
|
|
|
if ((w > 0) || (h > 0))
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I2"min: %d %d;\n", w, h);
|
2008-12-05 19:08:17 -08:00
|
|
|
w = edje_edit_group_max_w_get(obj);
|
|
|
|
h = edje_edit_group_max_h_get(obj);
|
2010-08-11 05:51:39 -07:00
|
|
|
if ((w > 0) || (h > 0))
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I2"max: %d %d;\n", w, h);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2014-06-05 10:38:20 -07:00
|
|
|
orient = edje_edit_group_orientation_get(obj);
|
|
|
|
switch(orient)
|
|
|
|
{
|
|
|
|
case(EDJE_ORIENTATION_LTR):
|
|
|
|
BUF_APPENDF(I2"orientation: LTR;\n");
|
|
|
|
break;
|
|
|
|
case(EDJE_ORIENTATION_RTL):
|
|
|
|
BUF_APPENDF(I2"orientation: RTL;\n");
|
|
|
|
break;
|
|
|
|
case(EDJE_ORIENTATION_AUTO):
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-06-07 13:57:49 -07:00
|
|
|
broadcast = edje_edit_group_broadcast_signal_get(obj);
|
|
|
|
if (!broadcast) BUF_APPENDF(I2"broadcast_signal: %d;\n", broadcast);
|
2014-06-05 10:38:20 -07:00
|
|
|
|
2010-02-05 08:39:06 -08:00
|
|
|
/* Data */
|
2010-12-02 10:20:34 -08:00
|
|
|
if (pc->data)
|
2010-02-05 08:39:06 -08:00
|
|
|
{
|
2010-08-11 05:51:41 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
BUF_APPEND(I2"data {\n");
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
it = eina_hash_iterator_tuple_new(pc->data);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-08-11 05:51:41 -07:00
|
|
|
if (!it)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Group[%s] data.", group);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-08-11 05:51:41 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, tuple)
|
2010-08-17 15:20:37 -07:00
|
|
|
BUF_APPENDF(I3"item: \"%s\" \"%s\";\n", (char *)tuple->key,
|
2010-08-13 13:38:57 -07:00
|
|
|
edje_string_get(tuple->data));
|
2010-08-11 05:51:41 -07:00
|
|
|
|
|
|
|
eina_iterator_free(it);
|
2010-08-17 15:20:37 -07:00
|
|
|
BUF_APPEND(I2"}\n");
|
2010-04-09 09:05:17 -07:00
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
if (eed->embryo_source)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I2"script {\n");
|
|
|
|
BUF_APPEND(eed->embryo_source);
|
|
|
|
BUF_APPEND(I2"}\n");
|
|
|
|
}
|
2008-09-23 10:47:31 -07:00
|
|
|
|
|
|
|
/* Parts */
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I2"parts {\n");
|
2010-12-02 10:20:34 -08:00
|
|
|
for (i = 0; i < pc->parts_count; i++)
|
2010-08-11 05:51:39 -07:00
|
|
|
{
|
|
|
|
Edje_Part *ep;
|
2010-12-02 10:20:34 -08:00
|
|
|
ep = pc->parts[i];
|
2010-08-11 05:51:39 -07:00
|
|
|
ret &= _edje_generate_source_of_part(obj, ep, buf);
|
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I2"}\n");//parts
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Group[%s] Parts.", group);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2008-09-23 10:47:31 -07:00
|
|
|
|
|
|
|
/* Programs */
|
2008-10-26 21:10:31 -07:00
|
|
|
if ((ll = edje_edit_programs_list_get(obj)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I2 "programs {\n");
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, data)
|
2010-07-13 19:05:47 -07:00
|
|
|
ret &= _edje_generate_source_of_program(obj, data, buf);
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I2 "}\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
|
|
|
}
|
2010-12-02 10:20:34 -08:00
|
|
|
BUF_APPEND(I1"}\n");//group
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Group[%s] Programs.", group);
|
|
|
|
evas_object_del(obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
eet_close(ef);
|
2010-01-29 12:44:34 -08:00
|
|
|
evas_object_del(obj);
|
2010-04-09 09:05:17 -07:00
|
|
|
return ret;
|
2008-06-13 18:13:16 -07:00
|
|
|
}
|
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Strbuf*
|
2008-06-13 18:13:16 -07:00
|
|
|
_edje_generate_source(Evas_Object *obj)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Strbuf *buf;
|
2008-10-08 17:04:18 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *ll;
|
2010-02-04 06:34:06 -08:00
|
|
|
Edje_Font_Directory_Entry *fnt;
|
2010-08-24 07:36:07 -07:00
|
|
|
|
|
|
|
char *entry;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2008-10-26 21:10:31 -07:00
|
|
|
GET_ED_OR_RETURN(NULL);
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
/* Open a str buffer */
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
if (!buf) return NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
/* Write edc into file */
|
2008-06-13 18:13:16 -07:00
|
|
|
//TODO Probably we need to save the file before generation
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-06-13 18:13:16 -07:00
|
|
|
/* Images */
|
2008-10-26 21:10:31 -07:00
|
|
|
if ((ll = edje_edit_images_list_get(obj)))
|
2008-06-13 18:13:16 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I0"images {\n");
|
2008-10-22 04:34:42 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ll, l, entry)
|
2008-07-30 15:41:04 -07:00
|
|
|
{
|
2014-06-07 23:42:27 -07:00
|
|
|
Eina_Strbuf *gen_buf = _edje_generate_image_source(obj, entry);
|
|
|
|
if (!gen_buf) continue;
|
2014-03-24 00:05:25 -07:00
|
|
|
|
2014-06-07 23:42:27 -07:00
|
|
|
BUF_APPENDF(I1"%s", eina_strbuf_string_get(gen_buf));
|
|
|
|
eina_strbuf_free(gen_buf);
|
2014-03-24 00:05:25 -07:00
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I0"}\n\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
2010-04-09 09:05:17 -07:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Images");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-06-13 18:13:16 -07:00
|
|
|
}
|
2008-07-30 15:41:04 -07:00
|
|
|
|
2008-06-13 18:13:16 -07:00
|
|
|
/* Fonts */
|
2010-08-31 12:32:08 -07:00
|
|
|
if (ed->file->fonts)
|
2008-07-30 15:41:04 -07:00
|
|
|
{
|
2010-08-31 12:32:08 -07:00
|
|
|
Eina_Iterator *it;
|
2008-07-30 15:41:04 -07:00
|
|
|
|
2010-08-31 12:32:08 -07:00
|
|
|
it = eina_hash_iterator_data_new(ed->file->fonts);
|
|
|
|
if (it)
|
|
|
|
{
|
|
|
|
BUF_APPEND(I0"fonts {\n");
|
2010-04-09 09:05:17 -07:00
|
|
|
|
2010-08-31 12:32:08 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, fnt)
|
|
|
|
BUF_APPENDF(I1"font: \"%s\" \"%s\";\n", fnt->file,
|
|
|
|
fnt->entry);
|
2010-04-09 09:05:17 -07:00
|
|
|
|
2010-08-31 12:32:08 -07:00
|
|
|
BUF_APPEND(I0"}\n\n");
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Fonts");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-08-24 07:36:07 -07:00
|
|
|
}
|
2008-07-30 15:41:04 -07:00
|
|
|
}
|
|
|
|
|
2008-06-13 18:13:16 -07:00
|
|
|
/* Data */
|
2008-10-26 21:10:31 -07:00
|
|
|
if ((ll = edje_edit_data_list_get(obj)))
|
2008-09-23 10:47:31 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I0 "data {\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, entry)
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPENDF(I1 "item: \"%s\" \"%s\";\n", entry,
|
|
|
|
edje_edit_data_value_get(obj, entry));
|
2008-09-23 10:47:31 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I0 "}\n\n");
|
2008-09-23 10:47:31 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
2010-04-09 09:05:17 -07:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Data");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-09-23 10:47:31 -07:00
|
|
|
}
|
|
|
|
|
2008-06-13 18:13:16 -07:00
|
|
|
/* Color Classes */
|
2008-10-26 21:10:31 -07:00
|
|
|
if ((ll = edje_edit_color_classes_list_get(obj)))
|
2008-09-28 15:45:47 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I0 "color_classes {\n");
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ll, l, entry)
|
2010-04-09 09:05:17 -07:00
|
|
|
_edje_generate_source_of_colorclass(ed, entry, buf);
|
|
|
|
|
|
|
|
BUF_APPEND(I0 "}\n\n");
|
2008-09-28 15:45:47 -07:00
|
|
|
edje_edit_string_list_free(ll);
|
2010-04-09 09:05:17 -07:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Color Classes");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-09-28 15:45:47 -07:00
|
|
|
}
|
2010-02-05 08:39:06 -08:00
|
|
|
|
2008-06-13 18:13:16 -07:00
|
|
|
/* Styles */
|
2008-11-02 06:10:11 -08:00
|
|
|
if ((ll = edje_edit_styles_list_get(obj)))
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
BUF_APPEND(I0 "styles {\n");
|
2008-11-02 06:10:11 -08:00
|
|
|
EINA_LIST_FOREACH(ll, l, entry)
|
2010-04-09 09:05:17 -07:00
|
|
|
_edje_generate_source_of_style(ed, entry, buf);
|
|
|
|
BUF_APPEND(I0 "}\n\n");
|
2008-11-02 06:10:11 -08:00
|
|
|
edje_edit_string_list_free(ll);
|
2010-04-09 09:05:17 -07:00
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Styles");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-11-02 06:10:11 -08:00
|
|
|
}
|
2008-10-07 14:13:27 -07:00
|
|
|
|
2009-11-26 09:01:31 -08:00
|
|
|
/* Externals */
|
|
|
|
if ((ll = edje_edit_externals_list_get(obj)))
|
|
|
|
{
|
2010-08-11 05:51:39 -07:00
|
|
|
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);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
ERR("Generating EDC for Externals");
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-11-26 09:01:31 -08:00
|
|
|
}
|
|
|
|
|
2008-06-13 18:13:16 -07:00
|
|
|
/* Collections */
|
2010-08-11 05:51:39 -07:00
|
|
|
if (ed->file->collection)
|
2010-04-09 09:05:17 -07:00
|
|
|
{
|
2010-08-11 05:51:39 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Edje_Part_Collection_Directory_Entry *pce;
|
|
|
|
BUF_APPEND("collections {\n");
|
|
|
|
|
2014-06-10 08:14:59 -07:00
|
|
|
/* Sounds */
|
|
|
|
if (ed->file->sound_dir)
|
|
|
|
{
|
|
|
|
_edje_generate_source_of_sounds(ed->file->sound_dir, buf);
|
|
|
|
}
|
|
|
|
|
2010-08-11 05:51:39 -07:00
|
|
|
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)
|
|
|
|
{
|
2013-12-18 22:26:07 -08:00
|
|
|
if (!pce->group_alias)
|
|
|
|
ret &= _edje_generate_source_of_group(ed, pce, buf);
|
2010-08-11 05:51:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
eina_iterator_free(it);
|
|
|
|
BUF_APPEND("}\n\n");
|
2010-04-09 09:05:17 -07:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
return buf;
|
2008-10-08 17:04:18 -07:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-08 17:04:18 -07:00
|
|
|
/*********************/
|
|
|
|
/* SAVING ROUTINES */
|
|
|
|
/*********************/
|
|
|
|
////////////////////////////////////////
|
2009-08-17 07:49:26 -07:00
|
|
|
typedef struct _SrcFile SrcFile;
|
|
|
|
typedef struct _SrcFile_List SrcFile_List;
|
|
|
|
|
|
|
|
struct _SrcFile
|
|
|
|
{
|
|
|
|
char *name;
|
2010-04-09 09:05:17 -07:00
|
|
|
const char *file;
|
2009-08-17 07:49:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _SrcFile_List
|
|
|
|
{
|
|
|
|
Eina_List *list;
|
|
|
|
};
|
|
|
|
|
2008-10-08 17:04:18 -07:00
|
|
|
static Eet_Data_Descriptor *_srcfile_edd = NULL;
|
|
|
|
static Eet_Data_Descriptor *_srcfile_list_edd = NULL;
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2009-09-01 03:02:40 -07:00
|
|
|
static void
|
2008-10-08 17:04:18 -07:00
|
|
|
source_edd(void)
|
|
|
|
{
|
|
|
|
Eet_Data_Descriptor_Class eddc;
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-01-29 12:44:34 -08:00
|
|
|
if (_srcfile_edd) return;
|
|
|
|
|
2010-08-13 09:21:38 -07:00
|
|
|
eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile", sizeof(SrcFile));
|
2009-08-13 05:53:12 -07:00
|
|
|
_srcfile_edd = eet_data_descriptor_stream_new(&eddc);
|
2008-10-08 17:04:18 -07:00
|
|
|
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);
|
|
|
|
|
2010-08-13 09:21:38 -07:00
|
|
|
eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile_list", sizeof(SrcFile_List));
|
2009-08-13 05:53:12 -07:00
|
|
|
_srcfile_list_edd = eet_data_descriptor_stream_new(&eddc);
|
2008-10-08 17:04:18 -07:00
|
|
|
EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd);
|
|
|
|
}
|
|
|
|
/////////////////////////////////////////
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
static Eina_Bool
|
2010-01-29 12:44:34 -08:00
|
|
|
_edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef)
|
2008-03-06 11:48:11 -08:00
|
|
|
{
|
2008-10-08 17:04:18 -07:00
|
|
|
/* Write Edje_File structure */
|
2009-12-22 05:46:00 -08:00
|
|
|
INF("** Writing Edje_File* ed->file");
|
2010-08-09 10:34:03 -07:00
|
|
|
if (eet_data_write(eetf, _edje_edd_edje_file, "edje/file", ef, 1) <= 0)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
ERR("Error. unable to write \"edje_file\" entry to \"%s\"", ef->path);
|
|
|
|
return EINA_FALSE;
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
2010-04-09 09:05:17 -07:00
|
|
|
return EINA_TRUE;
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
2008-03-06 11:48:11 -08:00
|
|
|
|
2010-04-06 11:18:53 -07:00
|
|
|
static Eina_Bool
|
2010-08-09 10:34:03 -07:00
|
|
|
_edje_edit_collection_save(Eet_File *eetf, Edje_Part_Collection *epc)
|
2010-01-29 12:44:34 -08:00
|
|
|
{
|
|
|
|
char buf[256];
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
snprintf(buf, sizeof(buf), "edje/collections/%i", epc->id);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
if (eet_data_write(eetf, _edje_edd_edje_part_collection, buf, epc, 1) > 0)
|
|
|
|
return EINA_TRUE;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
ERR("Error. unable to write \"%s\" part entry", buf);
|
|
|
|
return EINA_FALSE;
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-04-08 12:37:22 -07:00
|
|
|
static Eina_Bool
|
2010-01-29 12:44:34 -08:00
|
|
|
_edje_edit_source_save(Eet_File *eetf, Evas_Object *obj)
|
|
|
|
{
|
|
|
|
SrcFile *sf;
|
|
|
|
SrcFile_List *sfl;
|
2010-04-09 09:05:17 -07:00
|
|
|
Eina_Strbuf *source_file;
|
2010-04-08 12:37:22 -07:00
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2008-10-08 17:04:18 -07:00
|
|
|
|
|
|
|
source_file = _edje_generate_source(obj);
|
|
|
|
if (!source_file)
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
ERR("Can't create edc source");
|
2010-04-08 12:37:22 -07:00
|
|
|
return EINA_FALSE;
|
2008-10-08 17:04:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//open the temp file and put the contents in SrcFile
|
2009-08-17 07:13:26 -07:00
|
|
|
sf = _alloc(sizeof(SrcFile));
|
2010-04-08 12:37:22 -07:00
|
|
|
if (!sf)
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
ERR("Unable to create source file struct");
|
2010-04-08 12:37:22 -07:00
|
|
|
ret = EINA_FALSE;
|
|
|
|
goto save_free_source;
|
|
|
|
}
|
2009-08-17 14:28:40 -07:00
|
|
|
sf->name = strdup("generated_source.edc");
|
2010-04-08 12:37:22 -07:00
|
|
|
if (!sf->name)
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
ERR("Unable to alloc filename");
|
2010-04-08 12:37:22 -07:00
|
|
|
ret = EINA_FALSE;
|
|
|
|
goto save_free_sf;
|
|
|
|
}
|
2008-10-08 17:04:18 -07:00
|
|
|
|
2010-04-09 09:05:17 -07:00
|
|
|
sf->file = eina_strbuf_string_get(source_file);
|
2008-10-08 17:04:18 -07:00
|
|
|
|
|
|
|
//create the needed list of source files (only one)
|
2010-04-08 12:37:22 -07:00
|
|
|
sfl = _alloc(sizeof(SrcFile_List));
|
|
|
|
if (!sfl)
|
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
ERR("Unable to create file list");
|
2010-04-08 12:37:22 -07:00
|
|
|
ret = EINA_FALSE;
|
2010-04-09 09:05:17 -07:00
|
|
|
goto save_free_filename;
|
2010-04-08 12:37:22 -07:00
|
|
|
}
|
2008-10-08 17:04:18 -07:00
|
|
|
sfl->list = NULL;
|
2008-10-22 04:34:42 -07:00
|
|
|
sfl->list = eina_list_append(sfl->list, sf);
|
2010-04-08 12:37:22 -07:00
|
|
|
if (!sfl->list)
|
|
|
|
{
|
|
|
|
ERR("Error. unable to append file in list");
|
|
|
|
ret = EINA_FALSE;
|
|
|
|
goto save_free_sfl;
|
|
|
|
}
|
2008-10-08 17:04:18 -07:00
|
|
|
|
|
|
|
// write the sources list to the eet file
|
|
|
|
source_edd();
|
2010-04-09 09:05:17 -07:00
|
|
|
if (eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1) <= 0)
|
2008-10-08 17:04:18 -07:00
|
|
|
{
|
2010-04-09 09:05:17 -07:00
|
|
|
ERR("Unable to write edc source");
|
2010-04-08 12:37:22 -07:00
|
|
|
ret = EINA_FALSE;
|
2008-10-08 17:04:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear stuff */
|
2010-01-27 12:10:57 -08:00
|
|
|
eina_list_free(sfl->list);
|
2010-04-08 12:37:22 -07:00
|
|
|
save_free_sfl:
|
2010-01-27 12:10:57 -08:00
|
|
|
free(sfl);
|
2010-04-08 12:37:22 -07:00
|
|
|
save_free_filename:
|
2010-01-27 12:10:57 -08:00
|
|
|
free(sf->name);
|
2010-04-08 12:37:22 -07:00
|
|
|
save_free_sf:
|
2010-01-27 12:10:57 -08:00
|
|
|
free(sf);
|
2010-04-08 12:37:22 -07:00
|
|
|
save_free_source:
|
2010-04-09 09:05:17 -07:00
|
|
|
eina_strbuf_free(source_file);
|
2010-04-08 12:37:22 -07:00
|
|
|
return ret;
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
|
|
|
|
2010-04-06 11:18:53 -07:00
|
|
|
Eina_Bool
|
2010-01-29 12:44:34 -08:00
|
|
|
_edje_edit_internal_save(Evas_Object *obj, int current_only)
|
|
|
|
{
|
|
|
|
Edje_File *ef;
|
|
|
|
Eet_File *eetf;
|
|
|
|
|
2012-10-25 02:56:31 -07:00
|
|
|
GET_EED_OR_RETURN(EINA_FALSE);
|
2010-04-06 11:18:53 -07:00
|
|
|
GET_ED_OR_RETURN(EINA_FALSE);
|
2010-01-29 12:44:34 -08:00
|
|
|
|
|
|
|
ef = ed->file;
|
2010-04-06 11:18:53 -07:00
|
|
|
if (!ef) return EINA_FALSE;
|
2010-01-29 12:44:34 -08:00
|
|
|
|
|
|
|
INF("*********** Saving file ******************");
|
|
|
|
INF("** path: %s", ef->path);
|
|
|
|
|
|
|
|
/* Open the eet file */
|
|
|
|
eetf = eet_open(ef->path, EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!eetf)
|
|
|
|
{
|
|
|
|
ERR("Error. unable to open \"%s\" for writing output",
|
|
|
|
ef->path);
|
2010-04-06 11:18:53 -07:00
|
|
|
return EINA_FALSE;
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set compiler name */
|
|
|
|
if (strcmp(ef->compiler, "edje_edit"))
|
|
|
|
{
|
|
|
|
_edje_if_string_free(ed, ef->compiler);
|
2010-02-05 08:39:06 -08:00
|
|
|
ef->compiler = (char *)eina_stringshare_add("edje_edit");
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!_edje_edit_edje_file_save(eetf, ef))
|
|
|
|
{
|
|
|
|
eet_close(eetf);
|
2010-04-06 11:18:53 -07:00
|
|
|
return EINA_FALSE;
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (current_only)
|
|
|
|
{
|
|
|
|
if (ed->collection)
|
|
|
|
{
|
|
|
|
INF("** Writing Edje_Part_Collection* ed->collection "
|
|
|
|
"[id: %d]", ed->collection->id);
|
2010-08-09 10:34:03 -07:00
|
|
|
if (!_edje_edit_collection_save(eetf, ed->collection))
|
2010-01-29 12:44:34 -08:00
|
|
|
{
|
|
|
|
eet_close(eetf);
|
2010-04-06 11:18:53 -07:00
|
|
|
return EINA_FALSE;
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Part_Collection *edc;
|
2010-07-03 15:50:58 -07:00
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
2010-04-06 11:18:53 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
|
|
|
|
INF("** Writing all collections");
|
|
|
|
|
2010-06-28 06:56:30 -07:00
|
|
|
it = eina_hash_iterator_data_new(ef->collection);
|
2010-07-03 15:50:58 -07:00
|
|
|
while (eina_iterator_next(it, (void **)&ce))
|
2010-04-06 11:18:53 -07:00
|
|
|
{
|
2010-07-03 15:50:58 -07:00
|
|
|
if (ce->ref)
|
2010-04-06 11:18:53 -07:00
|
|
|
{
|
2010-07-03 15:50:58 -07:00
|
|
|
INF("** Writing hash Edje_Part_Collection* ed->collection "
|
|
|
|
"[id: %d]", ce->id);
|
2010-08-09 10:34:03 -07:00
|
|
|
if(!_edje_edit_collection_save(eetf, ce->ref))
|
2010-07-03 15:50:58 -07:00
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-04-06 11:18:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
2010-01-29 12:44:34 -08:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ef->collection_cache, l, edc)
|
2010-04-06 11:18:53 -07:00
|
|
|
{
|
|
|
|
INF("** Writing cache Edje_Part_Collection* ed->collection "
|
|
|
|
"[id: %d]", edc->id);
|
2010-08-09 10:34:03 -07:00
|
|
|
if(!_edje_edit_collection_save(eetf, edc))
|
2010-04-06 11:18:53 -07:00
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
2010-01-29 12:44:34 -08:00
|
|
|
}
|
|
|
|
|
2010-12-02 10:20:34 -08:00
|
|
|
if (eed->bytecode_dirty || eed->script_need_recompile)
|
|
|
|
{
|
|
|
|
char buf[64];
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Program_Script *ps;
|
|
|
|
Eina_List *deathnote = NULL;
|
|
|
|
|
|
|
|
if (eed->bytecode_dirty)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i",
|
|
|
|
ed->collection->id);
|
|
|
|
eet_write(eetf, buf, eed->bytecode, eed->bytecode_size, 1);
|
|
|
|
free(eed->bytecode);
|
|
|
|
eed->bytecode = NULL;
|
|
|
|
eed->bytecode_size = 0;
|
|
|
|
eed->bytecode_dirty = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (eed->embryo_source_dirty)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i",
|
|
|
|
ed->collection->id);
|
|
|
|
eet_write(eetf, buf, eed->embryo_source,
|
2013-12-18 22:15:34 -08:00
|
|
|
strlen(eed->embryo_source) + 1, 1);
|
2010-12-02 10:20:34 -08:00
|
|
|
eed->embryo_source_dirty = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
it = eina_hash_iterator_data_new(eed->program_scripts);
|
|
|
|
EINA_ITERATOR_FOREACH(it, ps)
|
|
|
|
{
|
|
|
|
if (ps->dirty)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/%i",
|
|
|
|
ed->collection->id, ps->id);
|
|
|
|
eet_write(eetf, buf, ps->code, strlen(ps->code) + 1, 1);
|
|
|
|
ps->dirty = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else if (ps->delete_me)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "edje/scripts/embryo/source/%i/%i",
|
|
|
|
ed->collection->id, ps->id);
|
|
|
|
eet_delete(eetf, buf);
|
|
|
|
deathnote = eina_list_append(deathnote, ps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
|
|
|
|
EINA_LIST_FREE(deathnote, ps)
|
|
|
|
eina_hash_del(eed->program_scripts, &ps->id, ps);
|
|
|
|
}
|
|
|
|
|
2010-04-08 12:37:22 -07:00
|
|
|
if (!_edje_edit_source_save(eetf, obj))
|
|
|
|
{
|
|
|
|
eet_close(eetf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-01-29 12:44:34 -08:00
|
|
|
|
|
|
|
eet_close(eetf);
|
2010-04-29 11:52:59 -07:00
|
|
|
|
|
|
|
/* Update mtime */
|
|
|
|
{
|
|
|
|
struct stat st;
|
|
|
|
if (stat(ed->path, &st) != 0)
|
|
|
|
return EINA_FALSE;
|
|
|
|
ef->mtime = st.st_mtime;
|
|
|
|
}
|
|
|
|
|
2009-12-22 05:46:00 -08:00
|
|
|
INF("*********** Saving DONE ******************");
|
2010-04-06 11:18:53 -07:00
|
|
|
return EINA_TRUE;
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
|
|
|
|
2010-04-06 11:18:53 -07:00
|
|
|
EAPI Eina_Bool
|
2010-01-29 12:44:34 -08:00
|
|
|
edje_edit_save(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return _edje_edit_internal_save(obj, 1);
|
|
|
|
}
|
|
|
|
|
2010-04-06 11:18:53 -07:00
|
|
|
EAPI Eina_Bool
|
2010-01-29 12:44:34 -08:00
|
|
|
edje_edit_save_all(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return _edje_edit_internal_save(obj, 0);
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:48:11 -08:00
|
|
|
EAPI void
|
|
|
|
edje_edit_print_internal_status(Evas_Object *obj)
|
|
|
|
{
|
2011-01-16 00:09:47 -08:00
|
|
|
/*
|
2008-10-22 04:34:42 -07:00
|
|
|
Edje_Program *epr;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2010-08-04 07:25:40 -07:00
|
|
|
int j;
|
2011-01-16 00:09:47 -08:00
|
|
|
*/
|
2013-12-14 18:40:16 -08:00
|
|
|
Eina_Strbuf *source_file;
|
2012-01-16 04:34:13 -08:00
|
|
|
GET_EED_OR_RETURN();
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2013-12-14 18:40:16 -08:00
|
|
|
source_file =_edje_generate_source(obj);
|
|
|
|
if (source_file) eina_strbuf_free(source_file);
|
2011-01-15 20:05:30 -08:00
|
|
|
/*
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("****** CHECKIN' INTERNAL STRUCTS STATUS *********");
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("path: '%s', group: '%s', parent: '%s'",
|
|
|
|
ed->path, ed->group, ed->parent);
|
2008-03-13 12:01:53 -07:00
|
|
|
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("Parts [table:%d list:%d]", ed->table_parts_size,
|
2010-07-29 05:02:36 -07:00
|
|
|
ed->collection->parts_count);
|
|
|
|
for (i = 0; i < ed->collection->parts_count; ++i)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part *p;
|
|
|
|
|
|
|
|
p = ed->collection->parts[i];
|
2008-03-13 12:01:53 -07:00
|
|
|
|
|
|
|
rp = ed->table_parts[p->id % ed->table_parts_size];
|
2010-10-07 17:24:22 -07:00
|
|
|
printf("part[%d]: '%s' ", p->id, p->name);
|
2008-03-13 12:01:53 -07:00
|
|
|
if (p == rp->part)
|
2010-10-07 17:24:22 -07:00
|
|
|
printf("OK!\n");
|
2008-03-13 12:01:53 -07:00
|
|
|
else
|
2010-10-07 17:24:22 -07:00
|
|
|
printf("WRONG (table[%d]->name = '%s')\n", p->id, rp->part->name);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("Programs [table:%d list:%d,%d,%d,%d,%d]", ed->table_programs_size,
|
2010-08-04 07:25:40 -07:00
|
|
|
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)
|
2008-03-13 12:01:53 -07:00
|
|
|
{
|
2010-08-04 07:25:40 -07:00
|
|
|
epr = ed->table_programs[i % ed->table_programs_size];
|
2010-10-07 17:24:22 -07:00
|
|
|
printf("program[%d]: '%s'\n", epr->id, epr->name);
|
2008-03-13 12:01:53 -07:00
|
|
|
}
|
|
|
|
|
2010-10-07 17:24:22 -07:00
|
|
|
INF("****************** END ************************");
|
2011-01-15 20:05:30 -08:00
|
|
|
*/
|
2008-03-06 11:48:11 -08:00
|
|
|
}
|
2012-10-21 03:46:58 -07:00
|
|
|
|
2014-04-01 03:11:27 -07:00
|
|
|
#include "edje_edit.eo.c"
|