[Request]Update Flora license version
[apps/core/preloaded/calculator.git] / edc / Inc.calculator.pannel.por.edc
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
5 * Licensed under the Flora License, Version 1.1 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *    http://floralicense.org/license
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #define BG_H_POR        (1280-60-88)
20 #define PANNEL_W_POR                    720
21 #define PANNEL_H_POR               (782+18)
22 #define PANNEL_FULL_W_POR               720
23 #define PANNEL_FULL_H_POR               (782+14)
24
25 #define PANNEL_X_LOFF_POR               34
26 #define PANNEL_Y_LOFF_POR               14//???
27
28 #define PANNEL_KEY_W_PAD_POR    23
29 #define PANNEL_KEY_H_PAD_POR    8
30 #define PANNEL_KEY_W_POR                150
31 #define PANNEL_KEY_H_POR                150
32 #define PANNEL_KEY_FULL_W_POR   (PANNEL_KEY_W_POR+PANNEL_KEY_W_PAD_POR)
33 #define PANNEL_KEY_FULL_H_POR   (PANNEL_KEY_H_POR+PANNEL_KEY_H_PAD_POR)
34
35 #define PANNEL_COR_POR_REF1_X(X,Y)   ((PANNEL_X_LOFF_POR+PANNEL_KEY_FULL_W_POR*(Y))/PANNEL_W_POR)
36 #define PANNEL_COR_POR_REF1_Y(X,Y)   ((PANNEL_Y_LOFF_POR+PANNEL_KEY_FULL_H_POR*(X))/PANNEL_FULL_H_POR)
37 #define PANNEL_COR_POR_REF2_X(X,Y)   ((PANNEL_X_LOFF_POR+PANNEL_KEY_FULL_W_POR*(Y)+PANNEL_KEY_W_POR)/PANNEL_W_POR)
38 #define PANNEL_COR_POR_REF2_Y(X,Y)   ((PANNEL_Y_LOFF_POR+PANNEL_KEY_FULL_H_POR*(X)+PANNEL_KEY_H_POR)/PANNEL_FULL_H_POR)
39
40 #define KEYPAD_KEY_IMG_POR(key_name, relx1, rely1, relx2, rely2, bg_img, bg_img_press, to_part) \
41     EDC_PART_RECT_RELATIVE(key_name, to_part, relx1, rely1, relx2, rely2)\
42     EDC_PART_BUTTON_IMG(key_name"_bg", key_name, EDC_IMAGE(bg_img), EDC_IMAGE(bg_img_press))
43
44
45 #define KEYPAD_KEY_PROG_POR(key_name) \
46     program { \
47         name: "mouse_down_"key_name; \
48         signal: "mouse,down,1"; \
49         source: key_name; \
50         action: STATE_SET "pressed" 0.0; \
51         target: key_name"_bg"; \
52     } \
53     program { \
54         name: "mouse_up_"key_name; \
55         signal: "mouse,up,1"; \
56         source: key_name; \
57         action: STATE_SET "default" 0.0; \
58         target: key_name"_bg"; \
59     }
60
61 ///////////////////// prtrait pannel ////////////////////////////////////////
62         group {
63                 name: "por_pannel";
64                 script {
65                         public pannel_state;
66                 }
67
68                 parts {
69                         part {
70                                 name: "por_pannel/in";
71                                 type: RECT;
72                                 mouse_events: 1;
73                                 description {
74                                         state: "default" 0.0;
75                                         visible: 0;
76                                         rel1 { relative: 0.0 (270+48)/BG_H_POR; }
77                                         rel2 { relative: 1.0 (BG_H_POR-18)/BG_H_POR; }
78                                 }
79                                 description {
80                                         state: "down" 0.0;
81                                         inherit: "default" 0.0;
82                                         rel1 { relative: 0.0 1.0; offset: 0 -12;}
83                                         rel2 { relative: 1.0 1.0; offset: 0 PANNEL_H_POR;}
84                                 }
85                         }
86                         part {
87                                 name: "por_pannel/BG";
88                                 type: RECT;
89                                 mouse_events: 1;
90                                 description {
91                                         state: "default" 0.0;
92                                         visible: 1;
93                                         rel1 { relative: 0.0 (270+48)/BG_H_POR;offset: 0  -2;}
94                                         rel2 { relative: 1.0 1.1; }
95                                         color: 201 198 190 255;
96                                 }
97                                 description {
98                                         state: "down" 0.0;
99                                         inherit: "default" 0.0;
100                                         rel1 { relative: 0.0 1.0; offset: 0 -12;}
101                                         rel2 { relative: 1.0 1.0; offset: 0 PANNEL_H_POR;}
102                                 }
103                         }
104
105                         /* close&open icon */
106                         part {
107                                 name: "pannel/icon";
108                                 type: IMAGE;
109                                 mouse_events: 1;
110                                 description {
111                                         state: "default" 0.0;
112                                         rel1 { relative: 0.0 (270)/BG_H_POR;}
113                                         rel2 { relative: 1.0 (270+48)/BG_H_POR;}
114                                         image { normal: "images/port_down_handle_nor.png"; }
115                                 }
116                                 description {
117                                         state: "open" 0.0;
118                                         inherit: "default" 0.0;
119                                         rel1 { relative: 0.0 (BG_H_POR-48)/BG_H_POR;}
120                                         rel2 { relative: 1.0 (BG_H_POR)/BG_H_POR;}
121                                         image { normal: "images/port_up_handle_nor.png"; }
122                                 }
123                                 description {
124                                         state: "default_press" 0.0;
125                                         rel1 { relative: 0.0  (270)/BG_H_POR;}
126                                         rel2 { relative: 1.0  (270+48)/BG_H_POR;}
127                                         image { normal: "images/port_down_handle_press.png"; }
128                                 }
129                                 description {
130                                         state: "open_press" 0.0;
131                                         inherit: "default" 0.0;
132                                         rel1 { relative: 0.0 (BG_H_POR-48)/BG_H_POR;}
133                                         rel2 { relative: 1.0 (BG_H_POR)/BG_H_POR;}
134                                         image { normal: "images/port_up_handle_press.png"; }
135                                 }
136                         }
137
138                         /* create pannel keys */
139                         // c, /, *, <-
140                         KEYPAD_KEY_IMG_POR("item_c",
141                                 PANNEL_COR_POR_REF1_X(0,0), PANNEL_COR_POR_REF1_Y(0,0),
142                                 PANNEL_COR_POR_REF2_X(0,0), PANNEL_COR_POR_REF2_Y(0,0),
143                                 "images/btn_type_a_01_nor.png", "images/btn_type_a_01_press.png",
144                                 "por_pannel/in");
145                         KEYPAD_KEY_IMG_POR("item_div",
146                                 PANNEL_COR_POR_REF1_X(0,1), PANNEL_COR_POR_REF1_Y(0,1),
147                 PANNEL_COR_POR_REF2_X(0,1), PANNEL_COR_POR_REF2_Y(0,1),
148                                 "images/btn_type_a_02_nor.png", "images/btn_type_a_02_press.png",
149                                 "por_pannel/in");
150                         KEYPAD_KEY_IMG_POR("item_mul",
151                                 PANNEL_COR_POR_REF1_X(0,2), PANNEL_COR_POR_REF1_Y(0,2),
152                 PANNEL_COR_POR_REF2_X(0,2), PANNEL_COR_POR_REF2_Y(0,2),
153                                 "images/btn_type_a_03_nor.png", "images/btn_type_a_03_press.png",
154                                 "por_pannel/in");
155                         KEYPAD_KEY_IMG_POR("item_del",
156                                 PANNEL_COR_POR_REF1_X(0,3), PANNEL_COR_POR_REF1_Y(0,3),
157                 PANNEL_COR_POR_REF2_X(0,3), PANNEL_COR_POR_REF2_Y(0,3),
158                                 "images/btn_type_a_04_nor.png", "images/btn_type_a_04_press.png",
159                                 "por_pannel/in");
160
161
162                         // 7, 8, 9, -
163                         KEYPAD_KEY_IMG_POR("item_num7",
164                                 PANNEL_COR_POR_REF1_X(1,0), PANNEL_COR_POR_REF1_Y(1,0),
165                 PANNEL_COR_POR_REF2_X(1,0), PANNEL_COR_POR_REF2_Y(1,0),
166                                 "images/btn_type_a_num7_nor.png", "images/btn_type_a_num7_press.png",
167                                 "por_pannel/in");
168                         KEYPAD_KEY_IMG_POR("item_num8",
169                                 PANNEL_COR_POR_REF1_X(1,1), PANNEL_COR_POR_REF1_Y(1,1),
170                 PANNEL_COR_POR_REF2_X(1,1), PANNEL_COR_POR_REF2_Y(1,1),
171                                 "images/btn_type_a_num8_nor.png", "images/btn_type_a_num8_press.png",
172                                 "por_pannel/in");
173                         KEYPAD_KEY_IMG_POR("item_num9",
174                                 PANNEL_COR_POR_REF1_X(1,2), PANNEL_COR_POR_REF1_Y(1,2),
175                 PANNEL_COR_POR_REF2_X(1,2), PANNEL_COR_POR_REF2_Y(1,2),
176                                 "images/btn_type_a_num9_nor.png", "images/btn_type_a_num9_press.png",
177                                 "por_pannel/in");
178                         KEYPAD_KEY_IMG_POR("item_sub",
179                                 PANNEL_COR_POR_REF1_X(1,3), PANNEL_COR_POR_REF1_Y(1,3),
180                 PANNEL_COR_POR_REF2_X(1,3), PANNEL_COR_POR_REF2_Y(1,3),
181                                 "images/btn_type_a_05_nor.png", "images/btn_type_a_05_press.png",
182                                 "por_pannel/in");
183
184
185                         // 4, 5 ,6, +
186                         KEYPAD_KEY_IMG_POR("item_num4",
187                                 PANNEL_COR_POR_REF1_X(2,0), PANNEL_COR_POR_REF1_Y(2,0),
188                 PANNEL_COR_POR_REF2_X(2,0), PANNEL_COR_POR_REF2_Y(2,0),
189                                 "images/btn_type_a_num4_nor.png", "images/btn_type_a_num4_press.png",
190                                 "por_pannel/in");
191                         KEYPAD_KEY_IMG_POR("item_num5",
192                                 PANNEL_COR_POR_REF1_X(2,1), PANNEL_COR_POR_REF1_Y(2,1),
193                 PANNEL_COR_POR_REF2_X(2,1), PANNEL_COR_POR_REF2_Y(2,1),
194                                 "images/btn_type_a_num5_nor.png", "images/btn_type_a_num5_press.png",
195                                 "por_pannel/in");
196                         KEYPAD_KEY_IMG_POR("item_num6",
197                                 PANNEL_COR_POR_REF1_X(2,2), PANNEL_COR_POR_REF1_Y(2,3),
198                 PANNEL_COR_POR_REF2_X(2,2), PANNEL_COR_POR_REF2_Y(2,3),
199                                 "images/btn_type_a_num6_nor.png", "images/btn_type_a_num6_press.png",
200                                 "por_pannel/in");
201                         KEYPAD_KEY_IMG_POR("item_plus",
202                                 PANNEL_COR_POR_REF1_X(2,3), PANNEL_COR_POR_REF1_Y(2,3),
203                 PANNEL_COR_POR_REF2_X(2,3), PANNEL_COR_POR_REF2_Y(2,3),
204                                 "images/btn_type_a_06_nor.png", "images/btn_type_a_06_press.png",
205                                 "por_pannel/in");
206
207
208
209                         // 1, 2, 3, ()
210                         KEYPAD_KEY_IMG_POR("item_num1",
211                                 PANNEL_COR_POR_REF1_X(3,0), PANNEL_COR_POR_REF1_Y(3,0),
212                 PANNEL_COR_POR_REF2_X(3,0), PANNEL_COR_POR_REF2_Y(3,0),
213                 "images/btn_type_a_num1_nor.png", "images/btn_type_a_num1_press.png",
214                                 "por_pannel/in");
215                         KEYPAD_KEY_IMG_POR("item_num2",
216                                 PANNEL_COR_POR_REF1_X(3,1), PANNEL_COR_POR_REF1_Y(3,1),
217                 PANNEL_COR_POR_REF2_X(3,1), PANNEL_COR_POR_REF2_Y(3,1),
218                 "images/btn_type_a_num2_nor.png", "images/btn_type_a_num2_press.png",
219                                 "por_pannel/in");
220                         KEYPAD_KEY_IMG_POR("item_num3",
221                                 PANNEL_COR_POR_REF1_X(3,2), PANNEL_COR_POR_REF1_Y(3,2),
222                 PANNEL_COR_POR_REF2_X(3,2), PANNEL_COR_POR_REF2_Y(3,2),
223                 "images/btn_type_a_num3_nor.png", "images/btn_type_a_num3_press.png",
224                                 "por_pannel/in");
225                         KEYPAD_KEY_IMG_POR("item_brack",
226                                 PANNEL_COR_POR_REF1_X(3,3), PANNEL_COR_POR_REF1_Y(3,3),
227                 PANNEL_COR_POR_REF2_X(3,3), PANNEL_COR_POR_REF2_Y(3,3),
228                                 "images/btn_type_a_07_nor.png", "images/btn_type_a_07_press.png",
229                                 "por_pannel/in");
230
231
232                         //0, ., +/-,  =
233                         KEYPAD_KEY_IMG_POR("item_num0",
234                                 PANNEL_COR_POR_REF1_X(4,0), PANNEL_COR_POR_REF1_Y(4,0),
235                 PANNEL_COR_POR_REF2_X(4,0), PANNEL_COR_POR_REF2_Y(4,0),
236                 "images/btn_type_a_num0_nor.png", "images/btn_type_a_num0_press.png",
237                                 "por_pannel/in");
238                         KEYPAD_KEY_IMG_POR("item_dot",
239                                 PANNEL_COR_POR_REF1_X(4,1), PANNEL_COR_POR_REF1_Y(4,1),
240                 PANNEL_COR_POR_REF2_X(4,1), PANNEL_COR_POR_REF2_Y(4,1),
241                                 "images/btn_type_a_10_nor.png", "images/btn_type_a_10_press.png",
242                                 "por_pannel/in");
243                         KEYPAD_KEY_IMG_POR("item_neg",
244                                 PANNEL_COR_POR_REF1_X(4,2), PANNEL_COR_POR_REF1_Y(4,2),
245                 PANNEL_COR_POR_REF2_X(4,2), PANNEL_COR_POR_REF2_Y(4,2),
246                                 "images/btn_type_a_09_nor.png", "images/btn_type_a_09_press.png",
247                                 "por_pannel/in");
248                         KEYPAD_KEY_IMG_POR("item_eq",
249                                 PANNEL_COR_POR_REF1_X(4,3), PANNEL_COR_POR_REF1_Y(4,4),
250                 PANNEL_COR_POR_REF2_X(4,3), PANNEL_COR_POR_REF2_Y(4,4),
251                                 "images/btn_type_a_08_nor.png", "images/btn_type_a_08_press.png",
252                                 "por_pannel/in");
253                 }
254
255                 programs {
256                         program {
257                                 name: "group_load";
258                                 signal: "load";
259                                 script {
260                                         set_int(pannel_state, 1);
261                                 }
262                         }
263
264                         program {
265                                 name:"icon_tween_down";
266                                 action: STATE_SET  "open"  0.0;
267                                 transition: ACCELERATE 0.4;
268                                 target: "pannel/icon";
269                         }
270
271                         program {
272                                 name:"icon_tween_up";
273                                 action: STATE_SET  "default"  0.0;
274                                 transition: ACCELERATE 0.3;
275                                 target: "pannel/icon";
276                         }
277
278                         /* pannel open/close program */
279                         //press up/down
280                         program {
281                                 name: "icon_click2_down";
282                                 signal: "mouse,down,1";
283                                 source: "pannel/icon";
284                                 script {
285                                         if (get_int(pannel_state) == 1) {
286                                                 set_state(PART:"pannel/icon", "default_press", 0.0);
287                                         } else {
288                                                 set_state(PART:"pannel/icon", "open_press", 0.0);
289                                         }
290                                 }
291                         }
292
293                         program {
294                                 name: "icon_click2_up";
295                                 signal: "mouse,up,1";
296                                 source: "pannel/icon";
297                                 script {
298                                         if (get_int(pannel_state) == 1) {
299                                                 run_program(PROGRAM:"icon_tween_down");
300                                                 emit("pannel,down", "por");
301                                                 set_int(pannel_state, 0);
302                                         } else {
303                                                 run_program(PROGRAM:"icon_tween_up");
304                                                 emit("pannel,up", "por");
305                                                 set_int(pannel_state, 1);
306                                         }
307                                 }
308                         }
309
310                         //flick up/down
311                         program {
312                                 name: "icon_click";
313                                 signal: "pannel,flick";
314                                 source: "";
315                                 script {
316                                         if (get_int(pannel_state) == 1) {
317                                                 emit("pannel,down", "por");
318                                                 set_state(PART:"pannel/icon", "open", 0.0);
319                                                 set_int(pannel_state, 0);
320                                         } else {
321                                                 emit("pannel,up", "por");
322                                                 set_state(PART:"pannel/icon", "default", 0.0);
323                                                 set_int(pannel_state, 1);
324                                         }
325                                 }
326                         }
327
328                         program {
329                                 name: "pannel/down";
330                                 signal: "pannel,down";
331                                 source: "*";
332                                 action: STATE_SET "down" 0.0;
333                                 target: "por_pannel/in";
334                                 target: "por_pannel/BG";
335                                 transition: ACCELERATE 0.4;
336                                 after: "check_icon_open";
337                         }
338                         program {
339                                 name: "pannel/down_i";
340                                 signal: "pannel,down_i";
341                                 source: "*";
342                                 action: STATE_SET "down" 0.0;
343                                 target: "por_pannel/in";
344                                 target: "por_pannel/BG";
345                                 after: "check_icon_open";
346                         }
347                         program {
348                                 name: "pannel/up";
349                                 signal: "pannel,up";
350                                 source: "*";
351                                 action: STATE_SET "default" 0.0;
352                                 target: "por_pannel/in";
353                                 target: "por_pannel/BG";
354                                 transition: ACCELERATE 0.3;
355                                 after: "check_icon_default";
356                         }
357
358                         program {
359                                 name: "check_icon_open";
360                                 script {
361                                         if (get_int(pannel_state) == 1) {
362                                                 set_state(PART:"pannel/icon", "open", 0.0);
363                                                 set_int(pannel_state, 0);
364                                         }
365                                 }
366                         }
367
368                         program {
369                                 name: "check_icon_default";
370                                 script {
371                                         if (get_int(pannel_state) == 0) {
372                                                 set_state(PART:"pannel/icon", "default", 0.0);
373                                                 set_int(pannel_state, 1);
374                                         }
375                                 }
376                         }
377
378                         /* programs for pennel items */
379                         KEYPAD_KEY_PROG_POR("item_c");
380                         KEYPAD_KEY_PROG_POR("item_div");
381                         KEYPAD_KEY_PROG_POR("item_mul");
382                         KEYPAD_KEY_PROG_POR("item_del");
383
384                         KEYPAD_KEY_PROG_POR("item_num7");
385                         KEYPAD_KEY_PROG_POR("item_num8");
386                         KEYPAD_KEY_PROG_POR("item_num9");
387                         KEYPAD_KEY_PROG_POR("item_sub");
388
389                         KEYPAD_KEY_PROG_POR("item_num4");
390                         KEYPAD_KEY_PROG_POR("item_num5");
391                         KEYPAD_KEY_PROG_POR("item_num6");
392                         KEYPAD_KEY_PROG_POR("item_plus");
393
394                         KEYPAD_KEY_PROG_POR("item_num1");
395                         KEYPAD_KEY_PROG_POR("item_num2");
396                         KEYPAD_KEY_PROG_POR("item_num3");
397                         KEYPAD_KEY_PROG_POR("item_brack");
398
399                         KEYPAD_KEY_PROG_POR("item_dot");
400                         KEYPAD_KEY_PROG_POR("item_num0");
401                         KEYPAD_KEY_PROG_POR("item_neg");
402                         KEYPAD_KEY_PROG_POR("item_eq");
403                 }
404         }
405 ///////////////////// prtrait pannel  finish ////////////////////////////////////////
406