Remove security-server dependency
[apps/core/preloaded/lockscreen.git] / data / edje / camera.edc
1 /*
2  * Copyright (c) 2009-2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 group {
18         name: "camera-layout";
19         images {
20                 image: "lock_circle_line_camera_drag.png" COMP;
21                 image: "lock_circle_line_camera.png" COMP;
22                 image: "quick_shot_bg.png" COMP;
23                 image: "quick_shot_icon.png" COMP;
24         }
25         parts {
26                 part {
27                         name: "bg";
28                         type: SPACER;
29                         scale: 1;
30                         description {
31                                 state: "default" 0.0;
32                                 fixed: 1 1;
33                                 min: CAMERA_LAYOUT_SIZE CAMERA_LAYOUT_SIZE;
34                                 max: CAMERA_LAYOUT_SIZE CAMERA_LAYOUT_SIZE;
35                                 rel1 { relative: 0.0 0.0; }
36                                 rel2 { relative: 1.0 1.0; }
37                         }
38                 }
39                 part {
40                         name: "img.camera.circle.line";
41                         type: IMAGE;
42                         scale: 1;
43                         description {
44                                 state: "default" 0.0;
45                                 fixed: 1 1;
46                                 rel1 { relative: 0.5 0.5; to: "bg"; }
47                                 rel2 { relative: 0.5 0.5; to: "bg"; }
48                                 min: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
49                                 max: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
50                                 image.normal: "lock_circle_line_camera.png";
51                                 visible: 0;
52                         }
53                         description {
54                                 state: "release" 0.0;
55                                 inherit: "default" 0.0;
56                                 min: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
57                                 max: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
58                                 visible: 0;
59                         }
60                         description {
61                                 state: "press" 0.0;
62                                 inherit: "default" 0.0;;
63                                 min: CAMERA_LAYOUT_SIZE CAMERA_LAYOUT_SIZE;
64                                 max: CAMERA_LAYOUT_SIZE CAMERA_LAYOUT_SIZE;
65                                 visible: 1;
66                         }
67                 }
68                 part {
69                         name: "img.camera.circle.drag";
70                         type: IMAGE;
71                         description {
72                                 state: "default" 0.0;
73                                 fixed: 1 1;
74                                 align: 0.5 0.5;
75                                 rel1 { relative: 0.5 0.5; to: "bg"; }
76                                 rel2 { relative: 0.5 0.5; to: "bg"; }
77                                 min: 1 1;
78                                 max: 1 1;
79                                 image.normal: "lock_circle_line_camera_drag.png";
80                                 visible: 0;
81                         }
82                         description {
83                                 state: "release" 0.0;
84                                 inherit: "default" 0.0;
85                                 min: 1 1;
86                                 max: 1 1;
87                                 visible: 0;
88                         }
89                         description {
90                                 state: "press" 0.0;
91                                 inherit: "default" 0.0;;
92                                 visible: 1;
93                         }
94                 }
95                 part {
96                         name: "img.camera.bg";
97                         type: IMAGE;
98                         scale: 1;
99                         description {
100                                 state: "default" 0.0;
101                                 min: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
102                                 max: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
103                                 fixed: 1 1;
104                                 rel1 { relative: 0.5 0.5; to: "bg"; }
105                                 rel2 { relative: 0.5 0.5; to: "bg"; }
106                                 image.normal: "quick_shot_bg.png";
107                                 color_class: "AO001";
108                         }
109                         description {
110                                 state: "release" 0.0;
111                                 inherit: "default" 0.0;
112                                 color_class: "AO001";
113                         }
114                         description {
115                                 state: "press" 0.0;
116                                 inherit: "default" 0.0;;
117                                 color_class: "AO001P";
118                         }
119                 }
120                 part {
121                         name: "img.camera.icon";
122                         type: IMAGE;
123                         scale: 1;
124                         repeat_events: 1;
125                         description {
126                                 state: "default" 0.0;
127                                 min: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
128                                 max: CAMERA_ICON_SIZE CAMERA_ICON_SIZE;
129                                 fixed: 1 1;
130                                 rel1 { relative: 0.5 0.5; to: "img.camera.bg"; }
131                                 rel2 { relative: 0.5 0.5; to: "img.camera.bg"; }
132                                 image.normal: "quick_shot_icon.png";
133                                 map {
134                                         on: 1;
135                                         rotation {
136                                                 center: "bg";
137                                                 x: 0.0;
138                                                 y: 0.0;
139                                                 z: 0.0;
140                                         }
141                                 }
142                         }
143                 }
144         }
145         programs {
146                 script{
147                         public use_custom;
148                         public g_mouse_down;
149                         public g_full_state;
150                         public g_angle;
151                         public g_angle_new;
152                         public g_angle_old;
153                         public g_angle_busy;
154                         public g_anim_fill_enable;
155                         public g_filler_expanded;
156                 }
157                 program {
158                         name: "init,layout";
159                         signal: "load";
160                         source: "";
161                         script {
162                                 set_int(g_mouse_down, 0);
163                                 set_int(g_angle, 0);
164                                 set_int(g_angle_new, 0);
165                                 set_int(g_angle_busy, 0);
166                                 set_int(g_anim_fill_enable, 0);
167                                 set_int(g_full_state, 0);
168                                 set_int(g_filler_expanded, 0);
169                                 set_int(use_custom, 0);
170                         }
171                 }
172                 program {
173                         name: "rotation,end";
174                         script {
175                                 new angle_old;
176                                 new angle_new;
177
178                                 angle_old = get_int(g_angle);
179                                 angle_new = get_int(g_angle_new);
180
181                                 if (angle_old != angle_new) {
182                                         set_int(g_angle_busy, 1);
183                                 } else {
184                                         set_int(g_angle_busy, 0);
185                                 }
186                         }
187                 }
188                 program {
189                         signal: "mouse,down,1";
190                         source: "img.camera.bg";
191                         action: SIGNAL_EMIT "camera,icon,mouse,down" "img.camera.bg";
192                         script {
193                                 set_int(g_mouse_down, 1);
194                         }
195                 }
196                 program {
197                         name: "camera,icon,press";
198                         signal: "camera,icon,press";
199                         source: "img.camera.bg";
200                         action: STATE_SET "press" 0.0;
201                         target: "img.camera.bg";
202                         target: "img.camera.circle.drag";
203                         after: "camera,circle,start";
204                 }
205                 program {
206                         name: "camera,circle,start";
207                         source: "img.camera.circle.line";
208                         action: STATE_SET "press" 0.0;
209                         target: "img.camera.circle.line";
210                         transition: SIN_FAC 0.5 1.7;
211                 }
212                 program {
213                         signal: "mouse,up,1";
214                         source: "img.camera.bg";
215                         action: SIGNAL_EMIT "camera,icon,mouse,up" "img.camera.bg";
216                         script {
217                                 set_int(g_mouse_down, 0);
218                         }
219
220                 }
221                 program {
222                         name: "camera,icon,release";
223                         signal: "camera,icon,release";
224                         source: "img.camera.bg";
225                         action: STATE_SET "release" 0.0;
226                         target: "img.camera.bg";
227                         after: "camera,circle,end";
228                 }
229                 program {
230                         name: "camera,circle,end";
231                         source: "img.camera.circle.line";
232                         action: STATE_SET "release" 0.0;
233                         target: "img.camera.circle.line";
234                         target: "img.camera.circle.drag";
235                         transition: SIN_FAC 0.5 1.7;
236                 }
237                 program {
238                         signal: "mouse,move";
239                         source: "img.camera.icon";
240                         script {
241                                 new x;
242                                 new y;
243                                 get_mouse(x, y);
244
245                                 if (get_int(g_mouse_down) == 0) {
246                                         return ;
247                                 }
248
249                                 new x_icon;
250                                 new y_icon;
251                                 new w_icon;
252                                 new h_icon;
253                                 get_geometry(PART:"img.camera.icon", x_icon, y_icon, w_icon, h_icon);
254
255                                 new x_max;
256                                 new y_max;
257                                 new w_max;
258                                 new h_max;
259                                 get_geometry(PART:"bg", x_max, y_max, w_max, h_max);
260
261                                 new Float:d_x;
262                                 new Float:d_y;
263                                 d_x = abs((x_icon + (w_icon / 2) - x) * 2);
264                                 d_y = abs((y_icon + (h_icon / 2) - y) * 2);
265
266                                 new min = round(sqrt((d_x * d_x) + (d_y * d_y)));
267
268                                 min = (min > w_max) ? w_max : min;
269                                 min = (min < w_icon) ? w_icon : min;
270
271                                 custom_state(PART:"img.camera.circle.drag", "press", 0.0);
272                                 set_state_val(PART:"img.camera.circle.drag", STATE_MIN, min, min);
273                                 set_state_val(PART:"img.camera.circle.drag", STATE_MAX, min, min);
274                                 set_state(PART:"img.camera.circle.drag", "custom", 0.0);
275
276                                 if (min >= w_max) {
277                                         if (get_int(g_full_state) == 0) {
278                                                 stop_programs_on(PART:"img.camera.circle.line");
279                                         }
280                                         set_int(g_full_state, 1);
281                                 } else {
282                                         set_int(g_full_state, 0);
283                                 }
284                                 set_int(g_filler_expanded, 1);
285                         }
286                 }
287         }
288 }