Remove unused variables
[platform/framework/web/livebox-edje.git] / src / script_port.c
index 88f61d7..e401356 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://floralicense.org
+ * http://floralicense.org/license/
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -28,6 +28,7 @@
 #include <Ecore_Evas.h>
 #include <Eet.h>
 #include <Ecore_X.h>
+##include <efl_assist.h>
 
 #include <system_settings.h>
 
 #include "script_port.h"
 
 #define TEXT_CLASS     "tizen"
-#define BASE_WIDTH     720.0f
+#define DEFAULT_FONT_SIZE      -100
 
 #define PUBLIC __attribute__((visibility("default")))
 
+#if defined(TIZEN_ENGINEER_MODE)
+#define ENGINEER_MODE_ENABLED 1
+#else
+#define ENGINEER_MODE_ENABLED 0
+#endif
+
 struct image_option {
        int orient;
        int aspect;
        enum {
                FILL_DISABLE,
                FILL_IN_SIZE,
-               FILL_OVER_SIZE,
+               FILL_OVER_SIZE
        } fill;
 
+       struct shadow {
+               int enabled;
+               int angle;
+               int offset;
+               int softness;
+               int color;
+       } shadow;
+
        int width;
        int height;
 };
@@ -64,9 +79,13 @@ struct info {
        int w;
        int h;
 
+       int is_mouse_down;
+
        Evas *e;
+       Evas_Object *parent;
 
        Eina_List *obj_list;
+       Eina_List *access_chain;
 };
 
 struct child {
@@ -77,25 +96,20 @@ struct child {
 struct obj_info {
        char *id;
        Eina_List *children;
-       Evas_Object *win;
-       Eina_List *access_chain;
+       Evas_Object *parent;
 };
 
 static struct {
        char *font_name;
        int font_size;
+
+       Eina_List *handle_list;
 } s_info = {
        .font_name = NULL,
-       .font_size = 1,
-};
+       .font_size = -100,
 
-static inline double scale_get(void)
-{
-       int width;
-       int height;
-       ecore_x_window_size_get(0, &width, &height);
-       return (double)width / BASE_WIDTH;
-}
+       .handle_list = NULL,
+};
 
 static inline Evas_Object *find_edje(struct info *handle, const char *id)
 {
@@ -111,44 +125,24 @@ static inline Evas_Object *find_edje(struct info *handle, const char *id)
                }
 
                if (!id) {
-                       if (!obj_info->id)
+                       if (!obj_info->id) {
                                return edje;
+                       }
 
                        continue;
                } else if (!obj_info->id) {
                        continue;
                }
 
-               if (!strcmp(obj_info->id, id))
+               if (!strcmp(obj_info->id, id)) {
                        return edje;
+               }
        }
 
        DbgPrint("EDJE[%s] is not found\n", id);
        return NULL;
 }
 
-static inline void rebuild_focus_chain(Evas_Object *obj)
-{
-       struct obj_info *obj_info;
-       Evas_Object *ao;
-       Eina_List *l;
-
-       obj_info = evas_object_data_get(obj, "obj_info");
-       if (!obj_info) {
-               ErrPrint("Object info is not available\n");
-               return;
-       }
-
-       elm_object_focus_custom_chain_unset(obj);
-
-       DbgPrint("Rebuild focus chain begin\n");
-       EINA_LIST_FOREACH(obj_info->access_chain, l, ao) {
-               DbgPrint("Append %p\n", ao);
-               elm_object_focus_custom_chain_append(obj, ao, NULL);
-       }
-       DbgPrint("Rebuild focus chain done\n");
-}
-
 PUBLIC const char *script_magic_id(void)
 {
        return "edje";
@@ -162,8 +156,9 @@ PUBLIC int script_update_color(void *h, Evas *e, const char *id, const char *par
        int ret;
 
        edje = find_edje(handle, id);
-       if (!edje)
+       if (!edje) {
                return LB_STATUS_ERROR_NOT_EXIST;
+       }
 
        ret = sscanf(rgba, "%d %d %d %d %d %d %d %d %d %d %d %d",
                                        r, g, b, a,                     /* OBJECT */
@@ -192,34 +187,53 @@ static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item
        int y;
        int w;
        int h;
-       struct timeval tv;
        double timestamp;
 
        ao = evas_object_data_get(part_obj, "ao");
-       if (!ao)
+       if (!ao) {
                return;
+       }
 
        edje = evas_object_data_get(ao, "edje");
-       if (!edje)
+       if (!edje) {
                return;
+       }
 
        e = evas_object_evas_get(part_obj);
        evas_object_geometry_get(part_obj, &x, &y, &w, &h);
        x += w / 2;
        y += h / 2;
 
+#if defined(_USE_ECORE_TIME_GET)
+       timestamp = ecore_time_get();
+#else
+       struct timeval tv;
        if (gettimeofday(&tv, NULL) < 0) {
                ErrPrint("Failed to get time\n");
                timestamp = 0.0f;
        } else {
                timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
        }
+#endif
 
        DbgPrint("Cursor is on %dx%d\n", x, y);
-       evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
-       evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
-       evas_event_feed_mouse_move(e, x, y, timestamp + 0.02f, NULL);
-       evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.03f, NULL);
+       evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
+       evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+       evas_event_feed_mouse_move(e, x, y, (timestamp + 0.02f) * 1000, NULL);
+       evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.03f) * 1000, NULL);
+}
+
+static void access_del_cb(void *_info, Evas *e, Evas_Object *ao, void *event_info)
+{
+       struct info *handle = _info;
+       Evas_Object *edje_part;
+
+       edje_part = evas_object_data_del(ao, "edje,part");
+       (void)evas_object_data_del(ao, "edje");
+       (void)evas_object_data_del(edje_part, "ao");
+
+       handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
+       DbgPrint("AO(%p) is removed from local access chain\n", ao);
 }
 
 PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part, const char *text)
@@ -227,7 +241,7 @@ PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part
        struct obj_info *obj_info;
        struct info *handle = h;
        Evas_Object *edje;
-       Evas_Object *to;
+       Evas_Object *edje_part;
 
        edje = find_edje(handle, id);
        if (!edje) {
@@ -243,33 +257,42 @@ PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part
 
        elm_object_part_text_set(edje, part, text ? text : "");
 
-       to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
-       if (to) {
+       edje_part = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
+       if (edje_part) {
                Evas_Object *ao;
                char *utf8;
 
-               ao = evas_object_data_get(to, "ao");
+               ao = evas_object_data_get(edje_part, "ao");
                if (!ao) {
-                       ao = elm_access_object_register(to, edje);
+                       ao = elm_access_object_register(edje_part, handle->parent);
                        if (!ao) {
-                               ErrPrint("Unable to add ao: %s\n", part);
+                               ErrPrint("Unable to register an access object(%s)\n", part);
                                goto out;
                        }
-                       obj_info->access_chain = eina_list_append(obj_info->access_chain, ao);
-                       evas_object_data_set(to, "ao", ao);
+                       handle->access_chain = eina_list_append(handle->access_chain, edje_part);
+                       evas_object_data_set(edje_part, "ao", ao);
                        evas_object_data_set(ao, "edje", edje);
+                       evas_object_data_set(ao, "edje,part", edje_part);
                        elm_access_activate_cb_set(ao, activate_cb, NULL);
-                       elm_object_focus_custom_chain_append(edje, ao, NULL);
+                       elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
+                       evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
+
+                       DbgPrint("[%s] Register access info: (%s) to, %p\n", part, text, handle->parent);
                }
 
                if (!text || !strlen(text)) {
-                       obj_info->access_chain = eina_list_remove(obj_info->access_chain, ao);
-                       evas_object_data_del(to, "ao");
-                       evas_object_data_del(ao, "edje");
+                       /*
+                       handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
+                       (void)evas_object_data_del(edje_part, "ao");
+                       (void)evas_object_data_del(ao, "edje");
+                       */
+                       /*!
+                        * \note
+                        * Delete callback will be called
+                        */
+                       DbgPrint("[%s] Remove access object(%p)\n", part, ao);
                        elm_access_object_unregister(ao);
-                       DbgPrint("[%s] Remove access object\n", part);
 
-                       rebuild_focus_chain(edje);
                        goto out;
                }
 
@@ -277,18 +300,22 @@ PUBLIC int script_update_text(void *h, Evas *e, const char *id, const char *part
                if ((!utf8 || !strlen(utf8))) {
                        free(utf8);
 
-                       obj_info->access_chain = eina_list_remove(obj_info->access_chain, ao);
-                       evas_object_data_del(to, "ao");
-                       evas_object_data_del(ao, "edje");
+                       /*
+                       handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
+                       (void)evas_object_data_del(edje_part, "ao");
+                       (void)evas_object_data_del(ao, "edje");
+                       */
+                       /*!
+                        * \note
+                        * Delete callback will be called
+                        */
+                       DbgPrint("[%s] Remove access object(%p)\n", part, ao);
                        elm_access_object_unregister(ao);
-                       DbgPrint("[%s] Remove access object\n", part);
 
-                       rebuild_focus_chain(edje);
                        goto out;
                }
 
                elm_access_info_set(ao, ELM_ACCESS_INFO, utf8);
-               DbgPrint("[%s] Update access object (%s)\n", part, utf8);
                free(utf8);
        } else {
                ErrPrint("Unable to get text part[%s]\n", part);
@@ -305,8 +332,9 @@ static void parse_aspect(struct image_option *img_opt, const char *value, int le
                len--;
        }
 
-       if (len < 4)
+       if (len < 4) {
                return;
+       }
 
        img_opt->aspect = !strncasecmp(value, "true", 4);
        DbgPrint("Parsed ASPECT: %d (%s)\n", img_opt->aspect, value);
@@ -319,8 +347,9 @@ static void parse_orient(struct image_option *img_opt, const char *value, int le
                len--;
        }
 
-       if (len < 4)
+       if (len < 4) {
                return;
+       }
 
        img_opt->orient = !strncasecmp(value, "true", 4);
        DbgPrint("Parsed ORIENT: %d (%s)\n", img_opt->orient, value);
@@ -354,6 +383,24 @@ static void parse_size(struct image_option *img_opt, const char *value, int len)
        free(buf);
 }
 
+static void parse_shadow(struct image_option *img_opt, const char *value, int len)
+{
+       int angle;
+       int offset;
+       int softness;
+       int color;
+
+       if (sscanf(value, "%d,%d,%d,%d", &angle, &offset, &softness, &color) != 4) {
+               ErrPrint("Invalid shadow [%s]\n", value);
+       } else {
+               img_opt->shadow.enabled = 1;
+               img_opt->shadow.angle = angle;
+               img_opt->shadow.offset = offset;
+               img_opt->shadow.softness = softness;
+               img_opt->shadow.color = color;
+       }
+}
+
 static void parse_fill(struct image_option *img_opt, const char *value, int len)
 {
        while (len > 0 && *value == ' ') {
@@ -361,12 +408,13 @@ static void parse_fill(struct image_option *img_opt, const char *value, int len)
                len--;
        }
 
-       if (!strncasecmp(value, "in-size", len))
+       if (!strncasecmp(value, "in-size", len)) {
                img_opt->fill = FILL_IN_SIZE;
-       else if (!strncasecmp(value, "over-size", len))
+       } else if (!strncasecmp(value, "over-size", len)) {
                img_opt->fill = FILL_OVER_SIZE;
-       else
+       } else {
                img_opt->fill = FILL_DISABLE;
+       }
 
        DbgPrint("Parsed FILL: %d (%s)\n", img_opt->fill, value);
 }
@@ -396,6 +444,10 @@ static inline void parse_image_option(const char *option, struct image_option *i
                        .cmd = "size",
                        .handler = parse_size,
                },
+               {
+                       .cmd = "shadow",
+                       .handler = parse_shadow,
+               },
        };
        enum {
                STATE_START,
@@ -403,13 +455,14 @@ static inline void parse_image_option(const char *option, struct image_option *i
                STATE_DATA,
                STATE_IGNORE,
                STATE_ERROR,
-               STATE_END,
+               STATE_END
        } state;
        int idx;
        int tag;
 
-       if (!option || !*option)
+       if (!option || !*option) {
                return;
+       }
 
        state = STATE_START;
        /*!
@@ -483,10 +536,11 @@ static inline void parse_image_option(const char *option, struct image_option *i
                        }
                        break;
                case STATE_ERROR:
-                       if (*ptr == ';')
+                       if (*ptr == ';') {
                                state = STATE_START;
-                       else if (*ptr == '\0')
+                       } else if (*ptr == '\0') {
                                state = STATE_END;
+                       }
                        break;
                default:
                        break;
@@ -499,7 +553,7 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
        struct info *handle = _h;
        Evas_Object *edje;
        struct obj_info *obj_info;
-       Evas_Object *to;
+       Evas_Object *edje_part;
 
        edje = find_edje(handle, id);
        if (!edje) {
@@ -513,36 +567,42 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
                return LB_STATUS_ERROR_FAULT;
        }
 
-       to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
-       if (to) {
+       edje_part = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
+       if (edje_part) {
                Evas_Object *ao;
 
-               ao = evas_object_data_get(to, "ao");
+               ao = evas_object_data_get(edje_part, "ao");
                if (ao) {
-                       DbgPrint("[%s] Update access object (%s)\n", part, text);
                        if (text && strlen(text)) {
                                elm_access_info_set(ao, ELM_ACCESS_INFO, text);
+                               DbgPrint("Access info is updated: [%s]\n", text);
                        } else {
-                               obj_info->access_chain = eina_list_remove(obj_info->access_chain, ao);
-                               evas_object_data_del(to, "ao");
-                               evas_object_data_del(ao, "edje");
+                               /*
+                               handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
+                               (void)evas_object_data_del(edje_part, "ao");
+                               (void)evas_object_data_del(ao, "edje");
+                               */
+                               /*!
+                                * \note
+                                * Delete clalback will be called
+                                */
+                               DbgPrint("[%s] Remove access object(%p)\n", part, ao);
                                elm_access_object_unregister(ao);
-                               DbgPrint("Successfully unregistered\n");
-
-                               rebuild_focus_chain(edje);
                        }
                } else if (text && strlen(text)) {
-                       ao = elm_access_object_register(to, edje);
+                       ao = elm_access_object_register(edje_part, handle->parent);
                        if (!ao) {
-                               ErrPrint("Unable to register access object\n");
+                               ErrPrint("Unable to register an access object(%s)\n", part);
                        } else {
                                elm_access_info_set(ao, ELM_ACCESS_INFO, text);
-                               obj_info->access_chain = eina_list_append(obj_info->access_chain, ao);
-                               evas_object_data_set(to, "ao", ao);
-                               elm_object_focus_custom_chain_append(edje, ao, NULL);
-                               DbgPrint("[%s] Register access info: (%s)\n", part, text);
+                               handle->access_chain = eina_list_append(handle->access_chain, edje_part);
+                               evas_object_data_set(edje_part, "ao", ao);
                                evas_object_data_set(ao, "edje", edje);
+                               evas_object_data_set(ao, "edje,part", edje_part);
+                               elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
                                elm_access_activate_cb_set(ao, activate_cb, NULL);
+                               evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
+                               DbgPrint("[%s] Register access info: (%s) to, %p\n", part, text, handle->parent);
                        }
                }
        } else {
@@ -552,6 +612,86 @@ PUBLIC int script_update_access(void *_h, Evas *e, const char *id, const char *p
        return LB_STATUS_SUCCESS;
 }
 
+PUBLIC int script_operate_access(void *_h, Evas *e, const char *id, const char *part, const char *operation, const char *option)
+{
+       struct info *handle = _h;
+       Evas_Object *edje;
+       struct obj_info *obj_info;
+       Elm_Access_Action_Info action_info;
+       int ret;
+
+       if (!operation || !strlen(operation)) {
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       edje = find_edje(handle, id);
+       if (!edje) {
+               ErrPrint("No such object: %s\n", id);
+               return LB_STATUS_ERROR_NOT_EXIST;
+       }
+
+       obj_info = evas_object_data_get(edje, "obj_info");
+       if (!obj_info) {
+               ErrPrint("Object info is not available\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       memset(&action_info, 0, sizeof(action_info));
+
+       /* OPERATION is defined in liblivebox package */
+       if (!strcasecmp(operation, "set,hl")) {
+               if (part) {
+                       Evas_Object *edje_part;
+                       Evas_Coord x;
+                       Evas_Coord y;
+                       Evas_Coord w;
+                       Evas_Coord h;
+
+                       edje_part = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(edje), part);
+                       if (!edje_part) {
+                               ErrPrint("Invalid part: %s\n", part);
+                               goto out;
+                       }
+
+                       evas_object_geometry_get(edje_part, &x, &y, &w, &h);
+
+                       action_info.x = x + w / 2;
+                       action_info.y = x + h / 2;
+               } else if (option && sscanf(option, "%dx%d", &action_info.x, &action_info.y) == 2) {
+               } else {
+                       ErrPrint("Insufficient info for HL\n");
+                       goto out;
+               }
+
+               DbgPrint("TXxTY: %dx%d\n", action_info.x, action_info.y);
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       } else if (!strcasecmp(operation, "unset,hl")) {
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_UNHIGHLIGHT, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       } else if (!strcasecmp(operation, "next,hl")) {
+               action_info.highlight_cycle = (!!option) && (!!strcasecmp(option, "no,cycle"));
+
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       } else if (!strcasecmp(operation, "prev,hl")) {
+               action_info.highlight_cycle = EINA_TRUE;
+               ret = elm_access_action(edje, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, &action_info);
+               if (ret == EINA_FALSE) {
+                       ErrPrint("Action error\n");
+               }
+       }
+
+out:
+       return LB_STATUS_SUCCESS;
+}
+
 PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *part, const char *path, const char *option)
 {
        struct info *handle = _h;
@@ -567,6 +707,9 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                .fill = FILL_DISABLE,
                .width = -1,
                .height = -1,
+               .shadow = {
+                       .enabled = 0,
+               },
        };
 
        edje = find_edje(handle, id);
@@ -585,11 +728,11 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
        if (img) {
                Eina_List *l;
                Eina_List *n;
-               Evas_Object *ao;
 
                EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
-                       if (child->obj != img)
+                       if (child->obj != img) {
                                continue;
+                       }
 
                        obj_info->children = eina_list_remove(obj_info->children, child);
                        free(child->part);
@@ -598,16 +741,7 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                }
 
                DbgPrint("delete object %s %p\n", part, img);
-               ao = evas_object_data_del(img, "ao");
-               if (ao) {
-                       obj_info->access_chain = eina_list_remove(obj_info->access_chain, ao);
-                       evas_object_data_del(ao, "edje");
-                       elm_access_object_unregister(ao);
-                       DbgPrint("Successfully unregistered\n");
-               }
                evas_object_del(img);
-
-               rebuild_focus_chain(edje);
        }
 
        if (!path || !strlen(path) || access(path, R_OK) != 0) {
@@ -657,8 +791,8 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                        Evas_Coord part_h;
 
                        if (img_opt.width >= 0 && img_opt.height >= 0) {
-                               part_w = img_opt.width * scale_get();
-                               part_h = img_opt.height * scale_get();
+                               part_w = img_opt.width * elm_config_scale_get();
+                               part_h = img_opt.height * elm_config_scale_get();
                        } else {
                                part_w = 0;
                                part_h = 0;
@@ -681,19 +815,127 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                                        w = (double)w * fh;
                                }
                        }
-                       DbgPrint("Size: %dx%d\n", w, h);
 
-                       evas_object_image_load_size_set(img, w, h);
-                       evas_object_image_load_region_set(img, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h);
-                       evas_object_image_fill_set(img, 0, 0, part_w, part_h);
-                       evas_object_image_reload(img);
+                       if (!part_w || !part_h || !w || !h) {
+                               evas_object_del(img);
+                               free(child->part);
+                               free(child);
+                               return LB_STATUS_ERROR_INVALID;
+                       }
+
+                       if (evas_object_image_region_support_get(img)) {
+                               evas_object_image_load_region_set(img, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h);
+                               evas_object_image_load_size_set(img, part_w, part_h);
+                               evas_object_image_filled_set(img, EINA_TRUE);
+                               //evas_object_image_fill_set(img, 0, 0, part_w, part_h);
+                               DbgPrint("Size: %dx%d (region: %dx%d - %dx%d)\n", w, h, (w - part_w) / 2, (h - part_h) / 2, part_w, part_h);
+                       } else {
+                               Ecore_Evas *ee;
+                               Evas *e;
+                               Evas_Object *src_img;
+                               Evas_Coord rw, rh;
+                               const void *data;
+
+                               DbgPrint("Part loading is not supported\n");
+                               ee = ecore_evas_buffer_new(part_w, part_h);
+                               if (!ee) {
+                                       ErrPrint("Failed to create a EE\n");
+                                       evas_object_del(img);
+                                       free(child->part);
+                                       free(child);
+                                       return LB_STATUS_ERROR_FAULT;
+                               }
+
+                               ecore_evas_alpha_set(ee, EINA_TRUE);
+
+                               e = ecore_evas_get(ee);
+                               if (!e) {
+                                       ErrPrint("Unable to get Evas\n");
+                                       ecore_evas_free(ee);
+
+                                       evas_object_del(img);
+                                       free(child->part);
+                                       free(child);
+                                       return LB_STATUS_ERROR_FAULT;
+                               }
+
+                               src_img = evas_object_image_filled_add(e);
+                               if (!src_img) {
+                                       ErrPrint("Unable to add an image\n");
+                                       ecore_evas_free(ee);
+
+                                       evas_object_del(img);
+                                       free(child->part);
+                                       free(child);
+                                       return LB_STATUS_ERROR_FAULT;
+                               }
+
+                               evas_object_image_alpha_set(src_img, EINA_TRUE);
+                               evas_object_image_colorspace_set(src_img, EVAS_COLORSPACE_ARGB8888);
+                               evas_object_image_smooth_scale_set(src_img, EINA_TRUE);
+                               evas_object_image_load_orientation_set(src_img, img_opt.orient);
+                               evas_object_image_file_set(src_img, path, NULL);
+                               err = evas_object_image_load_error_get(src_img);
+                               if (err != EVAS_LOAD_ERROR_NONE) {
+                                       ErrPrint("Load error: %s\n", evas_load_error_str(err));
+                                       evas_object_del(src_img);
+                                       ecore_evas_free(ee);
+
+                                       evas_object_del(img);
+                                       free(child->part);
+                                       free(child);
+                                       return LB_STATUS_ERROR_IO;
+                               }
+                               evas_object_image_size_get(src_img, &rw, &rh);
+                               evas_object_image_fill_set(src_img, 0, 0, rw, rh);
+                               evas_object_resize(src_img, w, h);
+                               evas_object_move(src_img, -(w - part_w) / 2, -(h - part_h) / 2);
+                               evas_object_show(src_img);
+
+                               data = ecore_evas_buffer_pixels_get(ee);
+                               if (!data) {
+                                       ErrPrint("Unable to get pixels\n");
+                                       evas_object_del(src_img);
+                                       ecore_evas_free(ee);
+
+                                       evas_object_del(img);
+                                       free(child->part);
+                                       free(child);
+                                       return LB_STATUS_ERROR_IO;
+                               }
+
+                               e = evas_object_evas_get(img);
+                               evas_object_del(img);
+                               img = evas_object_image_filled_add(e);
+                               if (!img) {
+                                       evas_object_del(src_img);
+                                       ecore_evas_free(ee);
+
+                                       free(child->part);
+                                       free(child);
+                                       return LB_STATUS_ERROR_MEMORY;
+                               }
+
+                               evas_object_image_colorspace_set(img, EVAS_COLORSPACE_ARGB8888);
+                               evas_object_image_smooth_scale_set(img, EINA_TRUE);
+                               evas_object_image_alpha_set(img, EINA_TRUE);
+                               evas_object_image_data_set(img, NULL);
+                               evas_object_image_size_set(img, part_w, part_h);
+                               evas_object_resize(img, part_w, part_h);
+                               evas_object_image_data_copy_set(img, (void *)data);
+                               evas_object_image_fill_set(img, 0, 0, part_w, part_h);
+                               evas_object_image_data_update_add(img, 0, 0, part_w, part_h);
+
+                               evas_object_del(src_img);
+                               ecore_evas_free(ee);
+                       }
                } else if (img_opt.fill == FILL_IN_SIZE) {
                        Evas_Coord part_w;
                        Evas_Coord part_h;
 
                        if (img_opt.width >= 0 && img_opt.height >= 0) {
-                               part_w = img_opt.width * scale_get();
-                               part_h = img_opt.height * scale_get();
+                               part_w = img_opt.width * elm_config_scale_get();
+                               part_h = img_opt.height * elm_config_scale_get();
                        } else {
                                part_w = 0;
                                part_h = 0;
@@ -735,6 +977,29 @@ PUBLIC int script_update_image(void *_h, Evas *e, const char *id, const char *pa
                evas_object_image_fill_set(img, 0, 0, w, h);
                evas_object_size_hint_fill_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL);
                evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               evas_object_image_filled_set(img, EINA_TRUE);
+       }
+
+       if (img_opt.shadow.enabled) {
+               /*
+               ea_effect_h *ea_effect;
+
+               ea_effect = ea_image_effect_create();
+               if (ea_effect) {
+                       // -90, 2, 4, 0x99000000
+                       ea_image_effect_add_outer_shadow(ea_effect, img_opt.shadow.angle, img_opt.shadow.offset, img_opt.shadow.softness, img_opt.shadow.color);
+                       ea_object_image_effect_set(img, ea_effect);
+
+                       if (ENGINEER_MODE_ENABLED) {
+                               int x, y, w, h;
+                               ea_image_effect_offset_get(ea_effect, &x, &y);
+                               evas_object_image_size_get(img, &w, &h);
+                               DbgPrint("Effect applied (%dx%d) - (%dx%d), (%d,%d,%d,%d)\n", x, y, w, h, img_opt.shadow.angle, img_opt.shadow.offset, img_opt.shadow.softness, img_opt.shadow.color);
+                       }
+
+                       ea_image_effect_destroy(ea_effect);
+               }
+               */
        }
 
        /*!
@@ -783,7 +1048,6 @@ static void script_signal_cb(void *data, Evas_Object *obj, const char *emission,
                ey = (double)(py + ph) / (double)h;
        }
 
-       DbgPrint("Signal emit: source[%s], emission[%s]\n", source, emission);
        script_signal_emit(handle->e, source, emission, sx, sy, ex, ey);
 }
 
@@ -791,8 +1055,8 @@ static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info
 {
        struct info *handle = _info;
        struct obj_info *obj_info;
+       struct obj_info *parent_obj_info;
        struct child *child;
-       Evas_Object *ao;
 
        handle->obj_list = eina_list_remove(handle->obj_list, obj);
 
@@ -803,42 +1067,94 @@ static void edje_del_cb(void *_info, Evas *e, Evas_Object *obj, void *event_info
        }
 
        DbgPrint("delete object %s %p\n", obj_info->id, obj);
+       parent_obj_info = evas_object_data_get(obj_info->parent, "obj_info");
+       if (parent_obj_info) {
+               Eina_List *l;
+               Eina_List *n;
 
-       elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
+               EINA_LIST_FOREACH_SAFE(parent_obj_info->children, l, n, child) {
+                       if (child->obj != obj) {
+                               continue;
+                       }
 
-       elm_object_focus_custom_chain_unset(obj);
+                       /*!
+                        * \note
+                        * If this code is executed,
+                        * The parent is not deleted by desc, this object is deleted by itself.
+                        * It is not possible, but we care it.
+                        */
+                       DbgPrint("Parent's children is updated: %s\n", child->part);
+                       parent_obj_info->children = eina_list_remove(parent_obj_info->children, child);
+                       free(child->part);
+                       free(child);
+                       break;
+               }
+       } else {
+               DbgPrint("Parent EDJE\n");
+       }
+
+       elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
 
        EINA_LIST_FREE(obj_info->children, child) {
                DbgPrint("delete object %s %p\n", child->part, child->obj);
                if (child->obj) {
-                       Evas_Object *ao;
-                       ao = evas_object_data_del(child->obj, "ao");
-                       if (ao) {
-                               obj_info->access_chain = eina_list_remove(obj_info->access_chain, ao);
-                               evas_object_data_del(ao, "edje");
-                               elm_access_object_unregister(ao);
-                       }
                        evas_object_del(child->obj);
                }
                free(child->part);
                free(child);
        }
 
-       EINA_LIST_FREE(obj_info->access_chain, ao) {
-               evas_object_data_del(ao, "edje");
-               elm_access_object_unregister(ao);
+#if 0
+       Eina_List *l;
+       Eina_List *n;
+       Evas_Object *ao;
+       Evas_Object *edje_part;
+       Evas_Object *edje;
+       EINA_LIST_FOREACH_SAFE(handle->access_chain, l, n, edje_part) {
+               ao = evas_object_data_get(edje_part, "ao");
+               if (ao) {
+                       edje = evas_object_data_get(ao, "edje");
+               } else {
+                       ErrPrint("edje_part has no ao\n");
+                       continue;
+               }
+
+               if (edje == obj) {
+                       /*!
+                       handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
+                       (void)evas_object_data_del(edje_part, "ao");
+                       (void)evas_object_data_del(ao, "edje");
+                       */
+                       /*!
+                        * Delete callback will be called
+                        */
+                       DbgPrint("Remove access object(%p)\n", ao);
+                       elm_access_object_unregister(ao);
+               }
        }
+#endif
 
        free(obj_info->id);
        free(obj_info);
 }
 
+static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
+{
+       Evas_Object *o, *ho;
+
+       o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp");
+       if (!o) return NULL;
+
+       ho = evas_object_data_get(o, "_elm_access_target");
+       return ho;
+}
+
 /*!
        LB_ACCESS_HIGHLIGHT             0
        LB_ACCESS_HIGHLIGHT_NEXT        1
        LB_ACCESS_HIGHLIGHT_PREV        2
        LB_ACCESS_ACTIVATE              3
-       LB_ACCESS_VALUE_CHANGE          4
+       LB_ACCESS_ACTION                4
        LB_ACCESS_SCROLL                5
 */
 PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int down, double timestamp)
@@ -848,8 +1164,6 @@ PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int
        struct obj_info *obj_info;
        int ret = LB_STATUS_SUCCESS;
 
-       DbgPrint("event: %d, x: %d, y: %d\n", event_type, x, y);
-
        edje = find_edje(handle, NULL); /*!< Get the base layout */
        if (!edje) {
                ErrPrint("Base layout is not exist\n");
@@ -863,65 +1177,91 @@ PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int
        }
 
        if (event_type & LB_SCRIPT_ACCESS_EVENT) {
-               Elm_Access_Action_Info *info;
+               Elm_Access_Action_Info info;
                Elm_Access_Action_Type action;
-               const Eina_List *chain;
 
-               info = calloc(1, sizeof(*info));
-               if (!info) {
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               chain = elm_object_focus_custom_chain_get(edje);
-               DbgPrint("Focus chain : %d\n", eina_list_count(chain));
+               memset(&info, 0, sizeof(info));
 
                if ((event_type & LB_SCRIPT_ACCESS_HIGHLIGHT) == LB_SCRIPT_ACCESS_HIGHLIGHT) {
                        action = ELM_ACCESS_ACTION_HIGHLIGHT;
-                       info->x = x;
-                       info->y = y;
-                       ret = elm_access_action(edje, action, info);
+                       info.x = x;
+                       info.y = y;
+                       ret = elm_access_action(edje, action, &info);
                        DbgPrint("ACCESS_HIGHLIGHT: %dx%d returns %d\n", x, y, ret);
-                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+                       if (ret == EINA_TRUE) {
+                               if (!get_highlighted_object(edje)) {
+                                       ErrPrint("Highlighted object is not found\n");
+                                       ret = LB_ACCESS_STATUS_ERROR;
+                               } else {
+                                       DbgPrint("Highlighted object is found\n");
+                                       ret = LB_ACCESS_STATUS_DONE;
+                               }
+                       } else {
+                               ErrPrint("Action error\n");
+                               ret = LB_ACCESS_STATUS_ERROR;
+                       }
                } else if ((event_type & LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT) == LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT) {
                        action = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-                       info->highlight_cycle = EINA_FALSE;
-                       ret = elm_access_action(edje, action, info);
+                       info.highlight_cycle = EINA_FALSE;
+                       ret = elm_access_action(edje, action, &info);
                        DbgPrint("ACCESS_HIGHLIGHT_NEXT, returns %d\n", ret);
                        ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_LAST : LB_ACCESS_STATUS_DONE;
                } else if ((event_type & LB_SCRIPT_ACCESS_HIGHLIGHT_PREV) == LB_SCRIPT_ACCESS_HIGHLIGHT_PREV) {
                        action = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-                       info->highlight_cycle = EINA_FALSE;
-                       ret = elm_access_action(edje, action, info);
+                       info.highlight_cycle = EINA_FALSE;
+                       ret = elm_access_action(edje, action, &info);
                        DbgPrint("ACCESS_HIGHLIGHT_PREV, returns %d\n", ret);
                        ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_FIRST : LB_ACCESS_STATUS_DONE;
                } else if ((event_type & LB_SCRIPT_ACCESS_ACTIVATE) == LB_SCRIPT_ACCESS_ACTIVATE) {
                        action = ELM_ACCESS_ACTION_ACTIVATE;
-                       ret = elm_access_action(edje, action, info);
-                       DbgPrint("ACCESS_HIGHLIGHT_ACTIVATE, returns %d\n", ret);
-                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
-               } else if ((event_type & LB_SCRIPT_ACCESS_VALUE_CHANGE) == LB_SCRIPT_ACCESS_VALUE_CHANGE) {
-                       action = ELM_ACCESS_ACTION_VALUE_CHANGE;
-                       ret = elm_access_action(edje, action, info);
-                       DbgPrint("ACCESS_HIGHLIGHT_VALUE_CHANGE, returns %d\n", ret);
+                       ret = elm_access_action(edje, action, &info);
+                       DbgPrint("ACCESS_ACTIVATE, returns %d\n", ret);
                        ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+               } else if ((event_type & LB_SCRIPT_ACCESS_ACTION) == LB_SCRIPT_ACCESS_ACTION) {
+                       if (down == 0) {
+                               action = ELM_ACCESS_ACTION_UP;
+                               ret = elm_access_action(edje, action, &info);
+                               DbgPrint("ACCESS_ACTION(%d), returns %d\n", down, ret);
+                               ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+                       } else if (down == 1) {
+                               action = ELM_ACCESS_ACTION_DOWN;
+                               ret = elm_access_action(edje, action, &info);
+                               DbgPrint("ACCESS_ACTION(%d), returns %d\n", down, ret);
+                               ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+                       } else {
+                               ErrPrint("Invalid access event\n");
+                               ret = LB_ACCESS_STATUS_ERROR;
+                       }
                } else if ((event_type & LB_SCRIPT_ACCESS_SCROLL) == LB_SCRIPT_ACCESS_SCROLL) {
                        action = ELM_ACCESS_ACTION_SCROLL;
-                       info->x = x;
-                       info->y = y;
+                       info.x = x;
+                       info.y = y;
                        switch (down) {
-                       case 0: info->mouse_type = 0; break;
-                       case -1: info->mouse_type = 1; break;
-                       case 1: info->mouse_type = 2; break;
+                       case 0:
+                               info.mouse_type = 0;
+                               ret = elm_access_action(edje, action, &info);
+                               DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
+                               ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+                               break;
+                       case -1:
+                               info.mouse_type = 1;
+                               ret = elm_access_action(edje, action, &info);
+                               DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
+                               ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+                               break;
+                       case 1:
+                               info.mouse_type = 2;
+                               ret = elm_access_action(edje, action, &info);
+                               DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
+                               ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
+                               break;
                        default:
+                               ret = LB_ACCESS_STATUS_ERROR;
                                break;
                        }
-                       ret = elm_access_action(edje, action, info);
-                       DbgPrint("ACCESS_HIGHLIGHT_SCROLL, returns %d\n", ret);
-                       ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
                } else if ((event_type & LB_SCRIPT_ACCESS_UNHIGHLIGHT) == LB_SCRIPT_ACCESS_UNHIGHLIGHT) {
                        action = ELM_ACCESS_ACTION_UNHIGHLIGHT;
-                       ret = elm_access_action(edje, action, info);
+                       ret = elm_access_action(edje, action, &info);
                        DbgPrint("ACCESS_UNHIGHLIGHT, returns %d\n", ret);
                        ret = (ret == EINA_FALSE) ? LB_ACCESS_STATUS_ERROR : LB_ACCESS_STATUS_DONE;
                } else {
@@ -929,25 +1269,48 @@ PUBLIC int script_feed_event(void *h, Evas *e, int event_type, int x, int y, int
                        ret = LB_ACCESS_STATUS_ERROR;
                }
 
-               free(info);
        } else if (event_type & LB_SCRIPT_MOUSE_EVENT) {
+               double cur_timestamp;
+
+#if defined(_USE_ECORE_TIME_GET)
+               cur_timestamp = ecore_time_get();
+#else
+               struct timeval tv;
+               if (gettimeofday(&tv, NULL) < 0) {
+                       ErrPrint("Failed to get time\n");
+                       cur_timestamp = 0.0f;
+               } else {
+                       cur_timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
+               }
+#endif
+               if (cur_timestamp - timestamp > 0.1f && handle->is_mouse_down == 0) {
+                       DbgPrint("Discard lazy event : %lf\n", cur_timestamp - timestamp);
+                       return LB_STATUS_SUCCESS;
+               }
+
                switch (event_type) {
                case LB_SCRIPT_MOUSE_DOWN:
-                       evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
-                       evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, timestamp + 0.01f, NULL);
+                       if (handle->is_mouse_down == 0) {
+                               evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
+                               evas_event_feed_mouse_down(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+                               handle->is_mouse_down = 1;
+                       }
                        break;
                case LB_SCRIPT_MOUSE_MOVE:
-                       evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
+                       evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
                        break;
                case LB_SCRIPT_MOUSE_UP:
-                       evas_event_feed_mouse_move(e, x, y, timestamp, NULL);
-                       evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, timestamp + 0.1f, NULL);
+                       if (handle->is_mouse_down == 1) {
+                               evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
+                               evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.01f) * 1000, NULL);
+                               handle->is_mouse_down = 0;
+                       }
                        break;
                case LB_SCRIPT_MOUSE_IN:
-                       evas_event_feed_mouse_in(e, timestamp, NULL);
+                       evas_event_feed_mouse_in(e, timestamp * 1000, NULL);
                        break;
                case LB_SCRIPT_MOUSE_OUT:
-                       evas_event_feed_mouse_out(e, timestamp, NULL);
+                       evas_event_feed_mouse_out(e, timestamp * 1000, NULL);
                        break;
                default:
                        return LB_STATUS_ERROR_INVALID;
@@ -967,12 +1330,11 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
        Evas_Object *obj;
        struct obj_info *obj_info;
        struct child *child;
-
-       DbgPrint("src_id[%s] target_id[%s] part[%s] path[%s] group[%s]\n", src_id, target_id, part, path, group);
+       char _target_id[32];
 
        edje = find_edje(handle, src_id);
        if (!edje) {
-               ErrPrint("Edje is not exists\n");
+               ErrPrint("Edje is not exists (%s)\n", src_id);
                return LB_STATUS_ERROR_NOT_EXIST;
        }
 
@@ -988,8 +1350,9 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
                Eina_List *n;
 
                EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
-                       if (child->obj != obj)
+                       if (child->obj != obj) {
                                continue;
+                       }
 
                        obj_info->children = eina_list_remove(obj_info->children, child);
 
@@ -1012,19 +1375,46 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
                return LB_STATUS_SUCCESS;
        }
 
+       if (!target_id) {
+               if (find_edje(handle, part)) {
+                       double timestamp;
+
+                       do {
+#if defined(_USE_ECORE_TIME_GET)
+                               timestamp = ecore_time_get();
+#else
+                               struct timeval tv;
+                               if (gettimeofday(&tv, NULL) < 0) {
+                                       static int local_idx = 0;
+                                       timestamp = (double)(local_idx++);
+                               } else {
+                                       timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
+                               }
+#endif
+
+                               snprintf(_target_id, sizeof(_target_id), "%lf", timestamp);
+                       } while (find_edje(handle, _target_id));
+
+                       target_id = _target_id;
+               } else {
+                       target_id = part;
+               }
+
+               DbgPrint("Anonymouse target id: %s\n", target_id);
+       }
+
        obj = elm_layout_add(edje);
        if (!obj) {
                ErrPrint("Failed to add a new edje object\n");
                return LB_STATUS_ERROR_FAULT;
        }
 
+       edje_object_scale_set(elm_layout_edje_get(obj), elm_config_scale_get());
+
        if (!elm_layout_file_set(obj, path, group)) {
                int err;
-               const char *errmsg;
-
                err = edje_object_load_error_get(elm_layout_edje_get(obj));
-               errmsg = edje_load_error_str(err);
-               ErrPrint("Could not load %s from %s: %s\n", group, path, errmsg);
+               ErrPrint("Could not load %s from %s: %s\n", group, path, edje_load_error_str(err));
                evas_object_del(obj);
                return LB_STATUS_ERROR_IO;
        }
@@ -1046,6 +1436,8 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
                return LB_STATUS_ERROR_MEMORY;
        }
 
+       obj_info->parent = edje;
+
        child = malloc(sizeof(*child));
        if (!child) {
                ErrPrint("Error: %s\n", strerror(errno));
@@ -1074,8 +1466,10 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
 
        DbgPrint("%s part swallow edje %p\n", part, obj);
        elm_object_part_content_set(edje, part, obj);
+
        obj_info = evas_object_data_get(edje, "obj_info");
        obj_info->children = eina_list_append(obj_info->children, child);
+
        return LB_STATUS_SUCCESS;
 }
 
@@ -1084,11 +1478,10 @@ PUBLIC int script_update_signal(void *h, Evas *e, const char *id, const char *pa
        struct info *handle = h;
        Evas_Object *edje;
 
-       DbgPrint("id[%s], part[%s], signal[%s]\n", id, part, signal);
-
        edje = find_edje(handle, id);
-       if (!edje)
+       if (!edje) {
                return LB_STATUS_ERROR_NOT_EXIST;
+       }
 
        elm_object_signal_emit(edje, signal, part);
        return LB_STATUS_SUCCESS;
@@ -1099,11 +1492,10 @@ PUBLIC int script_update_drag(void *h, Evas *e, const char *id, const char *part
        struct info *handle = h;
        Evas_Object *edje;
 
-       DbgPrint("id[%s], part[%s], %lfx%lf\n", id, part, x, y);
-
        edje = find_edje(handle, id);
-       if (!edje)
+       if (!edje) {
                return LB_STATUS_ERROR_NOT_EXIST;
+       }
 
        edje_object_part_drag_value_set(elm_layout_edje_get(edje), part, x, y);
        return LB_STATUS_SUCCESS;
@@ -1115,8 +1507,9 @@ PUBLIC int script_update_size(void *han, Evas *e, const char *id, int w, int h)
        Evas_Object *edje;
 
        edje = find_edje(handle, id);
-       if (!edje)
+       if (!edje) {
                return LB_STATUS_ERROR_NOT_EXIST;
+       }
 
        if (!id) {
                handle->w = w;
@@ -1132,15 +1525,14 @@ PUBLIC int script_update_category(void *h, Evas *e, const char *id, const char *
 {
        struct info *handle = h;
 
-       DbgPrint("id[%s], category[%s]\n", id, category);
-
        if (handle->category) {
                free(handle->category);
                handle->category = NULL;
        }
 
-       if (!category)
+       if (!category) {
                return LB_STATUS_SUCCESS;
+       }
 
        handle->category = strdup(category);
        if (!handle->category) {
@@ -1155,8 +1547,6 @@ PUBLIC void *script_create(const char *file, const char *group)
 {
        struct info *handle;
 
-       DbgPrint("file[%s], group[%s]\n", file, group);
-
        handle = calloc(1, sizeof(*handle));
        if (!handle) {
                ErrPrint("Error: %s\n", strerror(errno));
@@ -1178,6 +1568,8 @@ PUBLIC void *script_create(const char *file, const char *group)
                return NULL;
        }
 
+       s_info.handle_list = eina_list_append(s_info.handle_list, handle);
+
        return handle;
 }
 
@@ -1188,9 +1580,17 @@ PUBLIC int script_destroy(void *_handle)
 
        handle = _handle;
 
+       if (!eina_list_data_find(s_info.handle_list, handle)) {
+               DbgPrint("Not found (already deleted?)\n");
+               return LB_STATUS_ERROR_NOT_EXIST;
+       }
+
+       s_info.handle_list = eina_list_remove(s_info.handle_list, handle);
+
        edje = eina_list_nth(handle->obj_list, 0);
-       if (edje)
+       if (edje) {
                evas_object_del(edje);
+       }
 
        free(handle->category);
        free(handle->file);
@@ -1213,30 +1613,30 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
                return LB_STATUS_ERROR_MEMORY;
        }
 
-       obj_info->win = evas_object_rectangle_add(e);
-       if (!obj_info->win) {
+       obj_info->parent = evas_object_rectangle_add(e);
+       if (!obj_info->parent) {
+               ErrPrint("Unable to create a parent box\n");
                free(obj_info);
                return LB_STATUS_ERROR_FAULT;
        }
 
-       edje = elm_layout_add(obj_info->win);
+       edje = elm_layout_add(obj_info->parent);
        if (!edje) {
                ErrPrint("Failed to create an edje object\n");
-               evas_object_del(obj_info->win);
+               evas_object_del(obj_info->parent);
                free(obj_info);
                return LB_STATUS_ERROR_FAULT;
        }
 
-       DbgPrint("Load edje: %s - %s\n", handle->file, handle->group);
+       edje_object_scale_set(elm_layout_edje_get(edje), elm_config_scale_get());
+
        if (!elm_layout_file_set(edje, handle->file, handle->group)) {
                int err;
-               const char *errmsg;
 
                err = edje_object_load_error_get(elm_layout_edje_get(edje));
-               errmsg = edje_load_error_str(err);
-               ErrPrint("Could not load %s from %s: %s\n", handle->group, handle->file, errmsg);
+               ErrPrint("Could not load %s from %s: %s\n", handle->group, handle->file, edje_load_error_str(err));
                evas_object_del(edje);
-               evas_object_del(obj_info->win);
+               evas_object_del(obj_info->parent);
                free(obj_info);
                return LB_STATUS_ERROR_IO;
        }
@@ -1244,6 +1644,7 @@ PUBLIC int script_load(void *_handle, Evas *e, int w, int h)
        handle->e = e;
        handle->w = w;
        handle->h = h;
+       handle->parent = edje;
 
        elm_object_signal_callback_add(edje, "*", "*", script_signal_cb, handle);
        evas_object_event_callback_add(edje, EVAS_CALLBACK_DEL, edje_del_cb, handle);
@@ -1261,13 +1662,26 @@ PUBLIC int script_unload(void *_handle, Evas *e)
 {
        struct info *handle;
        Evas_Object *edje;
+       Evas_Object *parent = NULL;
 
        handle = _handle;
 
-       DbgPrint("Unload edje: %s - %s\n", handle->file, handle->group);
        edje = eina_list_nth(handle->obj_list, 0);
-       if (edje)
+       if (edje) {
+               struct obj_info *obj_info;
+
+               obj_info = evas_object_data_get(edje, "obj_info");
+               if (obj_info) {
+                       parent = obj_info->parent;
+               }
                evas_object_del(edje);
+       }
+
+       if (parent) {
+               DbgPrint("Delete parent box\n");
+               evas_object_del(parent);
+       }
+
        handle->e = NULL;
        return LB_STATUS_SUCCESS;
 }
@@ -1291,32 +1705,45 @@ static void access_cb(keynode_t *node, void *user_data)
 
 static void update_font_cb(void *data)
 {
-       elm_config_font_overlay_set(TEXT_CLASS, s_info.font_name, s_info.font_size);
-       DbgPrint("Update text class %s (%s, %d)\n", TEXT_CLASS, s_info.font_name, s_info.font_size);
+       elm_config_font_overlay_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
+       DbgPrint("Update text class %s (%s, %d)\n", TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
 }
 
-static void font_changed_cb(system_settings_key_e key, void *user_data)
+static void font_changed_cb(keynode_t *node, void *user_data)
 {
-       int ret;
        char *font_name;
 
-       ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
-       if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name)
-               return;
+       if (s_info.font_name) {
+               font_name = vconf_get_str("db/setting/accessibility/font_name");
+               if (!font_name) {
+                       ErrPrint("Invalid font name (NULL)\n");
+                       return;
+               }
 
-       if (s_info.font_name && !strcmp(s_info.font_name, font_name)) {
-               DbgPrint("Font is not changed\n");
-               free(font_name);
-               return;
-       }
+               if (!strcmp(s_info.font_name, font_name)) {
+                       DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
+                       free(font_name);
+                       return;
+               }
 
-       if (s_info.font_name) {
+               DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
                free(s_info.font_name);
-               s_info.font_name = NULL;
+       } else {
+               int ret;
+
+               /*!
+                * Get the first font name using system_settings API.
+                */
+               font_name = NULL;
+               ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
+               if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
+                       ErrPrint("System setting get: %d, font_name[%p]\n", ret, font_name);
+                       return;
+               }
        }
 
        s_info.font_name = font_name;
-       DbgPrint("Font name is changed to %s\n", s_info.font_name);
+       DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
 
        /*!
         * \NOTE
@@ -1325,12 +1752,42 @@ static void font_changed_cb(system_settings_key_e key, void *user_data)
        update_font_cb(NULL);
 }
 
+static inline int convert_font_size(int size)
+{
+       switch (size) {
+       case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
+               size = -80;
+               break;
+       case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
+               size = -100;
+               break;
+       case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
+               size = -150;
+               break;
+       case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
+               size = -190;
+               break;
+       case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
+               size = -250;
+               break;
+       default:
+               size = -100;
+               break;
+       }
+
+       DbgPrint("Return size: %d\n", size);
+       return size;
+}
+
 static void font_size_cb(system_settings_key_e key, void *user_data)
 {
        int size;
 
-       if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE)
+       if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
                return;
+       }
+
+       size = convert_font_size(size);
 
        if (size == s_info.font_size) {
                DbgPrint("Font size is not changed\n");
@@ -1338,52 +1795,61 @@ static void font_size_cb(system_settings_key_e key, void *user_data)
        }
 
        s_info.font_size = size;
-       DbgPrint("Font size is changed to %d\n", size);
-
-       update_font_cb(NULL);
+       DbgPrint("Font size is changed to %d, but don't update the font info\n", size);
 }
 
-PUBLIC int script_init(void)
+PUBLIC int script_init(double scale)
 {
        int ret;
        char *argv[] = {
                "livebox.edje",
                NULL,
        };
+
        /* ecore is already initialized */
        elm_init(1, argv);
-       elm_config_scale_set(scale_get());
+       elm_config_scale_set(scale);
+       DbgPrint("Scale is updated: %lf\n", scale);
 
        ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, access_cb, NULL);
-       if (ret < 0)
-               ErrPrint("Failed to access cb\n");
-
-       access_cb(NULL, NULL);
+       DbgPrint("TTS changed: %d\n", ret);
 
-       ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE, font_changed_cb, NULL);
+       ret = vconf_notify_key_changed("db/setting/accessibility/font_name", font_changed_cb, NULL);
        DbgPrint("System font is changed: %d\n", ret);
        
        ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
        DbgPrint("System font size is changed: %d\n", ret);
 
-       ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &s_info.font_name);
-       if (ret == SYSTEM_SETTINGS_ERROR_NONE)
-               DbgPrint("Current font: %s\n", s_info.font_name);
-
-       ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &s_info.font_size);
-       if (ret == SYSTEM_SETTINGS_ERROR_NONE)
-               DbgPrint("Current size: %d\n", s_info.font_size);
-
+       access_cb(NULL, NULL);
+       font_changed_cb(NULL, NULL);
+       font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
        return LB_STATUS_SUCCESS;
 }
 
 PUBLIC int script_fini(void)
 {
        int ret;
+       Eina_List *l;
+       Eina_List *n;
+       struct info *handle;
+
+       EINA_LIST_FOREACH_SAFE(s_info.handle_list, l, n, handle) {
+               script_destroy(handle);
+       }
+
        ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
-       ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE);
+       DbgPrint("Unset font size change event callback: %d\n", ret);
+
+       ret = vconf_ignore_key_changed("db/setting/accessibility/font_name", font_changed_cb);
+       DbgPrint("Unset font name change event callback: %d\n", ret);
+
        ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, access_cb);
+       DbgPrint("Unset tts: %d\n", ret);
+
        elm_shutdown();
+
+       free(s_info.font_name);
+       s_info.font_name = NULL;
        return LB_STATUS_SUCCESS;
 }