summaryrefslogtreecommitdiff
path: root/legacy/edje/doc
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2010-10-08 21:59:21 +0000
committerDavide Andreoli <dave@gurumeditation.it>2010-10-08 21:59:21 +0000
commit1f34fa16e7524469f734f12b12531cf7b1794f22 (patch)
tree6b39696715d0d0158ce2b89a0425effce32b2986 /legacy/edje/doc
parent80e0de0e199ac631ac27c9a71c7cc7da60222c63 (diff)
Put in edje examples the super cool edje-emotion-elementary
videoplayer by Gustavo Barbieri. SVN revision: 53214
Diffstat (limited to 'legacy/edje/doc')
-rw-r--r--legacy/edje/doc/edje.dox.in4
-rw-r--r--legacy/edje/doc/examples/external_emotion_elm.edc239
2 files changed, 243 insertions, 0 deletions
diff --git a/legacy/edje/doc/edje.dox.in b/legacy/edje/doc/edje.dox.in
index 2965b518c0..233d8d3a5b 100644
--- a/legacy/edje/doc/edje.dox.in
+++ b/legacy/edje/doc/edje.dox.in
@@ -478,8 +478,12 @@ This example show the usage of timers in embryo.
478@example external_elm_button.edc 478@example external_elm_button.edc
479This example create some elementary buttons and do some actions on user click. 479This example create some elementary buttons and do some actions on user click.
480 480
481@example external_emotion_elm.edc
482Super-concise video player example using Edje/Emotion/Elementary.
483
481@example lua_script.edc 484@example lua_script.edc
482This example show the usage of lua scripting to create and animate some 485This example show the usage of lua scripting to create and animate some
483objects in the canvas. 486objects in the canvas.
484 487
488
485*/ 489*/
diff --git a/legacy/edje/doc/examples/external_emotion_elm.edc b/legacy/edje/doc/examples/external_emotion_elm.edc
new file mode 100644
index 0000000000..686e10f3e4
--- /dev/null
+++ b/legacy/edje/doc/examples/external_emotion_elm.edc
@@ -0,0 +1,239 @@
1/*
2 Super-concise video player example using Edje/Emotion/Elementary.
3
4 This is all in Edje by means of type:EXTERNAL, you don't need any C
5 code other than emotion and edje installed with edje_external
6 support enabled.
7
8 Compile: edje_cc external-emotion-elm.edc
9 Run....: edje_player external-emotion-elm.edj
10
11 */
12collections {
13 group { name: "main";
14 min: 350 200; /* set a min window size */
15
16 externals { /* declare the modules you want to load */
17 external: "emotion"; /* video player engine */
18 external: "elm"; /* toolkit/widgets */
19 }
20
21 parts {
22 part { name: "bg"; /* dark gray rectangle as background */
23 type: RECT;
24 description { state: "default" 0.0;
25 color: 64 64 64 255;
26 }
27 }
28
29 part { name: "video"; /* video object */
30 type: EXTERNAL;
31 source: "emotion";
32 description { state: "default" 0.0;
33 params {
34 /* explicitly select the emotion engine
35 * ['xine', 'gstreamer' or 'vlc']
36 * or comment the line to autoselect the engine */
37 // choice: "engine" "gstreamer";
38 }
39 }
40 }
41
42 part { name: "title";
43 type: TEXT;
44 effect: SOFT_SHADOW;
45 description { state: "default" 0.0;
46 color: 255 255 255 0;
47 color3: 0 0 0 0;
48 align: 0.5 0.0;
49 rel1 {
50 relative: 0.0 0.0;
51 offset: 10 2;
52 }
53 rel2 {
54 relative: 1.0 0.0;
55 offset: -11 10;
56 }
57 text {
58 font: "Sans:style=Bold";
59 align: 0.5 0.0;
60 size: 10;
61 min: 0 1;
62 text: "";
63 }
64 }
65 description { state: "visible" 0.0;
66 inherit: "default" 0.0;
67 color: 255 255 255 255;
68 color3: 0 0 0 255;
69 }
70 }
71
72 part { name: "controls-clipper"; /* clipper to control visibility */
73 type: RECT;
74 description { state: "default" 0.0;
75 color: 255 255 255 32;
76 }
77 description { state: "visible" 0.0;
78 color: 255 255 255 255;
79 }
80 }
81
82 part { name: "controls-bg"; /* controls background as
83 semi-transparent black at bottom edge */
84 type: RECT;
85 clip_to: "controls-clipper";
86 description { state: "default" 0.0;
87 color: 0 0 0 128;
88 rel1 {
89 relative: 0.0 1.0;
90 offset: 0 -40;
91 }
92 rel2 {
93 relative: 1.0 1.0;
94 offset: -1 -1;
95 }
96 }
97 }
98
99 part { name: "play"; /* play button at bottom-left (relative
100 to controls-bg) */
101 type: EXTERNAL;
102 source: "elm/button";
103 clip_to: "controls-clipper";
104 description { state: "default" 0.0;
105 rel1 {
106 relative: 0.0 0.0;
107 offset: 0 0;
108 to: "controls-bg";
109 }
110 rel2 {
111 relative: 0.0 1.0;
112 offset: 50 -1;
113 to: "controls-bg";
114 }
115 params.string: "icon" "apps";
116 }
117 }
118
119 part { name: "open"; /* open file button next to play button */
120 type: EXTERNAL;
121 source: "elm/fileselector_button";
122 clip_to: "controls-clipper";
123 description { state: "default" 0.0;
124 rel1 {
125 relative: 0.0 0.0;
126 offset: 52 0;
127 to: "controls-bg";
128 }
129 rel2 {
130 relative: 0.0 1.0;
131 offset: 102 -1;
132 to: "controls-bg";
133 }
134 params.string: "icon" "folder";
135 }
136 }
137
138 part { name: "time"; /* time/progress */
139 type: EXTERNAL;
140 source: "elm/slider";
141 clip_to: "controls-clipper";
142 description { state: "default" 0.0;
143 rel1 {
144 relative: 0.0 0.0;
145 offset: 104 0;
146 to: "controls-bg";
147 }
148 rel2 {
149 relative: 1.0 1.0;
150 offset: -1 -1;
151 to: "controls-bg";
152 }
153 }
154 }
155
156 part { name: "controls-eventarea"; /* event area so we catch mouse in
157 and out, repeat events so
158 buttons get them */
159 type: RECT;
160 repeat_events: 1;
161 description {
162 state: "default" 0.0;
163 color: 255 255 255 0; /* fully transparent as we don't
164 need any visual feedback */
165 rel1.to: "controls-bg";
166 rel2.to: "controls-bg";
167 }
168 }
169
170 programs {
171 /* animated 0.2 linear fade in/out if mouse is over controls */
172 program { signal: "mouse,in";
173 source: "controls-eventarea";
174 action: STATE_SET "visible" 0.0;
175 transition: LINEAR 0.2;
176 target: "controls-clipper";
177 target: "title";
178 }
179 program { signal: "mouse,out";
180 source: "controls-eventarea";
181 action: STATE_SET "default" 0.0;
182 transition: LINEAR 0.2;
183 target: "controls-clipper";
184 target: "title";
185 }
186
187 /* toggle video playing state when play is clicked */
188 program { name: "toggle-play-video";
189 signal: "clicked";
190 source: "play";
191 script {
192 new v = external_param_get_bool(PART:"video", "play");
193 external_param_set_bool(PART:"video", "play", !v);
194 }
195 }
196
197 /* whenever file is chosen, set and play it */
198 program { signal: "file,chosen";
199 source: "open";
200 action: PARAM_COPY "open" "path" "video" "file";
201 after: "play-video";
202 after: "set-title";
203 }
204 program { name: "play-video";
205 action: PARAM_SET "video" "play" "1";
206 }
207 program { name: "set-title";
208 action: PARAM_COPY "open" "path" "title" "text";
209 }
210
211 /* if position changes, set slider (time) */
212 program { signal: "position_update";
213 source: "video";
214 script {
215 new Float:p, Float:len;
216
217 p = external_param_get_float(PART:"video", "position");
218 len = external_param_get_float(PART:"video", "play_length");
219 if (len > 0.0)
220 external_param_set_float(PART:"time", "value", p / len);
221 }
222 }
223
224 /* if slider (time) changes, set the position (seek) */
225 program { signal: "changed";
226 source: "time";
227 script {
228 new Float:v, Float:len;
229
230 v = external_param_get_float(PART:"time", "value");
231 len = external_param_get_float(PART:"video", "play_length");
232 if (len > 0.0)
233 external_param_set_float(PART:"video", "position", v * len);
234 }
235 }
236 }
237 }
238 }
239}