Backup : 0813
[apps/native/sample/adventure.git] / src / map.c
index d7ce295..f40ab40 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -25,7 +25,6 @@ map_geom_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
        Evas_Coord x, y, w, h, x2, y2, w2, h2;
        evas_object_geometry_get(obj, &x, &y, &w, &h);
-       edje_object_part_geometry_get(elm_layout_edje_get(obj), "map", &x2, &y2, &w, &h);
        double scale_w = (double) w / ORIGIN_W;
        double scale_h = (double) h / ORIGIN_H;
 
@@ -34,12 +33,9 @@ map_geom_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
      {
         if (!city[idx].obj) continue;
         evas_object_move(city[idx].obj,
-                         (x + city[idx].ci.x) - (city[idx].w / 2),
-                         (y + city[idx].ci.y) - (city[idx].h / 2));
-        evas_object_move(city[idx].obj,
-                         (int)((double)city[idx].ci.x * scale_w) + x + x2 - (city[idx].w / 2),
-                         (int)((double)city[idx].ci.y * scale_h) + y + y2 - (city[idx].h / 2));
-     }
+                         (int)((double)city[idx].ci.x * scale_w) + x - (city[idx].w / 2),
+                         (int)((double)city[idx].ci.y * scale_h) + y - (city[idx].h / 2));
+        }
 }
 
 static void
@@ -105,7 +101,7 @@ add_city_to_map(int idx, city_s *ci)
    snprintf(buf, sizeof(buf), "city%d", idx);
    city[idx].obj = elm_layout_add(map_layout);
    elm_layout_file_set(city[idx].obj, full_path, buf);
-   evas_object_smart_member_add(city[idx].obj, map_layout);
+//   evas_object_smart_member_add(city[idx].obj, map_layout);
    evas_object_show(city[idx].obj);
 
    Evas_Object *edje = elm_layout_edje_get(city[idx].obj);
@@ -240,8 +236,8 @@ item_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
 Eina_Bool
 set_time_range(Evas_Object *item, int idx, double p1, double p2, double p3, double p4)
 {
-       if (!item) return EINA_FALSE;
-       if (idx < 0 || idx >= MAXIMUM_SELECTED_CITY) return EINA_FALSE;
+       retv_if(!item, EINA_FALSE);
+       retv_if(idx < 0 || idx >= 6, EINA_FALSE); /* FIXME */
 
        if (0.0f != p1)
                p1 /= 24.0f;
@@ -275,6 +271,7 @@ set_time_range(Evas_Object *item, int idx, double p1, double p2, double p3, doub
        //Part 1
 
        rect = evas_object_rectangle_add(evas_object_evas_get(item));
+       evas_object_smart_member_add(rect, item);
        switch (idx)
        {
            case 0:
@@ -316,6 +313,8 @@ set_time_range(Evas_Object *item, int idx, double p1, double p2, double p3, doub
        if ((p3 == 0 && p4 == 0)) return EINA_TRUE;
 
        rect = evas_object_rectangle_add(evas_object_evas_get(item));
+       evas_object_smart_member_add(rect, item);
+
        switch (idx)
        {
                case 0: