edje: Add embryo function get_image_id
This makes it possible to change the image from an embryo script Signed-off-by: Daniel Willmann <d.willmann@samsung.com> SVN revision: 79327
This commit is contained in:
parent
515d08491d
commit
c5996880a6
|
@ -31,3 +31,4 @@ WooHyun Jung (woohyun) <woohyun0705@gmail.com>
|
||||||
Guilherme Silveira <xguiga@gmail.com>
|
Guilherme Silveira <xguiga@gmail.com>
|
||||||
Flavio Ceolin <flavio.ceolin@profusion.mobi>
|
Flavio Ceolin <flavio.ceolin@profusion.mobi>
|
||||||
Daniel Zaoui <daniel.zaoui@yahoo.com>
|
Daniel Zaoui <daniel.zaoui@yahoo.com>
|
||||||
|
Daniel Willmann <d.willmann@samsung.com>
|
||||||
|
|
|
@ -675,3 +675,7 @@
|
||||||
2012-11-02 ChunEon Park (Hermet)
|
2012-11-02 ChunEon Park (Hermet)
|
||||||
|
|
||||||
* Fix to not update map uv for proxy
|
* Fix to not update map uv for proxy
|
||||||
|
|
||||||
|
2012-11-15 Daniel Willmann
|
||||||
|
|
||||||
|
* Add embryo function get_image_id
|
||||||
|
|
|
@ -9,6 +9,7 @@ Additions:
|
||||||
* Add EDJE_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN
|
* Add EDJE_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN
|
||||||
* Add edje_codegen - A code generator to working with edje files.
|
* Add edje_codegen - A code generator to working with edje files.
|
||||||
* Add more tags(preedit_sub1~4) for a variety of preediting states.
|
* Add more tags(preedit_sub1~4) for a variety of preediting states.
|
||||||
|
* Add embryo function get_image_id
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
* Change Edje to use Eo.
|
* Change Edje to use Eo.
|
||||||
|
|
|
@ -84,6 +84,7 @@ native cancel_anim(id);
|
||||||
*/
|
*/
|
||||||
native emit (sig[], src[]);
|
native emit (sig[], src[]);
|
||||||
native get_part_id (part[]);
|
native get_part_id (part[]);
|
||||||
|
native get_image_id (image[]);
|
||||||
native set_state (part_id, state[], Float:state_val);
|
native set_state (part_id, state[], Float:state_val);
|
||||||
native get_state (part_id, dst[], maxlen, &Float:val);
|
native get_state (part_id, dst[], maxlen, &Float:val);
|
||||||
native set_tween_state (part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val);
|
native set_tween_state (part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val);
|
||||||
|
|
|
@ -60,6 +60,7 @@ filesdir = $(pkgdatadir)/examples
|
||||||
files_DATA = \
|
files_DATA = \
|
||||||
$(EDCS) \
|
$(EDCS) \
|
||||||
bubble.png \
|
bubble.png \
|
||||||
|
bubble-blue.png \
|
||||||
red.png \
|
red.png \
|
||||||
test.png \
|
test.png \
|
||||||
Vera.ttf \
|
Vera.ttf \
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -1,10 +1,29 @@
|
||||||
collections {
|
collections {
|
||||||
|
images {
|
||||||
|
image: "bubble.png" COMP;
|
||||||
|
image: "bubble-blue.png" COMP;
|
||||||
|
}
|
||||||
|
|
||||||
group { name: "main";
|
group { name: "main";
|
||||||
script {
|
script {
|
||||||
/* define 3 global vars to hold the rotation values */
|
/* define 3 global vars to hold the rotation values */
|
||||||
public rotx;
|
public rotx;
|
||||||
public roty;
|
public roty;
|
||||||
public rotz;
|
public rotz;
|
||||||
|
|
||||||
|
public change_image(part[], img[]) {
|
||||||
|
new imgid;
|
||||||
|
new partid;
|
||||||
|
|
||||||
|
partid = get_part_id(part);
|
||||||
|
imgid = get_image_id(img);
|
||||||
|
|
||||||
|
custom_state(partid, "default", 0.0);
|
||||||
|
/* change the rotation in the custom state */
|
||||||
|
set_state_val(partid, STATE_IMAGE, imgid);
|
||||||
|
/* apply the custom state */
|
||||||
|
set_state(partid, "custom", 0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parts {
|
parts {
|
||||||
part { name: "bg";
|
part { name: "bg";
|
||||||
|
@ -13,6 +32,18 @@ collections {
|
||||||
color: 255 255 255 255;
|
color: 255 255 255 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
part { name: "img";
|
||||||
|
type: IMAGE;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
image { normal: "bubble.png"; }
|
||||||
|
}
|
||||||
|
/* Dummy state - otherwise edje_cc discards bubble-blue.png
|
||||||
|
as it thinks it's unused */
|
||||||
|
description { state: "foo" 0.0;
|
||||||
|
image { normal: "bubble-blue.png"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
part { name: "title";
|
part { name: "title";
|
||||||
type: TEXT;
|
type: TEXT;
|
||||||
description { state: "default" 0.0;
|
description { state: "default" 0.0;
|
||||||
|
@ -61,6 +92,18 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
part { name: "setimg";
|
||||||
|
type: TEXT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 0 0 0 255;
|
||||||
|
text {
|
||||||
|
text: "Change image";
|
||||||
|
font: "Sans";
|
||||||
|
size: 12;
|
||||||
|
align: 0.5 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
part { name: "rect";
|
part { name: "rect";
|
||||||
type: RECT;
|
type: RECT;
|
||||||
mouse_events: 0;
|
mouse_events: 0;
|
||||||
|
@ -129,6 +172,13 @@ collections {
|
||||||
set_text(PART:"Z", buf);
|
set_text(PART:"Z", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
program {
|
||||||
|
signal: "mouse,down,1";
|
||||||
|
source: "setimg";
|
||||||
|
script {
|
||||||
|
change_image("img", "bubble-blue.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,6 +828,33 @@ _edje_embryo_fn_get_part_id(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get_image_id(img[]) */
|
||||||
|
static Embryo_Cell
|
||||||
|
_edje_embryo_fn_get_image_id(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_File *file;
|
||||||
|
Edje_Image_Directory *dir;
|
||||||
|
Edje_Image_Directory_Entry *dirent;
|
||||||
|
char *p;
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
CHKPARAM(1);
|
||||||
|
ed = embryo_program_data_get(ep);
|
||||||
|
GETSTR(p, params[1]);
|
||||||
|
if (!p) return -1;
|
||||||
|
file = ed->file;
|
||||||
|
if (!file) return -1;
|
||||||
|
dir = file->image_dir;
|
||||||
|
dirent = dir->entries;
|
||||||
|
for (i = 0; i < dir->entries_count; i++, dirent++)
|
||||||
|
{
|
||||||
|
if (!dirent->entry) continue;
|
||||||
|
if (!strcmp(dirent->entry, p)) return dirent->id;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static Embryo_Cell
|
static Embryo_Cell
|
||||||
_edje_embryo_fn_play_sample(Embryo_Program *ep, Embryo_Cell *params)
|
_edje_embryo_fn_play_sample(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
{
|
{
|
||||||
|
@ -3022,6 +3049,7 @@ _edje_embryo_script_init(Edje_Part_Collection *edc)
|
||||||
|
|
||||||
embryo_program_native_call_add(ep, "emit", _edje_embryo_fn_emit);
|
embryo_program_native_call_add(ep, "emit", _edje_embryo_fn_emit);
|
||||||
embryo_program_native_call_add(ep, "get_part_id", _edje_embryo_fn_get_part_id);
|
embryo_program_native_call_add(ep, "get_part_id", _edje_embryo_fn_get_part_id);
|
||||||
|
embryo_program_native_call_add(ep, "get_image_id", _edje_embryo_fn_get_image_id);
|
||||||
embryo_program_native_call_add(ep, "set_state", _edje_embryo_fn_set_state);
|
embryo_program_native_call_add(ep, "set_state", _edje_embryo_fn_set_state);
|
||||||
embryo_program_native_call_add(ep, "get_state", _edje_embryo_fn_get_state);
|
embryo_program_native_call_add(ep, "get_state", _edje_embryo_fn_get_state);
|
||||||
embryo_program_native_call_add(ep, "set_tween_state", _edje_embryo_fn_set_tween_state);
|
embryo_program_native_call_add(ep, "set_tween_state", _edje_embryo_fn_set_tween_state);
|
||||||
|
|
|
@ -530,8 +530,8 @@ struct _Edje_Image_Directory
|
||||||
Edje_Image_Directory_Entry *entries; /* an array of Edje_Image_Directory_Entry */
|
Edje_Image_Directory_Entry *entries; /* an array of Edje_Image_Directory_Entry */
|
||||||
unsigned int entries_count;
|
unsigned int entries_count;
|
||||||
|
|
||||||
Edje_Image_Directory_Set *sets;
|
Edje_Image_Directory_Set *sets; /* an array of Edje_Image_Directory_Set */
|
||||||
unsigned int sets_count; /* an array of Edje_Image_Directory_Set */
|
unsigned int sets_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Edje_Image_Directory_Entry
|
struct _Edje_Image_Directory_Entry
|
||||||
|
|
Loading…
Reference in New Issue