Lockscreen refactor
[apps/core/preloaded/lockscreen.git] / res / 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: "quick_shot.png" COMP;
21                 image: "quick_shot_press.png" COMP;
22                 image: "lock_circle_line_camera.png" COMP;
23                 image: "lock_circle_line_camera_drag.png" COMP;
24         }
25         parts {
26                 part {
27                         name: "camera.circle";
28                         type: IMAGE;
29                         scale: 1;
30                         description {
31                                 state: "default" 0.0;
32                                 min: 500 500;
33                                 visible: 0;
34                                 image.normal: "lock_circle_line_camera.png";
35                                 rel1 { relative: 0.0 0.0; }
36                                 rel2 { relative: 1.0 1.0; }
37                         }
38                         description {
39                                 inherit: "default";
40                                 state: "pressed" 1.0;
41                                 visible: 1;
42                         }
43                 }
44                 part {
45                         name: "camera.circle.fill";
46                         type: IMAGE;
47                         scale: 1;
48                         description {
49                                 state: "default" 0.0;
50                                 min: 500 500;
51                                 visible: 0;
52                                 image.normal: "lock_circle_line_camera_drag.png";
53                                 rel1 { relative: 0.0 0.0; }
54                                 rel2 { relative: 1.0 1.0; }
55                                 fixed: 1 1;
56                         }
57                         description {
58                                 inherit: "default";
59                                 state: "pressed" 1.0;
60                                 visible: 1;
61                         }
62                 }
63                 part {
64                         name: "img.camera";
65                         type: IMAGE;
66                         scale: 1;
67                         description {
68                                 state: "default" 0.0;
69                                 max: 124 124;
70                                 fixed: 1 1;
71                                 align: 1.0 1.0;
72                                 rel1 { relative: 0.0 0.0; to: "camera.circle.fill"; }
73                                 rel2 { relative: 462/500 462/500; to: "camera.circle.fill"; }
74                                 image.normal: "quick_shot.png";
75                                 visible: 1;
76                         }
77                         description {
78                                 state: "pressed" 1.0;
79                                 inherit: "default" 0.0;;
80                                 image.normal: "quick_shot_press.png";
81                         }
82                 }
83         }
84         programs {
85                 program {
86                         signal: "mouse,down,1";
87                         source: "img.camera";
88                         action: STATE_SET "pressed" 1.0;
89                         target: "camera.circle.fill";
90                         target: "camera.circle";
91                         target: "img.camera";
92                 }
93                 program {
94                         signal: "mouse,up,1";
95                         source: "img.camera";
96                         action: STATE_SET "default" 0.0;
97                         target: "camera.circle.fill";
98                         target: "camera.circle";
99                         target: "img.camera";
100                 }
101                 program {
102                         signal: "mouse,up,1";
103                         source: "img.camera";
104                         script {
105                                 /* get parts coords */
106                                 new x,y,w,h,ix,iy,iw,ih;
107                                 get_geometry(PART:"img.camera", ix, iy, iw, ih);
108                                 get_geometry(PART:"camera.circle.fill", x, y, w, h);
109
110                                 /* calculate elipsis center */
111                                 new xc = x + ix + iw / 2;
112                                 new yc = y + iy + ih / 2;
113
114                                 /* calculate elipsis radious */
115                                 new radx = xc - x;
116                                 new rady = yc - y;
117
118                                 /* get mouse coords */
119                                 new mx, my;
120                                 get_mouse(mx, my);
121
122                                 /* check if mouse is inside elipsis */
123                                 new Float:d = float((mx-xc)*(mx-xc))/float(radx*radx) + float((my-yc)*(my-yc))/float(rady*rady);
124
125                                 /* Emit signal if mouse inside elipsis */
126                                 if (d <= 1.0)
127                                 {
128                                         emit("camera,icon,clicked", "camera-layout");
129                                 }
130                         }
131                 }
132         }
133 }