[Tizen 6.0] Enable build with -Wformat-truncation warning
[platform/core/system/swap-manager.git] / ui_viewer / ui_viewer_data.c
1 /*
2  *  DA manager
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Lyupa Anastasia <a.lyupa@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  * Contributors:
23  * - Samsung RnD Institute Russia
24  *
25  */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <limits.h>
30 #include <stdbool.h>
31 #include <stdint.h>
32 #include <poll.h>
33 #include <Elementary.h>
34
35 #include "ui_viewer_lib.h"
36 #include "ui_viewer_utils.h"
37 #include "ui_viewer_screenshot.h"
38 #include "ui_viewer_data.h"
39
40 static pthread_mutex_t request_lock = PTHREAD_MUTEX_INITIALIZER;
41 static pthread_mutex_t hierarchy_lock = PTHREAD_MUTEX_INITIALIZER;
42 enum hierarchy_status_t hierarchy_status = HIERARCHY_NOT_RUNNING;
43
44 static Eina_List *_get_obj(Eina_List *obj_list, Evas_Object *obj);
45 static void pack_ui_obj_prop(int file, Evas_Object *obj, const char *type_name);
46 static Eina_List *ui_viewer_get_all_objs(void);
47
48
49 static inline void write_int8(int file, uint8_t val)
50 {
51         write(file, &val, sizeof(val));
52 }
53
54 static inline void write_int32(int file, uint32_t val)
55 {
56         write(file, &val, sizeof(val));
57 }
58
59 static inline void write_int64(int file, uint64_t val)
60 {
61         write(file, &val, sizeof(val));
62 }
63
64 static inline void write_float(int file, float val)
65 {
66         write(file, &val, sizeof(val));
67 }
68 static inline void write_ptr(int file, const void *val)
69 {
70         uint64_t ptr = (uint64_t)(uintptr_t)val;
71
72         write(file, &ptr, sizeof(ptr));
73 }
74
75 static inline void write_timeval(int file, struct timeval tv)
76 {
77         write_int32(file, tv.tv_sec);
78         write_int32(file, tv.tv_usec * 1000);
79 }
80
81 static void write_string(int file, const char *str)
82 {
83         size_t len = strlen(str) + 1;
84
85         write(file, str, len);
86 }
87
88
89
90 static enum ui_obj_category_t _get_object_category(const char *type_name)
91 {
92         enum ui_obj_category_t category = UI_UNDEFINED;
93         const char evas_prefix[] = "Evas_";
94         const char elm_prefix[] = "elm_";
95
96         if (!strcmp(type_name, "rectangle") || !strcmp(type_name, "line") ||
97             !strcmp(type_name, "polygon") || !strcmp(type_name, "text") ||
98             !strcmp(type_name, "textblock") || !strcmp(type_name, "image") ||
99             !strcmp(type_name, "vectors") || !strcmp(type_name, "textgrid") ||
100             !strncmp(type_name, evas_prefix, strlen(evas_prefix)))
101                 category = UI_EVAS;
102         else if (!strncmp(type_name, elm_prefix, strlen(elm_prefix)))
103                 category = UI_ELM;
104         else if (!strcmp(type_name, "edje"))
105                 category = UI_EDJE;
106         else
107                 ui_viewer_log("cannot get category for type = %s\n", type_name);
108
109         return category;
110 }
111
112 static enum ui_obj_code_t _get_object_type_code(const char *type_name)
113 {
114         enum ui_obj_code_t type_code = UI_CODE_UNDEFINED;
115         const char evas_prefix[] = "Evas_";
116         const char elm_prefix[] = "elm_";
117
118         if (!strcmp(type_name, "rectangle"))
119                 type_code = UI_EVAS_RECTANGLE;
120         else if (!strcmp(type_name, "line"))
121                 type_code = UI_EVAS_LINE;
122         else if (!strcmp(type_name, "polygon"))
123                 type_code = UI_EVAS_POLYGON;
124         else if (!strcmp(type_name, "text"))
125                 type_code = UI_EVAS_TEXT;
126         else if (!strcmp(type_name, "textblock"))
127                 type_code = UI_EVAS_TEXTBLOCK;
128         else if (!strcmp(type_name, "image"))
129                 type_code = UI_EVAS_IMAGE;
130         else if (!strcmp(type_name, "vectors"))
131                 type_code = UI_EVAS_VECTORS;
132         else if (!strcmp(type_name, "Evas_Object_Table"))
133                 type_code = UI_EVAS_TABLE;
134         else if (!strcmp(type_name, "Evas_Object_Box"))
135                 type_code = UI_EVAS_BOX;
136         else if (!strcmp(type_name, "textgrid"))
137                 type_code = UI_EVAS_TEXTGRID;
138         else if (!strcmp(type_name, "Evas_Object_Grid"))
139                 type_code = UI_EVAS_GRID;
140         else if (!strcmp(type_name, "Evas_Object_Smart"))
141                 type_code = UI_EVAS_SMART;
142         else if (!strncmp(type_name, evas_prefix, strlen(evas_prefix)))
143                 type_code = UI_EVAS_UNDEFINED;
144         else if (!strcmp(type_name, "elm_bg"))
145                 type_code = UI_ELM_BACKGROUND;
146         else if (!strcmp(type_name, "elm_button"))
147                 type_code = UI_ELM_BUTTON;
148         else if (!strcmp(type_name, "elm_check"))
149                 type_code = UI_ELM_CHECK;
150         else if (!strcmp(type_name, "elm_colorselector"))
151                 type_code = UI_ELM_COLORSELECTOR;
152         else if (!strcmp(type_name, "elm_ctxpopup"))
153                 type_code = UI_ELM_CTXPOPUP;
154         else if (!strcmp(type_name, "elm_datetime"))
155                 type_code = UI_ELM_DATETIME;
156         else if (!strcmp(type_name, "elm_entry"))
157                 type_code = UI_ELM_ENTRY;
158         else if (!strcmp(type_name, "elm_flip"))
159                 type_code = UI_ELM_FLIP;
160         else if (!strcmp(type_name, "elm_gengrid"))
161                 type_code = UI_ELM_GENGRID;
162         else if (!strcmp(type_name, "elm_genlist"))
163                 type_code = UI_ELM_GENLIST;
164         else if (!strcmp(type_name, "elm_glview"))
165                 type_code = UI_ELM_GLVIEW;
166         else if (!strcmp(type_name, "elm_icon"))
167                 type_code = UI_ELM_ICON;
168         else if (!strcmp(type_name, "elm_image"))
169                 type_code = UI_ELM_IMAGE;
170         else if (!strcmp(type_name, "elm_index"))
171                 type_code = UI_ELM_INDEX;
172         else if (!strcmp(type_name, "elm_label"))
173                 type_code = UI_ELM_LABEL;
174         else if (!strcmp(type_name, "elm_list"))
175                 type_code = UI_ELM_LIST;
176         else if (!strcmp(type_name, "elm_map"))
177                 type_code = UI_ELM_MAP;
178         else if (!strcmp(type_name, "elm_notify"))
179                 type_code = UI_ELM_NOTIFY;
180         else if (!strcmp(type_name, "elm_panel"))
181                 type_code = UI_ELM_PANEL;
182         else if (!strcmp(type_name, "elm_photo"))
183                 type_code = UI_ELM_PHOTO;
184         else if (!strcmp(type_name, "elm_photocam"))
185                 type_code = UI_ELM_PHOTOCAM;
186         else if (!strcmp(type_name, "elm_plug"))
187                 type_code = UI_ELM_PLUG;
188         else if (!strcmp(type_name, "elm_popup"))
189                 type_code = UI_ELM_POPUP;
190         else if (!strcmp(type_name, "elm_progressbar"))
191                 type_code = UI_ELM_PROGRESSBAR;
192         else if (!strcmp(type_name, "elm_radio"))
193                 type_code = UI_ELM_RADIO;
194         else if (!strcmp(type_name, "elm_segment_control"))
195                 type_code = UI_ELM_SEGMENTCONTROL;
196         else if (!strcmp(type_name, "elm_slider"))
197                 type_code = UI_ELM_SLIDER;
198         else if (!strcmp(type_name, "elm_spinner"))
199                 type_code = UI_ELM_SPINNER;
200         else if (!strcmp(type_name, "elm_toolbar"))
201                 type_code = UI_ELM_TOOLBAR;
202         else if (!strcmp(type_name, "elm_tooltip"))
203                 type_code = UI_ELM_TOOLTIP;
204         else if (!strcmp(type_name, "elm_win"))
205                 type_code = UI_ELM_WIN;
206         else if (!strncmp(type_name, elm_prefix, strlen(elm_prefix)))
207                 type_code = UI_ELM_UNDEFINED;
208         else if (!strcmp(type_name, "edje"))
209                 type_code = UI_EDJE_UNDEFINED;
210         else
211                 ui_viewer_log("cannot get type code for type = %s\n", type_name);
212
213         return type_code;
214 }
215
216 static Eina_Bool _get_redraw(enum ui_obj_category_t category)
217 {
218         Eina_Bool redraw = EINA_FALSE;
219
220         if (category != UI_EDJE)
221                 redraw = EINA_TRUE;
222
223         return redraw;
224 }
225
226 static void _render_obj(Evas __unused *evas, Evas_Object __unused *obj,
227                         enum ui_obj_category_t category,
228                         enum ui_obj_code_t type_code EINA_UNUSED,
229                         struct timeval *tv,
230                         enum rendering_option_t rendering)
231 {
232         Eina_Bool redraw;
233
234         if ((rendering == RENDER_NONE) ||
235             (rendering == RENDER_NONE_HOST_OPT) ||
236             (rendering == RENDER_ELM && category != UI_ELM)) {
237                 timerclear(tv);
238                 return;
239         }
240
241         redraw = _get_redraw(category);
242
243         /* TODO FIXME What the hell is going around? This shouldn't be this way */
244         if (redraw) {
245 //              struct timeval start_tv, finish_tv;
246 //              Eina_Bool visible;
247 //
248 //              visible = evas_object_visible_get(obj);
249 //              if (visible) {
250 //                      evas_object_hide(obj);
251 //                      evas_render(evas);
252 //              }
253 //              gettimeofday(&start_tv, NULL);
254 //              evas_object_show(obj);
255 //              evas_render(evas);
256 //              gettimeofday(&finish_tv, NULL);
257 //              if (!visible) {
258 //                      evas_object_hide(obj);
259 //                      evas_render(evas);
260 //              }
261 //              timersub(&finish_tv, &start_tv, tv);
262 //      } else {
263         }
264                 timerclear(tv);
265 //      }
266 }
267
268 static Eina_List *_get_obj(Eina_List *obj_list, Evas_Object *obj)
269 {
270         Eina_List *children;
271         Evas_Object *child;
272         char type_name[MAX_PATH_LENGTH];
273
274         evas_object_ref(obj);
275         obj_list = eina_list_append(obj_list, obj);
276
277         _strncpy(type_name, evas_object_type_get(obj), MAX_PATH_LENGTH);
278
279         evas_object_unref(obj);
280
281         if (!strcmp(type_name, "rectangle") || !strcmp(type_name, "line") ||
282             !strcmp(type_name, "polygon") || !strcmp(type_name, "text") ||
283             !strcmp(type_name, "textblock") || !strcmp(type_name, "image") ||
284             !strcmp(type_name, "vectors") || !strcmp(type_name, "textgrid"))
285                 return obj_list;
286
287         children = evas_object_smart_members_get(obj);
288         EINA_LIST_FREE(children, child) {
289                 obj_list = _get_obj(obj_list, child);
290         }
291         eina_list_free(children);
292
293         return obj_list;
294 }
295
296 char *pack_string(char *to, const char *str)
297 {
298         if (!str) {
299                 *to = '\0';
300                 return to + 1;
301         } else {
302                 size_t len = strlen(str) + 1;
303                 memcpy(to, str, len);
304                 return to + len;
305         }
306 }
307
308 static Eina_Bool _get_obj_exists(Evas_Object *obj)
309 {
310         Eina_Bool exists = EINA_FALSE;
311
312         // this call is safe even if object doesn't exist (returns NULL)
313         if (evas_object_type_get(obj) != NULL)
314                 exists = EINA_TRUE;
315
316         return exists;
317 }
318
319 static Evas_Object *_get_win_id(Evas *evas)
320 {
321         Evas_Object *win_id = 0;
322         Eina_List *objs, *l;
323         Evas_Object *obj_i;
324
325         objs = evas_objects_in_rectangle_get(evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX,
326                                              EINA_TRUE, EINA_TRUE);
327         EINA_LIST_FOREACH(objs, l, obj_i)
328         {
329                 if (!strcmp(evas_object_type_get(obj_i), "elm_win")) {
330                         win_id = obj_i;
331                         break;
332                 }
333         }
334         eina_list_free(objs);
335
336         return win_id;
337 }
338
339 static void _pack_ui_obj_info(int file, Evas_Object *obj,
340                                enum rendering_option_t rendering)
341 {
342         ui_obj_info_t info;
343         Evas *evas;
344
345         if (!_get_obj_exists(obj)) {
346                 ui_viewer_log("object %p doesn't exist\n", obj);
347                 set_hierarchy_status(HIERARCHY_CANCELLED);
348                 print_log_ui_viewer_hierarchy_error();
349                 return;
350         }
351
352         evas = evas_object_evas_get(obj);
353
354         info.id = obj;
355         _strncpy(info.name, evas_object_type_get(obj), MAX_PATH_LENGTH);
356         info.parent_id = evas_object_smart_parent_get(obj);
357         info.category = _get_object_category(info.name);
358         info.code = _get_object_type_code(info.name);
359
360         // we set window as parent for objects without it
361         if (info.parent_id == 0 && strcmp(info.name, "elm_win"))
362                 info.parent_id = _get_win_id(evas);
363
364         _render_obj(evas, obj, info.category, info.code, &(info.rendering_tv), rendering);
365
366         ui_viewer_log("object : 0x%lx, category : %x, type_code: %x, "
367                         "type_name : %s, rendering time : %d sec, %d nano sec, parent : 0x%lx\n",
368                         (unsigned long)info.id, info.category, info.code,
369                         info.name, info.rendering_tv.tv_sec, info.rendering_tv.tv_usec * 1000,
370                         (unsigned long)info.parent_id);
371
372
373         write_ptr(file, info.id);
374         write_int8(file, info.category);
375         write_int32(file, info.code);
376         write_string(file, info.name);
377         write_timeval(file, info.rendering_tv);
378         write_ptr(file, info.parent_id);
379         pack_ui_obj_prop(file, info.id, info.name);
380
381         evas_object_unref(obj);
382
383         return;
384 }
385
386 void pack_ui_obj_info_list(int file, enum rendering_option_t rendering,
387                             Eina_Bool *cancelled)
388 {
389         Eina_List *obj_list;
390         Evas_Object *obj;
391         unsigned int info_cnt;
392 //      char *start_ptr = to;
393         Eina_List *ee_list = NULL, *ee_list_tmp = NULL;
394         Ecore_Evas *ee;
395
396         ee_list = ecore_evas_ecore_evas_list_get();
397         EINA_LIST_FOREACH(ee_list, ee_list_tmp, ee)
398         {
399                 Evas *evas = ecore_evas_get(ee);
400                 evas_event_freeze(evas);
401         }
402
403         pthread_mutex_lock(&request_lock);
404         obj_list = ui_viewer_get_all_objs();
405         info_cnt = eina_list_count(obj_list);
406         write_int8(file, rendering);
407         write_int32(file, info_cnt);
408         pthread_mutex_unlock(&request_lock);
409
410         *cancelled = EINA_FALSE;
411
412         if (info_cnt == 0) {
413                 ui_viewer_log("no objects exist\n");
414                 set_hierarchy_status(HIERARCHY_CANCELLED);
415                 *cancelled = EINA_TRUE;
416                 print_log_ui_viewer_hierarchy_error();
417         }
418
419         pthread_mutex_lock(&request_lock);
420         EINA_LIST_FREE(obj_list, obj)
421         {
422                 pthread_mutex_unlock(&request_lock);
423
424                 // check if hierarchy request is active
425                 if (get_hierarchy_status() == HIERARCHY_RUNNING) {
426                         pthread_mutex_lock(&request_lock);
427                         _pack_ui_obj_info(file, obj, rendering);
428                         pthread_mutex_unlock(&request_lock);
429                 } else {
430                         ui_viewer_log("break packing hierarchy info\n");
431                         // don't save any data if request was cancelled
432                         *cancelled = EINA_TRUE;
433
434                         /*
435                          * 'request_lock' is locked to preserve
436                          * the state consistency at loop exit.
437                          */
438                         pthread_mutex_lock(&request_lock);
439                         break;
440                 }
441
442                 pthread_mutex_lock(&request_lock);
443         }
444         // 'request_lock' is not unlocked because it must be locked.
445
446         // unref remained objects
447         EINA_LIST_FREE(obj_list, obj)
448         {
449                 evas_object_unref(obj);
450         }
451         eina_list_free(obj_list);
452
453         EINA_LIST_FREE(ee_list, ee)
454         {
455                 Evas *evas = ecore_evas_get(ee);
456                 evas_event_thaw(evas);
457         }
458         eina_list_free(ee_list);
459
460         pthread_mutex_unlock(&request_lock);
461
462         return;
463 }
464
465 enum hierarchy_status_t get_hierarchy_status(void)
466 {
467         enum hierarchy_status_t status;
468
469         pthread_mutex_lock(&hierarchy_lock);
470         status = hierarchy_status;
471         pthread_mutex_unlock(&hierarchy_lock);
472
473         return status;
474 }
475
476 void set_hierarchy_status(enum hierarchy_status_t status)
477 {
478         pthread_mutex_lock(&hierarchy_lock);
479         hierarchy_status = status;
480         pthread_mutex_unlock(&hierarchy_lock);
481 }
482
483 static Eina_List *_get_all_objs_in_rect(Evas_Coord x, Evas_Coord y, Evas_Coord w,
484                                  Evas_Coord h,
485                                  Eina_Bool      include_pass_events_objects,
486                                  Eina_Bool      include_hidden_objects)
487 {
488         Eina_List *ecore_evas_list = NULL, *obj_list = NULL;
489         Ecore_Evas *ee;
490
491         ecore_evas_list = ecore_evas_ecore_evas_list_get();
492
493         EINA_LIST_FREE(ecore_evas_list, ee)
494         {
495                 Evas *evas;
496                 Eina_List *objs, *l;
497                 Evas_Object *obj_i;
498
499                 evas = ecore_evas_get(ee);
500
501                 objs = evas_objects_in_rectangle_get(evas, x, y, w, h,
502                                                      include_pass_events_objects,
503                                                      include_hidden_objects);
504
505                 EINA_LIST_FOREACH(objs, l, obj_i)
506                 {
507                         obj_list = _get_obj(obj_list, obj_i);
508                 }
509                 eina_list_free(objs);
510         }
511
512         eina_list_free(ecore_evas_list);
513
514         return obj_list;
515 }
516
517 static Eina_List *ui_viewer_get_all_objs(void)
518 {
519         return _get_all_objs_in_rect(SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX,
520                                     EINA_TRUE, EINA_TRUE);
521 }
522
523 static void _pack_ui_obj_evas_prop(int file, ui_obj_prop_t *prop)
524 {
525         if (!prop)
526                 return;
527
528         ui_viewer_log("evas prop: geometry : [%d,%d,%d,%d], "
529                         "focus : %d, name : %s, visible : %d, \n\t"
530                         "color : [%d,%d,%d,%d], anti_alias : %d, scale : %f, "
531                         "size_min : [%d,%d], size_max : [%d,%d], size_request : [%d,%d], \n\t"
532                         "size_align : [%f,%f], size_weight : [%f,%f], "
533                         "size_padding : [%d,%d,%d,%d], render_op : %d\n",
534                         prop->geometry[0], prop->geometry[1],
535                         prop->geometry[2], prop->geometry[3],
536                         prop->focus, prop->name, prop->visible,
537                         prop->color[0], prop->color[1],
538                         prop->color[2], prop->color[3],
539                         prop->anti_alias, prop->scale,
540                         prop->size_min[0], prop->size_min[1],
541                         prop->size_max[0], prop->size_max[1],
542                         prop->size_request[0], prop->size_request[1],
543                         prop->size_align[0], prop->size_align[1],
544                         prop->size_weight[0], prop->size_weight[1],
545                         prop->size_padding[0], prop->size_padding[1],
546                         prop->size_padding[2], prop->size_padding[3],
547                         prop->render_op);
548
549         write_int32(file, prop->geometry[0]);
550         write_int32(file, prop->geometry[1]);
551         write_int32(file, prop->geometry[2]);
552         write_int32(file, prop->geometry[3]);
553         write_int8(file, prop->focus);
554         write_string(file, prop->name);
555         write_int8(file, prop->visible);
556         write_int32(file, prop->color[0]);
557         write_int32(file, prop->color[1]);
558         write_int32(file, prop->color[2]);
559         write_int32(file, prop->color[3]);
560         write_int8(file, prop->anti_alias);
561         write_float(file, prop->scale);
562         write_int32(file, prop->size_min[0]);
563         write_int32(file, prop->size_min[1]);
564         write_int32(file, prop->size_max[0]);
565         write_int32(file, prop->size_max[1]);
566         write_int32(file, prop->size_request[0]);
567         write_int32(file, prop->size_request[1]);
568         write_float(file, prop->size_align[0]);
569         write_float(file, prop->size_align[1]);
570         write_float(file, prop->size_weight[0]);
571         write_float(file, prop->size_weight[1]);
572         write_int32(file, prop->size_padding[0]);
573         write_int32(file, prop->size_padding[1]);
574         write_int32(file, prop->size_padding[2]);
575         write_int32(file, prop->size_padding[3]);
576         write_int8(file, prop->render_op);
577 }
578
579 static void _pack_ui_obj_elm_prop(int file, ui_obj_elm_prop_t *prop)
580 {
581         if (!prop)
582                 return;
583
584         ui_viewer_log("elm prop: text : %s, style : %s, disabled : %d, type : %s\n",
585                       prop->text, prop->style, prop->disabled, prop->type);
586
587         write_string(file, prop->text);
588         write_string(file, prop->style);
589         write_int8(file, prop->disabled);
590         write_string(file, prop->type);
591
592         return;
593 }
594
595 static void _pack_ui_obj_edje_prop(int file, ui_obj_edje_prop_t *prop)
596 {
597         if (!prop)
598                 return;
599
600         ui_viewer_log("edje prop: animation : %d, play : %d, scale : %f, base_scale : %f, "
601                       "size_min : [%d,%d], size_max : [%d,%d]\n",
602                       prop->animation, prop->play, prop->scale, prop->base_scale,
603                       prop->size_min[0], prop->size_min[1], prop->size_max[0],
604                       prop->size_max[1]);
605
606         write_int8(file, prop->animation);
607         write_int8(file, prop->play);
608         write_float(file, prop->scale);
609         write_float(file, prop->base_scale);
610         write_int32(file, prop->size_min[0]);
611         write_int32(file, prop->size_min[1]);
612         write_int32(file, prop->size_max[0]);
613         write_int32(file, prop->size_max[1]);
614 }
615
616 static void _pack_image_prop(int file, image_prop_t *prop)
617 {
618         if (!prop)
619                 return;
620
621         ui_viewer_log("image prop: load_dpi : %f, source_clip : %d, filled : %d, content_hint : %d, "
622                       "alpha : %d, border : [%d,%d,%d,%d], border_scale : %f, pixels_dirty : %d,\n\t"
623                       "load_orientation : %d, border_center_fill : %d, size : [%d,%d], source_visible: %d, "
624                       "fill : [%d,%d,%d,%d], load_scale_down : %d,\n\tscale_hint : %d, source_events : %d, "
625                       "frame_count : %d, evas_image_stride : %d\n",
626                       prop->load_dpi, prop->source_clip, prop->filled, prop->content_hint,
627                       prop->alpha, prop->border[0], prop->border[1], prop->border[2],
628                       prop->border[3], prop->border_scale, prop->pixels_dirty, prop->load_orientation,
629                       prop->border_center_fill, prop->size[0], prop->size[1], prop->source_visible,
630                       prop->fill[0], prop->fill[1], prop->fill[2], prop->fill[3], prop->load_scale_down,
631                       prop->scale_hint, prop->source_events, prop->frame_count, prop->evas_image_stride);
632
633         write_float(file, prop->load_dpi);
634         write_int8(file, prop->source_clip);
635         write_int8(file, prop->filled);
636         write_int8(file, prop->content_hint);
637         write_int8(file, prop->alpha);
638         write_int32(file, prop->border[0]);
639         write_int32(file, prop->border[1]);
640         write_int32(file, prop->border[2]);
641         write_int32(file, prop->border[3]);
642         write_float(file, prop->border_scale);
643         write_int8(file, prop->pixels_dirty);
644         write_int8(file, prop->load_orientation);
645         write_int8(file, prop->border_center_fill);
646         write_int32(file, prop->size[0]);
647         write_int32(file, prop->size[1]);
648         write_int8(file, prop->source_visible);
649         write_int32(file, prop->fill[0]);
650         write_int32(file, prop->fill[1]);
651         write_int32(file, prop->fill[2]);
652         write_int32(file, prop->fill[3]);
653         write_int32(file, prop->load_scale_down);
654         write_int8(file, prop->scale_hint);
655         write_int8(file, prop->source_events);
656         write_int32(file, prop->frame_count);
657         write_int32(file, prop->evas_image_stride);
658 }
659
660 static void _pack_line_prop(int file, line_prop_t *prop)
661 {
662         if (!prop)
663                 return;
664
665         ui_viewer_log("line prop: xy : [%d,%d,%d,%d]\n",
666                       prop->xy[0], prop->xy[1], prop->xy[2], prop->xy[3]);
667
668         write_int32(file, prop->xy[0]);
669         write_int32(file, prop->xy[1]);
670         write_int32(file, prop->xy[2]);
671         write_int32(file, prop->xy[3]);
672 }
673
674 static void _pack_text_prop(int file, text_prop_t *prop)
675 {
676         if (!prop)
677                 return;
678
679         ui_viewer_log("text prop: font : %s, size : %d, text : %s, delim : %s, "
680                       "ellipsis : %s, style : %d, shadow_color : [%d,%d,%d,%d], glow_color : [%d,%d,%d,%d],\n\t"
681                       "glow2_color : [%d,%d,%d,%d], outline_color : [%d,%d,%d,%d], style_pad: [%d,%d,%d,%d], "
682                       "direction : %d\n",
683                       prop->font, prop->size, prop->text, prop->delim, prop->ellipsis, prop->style,
684                       prop->shadow_color[0], prop->shadow_color[1], prop->shadow_color[2], prop->shadow_color[3],
685                       prop->glow_color[0], prop->glow_color[1], prop->glow_color[2], prop->glow_color[3],
686                       prop->glow2_color[0], prop->glow2_color[1], prop->glow2_color[2], prop->glow2_color[3],
687                       prop->outline_color[0], prop->outline_color[1], prop->outline_color[2], prop->outline_color[3],
688                       prop->style_pad[0], prop->style_pad[1], prop->style_pad[2], prop->style_pad[3],
689                       prop->direction);
690
691         write_string(file, prop->font);
692         write_int32(file, prop->size);
693         write_string(file, prop->text);
694         write_string(file, prop->delim);
695         write_float(file, prop->ellipsis);
696         write_int8(file, prop->style);
697         write_int32(file, prop->shadow_color[0]);
698         write_int32(file, prop->shadow_color[1]);
699         write_int32(file, prop->shadow_color[2]);
700         write_int32(file, prop->shadow_color[3]);
701         write_int32(file, prop->glow_color[0]);
702         write_int32(file, prop->glow_color[1]);
703         write_int32(file, prop->glow_color[2]);
704         write_int32(file, prop->glow_color[3]);
705         write_int32(file, prop->glow2_color[0]);
706         write_int32(file, prop->glow2_color[1]);
707         write_int32(file, prop->glow2_color[2]);
708         write_int32(file, prop->glow2_color[3]);
709         write_int32(file, prop->outline_color[0]);
710         write_int32(file, prop->outline_color[1]);
711         write_int32(file, prop->outline_color[2]);
712         write_int32(file, prop->outline_color[3]);
713         write_int32(file, prop->style_pad[0]);
714         write_int32(file, prop->style_pad[1]);
715         write_int32(file, prop->style_pad[2]);
716         write_int32(file, prop->style_pad[3]);
717         write_int8(file, prop->direction);
718 }
719
720 static void _pack_textblock_prop(int file, textblock_prop_t *prop)
721 {
722         if (!prop)
723                 return;
724
725         ui_viewer_log("textblock prop: replace_char : %s, valign : %f, delim : %s, newline : %d, "
726                       "markup : %s\n",
727                       prop->replace_char, prop->valign, prop->delim, prop->newline,
728                       prop->markup);
729
730         write_string(file, prop->replace_char);
731         write_float(file, prop->valign);
732         write_string(file, prop->delim);
733         write_int8(file, prop->newline);
734         write_string(file, prop->markup);
735 }
736
737 static void _pack_table_prop(int file, table_prop_t *prop)
738 {
739         if (!prop)
740                 return;
741
742         ui_viewer_log("table prop: homogeneous : %d, align : [%f,%f], padding : [%d,%d], mirrored : %d, "
743                       "col_row_size : [%d,%d]\n",
744                       prop->homogeneous, prop->align[0], prop->align[1], prop->padding[0],
745                       prop->padding[1], prop->mirrored, prop->col_row_size[0], prop->col_row_size[1]);
746
747         write_int8(file, prop->homogeneous);
748         write_float(file, prop->align[0]);
749         write_float(file, prop->align[1]);
750         write_int32(file, prop->padding[0]);
751         write_int32(file, prop->padding[1]);
752         write_int8(file, prop->mirrored);
753         write_int32(file, prop->col_row_size[0]);
754         write_int32(file, prop->col_row_size[1]);
755 }
756
757 static void _pack_box_prop(int file, box_prop_t *prop)
758 {
759         if (!prop)
760                 return;
761
762         ui_viewer_log("box prop: align : [%f,%f]\n",
763                       prop->align[0], prop->align[1]);
764
765         write_float(file, prop->align[0]);
766         write_float(file, prop->align[1]);
767 }
768
769 static void _pack_grid_prop(int file, grid_prop_t *prop)
770 {
771         if (!prop)
772                 return ;
773
774         ui_viewer_log("grid prop: mirrored : %d\n",
775                       prop->mirrored);
776
777         write_int8(file, prop->mirrored);
778 }
779
780 static void _pack_textgrid_prop(int file, textgrid_prop_t *prop)
781 {
782         if (!prop)
783                 return;
784
785         ui_viewer_log("textgrid prop: size : [%d,%d], cell_size : [%d,%d]\n",
786                       prop->size[0], prop->size[1], prop->cell_size[0],
787                       prop->cell_size[1]);
788
789         write_int32(file, prop->size[0]);
790         write_int32(file, prop->size[1]);
791         write_int32(file, prop->cell_size[0]);
792         write_int32(file, prop->cell_size[1]);
793 }
794
795 static void _pack_bg_prop(int file, bg_prop_t *prop)
796 {
797         if (!prop)
798                 return;
799
800         ui_viewer_log("bg prop: color : [%d,%d,%d], option : %d\n",
801                       prop->color[0], prop->color[1], prop->color[2],
802                       prop->option);
803
804         write_int32(file, prop->color[0]);
805         write_int32(file, prop->color[1]);
806         write_int32(file, prop->color[2]);
807         write_int8(file, prop->option);
808 }
809
810 static void _pack_button_prop(int file, button_prop_t *prop)
811 {
812         if (!prop)
813                 return;
814
815         ui_viewer_log("button prop: initial_timeout : %f, gap_timeout : %f, autorepeat : %d\n",
816                       prop->initial_timeout, prop->gap_timeout, prop->autorepeat);
817
818         write_float(file, prop->initial_timeout);
819         write_float(file, prop->gap_timeout);
820         write_int8(file, prop->autorepeat);
821 }
822
823 static void _pack_check_prop(int file, check_prop_t *prop)
824 {
825         if (!prop)
826                 return;
827
828         ui_viewer_log("check prop: state : %d\n",
829                       prop->state);
830
831         write_int8(file, prop->state);
832 }
833
834 static void _pack_colorselector_prop(int file, colorselector_prop_t *prop)
835 {
836         if (!prop)
837                 return;
838
839         ui_viewer_log("colorselector prop: color : [%d,%d,%d,%d], palette_name : %s, "
840                       "mode : %d\n",
841                       prop->color[0], prop->color[1], prop->color[2], prop->color[3], prop->palette_name,
842                       prop->mode);
843
844         write_int32(file, prop->color[0]);
845         write_int32(file, prop->color[1]);
846         write_int32(file, prop->color[2]);
847         write_int32(file, prop->color[3]);
848         write_string(file, prop->palette_name);
849         write_int8(file, prop->mode);
850 }
851
852 static void _pack_ctxpopup_prop(int file, ctxpopup_prop_t *prop)
853 {
854         if (!prop)
855                 return;
856
857         ui_viewer_log("ctxpopup prop: horizontal : %d\n",
858                       prop->horizontal);
859
860         write_int8(file, prop->horizontal);
861 }
862
863 static void _pack_datetime_prop(int file, datetime_prop_t *prop)
864 {
865         if (!prop)
866                 return;
867
868         ui_viewer_log("datetime prop: format : %s, value : [%d,%d,%d,%d,%d,%d,%d,%d]\n",
869                       prop->format, prop->value[0], prop->value[1], prop->value[2], prop->value[3],
870                       prop->value[4], prop->value[5], prop->value[6], prop->value[7]);
871
872         write_string(file, prop->format);
873         write_int32(file, prop->value[0]);
874         write_int32(file, prop->value[1]);
875         write_int32(file, prop->value[2]);
876         write_int32(file, prop->value[3]);
877         write_int32(file, prop->value[4]);
878         write_int32(file, prop->value[5]);
879         write_int32(file, prop->value[6]);
880         write_int32(file, prop->value[7]);
881 }
882
883 static void _pack_entry_prop(int file, entry_prop_t *prop)
884 {
885         if (!prop)
886                 return;
887
888         ui_viewer_log("entry prop: entry : %s, scrollable : %d, panel_show_on_demand : %d, menu_disabled : %d, "
889                       "cnp_mode : %d, editable : %d, hover_style : %s, single_line : %d,\n\t"
890                       "password : %d, autosave : %d, prediction_allow : %d, panel_enabled: %d, "
891                       "cursor_pos : %d, cursor_is_format : %d,\n\tcursor_content : %s, "
892                       "selection : %s, is_visible_format : %d\n",
893                       prop->entry, prop->scrollable, prop->panel_show_on_demand, prop->menu_disabled,
894                       prop->cnp_mode, prop->editable, prop->hover_style, prop->single_line,
895                       prop->password, prop->autosave, prop->prediction_allow, prop->panel_enabled,
896                       prop->cursor_pos, prop->cursor_is_format, prop->cursor_content, prop->selection,
897                       prop->is_visible_format);
898
899         write_string(file, prop->entry);
900         write_int8(file, prop->scrollable);
901         write_int8(file, prop->panel_show_on_demand);
902         write_int8(file, prop->menu_disabled);
903         write_int8(file, prop->cnp_mode);
904         write_int8(file, prop->editable);
905         write_string(file, prop->hover_style);
906         write_int8(file, prop->single_line);
907         write_int8(file, prop->password);
908         write_int8(file, prop->autosave);
909         write_int8(file, prop->prediction_allow);
910         write_int8(file, prop->panel_enabled);
911         write_int32(file, prop->cursor_pos);
912         write_int8(file, prop->cursor_is_format);
913         write_string(file, prop->cursor_content);
914         free(prop->cursor_content); // we need free it according to efl docs
915         write_string(file, prop->selection);
916         write_int8(file, prop->is_visible_format);
917 }
918
919 static void _pack_flip_prop(int file, flip_prop_t *prop)
920 {
921         if (!prop)
922                 return;
923
924         ui_viewer_log("flip prop: interaction : %d, front_visible : %d\n",
925                       prop->interaction, prop->front_visible);
926
927         write_int8(file, prop->interaction);
928         write_int8(file, prop->front_visible);
929 }
930
931 static void _pack_gengrid_prop(int file, gengrid_prop_t *prop)
932 {
933         if (!prop)
934                 return;
935
936         ui_viewer_log("gengrid prop: align : [%f,%f], filled : %d, relative : [%f,%f], "
937                       "multi_select : %d, group_item_size : [%d,%d], select_mode : %d, render_mode : %d,\n\t"
938                       "highlight_mode : %d, item_size : [%d,%d], multi_select_mode: %d, "
939                       "horizontal : %d, wheel_disabled : %d, items_count : %d\n",
940                       prop->align[0], prop->align[1], prop->filled, prop->relative[0],
941                       prop->relative[1], prop->multi_select, prop->group_item_size[0], prop->group_item_size[1],
942                       prop->select_mode, prop->render_mode, prop->highlight_mode, prop->item_size[0],
943                       prop->item_size[1], prop->multi_select_mode, prop->horizontal, prop->wheel_disabled,
944                       prop->items_count);
945
946         write_float(file, prop->align[0]);
947         write_float(file, prop->align[1]);
948         write_int8(file, prop->filled);
949         write_float(file, prop->relative[0]);
950         write_float(file, prop->relative[1]);
951         write_int8(file, prop->multi_select);
952         write_int32(file, prop->group_item_size[0]);
953         write_int32(file, prop->group_item_size[1]);
954         write_int8(file, prop->select_mode);
955         write_int8(file, prop->render_mode);
956         write_int8(file, prop->highlight_mode);
957         write_int32(file, prop->item_size[0]);
958         write_int32(file, prop->item_size[1]);
959         write_int8(file, prop->multi_select_mode);
960         write_int8(file, prop->horizontal);
961         write_int8(file, prop->wheel_disabled);
962         write_int32(file, prop->items_count);
963 }
964
965 static void _pack_genlist_prop(int file, genlist_prop_t *prop)
966 {
967         if (!prop)
968                 return;
969
970         ui_viewer_log("genlist prop: multi_select : %d, genlist_mode : %d, items_count : %d, homogeneous : %d, "
971                       "block_count : %d, timeout : %f, reorder_mode : %d,\n\t"
972                       "decorate_mode : %d, effect_enabled : %d, select_mode: %d, "
973                       "highlight_mode : %d, realization_mode : %d\n",
974                       prop->multi_select, prop->genlist_mode, prop->items_count, prop->homogeneous,
975                       prop->block_count, prop->timeout, prop->reorder_mode, prop->decorate_mode,
976                       prop->effect_enabled, prop->select_mode, prop->highlight_mode, prop->realization_mode);
977
978         write_int8(file, prop->multi_select);
979         write_int8(file, prop->genlist_mode);
980         write_int32(file, prop->items_count);
981         write_int8(file, prop->homogeneous);
982         write_int32(file, prop->block_count);
983         write_float(file, prop->timeout);
984         write_int8(file, prop->reorder_mode);
985         write_int8(file, prop->decorate_mode);
986         write_int8(file, prop->effect_enabled);
987         write_int8(file, prop->select_mode);
988         write_int8(file, prop->highlight_mode);
989         write_int8(file, prop->realization_mode);
990 }
991
992 static void _pack_glview_prop(int file, glview_prop_t *prop)
993 {
994         if (!prop)
995                 return;
996
997         ui_viewer_log("glview prop: size : [%d,%d], rotation: %d\n",
998                       prop->size[0], prop->size[1], prop->rotation);
999
1000         write_int32(file, prop->size[0]);
1001         write_int32(file, prop->size[1]);
1002         write_int32(file, prop->rotation);
1003 }
1004
1005 static void _pack_icon_prop(int file, icon_prop_t *prop)
1006 {
1007         if (!prop)
1008                 return;
1009
1010         ui_viewer_log("icon prop: lookup : %d, standard : %s\n",
1011                       prop->lookup, prop->standard);
1012
1013         write_int8(file, prop->lookup);
1014         write_string(file, prop->standard);
1015 }
1016
1017 static void _pack_elm_image_prop(int file, elm_image_prop_t *prop)
1018 {
1019         if (!prop)
1020                 return;
1021
1022         ui_viewer_log("elm_image prop: editable : %d, play : %d, smooth : %d, no_scale : %d, "
1023                       "animated : %d, aspect_fixed : %d, orient : %d,\n\t"
1024                       "fill_outside : %d, resizable : [%d,%d], animated_available: %d, "
1025                       "size : [%d,%d]\n",
1026                       prop->editable, prop->play, prop->smooth, prop->no_scale,
1027                       prop->animated, prop->aspect_fixed, prop->orient, prop->fill_outside,
1028                       prop->resizable[0], prop->resizable[1], prop->animated_available,
1029                       prop->size[0], prop->size[1]);
1030
1031         write_int8(file, prop->editable);
1032         write_int8(file, prop->play);
1033         write_int8(file, prop->smooth);
1034         write_int8(file, prop->no_scale);
1035         write_int8(file, prop->animated);
1036         write_int8(file, prop->aspect_fixed);
1037         write_int8(file, prop->orient);
1038         write_int8(file, prop->fill_outside);
1039         write_int8(file, prop->resizable[0]);
1040         write_int8(file, prop->resizable[1]);
1041         write_int8(file, prop->animated_available);
1042         write_int32(file, prop->size[0]);
1043         write_int32(file, prop->size[1]);
1044 }
1045
1046 static void _pack_index_prop(int file, index_prop_t *prop)
1047 {
1048         if (!prop)
1049                 return;
1050
1051         ui_viewer_log("index prop: autohide_disabled : %d, omit_enabled : %d, priority : %d, horizontal : %d, "
1052                       "change_time : %f,\n\tindicator_disabled : %d, item_level : %d\n",
1053                       prop->autohide_disabled, prop->omit_enabled, prop->priority, prop->horizontal,
1054                       prop->change_time, prop->indicator_disabled, prop->item_level);
1055
1056         write_int8(file, prop->autohide_disabled);
1057         write_int8(file, prop->omit_enabled);
1058         write_int32(file, prop->priority);
1059         write_int8(file, prop->horizontal);
1060         write_float(file, prop->change_time);
1061         write_int8(file, prop->indicator_disabled);
1062         write_int32(file, prop->item_level);
1063 }
1064
1065 static void _pack_label_prop(int file, label_prop_t *prop)
1066 {
1067         if (!prop)
1068                 return;
1069
1070         ui_viewer_log("label prop: wrap_width : %d, speed : %f, mode : %d\n",
1071                       prop->wrap_width, prop->speed, prop->mode);
1072
1073         write_int32(file, prop->wrap_width);
1074         write_float(file, prop->speed);
1075         write_int8(file, prop->mode);
1076 }
1077
1078 static void _pack_list_prop(int file, list_prop_t *prop)
1079 {
1080         if (!prop)
1081                 return;
1082
1083         ui_viewer_log("list prop: horizontal : %d, select_mode : %d, focus_on_selection : %d, multi_select : %d, "
1084                       "multi_select_mode : %d, mode : %d\n",
1085                       prop->horizontal, prop->select_mode, prop->focus_on_selection, prop->multi_select,
1086                       prop->multi_select_mode, prop->mode);
1087
1088         write_int8(file, prop->horizontal);
1089         write_int8(file, prop->select_mode);
1090         write_int8(file, prop->focus_on_selection);
1091         write_int8(file, prop->multi_select);
1092         write_int8(file, prop->multi_select_mode);
1093         write_int8(file, prop->mode);
1094 }
1095
1096 static void _pack_map_prop(int file, map_prop_t *prop)
1097 {
1098         if (!prop)
1099                 return;
1100
1101         ui_viewer_log("map prop: zoom : %d, paused : %d, wheel_disabled : %d, zoom_min : %d, "
1102                       "rotate_degree : %f, rotate : [%d,%d],\n\tagent : %s, zoom_max : %d, "
1103                       "zoom_mode : %d, region : [%f,%f]\n",
1104                       prop->zoom, prop->paused, prop->wheel_disabled, prop->zoom_min,
1105                       prop->rotate_degree, prop->rotate[0], prop->rotate[1],
1106                       prop->agent, prop->zoom_max, prop->zoom_mode, prop->region[0], prop->region[1]);
1107
1108         write_int32(file, prop->zoom);
1109         write_int8(file, prop->paused);
1110         write_int8(file, prop->wheel_disabled);
1111         write_int32(file, prop->zoom_min);
1112         write_float(file, prop->rotate_degree);
1113         write_int32(file, prop->rotate[0]);
1114         write_int32(file, prop->rotate[1]);
1115         write_string(file, prop->agent);
1116         write_int32(file, prop->zoom_max);
1117         write_int8(file, prop->zoom_mode);
1118         write_float(file, prop->region[0]);
1119         write_float(file, prop->region[1]);
1120 }
1121
1122 static void _pack_notify_prop(int file, notify_prop_t *prop)
1123 {
1124         if (!prop)
1125                 return;
1126
1127         ui_viewer_log("notify prop: align : [%f,%f], allow_events: %d, "
1128                       "timeout : %f\n",
1129                       prop->align[0], prop->align[1], prop->allow_events,
1130                       prop->timeout);
1131
1132         write_float(file, prop->align[0]);
1133         write_float(file, prop->align[1]);
1134         write_int8(file, prop->allow_events);
1135         write_float(file, prop->timeout);
1136 }
1137
1138 static void _pack_panel_prop(int file, panel_prop_t *prop)
1139 {
1140         if (!prop)
1141                 return;
1142
1143         ui_viewer_log("panel prop: orient : %d, hidden : %d, scrollable : %d\n",
1144                       prop->orient, prop->hidden, prop->scrollable);
1145
1146         write_int8(file, prop->orient);
1147         write_int8(file, prop->hidden);
1148         write_int8(file, prop->scrollable);
1149 }
1150
1151 static void _pack_photo_prop(int file, photo_prop_t *prop)
1152 {
1153         if (!prop)
1154                 return;
1155
1156         ui_viewer_log("photo prop: editable : %d, fill_inside : %d, aspect_fixed : %d, size : %d\n",
1157                       prop->editable, prop->fill_inside, prop->aspect_fixed, prop->size);
1158
1159         write_int8(file, prop->editable);
1160         write_int8(file, prop->fill_inside);
1161         write_int8(file, prop->aspect_fixed);
1162         write_int32(file, prop->size);
1163 }
1164
1165 static void _pack_photocam_prop(int file, photocam_prop_t *prop)
1166 {
1167         if (!prop)
1168                 return;
1169
1170         ui_viewer_log("photocam prop: paused : %d, file : %f, gesture_enabled : %d, zoom : %f, "
1171                       "zoom_mode : %d, image_size : [%d,%d]\n",
1172                       prop->paused, prop->file, prop->gesture_enabled, prop->zoom,
1173                       prop->zoom_mode, prop->image_size[0], prop->image_size[1]);
1174
1175         write_int8(file, prop->paused);
1176         write_string(file, prop->file);
1177         write_int8(file, prop->gesture_enabled);
1178         write_float(file, prop->zoom);
1179         write_int8(file, prop->zoom_mode);
1180         write_int32(file, prop->image_size[0]);
1181         write_int32(file, prop->image_size[1]);
1182 }
1183
1184 static void _pack_popup_prop(int file, popup_prop_t *prop)
1185 {
1186         if (!prop)
1187                 return;
1188
1189         ui_viewer_log("popup prop: align : [%f,%f], allow_events : %d, wrap_type : %d, orient : %d, "
1190                       "timeout : %f\n",
1191                       prop->align[0], prop->align[1], prop->allow_events, prop->wrap_type,
1192                       prop->orient, prop->timeout);
1193
1194         write_float(file, prop->align[0]);
1195         write_float(file, prop->align[1]);
1196         write_int8(file, prop->allow_events);
1197         write_int8(file, prop->wrap_type);
1198         write_int8(file, prop->orient);
1199         write_float(file, prop->timeout);
1200 }
1201
1202 static void _pack_progressbar_prop(int file, progressbar_prop_t *prop)
1203 {
1204         if (!prop)
1205                 return;
1206
1207         ui_viewer_log("progressbar prop: span_size : %d, pulse : %d, value : %f, inverted : %d, "
1208                       "horizontal : %d, unit_format : %s\n",
1209                       prop->span_size, prop->pulse, prop->value, prop->inverted,
1210                       prop->horizontal, prop->unit_format);
1211
1212         write_int32(file, prop->span_size);
1213         write_int8(file, prop->pulse);
1214         write_float(file, prop->value);
1215         write_int8(file, prop->inverted);
1216         write_int8(file, prop->horizontal);
1217         write_string(file, prop->unit_format);
1218 }
1219
1220 static void _pack_radio_prop(int file, radio_prop_t *prop)
1221 {
1222         if (!prop)
1223                 return;
1224
1225         ui_viewer_log("radio prop: state_value : %d, value : %d\n",
1226                       prop->state_value, prop->value);
1227
1228         write_int32(file, prop->state_value);
1229         write_int32(file, prop->value);
1230 }
1231
1232 static void _pack_segmencontrol_prop(int file, segmencontrol_prop_t *prop)
1233 {
1234         if (!prop)
1235                 return;
1236
1237         ui_viewer_log("segmencontrol prop: item_count : %d\n",
1238                       prop->item_count);
1239
1240         write_int32(file, prop->item_count);
1241 }
1242
1243 static void _pack_slider_prop(int file, slider_prop_t *prop)
1244 {
1245         if (!prop)
1246                 return;
1247
1248         ui_viewer_log("slider prop: horizontal : %d, value : %f, format : %s\n",
1249                       prop->horizontal, prop->value, prop->format);
1250
1251         write_int8(file, prop->horizontal);
1252         write_float(file, prop->value);
1253         write_string(file, prop->format);
1254 }
1255
1256 static void _pack_spinner_prop(int file, spinner_prop_t *prop)
1257 {
1258         if (!prop)
1259                 return;
1260
1261         ui_viewer_log("spinner prop: min : %f, max : %f, step : %f, wrap : %d, "
1262                       "interval : %f, round : %d, editable : %d, "
1263                       "base : %f, value : %f, format : %s\n",
1264                       prop->min_max[0], prop->min_max[1], prop->step, prop->wrap,
1265                       prop->interval, prop->round, prop->editable, prop->base,
1266                       prop->value, prop->format);
1267
1268         write_float(file, prop->min_max[0]);
1269         write_float(file, prop->min_max[1]);
1270         write_float(file, prop->step);
1271         write_int8(file, prop->wrap);
1272         write_float(file, prop->interval);
1273         write_int32(file, prop->round);
1274         write_int8(file, prop->editable);
1275         write_float(file, prop->base);
1276         write_float(file, prop->value);
1277         write_string(file, prop->format);
1278 }
1279
1280 static void _pack_toolbar_prop(int file, toolbar_prop_t *prop)
1281 {
1282         if (!prop)
1283                 return;
1284
1285         ui_viewer_log("toolbar prop: reorder_mode : %d, transverse_expanded : %d, homogeneous : %d, align : %f, "
1286                       "select_mode : %d, icon_size : %d, horizontal : %d,\n\tstandard_priority : %d, "
1287                       "items_count : %d\n",
1288                       prop->reorder_mode, prop->transverse_expanded, prop->homogeneous, prop->align,
1289                       prop->select_mode, prop->icon_size, prop->horizontal, prop->standard_priority,
1290                       prop->items_count);
1291
1292         write_int8(file, prop->reorder_mode);
1293         write_int8(file, prop->transverse_expanded);
1294         write_int8(file, prop->homogeneous);
1295         write_float(file, prop->align);
1296         write_int8(file, prop->select_mode);
1297         write_int32(file, prop->icon_size);
1298         write_int8(file, prop->horizontal);
1299         write_int32(file, prop->standard_priority);
1300         write_int32(file, prop->items_count);
1301 }
1302
1303 static void _pack_tooltip_prop(int file, tooltip_prop_t *prop)
1304 {
1305         if (!prop)
1306                 return;
1307
1308         ui_viewer_log("tooltip prop: style : %s, window_mode : %d\n",
1309                       prop->style, prop->window_mode);
1310
1311         write_string(file, prop->style);
1312         write_int8(file, prop->window_mode);
1313 }
1314
1315 static void _pack_win_prop(int file, win_prop_t *prop)
1316 {
1317         if (!prop)
1318                 return;
1319
1320         ui_viewer_log("win prop: iconfield : %d, maximized : %d, modal : %d, icon_name : %s, "
1321                       "withdrawn : %d, role : %s, size_step : [%d,%d], highlight_style : %s,\n\t"
1322                       "borderless : %d, highlight_enabled : %d, title : %s, alpha: %d, "
1323                       "urgent : %d, rotation : %d, sticky : %d, highlight_animate : %d,\n\t"
1324                       "aspect : %f, indicator_opacity : %d, demand_attention : %d, "
1325                       "layer : %d, profile : %s, shaped : %d, indicator_mode : %d, conformant : %d,\n\t"
1326                       "size_base : [%d,%d], quickpanel : %d, rotation_supported : %d, screen_dpi : [%d,%d], "
1327                       "win_type : %d\n",
1328                       prop->iconfield, prop->maximized, prop->modal, prop->icon_name,
1329                       prop->withdrawn, prop->role, prop->size_step[0], prop->size_step[1],
1330                       prop->highlight_style, prop->borderless, prop->highlight_enabled, prop->title,
1331                       prop->alpha, prop->urgent, prop->rotation, prop->sticky,
1332                       prop->highlight_animate, prop->aspect, prop->indicator_opacity, prop->demand_attention, prop->layer,
1333                       prop->profile, prop->shaped, prop->fullscreen, prop->indicator_mode, prop->conformant,
1334                       prop->size_base[0], prop->size_base[1], prop->quickpanel, prop->rotation_supported, prop->screen_dpi[0],
1335                       prop->screen_dpi[1], prop->win_type);
1336
1337         write_int8(file, prop->iconfield);
1338         write_int8(file, prop->maximized);
1339         write_int8(file, prop->modal);
1340         write_string(file, prop->icon_name);
1341         write_int8(file, prop->withdrawn);
1342         write_string(file, prop->role);
1343         write_int32(file, prop->size_step[0]);
1344         write_int32(file, prop->size_step[1]);
1345         write_string(file, prop->highlight_style);
1346         write_int8(file, prop->borderless);
1347         write_int8(file, prop->highlight_enabled);
1348         write_string(file, prop->title);
1349         write_int8(file, prop->alpha);
1350         write_int8(file, prop->urgent);
1351         write_int32(file, prop->rotation);
1352         write_int8(file, prop->sticky);
1353         write_int8(file, prop->highlight_animate);
1354         write_float(file, prop->aspect);
1355         write_int8(file, prop->indicator_opacity);
1356         write_int8(file, prop->demand_attention);
1357         write_int32(file, prop->layer);
1358         write_string(file, prop->profile);
1359         write_int8(file, prop->shaped);
1360         write_int8(file, prop->fullscreen);
1361         write_int8(file, prop->indicator_mode);
1362         write_int8(file, prop->conformant);
1363         write_int32(file, prop->size_base[0]);
1364         write_int32(file, prop->size_base[1]);
1365         write_int8(file, prop->quickpanel);
1366         write_int8(file, prop->rotation_supported);
1367         write_int32(file, prop->screen_dpi[0]);
1368         write_int32(file, prop->screen_dpi[1]);
1369         write_int8(file, prop->win_type);
1370 }
1371
1372 static void pack_ui_obj_prop(int file, Evas_Object *obj, const char *type_name)
1373 {
1374         ui_obj_prop_t obj_prop;
1375         enum ui_obj_category_t category;
1376         enum ui_obj_code_t code;
1377
1378         evas_object_geometry_get(obj, &obj_prop.geometry[0], &obj_prop.geometry[1],
1379                                  &obj_prop.geometry[2], &obj_prop.geometry[3]);
1380         obj_prop.focus = evas_object_focus_get(obj);
1381         _strncpy(obj_prop.name, evas_object_name_get(obj), MAX_PATH_LENGTH);
1382         obj_prop.visible = evas_object_visible_get(obj);
1383         evas_object_color_get(obj, &obj_prop.color[0], &obj_prop.color[1],
1384                               &obj_prop.color[2], &obj_prop.color[3]);
1385         obj_prop.anti_alias = evas_object_anti_alias_get(obj);
1386         obj_prop.scale = evas_object_scale_get(obj);
1387         evas_object_size_hint_min_get(obj, &obj_prop.size_min[0], &obj_prop.size_min[1]);
1388         evas_object_size_hint_max_get(obj, &obj_prop.size_max[0], &obj_prop.size_max[1]);
1389         evas_object_size_hint_request_get(obj, &obj_prop.size_request[0], &obj_prop.size_request[1]);
1390         evas_object_size_hint_align_get(obj, &obj_prop.size_align[0], &obj_prop.size_align[1]);
1391         evas_object_size_hint_weight_get(obj, &obj_prop.size_weight[0], &obj_prop.size_weight[1]);
1392         evas_object_size_hint_padding_get(obj, &obj_prop.size_padding[0], &obj_prop.size_padding[1],
1393                                           &obj_prop.size_padding[2], &obj_prop.size_padding[3]);
1394         obj_prop.render_op = evas_object_render_op_get(obj);
1395
1396         _pack_ui_obj_evas_prop(file, &obj_prop);
1397
1398         category = _get_object_category(type_name);
1399         if (category == UI_UNDEFINED) {
1400                 return;
1401         } else if (category == UI_ELM) {
1402                 ui_obj_elm_prop_t elm_prop;
1403
1404                 if (!strcmp(type_name, "elm_pan")) {
1405                         elm_prop.text[0] = '\0';
1406                         elm_prop.style[0] = '\0';
1407                         elm_prop.disabled = 0;
1408                 } else {
1409                         _strncpy(elm_prop.text, elm_object_text_get(obj), MAX_TEXT_LENGTH);
1410                         _strncpy(elm_prop.style, elm_object_style_get(obj), MAX_PATH_LENGTH);
1411                         elm_prop.disabled = elm_object_disabled_get(obj);
1412                 }
1413                 _strncpy(elm_prop.type, elm_object_widget_type_get(obj), MAX_PATH_LENGTH);
1414
1415                 _pack_ui_obj_elm_prop(file, &elm_prop);
1416
1417         } else if (category == UI_EDJE) {
1418                 ui_obj_edje_prop_t edje_prop;
1419                 edje_prop.animation = edje_object_animation_get(obj);
1420                 edje_prop.play = edje_object_play_get(obj);
1421                 edje_prop.scale = edje_object_scale_get(obj);
1422                 edje_prop.base_scale = edje_object_base_scale_get(obj);
1423                 edje_object_size_min_get(obj, &edje_prop.size_min[0], &edje_prop.size_min[1]);
1424                 edje_object_size_max_get(obj, &edje_prop.size_max[0], &edje_prop.size_max[1]);
1425
1426                 _pack_ui_obj_edje_prop(file, &edje_prop);
1427         }
1428
1429         code = _get_object_type_code(type_name);
1430
1431         if (code == 0) {
1432                 return;
1433         } else if (code == UI_EVAS_IMAGE) {
1434                 image_prop_t image_prop;
1435
1436                 image_prop.load_dpi = evas_object_image_load_dpi_get(obj);
1437                 image_prop.source_clip = evas_object_image_source_clip_get(obj);
1438                 image_prop.filled = evas_object_image_filled_get(obj);
1439                 image_prop.content_hint = evas_object_image_content_hint_get(obj);
1440                 image_prop.alpha = evas_object_image_alpha_get(obj);
1441                 evas_object_image_border_get(obj, &(image_prop.border[0]),
1442                                           &(image_prop.border[1]),
1443                                           &(image_prop.border[2]),
1444                                           &(image_prop.border[3]));
1445                 image_prop.border_scale = evas_object_image_border_scale_get(obj);
1446                 image_prop.pixels_dirty = evas_object_image_pixels_dirty_get(obj);
1447                 image_prop.load_orientation = evas_object_image_load_orientation_get(obj);
1448                 image_prop.border_center_fill = evas_object_image_border_center_fill_get(obj);
1449                 evas_object_image_size_get(obj, &(image_prop.size[0]), &(image_prop.size[1]));
1450                 image_prop.source_visible = evas_object_image_source_visible_get(obj);
1451                 evas_object_image_fill_get(obj, &(image_prop.fill[0]),
1452                                         &(image_prop.fill[1]),
1453                                         &(image_prop.fill[2]),
1454                                         &(image_prop.fill[3]));
1455                 image_prop.load_scale_down = evas_object_image_load_scale_down_get(obj);
1456                 image_prop.scale_hint = evas_object_image_scale_hint_get(obj);
1457                 image_prop.source_events = evas_object_image_source_events_get(obj);
1458                 //evas_object_image_animated_frame_count_get(obj); - unstable
1459                 image_prop.frame_count = 0;
1460                 image_prop.evas_image_stride = evas_object_image_stride_get(obj);
1461
1462                 _pack_image_prop(file, &image_prop);
1463         } else if (code == UI_EVAS_LINE) {
1464                 line_prop_t line_prop;
1465
1466                 evas_object_line_xy_get(obj, &(line_prop.xy[0]),
1467                                      &(line_prop.xy[1]),
1468                                      &(line_prop.xy[2]),
1469                                      &(line_prop.xy[3]));
1470
1471                 _pack_line_prop(file, &line_prop);
1472         } else if (code == UI_EVAS_TEXT) {
1473                 text_prop_t text_prop;
1474                 const char *text_font;
1475
1476                 evas_object_text_font_get(obj, &text_font, &(text_prop.size));
1477                 _strncpy(text_prop.font, text_font, MAX_PATH_LENGTH);
1478                 _strncpy(text_prop.text, evas_object_text_text_get(obj), MAX_PATH_LENGTH);
1479                 _strncpy(text_prop.delim, evas_object_text_bidi_delimiters_get(obj), MAX_PATH_LENGTH);
1480                 text_prop.ellipsis = evas_object_text_ellipsis_get(obj);
1481                 text_prop.style = evas_object_text_style_get(obj);
1482                 evas_object_text_shadow_color_get(obj, &(text_prop.shadow_color[0]),
1483                                                &(text_prop.shadow_color[1]),
1484                                                &(text_prop.shadow_color[2]),
1485                                                &(text_prop.shadow_color[3]));
1486                 evas_object_text_glow_color_get(obj, &(text_prop.glow_color[0]),
1487                                              &(text_prop.glow_color[1]),
1488                                              &(text_prop.glow_color[2]),
1489                                              &(text_prop.glow_color[3]));
1490                 evas_object_text_glow2_color_get(obj, &(text_prop.glow2_color[0]),
1491                                               &(text_prop.glow2_color[1]),
1492                                               &(text_prop.glow2_color[2]),
1493                                               &(text_prop.glow2_color[3]));
1494                 evas_object_text_outline_color_get(obj, &(text_prop.outline_color[0]),
1495                                                 &(text_prop.outline_color[1]),
1496                                                 &(text_prop.outline_color[2]),
1497                                                 &(text_prop.outline_color[3]));
1498                 evas_object_text_style_pad_get(obj, &(text_prop.style_pad[0]),
1499                                             &(text_prop.style_pad[1]),
1500                                             &(text_prop.style_pad[2]),
1501                                             &(text_prop.style_pad[3]));
1502                 text_prop.direction = evas_object_text_direction_get(obj);
1503
1504                 _pack_text_prop(file, &text_prop);
1505         } else if (code == UI_EVAS_TEXTBLOCK) {
1506                 textblock_prop_t textblock_prop;
1507
1508                 _strncpy(textblock_prop.replace_char, evas_object_textblock_replace_char_get(obj), MAX_PATH_LENGTH);
1509                 textblock_prop.valign = evas_object_textblock_valign_get(obj);
1510                 _strncpy(textblock_prop.delim, evas_object_textblock_bidi_delimiters_get(obj), MAX_PATH_LENGTH);
1511                 textblock_prop.newline = evas_object_textblock_legacy_newline_get(obj);
1512                 _strncpy(textblock_prop.markup, evas_object_textblock_text_markup_get(obj), MAX_PATH_LENGTH);
1513
1514                 _pack_textblock_prop(file, &textblock_prop);
1515         } else if (code == UI_EVAS_TABLE) {
1516                 table_prop_t table_prop;
1517
1518                 table_prop.homogeneous = evas_object_table_homogeneous_get(obj);
1519                 evas_object_table_align_get(obj, &(table_prop.align[0]),
1520                                          &(table_prop.align[1]));
1521                 evas_object_table_padding_get(obj, &(table_prop.padding[0]),
1522                                            &(table_prop.padding[1]));
1523                 table_prop.mirrored = evas_object_table_mirrored_get(obj);
1524                 evas_object_table_col_row_size_get(obj, &(table_prop.col_row_size[0]),
1525                                                 &(table_prop.col_row_size[1]));
1526
1527                 _pack_table_prop(file, &table_prop);
1528         } else if (code == UI_EVAS_BOX) {
1529                 box_prop_t box_prop;
1530
1531                 evas_object_box_align_get(obj, &(box_prop.align[0]),
1532                                        &(box_prop.align[1]));
1533
1534                 _pack_box_prop(file, &box_prop);
1535         } else if (code == UI_EVAS_GRID) {
1536                 grid_prop_t grid_prop;
1537
1538                 grid_prop.mirrored = evas_object_grid_mirrored_get(obj);
1539
1540                 _pack_grid_prop(file, &grid_prop);
1541         } else if (code == UI_EVAS_TEXTGRID) {
1542                 textgrid_prop_t textgrid_prop;
1543
1544                 evas_object_textgrid_size_get(obj, &(textgrid_prop.size[0]),
1545                                            &(textgrid_prop.size[1]));
1546                 evas_object_textgrid_cell_size_get(obj, &(textgrid_prop.cell_size[0]),
1547                                                 &(textgrid_prop.cell_size[1]));
1548
1549                 _pack_textgrid_prop(file, &textgrid_prop);
1550         } else if (code == UI_ELM_BACKGROUND) {
1551                 bg_prop_t bg_prop;
1552
1553                 elm_bg_color_get(obj, &(bg_prop.color[0]),
1554                                       &(bg_prop.color[1]),
1555                                       &(bg_prop.color[2]));
1556                 bg_prop.option = elm_bg_option_get(obj);
1557
1558                 _pack_bg_prop(file, &bg_prop);
1559         } else if (code == UI_ELM_BUTTON) {
1560                 button_prop_t button_prop;
1561
1562                 button_prop.initial_timeout = elm_button_autorepeat_initial_timeout_get(obj);
1563                 button_prop.gap_timeout = elm_button_autorepeat_gap_timeout_get(obj);
1564                 button_prop.autorepeat = elm_button_autorepeat_get(obj);
1565
1566                 _pack_button_prop(file, &button_prop);
1567         } else if (code == UI_ELM_CHECK) {
1568                 check_prop_t check_prop;
1569
1570                 check_prop.state = elm_check_state_get(obj);
1571
1572                 _pack_check_prop(file, &check_prop);
1573         } else if (code == UI_ELM_COLORSELECTOR) {
1574                 colorselector_prop_t colorselector_prop;
1575
1576                 elm_colorselector_color_get(obj, &(colorselector_prop.color[0]),
1577                                          &(colorselector_prop.color[1]),
1578                                          &(colorselector_prop.color[2]),
1579                                          &(colorselector_prop.color[3]));
1580                 _strncpy(colorselector_prop.palette_name, elm_colorselector_palette_name_get(obj), MAX_PATH_LENGTH);
1581                 colorselector_prop.mode = elm_colorselector_mode_get(obj);
1582
1583                 _pack_colorselector_prop(file, &colorselector_prop);
1584         } else if (code == UI_ELM_CTXPOPUP) {
1585                 ctxpopup_prop_t ctxpopup_prop;
1586
1587                 ctxpopup_prop.horizontal = elm_ctxpopup_horizontal_get(obj);
1588
1589         _pack_ctxpopup_prop(file, &ctxpopup_prop);
1590         } else if (code == UI_ELM_DATETIME) {
1591                 datetime_prop_t datetime_prop;
1592                 struct tm currtime;
1593
1594                 _strncpy(datetime_prop.format, elm_datetime_format_get(obj), MAX_PATH_LENGTH);
1595                 elm_datetime_value_get(obj, &currtime);
1596                 datetime_prop.value[0] = currtime.tm_sec;
1597                 datetime_prop.value[1] = currtime.tm_min;
1598                 datetime_prop.value[2] = currtime.tm_hour;
1599                 datetime_prop.value[3] = currtime.tm_mday;
1600                 datetime_prop.value[4] = currtime.tm_mon;
1601                 datetime_prop.value[5] = currtime.tm_year;
1602                 datetime_prop.value[6] = currtime.tm_wday;
1603                 datetime_prop.value[7] = currtime.tm_yday;
1604
1605                 _pack_datetime_prop(file, &datetime_prop);
1606         } else if (code == UI_ELM_ENTRY) {
1607                 entry_prop_t entry_prop;
1608
1609                 _strncpy(entry_prop.entry, elm_entry_entry_get(obj), MAX_PATH_LENGTH);
1610                 entry_prop.scrollable = elm_entry_scrollable_get(obj);
1611                 entry_prop.panel_show_on_demand = elm_entry_input_panel_show_on_demand_get(obj);
1612                 entry_prop.menu_disabled = elm_entry_context_menu_disabled_get(obj);
1613                 entry_prop.cnp_mode = elm_entry_cnp_mode_get(obj);
1614                 entry_prop.editable = elm_entry_editable_get(obj);
1615                 _strncpy(entry_prop.hover_style, elm_entry_anchor_hover_style_get(obj), MAX_PATH_LENGTH);
1616                 entry_prop.single_line= elm_entry_single_line_get(obj);
1617                 entry_prop.password = elm_entry_password_get(obj);
1618                 entry_prop.autosave = elm_entry_autosave_get(obj);
1619                 entry_prop.prediction_allow = elm_entry_prediction_allow_get(obj);
1620                 entry_prop.panel_enabled = elm_entry_input_panel_enabled_get(obj);
1621                 entry_prop.cursor_pos = elm_entry_cursor_pos_get(obj);
1622                 entry_prop.cursor_is_format = elm_entry_cursor_is_format_get(obj);
1623                 entry_prop.cursor_content = elm_entry_cursor_content_get(obj);
1624                 _strncpy(entry_prop.selection, elm_entry_selection_get(obj), MAX_PATH_LENGTH);
1625                 entry_prop.is_visible_format = elm_entry_cursor_is_visible_format_get(obj);
1626
1627                 _pack_entry_prop(file, &entry_prop);
1628         } else if (code == UI_ELM_FLIP) {
1629                 flip_prop_t flip_prop;
1630
1631                 flip_prop.interaction = elm_flip_interaction_get(obj);
1632                 flip_prop.front_visible = elm_flip_front_visible_get(obj);
1633
1634                 _pack_flip_prop(file, &flip_prop);
1635         } else if (code == UI_ELM_GENGRID) {
1636                 gengrid_prop_t gengrid_prop;
1637
1638                 elm_gengrid_align_get(obj, &(gengrid_prop.align[0]),
1639                                    &(gengrid_prop.align[1]));
1640                 gengrid_prop.filled = elm_gengrid_filled_get(obj);
1641                 elm_gengrid_page_relative_get(obj, &(gengrid_prop.relative[0]),
1642                                            &(gengrid_prop.relative[1]));
1643                 gengrid_prop.multi_select = elm_gengrid_multi_select_get(obj);
1644                 elm_gengrid_group_item_size_get(obj, &(gengrid_prop.group_item_size[0]),
1645                                              &(gengrid_prop.group_item_size[1]));
1646                 gengrid_prop.select_mode = elm_gengrid_select_mode_get(obj);
1647                 gengrid_prop.render_mode = elm_gengrid_reorder_mode_get(obj);
1648                 gengrid_prop.highlight_mode = elm_gengrid_highlight_mode_get(obj);
1649                 elm_gengrid_item_size_get(obj, &(gengrid_prop.item_size[0]),
1650                                        &(gengrid_prop.item_size[1]));
1651                 gengrid_prop.multi_select_mode = elm_gengrid_multi_select_mode_get(obj);
1652                 gengrid_prop.horizontal = elm_gengrid_horizontal_get(obj);
1653                 gengrid_prop.wheel_disabled = elm_gengrid_wheel_disabled_get(obj);
1654                 gengrid_prop.items_count = elm_gengrid_items_count(obj);
1655
1656         _pack_gengrid_prop(file, &gengrid_prop);
1657         } else if (code == UI_ELM_GENLIST) {
1658                 genlist_prop_t genlist_prop;
1659
1660                 genlist_prop.multi_select = elm_genlist_multi_select_get(obj);
1661                 genlist_prop.genlist_mode = elm_genlist_mode_get(obj);
1662                 genlist_prop.items_count = elm_genlist_items_count(obj);
1663                 genlist_prop.homogeneous = elm_genlist_homogeneous_get(obj);
1664                 genlist_prop.block_count = elm_genlist_block_count_get(obj);
1665                 genlist_prop.timeout = elm_genlist_longpress_timeout_get(obj);
1666                 genlist_prop.reorder_mode = elm_genlist_reorder_mode_get(obj);
1667                 genlist_prop.decorate_mode = elm_genlist_decorate_mode_get(obj);
1668                 genlist_prop.effect_enabled = elm_genlist_tree_effect_enabled_get(obj);
1669                 genlist_prop.select_mode = elm_genlist_select_mode_get(obj);
1670                 genlist_prop.highlight_mode = elm_genlist_highlight_mode_get(obj);
1671                 /* TODO: Port this to Tizen 3.0 */
1672                 /* genlist_prop.realization_mode = elm_genlist_realization_mode_get(obj); */
1673                 genlist_prop.realization_mode = 0;
1674
1675                 _pack_genlist_prop(file, &genlist_prop);
1676         } else if (code == UI_ELM_GLVIEW) {
1677                 glview_prop_t glview_prop;
1678
1679                 elm_glview_size_get(obj, &(glview_prop.size[0]),
1680                                  &(glview_prop.size[1]));
1681                 glview_prop.rotation = elm_glview_rotation_get(obj);
1682
1683                 _pack_glview_prop(file, &glview_prop);
1684         } else if (code == UI_ELM_ICON) {
1685                 icon_prop_t icon_prop;
1686
1687                 icon_prop.lookup = elm_icon_order_lookup_get(obj);
1688                 _strncpy(icon_prop.standard, elm_icon_standard_get(obj), MAX_PATH_LENGTH);
1689
1690                 _pack_icon_prop(file, &icon_prop);
1691         } else if (code == UI_ELM_IMAGE) {
1692                 elm_image_prop_t elm_image_prop;
1693
1694                 elm_image_prop.editable = elm_image_editable_get(obj);
1695                 // elm_image_animated_available_get(obj); - unstable
1696                 elm_image_prop.animated_available = EINA_FALSE;
1697                 // elm_image_animated_play_get(obj); - unstable
1698                 elm_image_prop.play = EINA_FALSE;
1699                 elm_image_prop.smooth = elm_image_smooth_get(obj);
1700                 elm_image_prop.no_scale = elm_image_no_scale_get(obj);
1701                 elm_image_prop.animated = elm_image_animated_get(obj);
1702                 elm_image_prop.aspect_fixed = elm_image_aspect_fixed_get(obj);
1703                 elm_image_prop.orient = elm_image_orient_get(obj);
1704                 elm_image_prop.fill_outside = elm_image_fill_outside_get(obj);
1705                 elm_image_resizable_get(obj, &(elm_image_prop.resizable[0]),
1706                                      &(elm_image_prop.resizable[1]));
1707                 elm_image_object_size_get(obj, &(elm_image_prop.size[0]),
1708                                        &(elm_image_prop.size[1]));
1709
1710                 _pack_elm_image_prop(file, &elm_image_prop);
1711         } else if (code == UI_ELM_INDEX) {
1712                 index_prop_t index_prop;
1713
1714                 index_prop.autohide_disabled = elm_index_autohide_disabled_get(obj);
1715                 index_prop.omit_enabled = elm_index_omit_enabled_get(obj);
1716                 /* TODO: Port this to Tizen 3.0 */
1717                 /* index_prop.priority = elm_index_priority_get(obj); */
1718                 index_prop.priority = 0;
1719                 index_prop.horizontal = elm_index_horizontal_get(obj);
1720                 index_prop.change_time = elm_index_delay_change_time_get(obj);
1721                 index_prop.indicator_disabled = elm_index_indicator_disabled_get(obj);
1722                 index_prop.item_level = elm_index_item_level_get(obj);
1723
1724                 _pack_index_prop(file, &index_prop);
1725         } else if (code == UI_ELM_LABEL) {
1726                 label_prop_t label_prop;
1727
1728                 label_prop.wrap_width = elm_label_wrap_width_get(obj);
1729                 label_prop.speed = elm_label_slide_speed_get(obj);
1730                 label_prop.mode = elm_label_slide_mode_get(obj);
1731
1732                 _pack_label_prop(file, &label_prop);
1733         } else if (code == UI_ELM_LIST) {
1734                 list_prop_t list_prop;
1735
1736                 list_prop.horizontal = elm_list_horizontal_get(obj);
1737                 list_prop.select_mode = elm_list_select_mode_get(obj);
1738                 list_prop.focus_on_selection = elm_list_focus_on_selection_get(obj);
1739                 list_prop.multi_select = elm_list_multi_select_get(obj);
1740                 list_prop.multi_select_mode = elm_list_multi_select_mode_get(obj);
1741                 list_prop.mode = elm_list_mode_get(obj);
1742
1743                 _pack_list_prop(file, &list_prop);
1744         } else if (code == UI_ELM_MAP) {
1745                 map_prop_t map_prop;
1746
1747                 map_prop.zoom = elm_map_zoom_get(obj);
1748                 map_prop.paused = elm_map_paused_get(obj);
1749                 map_prop.wheel_disabled = elm_map_wheel_disabled_get(obj);
1750                 map_prop.zoom_min = elm_map_zoom_min_get(obj);
1751                 elm_map_rotate_get(obj, &(map_prop.rotate_degree),
1752                                 &(map_prop.rotate[0]),
1753                                 &(map_prop.rotate[1]));
1754                 _strncpy(map_prop.agent, elm_map_user_agent_get(obj), MAX_PATH_LENGTH);
1755                 map_prop.zoom_max = elm_map_zoom_max_get(obj);
1756                 map_prop.zoom_mode = elm_map_zoom_mode_get(obj);
1757                 elm_map_region_get(obj, &(map_prop.region[0]),
1758                                 &(map_prop.region[1]));
1759
1760                 _pack_map_prop(file, &map_prop);
1761         } else if (code == UI_ELM_NOTIFY) {
1762                 notify_prop_t notify_prop;
1763
1764                 elm_notify_align_get(obj, &(notify_prop.align[0]),
1765                                   &(notify_prop.align[1]));
1766                 notify_prop.allow_events = elm_notify_allow_events_get(obj);
1767                 notify_prop.timeout = elm_notify_timeout_get(obj);
1768
1769                 _pack_notify_prop(file, &notify_prop);
1770         } else if (code == UI_ELM_PANEL) {
1771                 panel_prop_t panel_prop;
1772
1773                 panel_prop.orient = elm_panel_orient_get(obj);
1774                 panel_prop.hidden = elm_panel_hidden_get(obj);
1775                 panel_prop.scrollable = elm_panel_scrollable_get(obj);
1776
1777                 _pack_panel_prop(file, &panel_prop);
1778         } else if (code == UI_ELM_PHOTO) {
1779                 photo_prop_t photo_prop;
1780
1781                 photo_prop.editable = elm_photo_editable_get(obj);
1782                 photo_prop.fill_inside = elm_photo_fill_inside_get(obj);
1783                 photo_prop.aspect_fixed = elm_photo_aspect_fixed_get(obj);
1784                 photo_prop.size = elm_photo_size_get(obj);
1785
1786                 _pack_photo_prop(file, &photo_prop);
1787         } else if (code == UI_ELM_PHOTOCAM) {
1788                 photocam_prop_t photocam_prop;
1789
1790                 photocam_prop.paused = elm_photocam_paused_get(obj);
1791                 _strncpy(photocam_prop.file, elm_photocam_file_get(obj), MAX_PATH_LENGTH);
1792                 photocam_prop.gesture_enabled = elm_photocam_gesture_enabled_get(obj);
1793                 photocam_prop.zoom = elm_photocam_zoom_get(obj);
1794                 photocam_prop.zoom_mode = elm_photocam_zoom_mode_get(obj);
1795                 elm_photocam_image_size_get(obj, &(photocam_prop.image_size[0]),
1796                                          &(photocam_prop.image_size[1]));
1797
1798                 _pack_photocam_prop(file, &photocam_prop);
1799         } else if (code == UI_ELM_POPUP) {
1800                 popup_prop_t popup_prop;
1801
1802                 elm_popup_align_get(obj, &(popup_prop.align[0]),
1803                                  &(popup_prop.align[1]));
1804                 popup_prop.allow_events = elm_popup_allow_events_get(obj);
1805                 popup_prop.wrap_type = elm_popup_content_text_wrap_type_get(obj);
1806                 popup_prop.orient = elm_popup_orient_get(obj);
1807                 popup_prop.timeout = elm_popup_timeout_get(obj);
1808
1809                 _pack_popup_prop(file, &popup_prop);
1810         } else if (code == UI_ELM_PROGRESSBAR) {
1811                 progressbar_prop_t progressbar_prop;
1812
1813                 progressbar_prop.span_size = elm_progressbar_span_size_get(obj);
1814                 progressbar_prop.pulse = elm_progressbar_pulse_get(obj);
1815                 progressbar_prop.value = elm_progressbar_value_get(obj);
1816                 progressbar_prop.inverted = elm_progressbar_inverted_get(obj);
1817                 progressbar_prop.horizontal = elm_progressbar_horizontal_get(obj);
1818                 _strncpy(progressbar_prop.unit_format, elm_progressbar_unit_format_get(obj), MAX_PATH_LENGTH);
1819
1820                 _pack_progressbar_prop(file, &progressbar_prop);
1821         } else if (code == UI_ELM_RADIO) {
1822                 radio_prop_t radio_prop;
1823
1824                 radio_prop.state_value = elm_radio_state_value_get(obj);
1825                 radio_prop.value = elm_radio_value_get(obj);
1826
1827                 _pack_radio_prop(file, &radio_prop);
1828         } else if (code == UI_ELM_SEGMENTCONTROL) {
1829                 segmencontrol_prop_t segmencontrol_prop;
1830
1831                 segmencontrol_prop.item_count = elm_segment_control_item_count_get(obj);
1832
1833                 _pack_segmencontrol_prop(file, &segmencontrol_prop);
1834         } else if (code == UI_ELM_SLIDER) {
1835                 slider_prop_t slider_prop;
1836
1837                 slider_prop.horizontal = elm_slider_horizontal_get(obj);
1838                 slider_prop.value = elm_slider_value_get(obj);
1839                 _strncpy(slider_prop.format, elm_slider_indicator_format_get(obj), MAX_PATH_LENGTH);
1840
1841                 _pack_slider_prop(file, &slider_prop);
1842         } else if (code == UI_ELM_SPINNER) {
1843                 spinner_prop_t spinner_prop;
1844
1845                 elm_spinner_min_max_get(obj, &(spinner_prop.min_max[0]),
1846                                      &(spinner_prop.min_max[1]));
1847                 spinner_prop.step = elm_spinner_step_get(obj);
1848                 spinner_prop.wrap = elm_spinner_wrap_get(obj);
1849                 spinner_prop.interval = elm_spinner_interval_get(obj);
1850                 spinner_prop.round = elm_spinner_round_get(obj);
1851                 spinner_prop.editable = elm_spinner_editable_get(obj);
1852                 spinner_prop.base = elm_spinner_base_get(obj);
1853                 spinner_prop.value = elm_spinner_value_get(obj);
1854                 _strncpy(spinner_prop.format, elm_spinner_label_format_get(obj), MAX_PATH_LENGTH);
1855
1856                 _pack_spinner_prop(file, &spinner_prop);
1857         } else if (code == UI_ELM_TOOLBAR) {
1858                 toolbar_prop_t toolbar_prop;
1859
1860                 toolbar_prop.reorder_mode = elm_toolbar_reorder_mode_get(obj);
1861                 toolbar_prop.transverse_expanded = elm_toolbar_transverse_expanded_get(obj);
1862                 toolbar_prop.homogeneous = elm_toolbar_homogeneous_get(obj);
1863                 toolbar_prop.align = elm_toolbar_align_get(obj);
1864                 toolbar_prop.select_mode = elm_toolbar_select_mode_get(obj);
1865                 toolbar_prop.icon_size = elm_toolbar_icon_size_get(obj);
1866                 toolbar_prop.horizontal = elm_toolbar_horizontal_get(obj);
1867                 toolbar_prop.standard_priority = elm_toolbar_standard_priority_get(obj);
1868                 toolbar_prop.items_count = elm_toolbar_items_count(obj);
1869
1870                 _pack_toolbar_prop(file, &toolbar_prop);
1871         } else if (code == UI_ELM_TOOLTIP) {
1872                 tooltip_prop_t tooltip_prop;
1873
1874                 _strncpy(tooltip_prop.style, elm_object_tooltip_style_get(obj), MAX_PATH_LENGTH);
1875                 tooltip_prop.window_mode = elm_object_tooltip_window_mode_get(obj);
1876
1877                 _pack_tooltip_prop(file, &tooltip_prop);
1878         } else if (code == UI_ELM_WIN) {
1879                 win_prop_t win_prop;
1880
1881                 win_prop.iconfield = elm_win_iconified_get(obj);
1882                 win_prop.maximized = elm_win_maximized_get(obj);
1883                 win_prop.modal = elm_win_modal_get(obj);
1884                 _strncpy(win_prop.icon_name, elm_win_icon_name_get(obj), MAX_PATH_LENGTH);
1885                 win_prop.withdrawn = elm_win_withdrawn_get(obj);
1886                 _strncpy(win_prop.role, elm_win_role_get(obj), MAX_PATH_LENGTH);
1887                 elm_win_size_step_get(obj, &(win_prop.size_step[0]),
1888                                    &(win_prop.size_step[1]));
1889                 _strncpy(win_prop.highlight_style, elm_win_focus_highlight_style_get(obj), MAX_PATH_LENGTH);
1890                 win_prop.borderless = elm_win_borderless_get(obj);
1891                 win_prop.highlight_enabled = elm_win_focus_highlight_enabled_get(obj);
1892                 _strncpy(win_prop.title, elm_win_title_get(obj), MAX_PATH_LENGTH);
1893                 win_prop.alpha = elm_win_alpha_get(obj);
1894                 win_prop.urgent = elm_win_urgent_get(obj);
1895                 win_prop.rotation = elm_win_rotation_get(obj);
1896                 win_prop.sticky = elm_win_sticky_get(obj);
1897                 win_prop.highlight_animate = elm_win_focus_highlight_animate_get(obj);
1898                 win_prop.aspect = elm_win_aspect_get(obj);
1899                 win_prop.indicator_opacity = elm_win_indicator_opacity_get(obj);
1900                 win_prop.demand_attention = elm_win_demand_attention_get(obj);
1901                 win_prop.layer = elm_win_layer_get(obj);
1902                 _strncpy(win_prop.profile, elm_win_profile_get(obj), MAX_PATH_LENGTH);
1903                 win_prop.shaped = elm_win_shaped_get(obj);
1904                 win_prop.fullscreen = elm_win_fullscreen_get(obj);
1905                 win_prop.indicator_mode = elm_win_indicator_mode_get(obj);
1906                 win_prop.conformant = elm_win_conformant_get(obj);
1907                 elm_win_size_base_get(obj, &(win_prop.size_base[0]),
1908                                    &(win_prop.size_base[1]));
1909                 win_prop.quickpanel = elm_win_quickpanel_get(obj);
1910                 win_prop.rotation_supported = elm_win_wm_rotation_supported_get(obj);
1911                 elm_win_screen_dpi_get(obj, &(win_prop.screen_dpi[0]),
1912                                     &(win_prop.screen_dpi[1]));
1913                 win_prop.win_type = elm_win_type_get(obj);
1914                 _pack_win_prop(file, &win_prop);
1915         }
1916 }
1917
1918 Eina_Bool _get_shot_in_bg(Evas_Object *obj)
1919 {
1920         char type_name[MAX_PATH_LENGTH];
1921         Eina_Bool can_shot_in_bg = EINA_FALSE;
1922
1923         _strncpy(type_name, evas_object_type_get(obj), MAX_PATH_LENGTH);
1924
1925         if (!strcmp(type_name, "rectangle") ||
1926             !strcmp(type_name, "image") ||
1927             !strcmp(type_name, "elm_image") ||
1928             !strcmp(type_name, "elm_icon"))
1929                 can_shot_in_bg = EINA_TRUE;
1930
1931         return can_shot_in_bg;
1932 }
1933 enum ErrorCode ui_obj_screenshot(Evas_Object *obj, const char *path)
1934 {
1935         enum ErrorCode err_code = ERR_NO;
1936         Eina_Bool exists;
1937
1938         pthread_mutex_lock(&request_lock);
1939         exists = _get_obj_exists(obj);
1940         if (!exists) {
1941                 err_code = ERR_UI_OBJ_NOT_FOUND;
1942                 ui_viewer_log("can't take screenshot of not existing obj = %p\n", obj);
1943         } else {
1944                 /* Evas_Object *win_id; */
1945                 /* Eina_Bool win_focus; */
1946                 Evas *evas;
1947
1948                 evas_object_ref(obj);
1949                 evas = evas_object_evas_get(obj);
1950                 evas_event_freeze(evas);
1951                 if (ui_viewer_capture_screen(path, obj) != 0)
1952                         err_code = ERR_UI_OBJ_SCREENSHOT_FAILED;
1953                 evas_event_thaw(evas);
1954                 evas_object_unref(obj);
1955         }
1956         pthread_mutex_unlock(&request_lock);
1957
1958         ui_viewer_log("screenshot: obj=%p err_code=%d path=%s\n",
1959                       obj, err_code, path);
1960
1961         return err_code;
1962 }