summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>2012-12-04 20:21:59 +0000
committerEduardo de Barros Lima <eblima@gmail.com>2012-12-04 20:21:59 +0000
commit5081d36996876f722d8bea0e5ea8612ef09b26fb (patch)
treec5b91be9eade73c773d8696dc73dcfcc43949442 /legacy
parentc49fd9d32b0e4c76b50cf71c8478ffc4d8dfec25 (diff)
New embryo function: get_program_id
It is now you can run programs with names generated dinamically. Say that you have 10 programs indexed somehow. You can now call them using the following snippet: script { new program_id[15], i; for (i = 0; i < 10; i++) { snprintf(program_id, 15, "my_program_%d", i+1); run_program(get_program_id(program_id)); } } Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com> SVN revision: 80199
Diffstat (limited to 'legacy')
-rw-r--r--legacy/edje/ChangeLog4
-rw-r--r--legacy/edje/data/include/edje.inc1
-rw-r--r--legacy/edje/src/lib/edje_embryo.c24
3 files changed, 29 insertions, 0 deletions
diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog
index 3b2e13c53c..1fcc946aa4 100644
--- a/legacy/edje/ChangeLog
+++ b/legacy/edje/ChangeLog
@@ -683,3 +683,7 @@
6832012-11-23 Bruno Dilly 6832012-11-23 Bruno Dilly
684 684
685 * Support message sending on edje player. 685 * Support message sending on edje player.
686
6872012-11-23 Eduardo Lima (Etrunko)
688
689 * Add embryo function get_program_id
diff --git a/legacy/edje/data/include/edje.inc b/legacy/edje/data/include/edje.inc
index 55eb9ee7ae..50f2bbed63 100644
--- a/legacy/edje/data/include/edje.inc
+++ b/legacy/edje/data/include/edje.inc
@@ -85,6 +85,7 @@ native cancel_anim(id);
85native emit (sig[], src[]); 85native emit (sig[], src[]);
86native get_part_id (part[]); 86native get_part_id (part[]);
87native get_image_id (image[]); 87native get_image_id (image[]);
88native get_program_id (program[]);
88native set_state (part_id, state[], Float:state_val); 89native set_state (part_id, state[], Float:state_val);
89native get_state (part_id, dst[], maxlen, &Float:val); 90native get_state (part_id, dst[], maxlen, &Float:val);
90native set_tween_state (part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val); 91native set_tween_state (part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val);
diff --git a/legacy/edje/src/lib/edje_embryo.c b/legacy/edje/src/lib/edje_embryo.c
index 1522dbb0a0..77f23b17b2 100644
--- a/legacy/edje/src/lib/edje_embryo.c
+++ b/legacy/edje/src/lib/edje_embryo.c
@@ -855,6 +855,29 @@ _edje_embryo_fn_get_image_id(Embryo_Program *ep, Embryo_Cell *params)
855 return -1; 855 return -1;
856} 856}
857 857
858/* get_program_id(program[]) */
859static Embryo_Cell
860_edje_embryo_fn_get_program_id(Embryo_Program *ep, Embryo_Cell *params)
861{
862 Edje *ed;
863 Edje_Program **prog;
864 char *p;
865 int i;
866
867 CHKPARAM(1);
868 ed = embryo_program_data_get(ep);
869 GETSTR(p, params[1]);
870 if (!p) return -1;
871 prog = ed->table_programs;
872 if (!prog) return -1;
873 for (i = 0; i < ed->table_programs_size; i++, prog++)
874 {
875 if (!(*prog)->name) continue;
876 if (!strcmp((*prog)->name, p)) return (*prog)->id;
877 }
878 return -1;
879}
880
858static Embryo_Cell 881static Embryo_Cell
859_edje_embryo_fn_play_sample(Embryo_Program *ep, Embryo_Cell *params) 882_edje_embryo_fn_play_sample(Embryo_Program *ep, Embryo_Cell *params)
860{ 883{
@@ -3050,6 +3073,7 @@ _edje_embryo_script_init(Edje_Part_Collection *edc)
3050 embryo_program_native_call_add(ep, "emit", _edje_embryo_fn_emit); 3073 embryo_program_native_call_add(ep, "emit", _edje_embryo_fn_emit);
3051 embryo_program_native_call_add(ep, "get_part_id", _edje_embryo_fn_get_part_id); 3074 embryo_program_native_call_add(ep, "get_part_id", _edje_embryo_fn_get_part_id);
3052 embryo_program_native_call_add(ep, "get_image_id", _edje_embryo_fn_get_image_id); 3075 embryo_program_native_call_add(ep, "get_image_id", _edje_embryo_fn_get_image_id);
3076 embryo_program_native_call_add(ep, "get_program_id", _edje_embryo_fn_get_program_id);
3053 embryo_program_native_call_add(ep, "set_state", _edje_embryo_fn_set_state); 3077 embryo_program_native_call_add(ep, "set_state", _edje_embryo_fn_set_state);
3054 embryo_program_native_call_add(ep, "get_state", _edje_embryo_fn_get_state); 3078 embryo_program_native_call_add(ep, "get_state", _edje_embryo_fn_get_state);
3055 embryo_program_native_call_add(ep, "set_tween_state", _edje_embryo_fn_set_tween_state); 3079 embryo_program_native_call_add(ep, "set_tween_state", _edje_embryo_fn_set_tween_state);