summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTae-Hwan Kim <the81.kim@samsung.com>2014-03-20 13:00:20 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-03-20 13:00:21 +0900
commit3061a706c4ca02eb876799da07dae72c24cf4507 (patch)
treecb81f578acd9779b974994477fbd8477d0d61b91
parent079e5d3692241e32cb1bcd7ac47d5ace71f5d37f (diff)
Add new PLUGIN_RUN action type and new plugins.plugin handlers 1. If external library is commerical source and not opensource, we cannot include/build the library within edje. 2. If external library does not use general encodable sources, we...
Summary: ...cannot encode those things into edje. In our case, we need vibration when longpressed. But those files are not audio or image and cannot be encoded into edje. Also, this library is not opensource so should not be linked directly with edje. So we should call vibration API by using this plug-in. Reviewers: raster, cedric, seoz, Hermet CC: cedric Differential Revision: https://phab.enlightenment.org/D588
-rw-r--r--data/edje/include/edje.inc1
-rw-r--r--src/bin/edje/edje_cc.c7
-rw-r--r--src/bin/edje/edje_cc.h1
-rw-r--r--src/bin/edje/edje_cc_handlers.c158
-rw-r--r--src/bin/edje/edje_cc_out.c101
-rw-r--r--src/bin/edje/edje_decc.c43
-rw-r--r--src/bin/edje/edje_pick.c103
-rw-r--r--src/lib/edje/Edje_Common.h3
-rw-r--r--src/lib/edje/edje_data.c21
-rw-r--r--src/lib/edje/edje_embryo.c22
-rw-r--r--src/lib/edje/edje_load.c16
-rw-r--r--src/lib/edje/edje_multisense.c13
-rw-r--r--src/lib/edje/edje_private.h19
-rw-r--r--src/lib/edje/edje_program.c5
14 files changed, 509 insertions, 4 deletions
diff --git a/data/edje/include/edje.inc b/data/edje/include/edje.inc
index 828380b830..0d29c0b6df 100644
--- a/data/edje/include/edje.inc
+++ b/data/edje/include/edje.inc
@@ -237,6 +237,7 @@ native get_state_val(part_id, State_Param:p, ...);
237/* Multisense */ 237/* Multisense */
238native play_sample (sample_name[], Float:speed, ...); 238native play_sample (sample_name[], Float:speed, ...);
239native play_tone (tone_name[], Float:duration, ...); 239native play_tone (tone_name[], Float:duration, ...);
240native play_vibration (sample_name[], ...);
240 241
241/***********************************************************/ 242/***********************************************************/
242/* Edje physics calls. */ 243/* Edje physics calls. */
diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c
index 422ff676fd..5f36270c6a 100644
--- a/src/bin/edje/edje_cc.c
+++ b/src/bin/edje/edje_cc.c
@@ -13,6 +13,7 @@ static void main_help(void);
13 13
14Eina_Prefix *pfx = NULL; 14Eina_Prefix *pfx = NULL;
15Eina_List *snd_dirs = NULL; 15Eina_List *snd_dirs = NULL;
16Eina_List *vibration_dirs = NULL;
16Eina_List *img_dirs = NULL; 17Eina_List *img_dirs = NULL;
17Eina_List *fnt_dirs = NULL; 18Eina_List *fnt_dirs = NULL;
18Eina_List *data_dirs = NULL; 19Eina_List *data_dirs = NULL;
@@ -91,6 +92,7 @@ main_help(void)
91 "-id image/directory Add a directory to look in for relative path images\n" 92 "-id image/directory Add a directory to look in for relative path images\n"
92 "-fd font/directory Add a directory to look in for relative path fonts\n" 93 "-fd font/directory Add a directory to look in for relative path fonts\n"
93 "-sd sound/directory Add a directory to look in for relative path sounds samples\n" 94 "-sd sound/directory Add a directory to look in for relative path sounds samples\n"
95 "-vd vbiration/directory Add a directory to look in for relative path vibration samples\n"
94 "-dd data/directory Add a directory to look in for relative path data.file entries\n" 96 "-dd data/directory Add a directory to look in for relative path data.file entries\n"
95 "-td temp/directory Directory to store temporary files\n" 97 "-td temp/directory Directory to store temporary files\n"
96 "-l license Specify the license of a theme\n" 98 "-l license Specify the license of a theme\n"
@@ -188,6 +190,11 @@ main(int argc, char **argv)
188 i++; 190 i++;
189 snd_dirs = eina_list_append(snd_dirs, argv[i]); 191 snd_dirs = eina_list_append(snd_dirs, argv[i]);
190 } 192 }
193 else if ((!strcmp(argv[i], "-vd") || !strcmp(argv[i], "--vibration_dir")) && (i < (argc - 1)))
194 {
195 i++;
196 vibration_dirs = eina_list_append(vibration_dirs, argv[i]);
197 }
191 else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1))) 198 else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1)))
192 { 199 {
193 i++; 200 i++;
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 48bb023976..226c455c26 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -222,6 +222,7 @@ extern Eina_List *ext_dirs;
222extern Eina_List *img_dirs; 222extern Eina_List *img_dirs;
223extern Eina_List *fnt_dirs; 223extern Eina_List *fnt_dirs;
224extern Eina_List *snd_dirs; 224extern Eina_List *snd_dirs;
225extern Eina_List *vibration_dirs;
225extern Eina_List *data_dirs; 226extern Eina_List *data_dirs;
226extern char *file_in; 227extern char *file_in;
227extern char *tmp_dir; 228extern char *tmp_dir;
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index bdac6d8adf..c1cfa5c97d 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -68,6 +68,10 @@
68 * <ul> 68 * <ul>
69 * <li>@ref sec_collections_sounds_sample "Sample"</li> 69 * <li>@ref sec_collections_sounds_sample "Sample"</li>
70 * </ul> 70 * </ul>
71 * <li>@ref sec_collections_vibrations "Vibrations"</li>
72 * <ul>
73 * <li>@ref sec_collections_vibrations_sample "Sample"</li>
74 * </ul>
71 * <li>@ref sec_collections_group "Group"</li> 75 * <li>@ref sec_collections_group "Group"</li>
72 * <ul> 76 * <ul>
73 * <li>@ref sec_collections_group_script "Script"</li> 77 * <li>@ref sec_collections_group_script "Script"</li>
@@ -385,6 +389,8 @@ static void ob_collections_group_programs_program_script(void);
385static void st_collections_group_sound_sample_name(void); 389static void st_collections_group_sound_sample_name(void);
386static void st_collections_group_sound_sample_source(void); 390static void st_collections_group_sound_sample_source(void);
387static void st_collections_group_sound_tone(void); 391static void st_collections_group_sound_tone(void);
392static void st_collections_group_vibration_sample_name(void);
393static void st_collections_group_vibration_sample_source(void);
388 394
389#ifdef HAVE_EPHYSICS 395#ifdef HAVE_EPHYSICS
390static void st_collections_group_physics_world_gravity(void); 396static void st_collections_group_physics_world_gravity(void);
@@ -443,6 +449,10 @@ New_Statement_Handler statement_handlers[] =
443 {"collections.group.sounds.sample.source", st_collections_group_sound_sample_source}, /* dup */ 449 {"collections.group.sounds.sample.source", st_collections_group_sound_sample_source}, /* dup */
444 {"collections.sounds.tone", st_collections_group_sound_tone}, 450 {"collections.sounds.tone", st_collections_group_sound_tone},
445 {"collections.group.sounds.tone", st_collections_group_sound_tone}, /* dup */ 451 {"collections.group.sounds.tone", st_collections_group_sound_tone}, /* dup */
452 {"collections.vibrations.sample.name", st_collections_group_vibration_sample_name},
453 {"collections.vibrations.sample.source", st_collections_group_vibration_sample_source},
454 {"collections.group.vibrations.sample.name", st_collections_group_vibration_sample_name}, /* dup */
455 {"collections.grpup.vibrations.sample.source", st_collections_group_vibration_sample_source}, /* dup */
446 {"collections.group.name", st_collections_group_name}, 456 {"collections.group.name", st_collections_group_name},
447 {"collections.group.inherit", st_collections_group_inherit}, 457 {"collections.group.inherit", st_collections_group_inherit},
448 {"collections.group.script_only", st_collections_group_script_only}, 458 {"collections.group.script_only", st_collections_group_script_only},
@@ -886,6 +896,10 @@ New_Object_Handler object_handlers[] =
886 {"collections.group.sounds", NULL}, /* dup */ 896 {"collections.group.sounds", NULL}, /* dup */
887 {"collections.sounds.sample", NULL}, 897 {"collections.sounds.sample", NULL},
888 {"collections.group.sounds.sample", NULL}, /* dup */ 898 {"collections.group.sounds.sample", NULL}, /* dup */
899 {"collections.vibrations", NULL},
900 {"collections.group.vibrations", NULL}, /* dup */
901 {"collections.vibrations.sample", NULL},
902 {"collections.group.vibrations.sample", NULL}, /* dup */
889 {"collections.group", ob_collections_group}, 903 {"collections.group", ob_collections_group},
890 {"collections.group.data", NULL}, 904 {"collections.group.data", NULL},
891 {"collections.group.limits", NULL}, 905 {"collections.group.limits", NULL},
@@ -2285,6 +2299,7 @@ st_styles_style_tag(void)
2285 collections { 2299 collections {
2286 .. 2300 ..
2287 sounds { } 2301 sounds { }
2302 vibrations { }
2288 group { } 2303 group { }
2289 group { } 2304 group { }
2290 .. 2305 ..
@@ -2292,7 +2307,8 @@ st_styles_style_tag(void)
2292 @description 2307 @description
2293 The "collections" block is used to list the groups that compose the 2308 The "collections" block is used to list the groups that compose the
2294 theme. Additional "collections" blocks do not prevent overriding group 2309 theme. Additional "collections" blocks do not prevent overriding group
2295 names. The "sounds" block comprises of all sound definitions. 2310 names. The "sounds" block comprises of all sound definitions. The "vibrations"
2311 block compriese all vibration definitions.
2296 @endblock 2312 @endblock
2297*/ 2313*/
2298static void 2314static void
@@ -2523,6 +2539,126 @@ st_collections_group_sound_tone(void)
2523} 2539}
2524 2540
2525/** 2541/**
2542 @edcsubsection{collections_vibrations,Vibrations}
2543 */
2544
2545/**
2546 @page edcref
2547 @block
2548 vibrations
2549 @context
2550 vibrations {
2551 sample {
2552 name: "vibration_file1";
2553 source: "vibration_file1.xxx";
2554 }
2555 }
2556
2557 @description
2558 The "vibrations" block contains a list of one or more vibration sample.
2559 @endblock
2560 @since 1.10
2561*/
2562
2563/**
2564 @edcsubsection{collections_vibrations_sample,Sample}
2565 */
2566
2567/**
2568 @page edcref
2569 @block
2570 sample
2571 @context
2572 sample {
2573 name: "vibration_file1";
2574 source: "vibration_file1.xxx";
2575 }
2576 @description
2577 The sample block defines the vibration sample.
2578 @endblock
2579 @property
2580 name
2581 @parameters
2582 [sample name]
2583 @effect
2584 Used to include each vibration file. The full path to the directory holding
2585 the vibrations can be defined later with edje_cc's "-vd" option.
2586 @endproperty
2587 @since 1.10
2588 */
2589static void
2590st_collections_group_vibration_sample_name(void)
2591{
2592 Edje_Vibration_Sample *sample;
2593 const char *tmp;
2594 unsigned int i;
2595
2596 if (!edje_file->vibration_dir)
2597 edje_file->vibration_dir = mem_alloc(SZ(Edje_Vibration_Directory));
2598
2599 tmp = parse_str(0);
2600
2601 for (i = 0; i < edje_file->vibration_dir->samples_count; i++)
2602 {
2603 if (!strcmp(edje_file->vibration_dir->samples[i].name, tmp))
2604 {
2605 free((char *)tmp);
2606 return;
2607 }
2608 }
2609
2610 edje_file->vibration_dir->samples_count++;
2611 sample = realloc(edje_file->vibration_dir->samples,
2612 sizeof(Edje_Vibration_Sample) *
2613 edje_file->vibration_dir->samples_count);
2614 if (!sample)
2615 {
2616 ERR("No enough memory.");
2617 exit(-1);
2618 }
2619 edje_file->vibration_dir->samples = sample;
2620
2621 sample =
2622 edje_file->vibration_dir->samples +
2623 edje_file->vibration_dir->samples_count - 1;
2624 memset(sample, 0, sizeof(Edje_Vibration_Sample));
2625
2626 sample->name = tmp;
2627 sample->id = edje_file->vibration_dir->samples_count - 1;
2628
2629 check_arg_count(1);
2630}
2631
2632/**
2633 @page edcref
2634 @property
2635 source
2636 @parameters
2637 [vibration file name]
2638 @effect
2639 The Vibration source file name
2640 @endproperty
2641 @since 1.10
2642 */
2643static void
2644st_collections_group_vibration_sample_source(void)
2645{
2646 Edje_Vibration_Sample *sample;
2647
2648 if (!edje_file->vibration_dir->samples)
2649 {
2650 ERR("Invalid vibration sample source definition.");
2651 exit(-1);
2652 }
2653
2654 sample =
2655 edje_file->vibration_dir->samples +
2656 edje_file->vibration_dir->samples_count - 1;
2657 sample->src = parse_str(0);
2658 check_arg_count(1);
2659}
2660
2661/**
2526 @edcsubsection{collections_group,Group} 2662 @edcsubsection{collections_group,Group}
2527 */ 2663 */
2528 2664
@@ -9105,7 +9241,7 @@ st_collections_group_programs_program_in(void)
9105 @effect 9241 @effect
9106 Action to be performed by the program. Valid actions are: STATE_SET, 9242 Action to be performed by the program. Valid actions are: STATE_SET,
9107 ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, DRAG_VAL_STEP, DRAG_VAL_PAGE, 9243 ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, DRAG_VAL_STEP, DRAG_VAL_PAGE,
9108 FOCUS_SET, PARAM_COPY, PARAM_SET, PLAY_SAMPLE, PLAY_TONE, 9244 FOCUS_SET, PARAM_COPY, PARAM_SET, PLAY_SAMPLE, PLAY_TONE, PLAY_VIBRATION,
9109 PHYSICS_IMPULSE, PHYSICS_TORQUE_IMPULSE, PHYSICS_FORCE, PHYSICS_TORQUE, 9245 PHYSICS_IMPULSE, PHYSICS_TORQUE_IMPULSE, PHYSICS_FORCE, PHYSICS_TORQUE,
9110 PHYSICS_FORCES_CLEAR, PHYSICS_VEL_SET, PHYSICS_ANG_VEL_SET, 9246 PHYSICS_FORCES_CLEAR, PHYSICS_VEL_SET, PHYSICS_ANG_VEL_SET,
9111 PHYSICS_STOP, PHYSICS_ROT_SET 9247 PHYSICS_STOP, PHYSICS_ROT_SET
@@ -9122,6 +9258,7 @@ st_collections_group_programs_program_in(void)
9122 action: PARAM_SET "part" "param" "value";\n 9258 action: PARAM_SET "part" "param" "value";\n
9123 action: PLAY_SAMPLE "sample name" speed (speed of sample - 1.0 is original speed - faster is higher pitch) [channel optional EFFECT/FX | BACKGROUND/BG | MUSIC/MUS | FOREGROUND/FG | INTERFACE/UI | INPUT | ALERT;\n 9259 action: PLAY_SAMPLE "sample name" speed (speed of sample - 1.0 is original speed - faster is higher pitch) [channel optional EFFECT/FX | BACKGROUND/BG | MUSIC/MUS | FOREGROUND/FG | INTERFACE/UI | INPUT | ALERT;\n
9124 action: PLAY_TONE "tone name" duration in seconds ( Range 0.1 to 10.0 );\n 9260 action: PLAY_TONE "tone name" duration in seconds ( Range 0.1 to 10.0 );\n
9261 action: PLAY_VIBRATION "sample name" repeat (repeat count);\n
9125 action: PHYSICS_IMPULSE 10 -23.4 0;\n 9262 action: PHYSICS_IMPULSE 10 -23.4 0;\n
9126 action: PHYSICS_TORQUE_IMPULSE 0 2.1 0.95;\n 9263 action: PHYSICS_TORQUE_IMPULSE 0 2.1 0.95;\n
9127 action: PHYSICS_FORCE -20.8 0 30.85;\n 9264 action: PHYSICS_FORCE -20.8 0 30.85;\n
@@ -9165,6 +9302,7 @@ st_collections_group_programs_program_action(void)
9165 "PHYSICS_ANG_VEL_SET", EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET, 9302 "PHYSICS_ANG_VEL_SET", EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET,
9166 "PHYSICS_STOP", EDJE_ACTION_TYPE_PHYSICS_STOP, 9303 "PHYSICS_STOP", EDJE_ACTION_TYPE_PHYSICS_STOP,
9167 "PHYSICS_ROT_SET", EDJE_ACTION_TYPE_PHYSICS_ROT_SET, 9304 "PHYSICS_ROT_SET", EDJE_ACTION_TYPE_PHYSICS_ROT_SET,
9305 "PLAY_VIBRATION", EDJE_ACTION_TYPE_VIBRATION_SAMPLE,
9168 NULL); 9306 NULL);
9169 if (ep->action == EDJE_ACTION_TYPE_STATE_SET) 9307 if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
9170 { 9308 {
@@ -9219,6 +9357,21 @@ st_collections_group_programs_program_action(void)
9219 } 9357 }
9220 ep->duration = parse_float_range(2, 0.1, 10.0); 9358 ep->duration = parse_float_range(2, 0.1, 10.0);
9221 } 9359 }
9360 else if (ep->action == EDJE_ACTION_TYPE_VIBRATION_SAMPLE)
9361 {
9362 ep->vibration_name = parse_str(1);
9363 for (i = 0; i < (int)edje_file->vibration_dir->samples_count; i++)
9364 {
9365 if (!strcmp(edje_file->vibration_dir->samples[i].name, ep->vibration_name))
9366 break;
9367 if (i == (int)(edje_file->vibration_dir->samples_count - 1))
9368 {
9369 ERR("No Vibration Sample name %s exist.", ep->vibration_name);
9370 exit(-1);
9371 }
9372 }
9373 ep->vibration_repeat = parse_int(2);
9374 }
9222 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET) 9375 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
9223 { 9376 {
9224 ep->value = parse_float(1); 9377 ep->value = parse_float(1);
@@ -9308,6 +9461,7 @@ st_collections_group_programs_program_action(void)
9308 check_arg_count(5); 9461 check_arg_count(5);
9309 break; 9462 break;
9310 case EDJE_ACTION_TYPE_SOUND_SAMPLE: 9463 case EDJE_ACTION_TYPE_SOUND_SAMPLE:
9464 case EDJE_ACTION_TYPE_VIBRATION_SAMPLE:
9311 break; 9465 break;
9312 default: 9466 default:
9313 check_arg_count(3); 9467 check_arg_count(3);
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 6a75c4c84a..b24bcc7606 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -122,6 +122,7 @@ typedef struct _Head_Write Head_Write;
122typedef struct _Fonts_Write Fonts_Write; 122typedef struct _Fonts_Write Fonts_Write;
123typedef struct _Image_Write Image_Write; 123typedef struct _Image_Write Image_Write;
124typedef struct _Sound_Write Sound_Write; 124typedef struct _Sound_Write Sound_Write;
125typedef struct _Vibration_Write Vibration_Write;
125typedef struct _Group_Write Group_Write; 126typedef struct _Group_Write Group_Write;
126typedef struct _License_Write License_Write; 127typedef struct _License_Write License_Write;
127 128
@@ -169,6 +170,13 @@ struct _Sound_Write
169 int i; 170 int i;
170}; 171};
171 172
173struct _Vibration_Write
174{
175 Eet_File *ef;
176 Edje_Vibration_Sample *sample;
177 int i;
178};
179
172struct _Group_Write 180struct _Group_Write
173{ 181{
174 Eet_File *ef; 182 Eet_File *ef;
@@ -1084,6 +1092,96 @@ data_write_sounds(Eet_File *ef, int *sound_num)
1084} 1092}
1085 1093
1086static void 1094static void
1095data_thread_vibrations(void *data, Ecore_Thread *thread EINA_UNUSED)
1096{
1097 Vibration_Write *vw = data;
1098 Eina_List *ll;
1099 char *dir_path = NULL;
1100 char path[PATH_MAX];
1101 char id_str[30];
1102 Eina_File *f = NULL;
1103 void *m = NULL;
1104 int bytes = 0;
1105
1106 EINA_LIST_FOREACH(vibration_dirs, ll, dir_path)
1107 {
1108 snprintf((char *)path, sizeof(path), "%s/%s", dir_path,
1109 vw->sample->src);
1110 f = eina_file_open(path, 0);
1111 if (f) break;
1112 }
1113 if (!f)
1114 {
1115 snprintf((char *)path, sizeof(path), "%s",
1116 vw->sample->src);
1117 f = eina_file_open(path, 0);
1118 }
1119 if (f) using_file(path, 'S');
1120 if (!f)
1121 {
1122 ERR("Unable to load vibration data of: %s", vw->sample->src);
1123 exit(-1);
1124 }
1125
1126 snprintf(id_str, sizeof(id_str), "edje/vibrations/%i", vw->sample->id);
1127 m = eina_file_map_all(f, EINA_FILE_WILLNEED);
1128 if (m)
1129 {
1130 bytes = eet_write(vw->ef, id_str, m, eina_file_size_get(f),
1131 EET_COMPRESSION_NONE);
1132 if (eina_file_map_faulted(f, m))
1133 {
1134 ERR("File access error when reading '%s'",
1135 eina_file_filename_get(f));
1136 exit(-1);
1137 }
1138 eina_file_map_free(f, m);
1139 }
1140 eina_file_close(f);
1141
1142 INF("Wrote %9i bytes (%4iKb) for \"%s\" %s vibration entry \"%s\"",
1143 bytes, (bytes + 512) / 1024,
1144 id_str, "RAW", vw->sample->name);
1145}
1146
1147static void
1148data_thread_vibrations_end(void *data, Ecore_Thread *thread EINA_UNUSED)
1149{
1150 Vibration_Write *sw = data;
1151 pending_threads--;
1152 if (pending_threads <= 0) ecore_main_loop_quit();
1153 free(sw);
1154}
1155
1156static void
1157data_write_vibrations(Eet_File *ef, int *num)
1158{
1159 if ((edje_file) && (edje_file->vibration_dir))
1160 {
1161 int i;
1162
1163 for (i = 0; i < (int)edje_file->vibration_dir->samples_count; i++)
1164 {
1165 Vibration_Write *vw;
1166
1167 vw = calloc(1, sizeof(Vibration_Write));
1168 if (!vw) continue;
1169 vw->ef = ef;
1170 vw->sample = &edje_file->vibration_dir->samples[i];
1171 vw->i = i;
1172 *num += 1;
1173 pending_threads++;
1174 if (threads)
1175 ecore_thread_run(data_thread_vibrations, data_thread_vibrations_end, NULL, vw);
1176 else
1177 {
1178 data_thread_vibrations(vw, NULL);
1179 data_thread_vibrations_end(vw, NULL);
1180 }
1181 }
1182 }
1183}
1184static void
1087check_groups(Eet_File *ef) 1185check_groups(Eet_File *ef)
1088{ 1186{
1089 Edje_Part_Collection *pc; 1187 Edje_Part_Collection *pc;
@@ -1807,6 +1905,7 @@ data_write(void)
1807 Eet_Error err; 1905 Eet_Error err;
1808 int image_num = 0; 1906 int image_num = 0;
1809 int sound_num = 0; 1907 int sound_num = 0;
1908 int vibration_num = 0;
1810 int font_num = 0; 1909 int font_num = 0;
1811 int collection_num = 0; 1910 int collection_num = 0;
1812 double t; 1911 double t;
@@ -1864,6 +1963,8 @@ data_write(void)
1864 INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get(); 1963 INF("fonts: %3.5f", ecore_time_get() - t); t = ecore_time_get();
1865 data_write_sounds(ef, &sound_num); 1964 data_write_sounds(ef, &sound_num);
1866 INF("sounds: %3.5f", ecore_time_get() - t); t = ecore_time_get(); 1965 INF("sounds: %3.5f", ecore_time_get() - t); t = ecore_time_get();
1966 data_write_vibrations(ef, &vibration_num);
1967 INF("vibrations: %3.5f", ecore_time_get() - t); t = ecore_time_get();
1867 data_write_license(ef); 1968 data_write_license(ef);
1868 INF("license: %3.5f", ecore_time_get() - t); t = ecore_time_get(); 1969 INF("license: %3.5f", ecore_time_get() - t); t = ecore_time_get();
1869 if (authors) 1970 if (authors)
diff --git a/src/bin/edje/edje_decc.c b/src/bin/edje/edje_decc.c
index fca3d332b0..747c7d5118 100644
--- a/src/bin/edje/edje_decc.c
+++ b/src/bin/edje/edje_decc.c
@@ -521,6 +521,49 @@ output(void)
521 } 521 }
522 522
523 } 523 }
524 if (edje_file->vibration_dir)
525 {
526 Edje_Vibration_Sample *sample;
527 void *data;
528 char out[PATH_MAX];
529 char out1[PATH_MAX];
530 char *pp;
531 int data_size;
532 FILE *f;
533 int i;
534
535 for (i = 0; i < (int)edje_file->vibration_dir->samples_count; i++)
536 {
537 sample = &edje_file->vibration_dir->samples[i];
538 if ((!sample) || (!sample->name)) continue;
539 snprintf(out, sizeof(out), "edje/vibrations/%i", sample->id);
540 data = (void *)eet_read_direct(tef, out, &data_size);
541 if (data)
542 {
543 snprintf(out1, sizeof(out1), "%s/%s", outdir, sample->src);
544 pp = strdup(out1);
545 p = strrchr(pp, '/');
546 *p = 0;
547 if (strstr(pp, "../"))
548 {
549 ERR("Potential security violation. attempt to write in parent dir.");
550 exit(-1);
551 }
552 ecore_file_mkpath(pp);
553 free(pp);
554 if (strstr(out, "../"))
555 {
556 ERR("Potential security violation. attempt to write in parent dir.");
557 exit(-1);
558 }
559 f = fopen(out1, "wb");
560 if (fwrite(data, data_size, 1, f) != 1)
561 ERR("Could not write sound: %s", strerror(errno));
562 fclose(f);
563 }
564 }
565 }
566
524 eet_close(tef); 567 eet_close(tef);
525 if (outdir) free(outdir); 568 if (outdir) free(outdir);
526} 569}
diff --git a/src/bin/edje/edje_pick.c b/src/bin/edje/edje_pick.c
index fc4d4d930c..f4d80a6793 100644
--- a/src/bin/edje/edje_pick.c
+++ b/src/bin/edje/edje_pick.c
@@ -66,6 +66,7 @@ struct _Edje_Pick_File_Params
66 Eina_List *imagesetlist; /* List of IDs (Edje_Pick_Data) for image sets */ 66 Eina_List *imagesetlist; /* List of IDs (Edje_Pick_Data) for image sets */
67 Eina_List *samplelist; 67 Eina_List *samplelist;
68 Eina_List *tonelist; 68 Eina_List *tonelist;
69 Eina_List *vibrationlist;
69}; 70};
70typedef struct _Edje_Pick_File_Params Edje_Pick_File_Params; 71typedef struct _Edje_Pick_File_Params Edje_Pick_File_Params;
71 72
@@ -197,6 +198,13 @@ _edje_pick_out_file_free(Edje_File *out_file)
197 198
198 free(out_file->sound_dir); 199 free(out_file->sound_dir);
199 } 200 }
201 if (out_file->vibration_dir)
202 {
203 if (out_file->vibration_dir->samples)
204 free(out_file->vibration_dir->samples);
205
206 free(out_file->vibration_dir);
207 }
200 208
201 eina_list_free(out_file->color_classes); 209 eina_list_free(out_file->color_classes);
202 eina_hash_free_cb_set(out_file->collection, free); 210 eina_hash_free_cb_set(out_file->collection, free);
@@ -861,6 +869,57 @@ _edje_pick_sounds_add(Edje_File *edf)
861} 869}
862 870
863static int 871static int
872_edje_pick_vibrations_add(Edje_File *edf)
873{
874 char buf[1024];
875 int size, k;
876 void *data;
877 Eina_Bool status = EDJE_PICK_NO_ERROR;
878 static int current_sample_id = 0;
879
880 if (edf->vibration_dir) /* Copy Sounds */
881 {
882 for (k = 0; k < (int) edf->vibration_dir->samples_count; k++)
883 {
884 Edje_Vibration_Sample *sample = &edf->vibration_dir->samples[k];
885
886 snprintf(buf, sizeof(buf), "edje/vibrations/%i", sample->id);
887 VERBOSE(EINA_LOG_INFO("Trying to read <%s>\n", sample->name));
888
889 data = eet_read(edf->ef, buf, &size);
890 if (size)
891 {
892 Edje_Pick_Data *smpl = malloc(sizeof(*smpl));
893 smpl->filename = eina_stringshare_add(sample->name);
894 smpl->data = data;
895 smpl->size = size;
896 smpl->entry = (void *) sample; /* for output file vibration dir */
897 smpl->id.old_id = sample->id;
898 sample->id = smpl->id.new_id = current_sample_id;
899 smpl->id.used = EINA_FALSE;
900
901 VERBOSE(EINA_LOG_INFO("Read <%s> sample data <%p> size <%d>\n",
902 buf, smpl->data, smpl->size));
903
904 current_sample_id++;
905 context.current_file->vibrationlist =
906 eina_list_append(context.current_file->vibrationlist, smpl);
907 }
908 else
909 {
910 EINA_LOG_ERR("Sample <%s> was not found in <%s> file.\n",
911 sample->name, context.current_file->name);
912 status = EDJE_PICK_SAMPLE_NOT_FOUND;
913 /* Should that really be freed? Or is some other handling needed? */
914 free(data);
915 }
916 }
917 }
918
919 return status;
920}
921
922static int
864_font_cmp(const void *d1, const void *d2) 923_font_cmp(const void *d1, const void *d2)
865{ 924{
866 const Edje_Font *f1 = d1; 925 const Edje_Font *f1 = d1;
@@ -977,7 +1036,7 @@ _edje_pick_lua_scripts_add(Edje_File *edf, int id, int new_id)
977static void 1036static void
978_edje_pick_styles_update(Edje_File *o, Edje_File *edf) 1037_edje_pick_styles_update(Edje_File *o, Edje_File *edf)
979{ 1038{
980 /* Color Class in Edje_File */ 1039 /* Styles in Edje_File */
981 Eina_List *l; 1040 Eina_List *l;
982 Edje_Style *stl; 1041 Edje_Style *stl;
983 1042
@@ -1186,6 +1245,30 @@ _edje_pick_sound_dir_compose(Eina_List *samples, Eina_List *tones, Edje_File *o)
1186 } 1245 }
1187} 1246}
1188 1247
1248static void
1249_edje_pick_vibration_dir_compose(Eina_List *vibrations, Edje_File *o)
1250{ /* Compose vibrationdir array from all used vibrations */
1251 if (vibrations)
1252 {
1253 Edje_Vibration_Sample *sample;
1254 Edje_Vibration_Sample *p;
1255 Eina_List *l;
1256
1257 o->vibration_dir = calloc(1, sizeof(*(o->vibration_dir)));
1258 o->vibration_dir->samples = malloc(eina_list_count(vibrations) *
1259 sizeof(Edje_Vibration_Sample));
1260
1261 p = o->vibration_dir->samples;
1262 EINA_LIST_FOREACH(vibrations, l, sample)
1263 {
1264 memcpy(p, sample, sizeof(Edje_Vibration_Sample));
1265 p++;
1266 }
1267
1268 o->vibration_dir->samples_count = eina_list_count(vibrations);
1269 }
1270}
1271
1189int 1272int
1190main(int argc, char **argv) 1273main(int argc, char **argv)
1191{ 1274{
@@ -1196,6 +1279,7 @@ main(int argc, char **argv)
1196 Eina_List *images = NULL; 1279 Eina_List *images = NULL;
1197 Eina_List *samples = NULL; 1280 Eina_List *samples = NULL;
1198 Eina_List *tones = NULL; 1281 Eina_List *tones = NULL;
1282 Eina_List *vibrations = NULL;
1199 Edje_Image_Directory_Set *sets = NULL; /* ALL files sets composed here */ 1283 Edje_Image_Directory_Set *sets = NULL; /* ALL files sets composed here */
1200 1284
1201 Edje_Part_Collection *edc; 1285 Edje_Part_Collection *edc;
@@ -1251,6 +1335,7 @@ main(int argc, char **argv)
1251 /* Build lists of all images, samples and fonts of input files */ 1335 /* Build lists of all images, samples and fonts of input files */
1252 _edje_pick_images_add(edf, out_file); /* Add Images to imagelist */ 1336 _edje_pick_images_add(edf, out_file); /* Add Images to imagelist */
1253 _edje_pick_sounds_add(edf); /* Add Sounds to samplelist */ 1337 _edje_pick_sounds_add(edf); /* Add Sounds to samplelist */
1338 _edje_pick_vibrations_add(edf); /* Add Vibrations to samplelist */
1254 _Edje_Pick_Fonts_add(edf); /* Add fonts from file to fonts list */ 1339 _Edje_Pick_Fonts_add(edf); /* Add fonts from file to fonts list */
1255 1340
1256 /* Copy styles, color class */ 1341 /* Copy styles, color class */
@@ -1367,9 +1452,25 @@ main(int argc, char **argv)
1367 if (context.current_file->append || tn->used) 1452 if (context.current_file->append || tn->used)
1368 tones = eina_list_append(tones, tn->tone); 1453 tones = eina_list_append(tones, tn->tone);
1369 } 1454 }
1455
1456 EINA_LIST_FOREACH(context.current_file->vibrationlist, l, s)
1457 {
1458 if (context.current_file->append || s->id.used)
1459 { /* Write only used vibrations */
1460 vibrations = eina_list_append(vibrations, s->entry);
1461
1462 snprintf(buf, sizeof(buf), "edje/vibrations/%i",
1463 s->id.new_id);
1464 eet_write(out_file->ef, buf,
1465 s->data, s->size,EINA_TRUE);
1466 VERBOSE(EINA_LOG_INFO("Wrote <%s> vibration data <%p> size <%d>\n",
1467 buf, s->data, s->size));
1468 }
1469 }
1370 } 1470 }
1371 1471
1372 _edje_pick_sound_dir_compose(samples, tones, out_file); 1472 _edje_pick_sound_dir_compose(samples, tones, out_file);
1473 _edje_pick_vibration_dir_compose(vibrations, out_file);
1373 1474
1374 /* Write file header after processing all groups */ 1475 /* Write file header after processing all groups */
1375 if (out_file) 1476 if (out_file)
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index e3000e5444..8c20fde90b 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1713,7 +1713,8 @@ typedef enum _Edje_Action_Type
1713 EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET = 21, /**< @since 1.8 */ 1713 EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET = 21, /**< @since 1.8 */
1714 EDJE_ACTION_TYPE_PHYSICS_STOP = 22, /**< @since 1.8 */ 1714 EDJE_ACTION_TYPE_PHYSICS_STOP = 22, /**< @since 1.8 */
1715 EDJE_ACTION_TYPE_PHYSICS_ROT_SET = 23, /**< @since 1.8 */ 1715 EDJE_ACTION_TYPE_PHYSICS_ROT_SET = 23, /**< @since 1.8 */
1716 EDJE_ACTION_TYPE_LAST = 24 1716 EDJE_ACTION_TYPE_VIBRATION_SAMPLE = 24, /**< @since 1.10 */
1717 EDJE_ACTION_TYPE_LAST = 25
1717} Edje_Action_Type; 1718} Edje_Action_Type;
1718 1719
1719/** 1720/**
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index fc76593bdb..2a9cf3fdaa 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -19,6 +19,8 @@ Eet_Data_Descriptor *_edje_edd_edje_limit_pointer = NULL;
19Eet_Data_Descriptor *_edje_edd_edje_sound_sample = NULL; 19Eet_Data_Descriptor *_edje_edd_edje_sound_sample = NULL;
20Eet_Data_Descriptor *_edje_edd_edje_sound_tone = NULL; 20Eet_Data_Descriptor *_edje_edd_edje_sound_tone = NULL;
21Eet_Data_Descriptor *_edje_edd_edje_sound_directory = NULL; 21Eet_Data_Descriptor *_edje_edd_edje_sound_directory = NULL;
22Eet_Data_Descriptor *_edje_edd_edje_vibration_sample = NULL;
23Eet_Data_Descriptor *_edje_edd_edje_vibration_directory = NULL;
22Eet_Data_Descriptor *_edje_edd_edje_program = NULL; 24Eet_Data_Descriptor *_edje_edd_edje_program = NULL;
23Eet_Data_Descriptor *_edje_edd_edje_program_pointer = NULL; 25Eet_Data_Descriptor *_edje_edd_edje_program_pointer = NULL;
24Eet_Data_Descriptor *_edje_edd_edje_program_target = NULL; 26Eet_Data_Descriptor *_edje_edd_edje_program_target = NULL;
@@ -204,6 +206,8 @@ _edje_edd_shutdown(void)
204 FREED(_edje_edd_edje_sound_sample); 206 FREED(_edje_edd_edje_sound_sample);
205 FREED(_edje_edd_edje_sound_tone); 207 FREED(_edje_edd_edje_sound_tone);
206 FREED(_edje_edd_edje_sound_directory); 208 FREED(_edje_edd_edje_sound_directory);
209 FREED(_edje_edd_edje_vibration_sample);
210 FREED(_edje_edd_edje_vibration_directory);
207 FREED(_edje_edd_edje_program); 211 FREED(_edje_edd_edje_program);
208 FREED(_edje_edd_edje_program_pointer); 212 FREED(_edje_edd_edje_program_pointer);
209 FREED(_edje_edd_edje_program_target); 213 FREED(_edje_edd_edje_program_target);
@@ -353,6 +357,19 @@ _edje_edd_init(void)
353 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_sound_directory, Edje_Sound_Directory, "samples", samples, _edje_edd_edje_sound_sample); 357 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_sound_directory, Edje_Sound_Directory, "samples", samples, _edje_edd_edje_sound_sample);
354 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_sound_directory, Edje_Sound_Directory, "tones", tones, _edje_edd_edje_sound_tone); 358 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_sound_directory, Edje_Sound_Directory, "tones", tones, _edje_edd_edje_sound_tone);
355 359
360 /* Vibration */
361 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Vibration_Sample);
362 _edje_edd_edje_vibration_sample =
363 eet_data_descriptor_file_new(&eddc);
364 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_vibration_sample, Edje_Vibration_Sample, "name", name, EET_T_STRING);
365 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_vibration_sample, Edje_Vibration_Sample, "src", src, EET_T_STRING);
366 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_vibration_sample, Edje_Vibration_Sample, "id", id, EET_T_INT);
367
368 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Vibration_Directory);
369 _edje_edd_edje_vibration_directory =
370 eet_data_descriptor_file_new(&eddc);
371 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_vibration_directory, Edje_Vibration_Directory, "samples", samples, _edje_edd_edje_vibration_sample);
372
356 /* collection directory */ 373 /* collection directory */
357 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry); 374 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry);
358 _edje_edd_edje_part_collection_directory_entry = 375 _edje_edd_edje_part_collection_directory_entry =
@@ -413,6 +430,7 @@ _edje_edd_init(void)
413 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory); 430 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "external_dir", external_dir, _edje_edd_edje_external_directory);
414 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory); 431 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "image_dir", image_dir, _edje_edd_edje_image_directory);
415 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "sound_dir", sound_dir, _edje_edd_edje_sound_directory); 432 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "sound_dir", sound_dir, _edje_edd_edje_sound_directory);
433 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_file, Edje_File, "vibration_dir", vibration_dir, _edje_edd_edje_vibration_directory);
416 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "styles", styles, _edje_edd_edje_style); 434 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "styles", styles, _edje_edd_edje_style);
417 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "color_classes", color_classes, _edje_edd_edje_color_class); 435 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_file, Edje_File, "color_classes", color_classes, _edje_edd_edje_color_class);
418 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_string); 436 EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_file, Edje_File, "data", data, _edje_edd_edje_string);
@@ -453,6 +471,9 @@ _edje_edd_init(void)
453 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tone_name", tone_name, EET_T_STRING); 471 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tone_name", tone_name, EET_T_STRING);
454 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"duration", duration, EET_T_DOUBLE); 472 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"duration", duration, EET_T_DOUBLE);
455 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"speed", speed, EET_T_DOUBLE); 473 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"speed", speed, EET_T_DOUBLE);
474 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_name", vibration_name, EET_T_STRING);
475 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_repeat", vibration_repeat, EET_T_INT);
476
456 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING); 477 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING);
457 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING); 478 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
458 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE); 479 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c
index d09ae72024..cc5eedacdd 100644
--- a/src/lib/edje/edje_embryo.c
+++ b/src/lib/edje/edje_embryo.c
@@ -75,6 +75,7 @@
75 * set_tween_state(part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val) 75 * set_tween_state(part_id, Float:tween, state1[], Float:state1_val, state2[], Float:state2_val)
76 * play_sample(sample_name, speed, ...) 76 * play_sample(sample_name, speed, ...)
77 * play_tone(tone_name, duration, ...) 77 * play_tone(tone_name, duration, ...)
78 * play_vibration(sample_name, repeat)
78 * run_program(program_id) 79 * run_program(program_id)
79 * Direction:get_drag_dir(part_id) 80 * Direction:get_drag_dir(part_id)
80 * get_drag(part_id, &Float:dx, &Float:&dy) 81 * get_drag(part_id, &Float:dx, &Float:&dy)
@@ -951,6 +952,26 @@ _edje_embryo_fn_play_tone(Embryo_Program *ep, Embryo_Cell *params)
951 return 0; 952 return 0;
952} 953}
953 954
955static Embryo_Cell
956_edje_embryo_fn_play_vibration(Embryo_Program *ep, Embryo_Cell *params)
957{
958 Edje *ed;
959 char *sample_name = NULL;
960 int repeat = 10;
961
962 if (params[0] < (int) (sizeof(Embryo_Cell) * 2)) return 0;
963 ed = embryo_program_data_get(ep);
964 GETSTR(sample_name, params[1]);
965 if ((!sample_name)) return 0;
966
967 if (params[0] == (int) (sizeof(Embryo_Cell) * 2))
968 GETINT(repeat, params[2]);
969
970 _edje_multisense_internal_vibration_sample_play(ed, sample_name,
971 repeat);
972 return 0;
973}
974
954/* set_state(part_id, state[], Float:state_val) */ 975/* set_state(part_id, state[], Float:state_val) */
955static Embryo_Cell 976static Embryo_Cell
956_edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params) 977_edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params)
@@ -3754,6 +3775,7 @@ _edje_embryo_script_init(Edje_Part_Collection *edc)
3754 embryo_program_native_call_add(ep, "set_max_size", _edje_embryo_fn_set_max_size); 3775 embryo_program_native_call_add(ep, "set_max_size", _edje_embryo_fn_set_max_size);
3755 embryo_program_native_call_add(ep, "play_sample", _edje_embryo_fn_play_sample); 3776 embryo_program_native_call_add(ep, "play_sample", _edje_embryo_fn_play_sample);
3756 embryo_program_native_call_add(ep, "play_tone", _edje_embryo_fn_play_tone); 3777 embryo_program_native_call_add(ep, "play_tone", _edje_embryo_fn_play_tone);
3778 embryo_program_native_call_add(ep, "play_vibration", _edje_embryo_fn_play_vibration);
3757 embryo_program_native_call_add(ep, "send_message", _edje_embryo_fn_send_message); 3779 embryo_program_native_call_add(ep, "send_message", _edje_embryo_fn_send_message);
3758 embryo_program_native_call_add(ep, "get_geometry", _edje_embryo_fn_get_geometry); 3780 embryo_program_native_call_add(ep, "get_geometry", _edje_embryo_fn_get_geometry);
3759 embryo_program_native_call_add(ep, "custom_state", _edje_embryo_fn_custom_state); 3781 embryo_program_native_call_add(ep, "custom_state", _edje_embryo_fn_custom_state);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index e43c8f1e0d..9dbeec3cc2 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1570,6 +1570,22 @@ _edje_file_free(Edje_File *edf)
1570 free(edf->sound_dir); 1570 free(edf->sound_dir);
1571 } 1571 }
1572 1572
1573 if (edf->vibration_dir)
1574 {
1575 unsigned int i;
1576
1577 if (edf->free_strings)
1578 {
1579 for (i = 0; i < edf->vibration_dir->samples_count; ++i)
1580 {
1581 eina_stringshare_del(edf->vibration_dir->samples[i].name);
1582 eina_stringshare_del(edf->vibration_dir->samples[i].src);
1583 }
1584 }
1585 free(edf->vibration_dir->samples);
1586 free(edf->vibration_dir);
1587 }
1588
1573 if (edf->external_dir) 1589 if (edf->external_dir)
1574 { 1590 {
1575 if (edf->external_dir->entries) free(edf->external_dir->entries); 1591 if (edf->external_dir->entries) free(edf->external_dir->entries);
diff --git a/src/lib/edje/edje_multisense.c b/src/lib/edje/edje_multisense.c
index a8ae628c8d..e4e7b6207e 100644
--- a/src/lib/edje/edje_multisense.c
+++ b/src/lib/edje/edje_multisense.c
@@ -295,6 +295,19 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const
295 295
296} 296}
297 297
298Eina_Bool
299_edje_multisense_internal_vibration_sample_play(Edje *ed EINA_UNUSED, const char *sample_name EINA_UNUSED, int repeat EINA_UNUSED)
300{
301#ifdef ENABLE_MULTISENSE
302 ERR("Vibration is not supported yet, name:%s, repeat:%d", sample_name, repeat);
303 return EINA_FALSE;
304#else
305 (void) ed;
306 (void) repeat;
307 return EINA_FALSE;
308#endif
309}
310
298void 311void
299_edje_multisense_init(void) 312_edje_multisense_init(void)
300{ 313{
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index cc7ddf2bfa..c5b0ef22e7 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -272,9 +272,12 @@ typedef struct _Edje_Image_Directory_Entry Edje_Image_Directory_Entry;
272typedef struct _Edje_Image_Directory_Set Edje_Image_Directory_Set; 272typedef struct _Edje_Image_Directory_Set Edje_Image_Directory_Set;
273typedef struct _Edje_Image_Directory_Set_Entry Edje_Image_Directory_Set_Entry; 273typedef struct _Edje_Image_Directory_Set_Entry Edje_Image_Directory_Set_Entry;
274typedef struct _Edje_Limit Edje_Limit; 274typedef struct _Edje_Limit Edje_Limit;
275typedef struct _Edje_Plugin Edje_Plugin;
275typedef struct _Edje_Sound_Sample Edje_Sound_Sample; 276typedef struct _Edje_Sound_Sample Edje_Sound_Sample;
276typedef struct _Edje_Sound_Tone Edje_Sound_Tone; 277typedef struct _Edje_Sound_Tone Edje_Sound_Tone;
277typedef struct _Edje_Sound_Directory Edje_Sound_Directory; 278typedef struct _Edje_Sound_Directory Edje_Sound_Directory;
279typedef struct _Edje_Vibration_Sample Edje_Vibration_Sample;
280typedef struct _Edje_Vibration_Directory Edje_Vibration_Directory;
278typedef struct _Edje_Program Edje_Program; 281typedef struct _Edje_Program Edje_Program;
279typedef struct _Edje_Program_Target Edje_Program_Target; 282typedef struct _Edje_Program_Target Edje_Program_Target;
280typedef struct _Edje_Program_After Edje_Program_After; 283typedef struct _Edje_Program_After Edje_Program_After;
@@ -461,6 +464,7 @@ struct _Edje_File
461 Edje_External_Directory *external_dir; 464 Edje_External_Directory *external_dir;
462 Edje_Image_Directory *image_dir; 465 Edje_Image_Directory *image_dir;
463 Edje_Sound_Directory *sound_dir; 466 Edje_Sound_Directory *sound_dir;
467 Edje_Vibration_Directory *vibration_dir;
464 468
465 Eina_List *styles; 469 Eina_List *styles;
466 470
@@ -613,6 +617,18 @@ struct _Edje_Sound_Directory
613 unsigned int tones_count; 617 unsigned int tones_count;
614}; 618};
615 619
620struct _Edje_Vibration_Sample
621{
622 const char *name;
623 const char *src;
624 int id;
625};
626
627struct _Edje_Vibration_Directory
628{
629 Edje_Vibration_Sample *samples; /* an array of Edje_Sound_Sample entries */
630 unsigned int samples_count;
631};
616/*----------*/ 632/*----------*/
617 633
618struct _Edje_Program /* a conditional program to be run */ 634struct _Edje_Program /* a conditional program to be run */
@@ -626,6 +642,8 @@ struct _Edje_Program /* a conditional program to be run */
626 const char *tone_name; 642 const char *tone_name;
627 double duration; 643 double duration;
628 double speed; 644 double speed;
645 const char *vibration_name;
646 int vibration_repeat;
629 647
630 struct { 648 struct {
631 const char *part; 649 const char *part;
@@ -2431,6 +2449,7 @@ void _edje_multisense_init(void);
2431void _edje_multisense_shutdown(void); 2449void _edje_multisense_shutdown(void);
2432Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed, int channel); 2450Eina_Bool _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, const double speed, int channel);
2433Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration, int channel); 2451Eina_Bool _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const double duration, int channel);
2452Eina_Bool _edje_multisense_internal_vibration_sample_play(Edje *ed, const char *sample_name, int repeat);
2434 2453
2435void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state); 2454void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state);
2436 2455
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 0a7c55acc7..d2fab353cf 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -874,6 +874,11 @@ low_mem_current:
874 goto break_prog; 874 goto break_prog;
875 _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration, pr->channel); 875 _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration, pr->channel);
876 break; 876 break;
877 case EDJE_ACTION_TYPE_VIBRATION_SAMPLE:
878 if (_edje_block_break(ed))
879 goto break_prog;
880 _edje_multisense_internal_vibration_sample_play(ed, pr->vibration_name, pr->vibration_repeat);
881 break;
877 case EDJE_ACTION_TYPE_PARAM_COPY: 882 case EDJE_ACTION_TYPE_PARAM_COPY:
878 { 883 {
879 Edje_Real_Part *src_part, *dst_part; 884 Edje_Real_Part *src_part, *dst_part;