From a5f0f44665e39bee416ec16e4cb809632e57e5c3 Mon Sep 17 00:00:00 2001 From: Tae-Hwan Kim Date: Fri, 9 Mar 2012 15:21:21 +0900 Subject: [PATCH] Fix conflicts: Map, Hover, Hoversel, Menu, Web Change-Id: I5c6d681cfaf2b5430a56aa15ffb8fe67f70e113e --- data/themes/widgets/map.edc | 4 - src/bin/test_hover.c | 14 - src/bin/test_hoversel.c | 22 - src/bin/test_map.c | 400 --- src/bin/test_menu.c | 16 - src/bin/test_web.c | 13 - src/edje_externals/elm_map.c | 18 - src/examples/map_example_01.c | 34 - src/examples/map_example_02.c | 139 - src/examples/map_example_03.c | 50 - src/examples/menu_example_01.c | 8 - src/examples/web_example.c | 41 - src/lib/elc_hoversel.c | 88 - src/lib/elc_hoversel.h | 14 - src/lib/elm_hover.c | 24 - src/lib/elm_hover.h | 27 - src/lib/elm_map.c | 7118 +++++++--------------------------------- src/lib/elm_map.h | 1370 +------- src/lib/elm_menu.c | 138 - src/lib/elm_menu.h | 53 - src/lib/elm_web.c | 85 +- src/lib/elm_web.h | 90 - src/modules/test_map/mod.c | 39 - 23 files changed, 1241 insertions(+), 8564 deletions(-) diff --git a/data/themes/widgets/map.edc b/data/themes/widgets/map.edc index 13cff05..816aca8 100644 --- a/data/themes/widgets/map.edc +++ b/data/themes/widgets/map.edc @@ -742,7 +742,3 @@ group { name: "elm/map/marker_bubble/default"; } } } -<<<<<<< HEAD -======= - ->>>>>>> remotes/origin/upstream diff --git a/src/bin/test_hover.c b/src/bin/test_hover.c index be9810f..cf66a3d 100644 --- a/src/bin/test_hover.c +++ b/src/bin/test_hover.c @@ -9,8 +9,6 @@ my_hover_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__ evas_object_show(hv); } -<<<<<<< HEAD -======= static void _top_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) @@ -19,7 +17,6 @@ _top_bt_clicked(void *data, Evas_Object *obj __UNUSED__, elm_hover_dismiss(hv); } ->>>>>>> remotes/origin/upstream void test_hover(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { @@ -60,20 +57,13 @@ test_hover(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ic = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); -<<<<<<< HEAD - elm_icon_scale_set(ic, 0, 0); -======= elm_icon_resizable_set(ic, 0, 0); ->>>>>>> remotes/origin/upstream elm_box_pack_end(bx, ic); evas_object_show(ic); bt = elm_button_add(win); elm_object_text_set(bt, "Top 1"); -<<<<<<< HEAD -======= evas_object_smart_callback_add(bt, "clicked", _top_bt_clicked, hv); ->>>>>>> remotes/origin/upstream elm_box_pack_end(bx, bt); evas_object_show(bt); bt = elm_button_add(win); @@ -150,11 +140,7 @@ test_hover2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info ic = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(ic, buf, NULL); -<<<<<<< HEAD - elm_icon_scale_set(ic, 0, 0); -======= elm_icon_resizable_set(ic, 0, 0); ->>>>>>> remotes/origin/upstream elm_box_pack_end(bx, ic); evas_object_show(ic); bt = elm_button_add(win); diff --git a/src/bin/test_hoversel.c b/src/bin/test_hoversel.c index 77da566..023663b 100644 --- a/src/bin/test_hoversel.c +++ b/src/bin/test_hoversel.c @@ -1,19 +1,9 @@ #include -<<<<<<< HEAD -======= #include "test.h" ->>>>>>> remotes/origin/upstream #ifdef HAVE_CONFIG_H # include "elementary_config.h" #endif #ifndef ELM_LIB_QUICKLAUNCH -<<<<<<< HEAD -void -test_hoversel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Evas_Object *win, *bg, *bx, *bt, *ic; - char buf[PATH_MAX]; -======= struct _api_data { unsigned int state; /* What state we are testing */ @@ -106,28 +96,17 @@ test_hoversel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in Evas_Object *win, *bg, *bx, *bt, *ic, *bxx; char buf[PATH_MAX]; api_data *api = calloc(1, sizeof(api_data)); ->>>>>>> remotes/origin/upstream win = elm_win_add(NULL, "hoversel", ELM_WIN_BASIC); elm_win_title_set(win, "Hoversel"); elm_win_autodel_set(win, EINA_TRUE); -<<<<<<< HEAD -======= evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); ->>>>>>> remotes/origin/upstream bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); -<<<<<<< HEAD - bx = elm_box_add(win); - elm_win_resize_object_add(win, bx); - evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(bx); - -======= bxx = elm_box_add(win); elm_win_resize_object_add(win, bxx); evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -148,7 +127,6 @@ test_hoversel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in elm_box_pack_end(bxx, bx); ->>>>>>> remotes/origin/upstream bt = elm_hoversel_add(win); // FIXME: need to add horizontal hoversel theme to default some day // elm_hoversel_horizontal_set(bt, 1); diff --git a/src/bin/test_map.c b/src/bin/test_map.c index da1c7d1..d6c25bd 100644 --- a/src/bin/test_map.c +++ b/src/bin/test_map.c @@ -8,17 +8,10 @@ #define MARKER_MAX 1000 #define NAME_ENTRY_TEXT "Enter freeform address" -<<<<<<< HEAD -typedef struct Marker_Data -{ - const char *file; -} Marker_Data; -======= typedef struct Overlay_Data { const char *file; } Overlay_Data; ->>>>>>> remotes/origin/upstream typedef struct Map_Source { @@ -26,15 +19,6 @@ typedef struct Map_Source char *source_name; } Map_Source; -<<<<<<< HEAD -static Elm_Map_Marker_Class *itc1, *itc2, *itc_parking; -static Elm_Map_Group_Class *itc_group1, *itc_group2, *itc_group_parking; - -static Evas_Object *rect, *menu, *fs_win; -static int nb_elts; -/*static Elm_Map_Marker *markers[MARKER_MAX];*/ -static Elm_Map_Marker *route_from, *route_to; -======= Overlay_Data data1 = {PACKAGE_DATA_DIR"/images/logo.png"}; Overlay_Data data2 = {PACKAGE_DATA_DIR"/images/logo_small.png"}; Overlay_Data data3 = {PACKAGE_DATA_DIR"/images/panel_01.jpg"}; @@ -55,7 +39,6 @@ static Elm_Map_Overlay *bubble_parking; static Elm_Map_Overlay *route_ovl; static Evas_Object *menu, *fs_win; ->>>>>>> remotes/origin/upstream static Elm_Map_Route *route; static Elm_Map_Name *name; static Evas_Object *track; @@ -64,26 +47,6 @@ static Evas_Coord old_x, old_y; static Evas_Coord old_d; static Map_Source ms[SOURCE_MAX]; -<<<<<<< HEAD -Marker_Data data1 = {PACKAGE_DATA_DIR"/images/logo.png"}; -Marker_Data data2 = {PACKAGE_DATA_DIR"/images/logo_small.png"}; -Marker_Data data3 = {PACKAGE_DATA_DIR"/images/panel_01.jpg"}; -Marker_Data data4 = {PACKAGE_DATA_DIR"/images/plant_01.jpg"}; -Marker_Data data5 = {PACKAGE_DATA_DIR"/images/rock_01.jpg"}; -Marker_Data data6 = {PACKAGE_DATA_DIR"/images/rock_02.jpg"}; -Marker_Data data7 = {PACKAGE_DATA_DIR"/images/sky_01.jpg"}; -Marker_Data data8 = {PACKAGE_DATA_DIR"/images/sky_02.jpg"}; -Marker_Data data9 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"}; -Marker_Data data10 = {PACKAGE_DATA_DIR"/images/sky_03.jpg"}; -Marker_Data data11= {PACKAGE_DATA_DIR"/images/wood_01.jpg"}; - -Marker_Data data_parking= {PACKAGE_DATA_DIR"/images/parking.png"}; - -static Evas_Object * _marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data); -static Evas_Object * _group_icon_get(Evas_Object *obj, void *data); - -======= ->>>>>>> remotes/origin/upstream static void #ifdef ELM_EMAP my_map_gpx_fileselector_done(void *data, Evas_Object *obj __UNUSED__, void *event_info) @@ -106,40 +69,6 @@ my_map_gpx_fileselector_done(void *data __UNUSED__, Evas_Object *obj __UNUSED__, evas_object_del(fs_win); } -<<<<<<< HEAD -static void -my_map_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("clicked\n"); -} - -static void -my_map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("press\n"); -} - -static void -my_map_longpressed(void *data __UNUSED__, Evas_Object *obj, void *event_info) -{ - printf("longpressed\n"); - double lon, lat; - Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info; - if (!down) return; - if (elm_map_zoom_get(obj) < 5) return; - - elm_map_canvas_to_geo_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat); - printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat); - name = elm_map_utils_convert_coord_into_name(obj, lon, lat); -} - -static void -my_map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info) -{ - printf("clicked,double\n"); - double lon, lat; - double flon, flat, tlon, tlat; -======= static Evas_Object * _route_icon_get(Evas_Object *obj) { @@ -161,43 +90,10 @@ _map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info) { printf("clicked,double\n"); double lon, lat; ->>>>>>> remotes/origin/upstream Evas_Event_Mouse_Down *down = (Evas_Event_Mouse_Down *)event_info; if (!down) return; if (elm_map_zoom_get(obj) < 5) return; -<<<<<<< HEAD - elm_map_canvas_to_geo_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat); - printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat); - itc1 = elm_map_marker_class_new(obj); - - elm_map_marker_class_del_cb_set(itc1, NULL); - - itc_group1 = elm_map_group_class_new(obj); - elm_map_group_class_icon_cb_set(itc_group1, _group_icon_get); - elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/bubble.png"); - elm_map_group_class_style_set(itc_group1, "empty"); - elm_map_group_class_zoom_displayed_set(itc_group1, 5); - - if (route_from && route_to) - { - elm_map_marker_remove(route_from); - route_from = NULL; - elm_map_marker_remove(route_to); - route_to = NULL; - elm_map_route_remove(route); - } - - if (!route_from) route_from = elm_map_marker_add(obj, lon, lat, itc1, itc_group1, NULL); - else route_to = elm_map_marker_add(obj, lon, lat, itc1, itc_group1, NULL); - - if (route_from && route_to) - { - elm_map_marker_region_get(route_from, &flon, &flat); - elm_map_marker_region_get(route_to, &tlon, &tlat); - route = elm_map_route_add(obj, ELM_MAP_ROUTE_TYPE_MOTOCAR, ELM_MAP_ROUTE_METHOD_FASTEST, flon, flat, tlon, tlat); - elm_map_route_color_set(route, 255, 0, 0, 255); -======= elm_map_canvas_to_region_convert(obj, down->canvas.x, down->canvas.y, &lon, &lat); printf("x:%d, y:%d, lon:%lf, lat:%lf\n", down->canvas.x, down->canvas.y, lon, lat); @@ -231,44 +127,10 @@ _map_clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info) ELM_MAP_ROUTE_METHOD_FASTEST, start_lon, start_lat, end_lon, end_lat, NULL, NULL); ->>>>>>> remotes/origin/upstream } } static void -<<<<<<< HEAD -my_map_load_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("load,detail\n"); -} - -static void -my_map_loaded_detail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("loaded,detail\n"); -} - -static void -my_map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("zoom,start\n"); -} - -static void -my_map_zoom_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("zoom,stop\n"); -} - -static void -my_map_zoom_change(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("zoom,change\n"); -} - -static void -my_map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -======= _map_press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { printf("press\n"); @@ -312,56 +174,17 @@ _map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSE static void _map_anim_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) ->>>>>>> remotes/origin/upstream { printf("scroll,anim,start\n"); } static void -<<<<<<< HEAD -my_map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -======= _map_anim_stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) ->>>>>>> remotes/origin/upstream { printf("scroll,anim,stop\n"); } static void -<<<<<<< HEAD -my_map_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("scroll,drag,start\n"); - evas_object_smart_callback_del(data, "longpressed", my_map_longpressed); -} - -static void -my_map_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - printf("scroll,drag,stop\n"); - evas_object_smart_callback_add(data, "longpressed", my_map_longpressed, data); -} - -static void -my_map_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) -{ - printf("scroll\n"); - double lon, lat; - elm_map_geo_region_get(obj, &lon, &lat); - printf("scroll longitude : %f latitude : %f\n", lon, lat); -} - -static void -my_map_downloaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - int try_num, finish_num; - elm_map_utils_downloading_status_get(data, &try_num, &finish_num); - printf("downloaded : %d / %d\n", finish_num, try_num); -} - -static void -my_map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -======= _map_zoom_start(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { printf("zoom,start\n"); @@ -403,25 +226,17 @@ _map_tile_loaded_fail(void *data, Evas_Object *obj __UNUSED__, void *event_info static void _map_route_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) ->>>>>>> remotes/origin/upstream { printf("route,load\n"); } static void -<<<<<<< HEAD -my_map_route_loaded(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -======= _map_route_loaded(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) ->>>>>>> remotes/origin/upstream { printf("route,loaded\n"); double d; const char *w, *n; -<<<<<<< HEAD -======= ->>>>>>> remotes/origin/upstream d = elm_map_route_distance_get(route); printf("route distance = %lf km\n", d); @@ -430,12 +245,6 @@ _map_route_loaded(void *data __UNUSED__, Evas_Object *obj, void *event_info __UN n = elm_map_route_node_get(route); if (n) printf("[nodes]\n%s\n", n); -<<<<<<< HEAD -} - -static void -my_map_name_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -======= if (route_ovl) elm_map_overlay_del(route_ovl); route_ovl = elm_map_overlay_route_add(obj, route); @@ -450,17 +259,12 @@ _map_route_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void static void _map_name_load(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) ->>>>>>> remotes/origin/upstream { printf("name,load\n"); } static void -<<<<<<< HEAD -my_map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -======= _map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) ->>>>>>> remotes/origin/upstream { printf("name,loaded\n"); if (!name) return; @@ -475,14 +279,6 @@ _map_name_loaded(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU Eina_Bool b = elm_map_paused_get(data); elm_map_paused_set(data, EINA_TRUE); elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); -<<<<<<< HEAD - elm_map_geo_region_show(data, lon, lat); - elm_map_zoom_set(data, elm_map_source_zoom_max_get(data)); - elm_map_paused_set(data, b); - } - } - elm_map_name_remove(name); -======= elm_map_zoom_set(data, elm_map_zoom_max_get(data)); elm_map_region_show(data, lon, lat); elm_map_paused_set(data, b); @@ -497,7 +293,6 @@ static void _map_name_loaded_fail(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { printf("name,loaded,fail\n"); ->>>>>>> remotes/origin/upstream } static void @@ -506,11 +301,7 @@ map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS Eina_Bool b = elm_map_paused_get(data); elm_map_paused_set(data, EINA_TRUE); elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); -<<<<<<< HEAD - elm_map_geo_region_show(data,7.325201, 48.526813); -======= elm_map_region_show(data,7.325201, 48.526813); ->>>>>>> remotes/origin/upstream elm_map_zoom_set(data, 12); elm_map_paused_set(data, b); } @@ -518,11 +309,7 @@ map_show_urmatt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS static void map_bring_seoul(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - elm_map_geo_region_bring_in(data, 126.977969, 37.566535); -======= elm_map_region_bring_in(data, 126.977969, 37.566535); ->>>>>>> remotes/origin/upstream } static void @@ -670,21 +457,13 @@ map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU static void map_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - elm_map_source_zoom_min_set(data, 1); -======= elm_map_zoom_min_set(data, 1); ->>>>>>> remotes/origin/upstream } static void map_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - elm_map_source_zoom_max_set(data, 10); -======= elm_map_zoom_max_set(data, 10); ->>>>>>> remotes/origin/upstream } static void @@ -693,11 +472,7 @@ map_source(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) Map_Source *s = data; if (!s) return; -<<<<<<< HEAD - elm_map_source_name_set(s->map, s->source_name); -======= elm_map_source_set(s->map, ELM_MAP_SOURCE_TYPE_TILE, s->source_name); ->>>>>>> remotes/origin/upstream } /* @@ -707,11 +482,7 @@ map_marker_add(void *data) int i; Elm_Map_Group_Class *g_clas; Elm_Map_Marker_Class *m_clas; -<<<<<<< HEAD - Marker_Data *d = &data7; -======= Overlay_Data *d = &data7; ->>>>>>> remotes/origin/upstream if (*markers) return; for (i =0; i>>>>>> remotes/origin/upstream } style = rand() % 2; @@ -782,41 +549,6 @@ my_map_entry_activated(void *data, Evas_Object *obj, void *event_info __UNUSED__ */ static Evas_Object * -<<<<<<< HEAD -_marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data) -{ - Marker_Data *d = data; - - Evas_Object *bx = elm_box_add(obj); - evas_object_show(bx); - - if (d == &data3) - { - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, d->file, NULL); - evas_object_show(icon); - - Evas_Object *o = elm_button_add(obj); - elm_object_part_content_set(o, "icon", icon); - evas_object_show(o); - elm_box_pack_end(bx, o); - } - else - { - Evas_Object *o = evas_object_image_add(evas_object_evas_get(obj)); - evas_object_image_file_set(o, d->file, NULL); - evas_object_image_filled_set(o, EINA_TRUE); - evas_object_size_hint_min_set(o, 64, 64); - evas_object_show(o); - elm_box_pack_end(bx, o); - - Evas_Object *lbl = elm_label_add(obj); - elm_object_text_set(lbl, "Wolves Go !"); - evas_object_show(lbl); - elm_box_pack_end(bx, lbl); - } - -======= _box_get(Evas_Object *obj, Overlay_Data *data) { Evas_Object *bx, *img, *label; @@ -834,55 +566,20 @@ _box_get(Evas_Object *obj, Overlay_Data *data) elm_object_text_set(label, "Wolves go!!"); evas_object_show(label); elm_box_pack_end(bx, label); ->>>>>>> remotes/origin/upstream return bx; } static Evas_Object * -<<<<<<< HEAD -_icon_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data) -{ - Marker_Data *d = data; - - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, d->file, NULL); - evas_object_show(icon); - - return icon; -} - -static Evas_Object * -_group_icon_get(Evas_Object *obj, void *data) -{ - char *file = data; - - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, file, NULL); -======= _icon_get(Evas_Object *obj, Overlay_Data *data) { Evas_Object *icon = elm_icon_add(obj); elm_icon_file_set(icon, data->file, NULL); ->>>>>>> remotes/origin/upstream evas_object_show(icon); return icon; } static void -<<<<<<< HEAD -_map_move_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - int x,y,w,h; - - evas_object_geometry_get(data,&x,&y,&w,&h); - evas_object_resize(rect,w,h); - evas_object_move(rect,x,y); -} - -static void -======= ->>>>>>> remotes/origin/upstream _populate(void *data, Elm_Object_Item *menu_it) { int idx; @@ -989,8 +686,6 @@ _map_mouse_up(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __U } } -<<<<<<< HEAD -======= static void _overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev) { @@ -1072,7 +767,6 @@ _del_map(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, name = NULL; } ->>>>>>> remotes/origin/upstream void test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { @@ -1091,15 +785,6 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __ map = elm_map_add(win); if (map) { -<<<<<<< HEAD - srand(time(NULL)); - - source_names = elm_map_source_names_get(map); - - if (!source_names) return; - printf("map sources [ "); - for (idx = 0; source_names[idx] ; idx++) printf("%s ", source_names[idx]); -======= Elm_Map_Overlay *ovl_1, *ovl_2, *ovl_3, *ovl_4, *ovl_5, *ovl6; Elm_Map_Overlay *ovl_7, *ovl_8, *ovl_9, *ovl_10, *ovl_11; Elm_Map_Overlay *parking1, *parking2, *parking3, *parking4, *parking5; @@ -1114,58 +799,12 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __ if (!source_names) return; printf("map sources [ "); for (idx = 0; source_names[idx] ; idx++) printf("%s, ", source_names[idx]); ->>>>>>> remotes/origin/upstream printf("]\n"); evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, map); evas_object_data_set(map, "window", win); -<<<<<<< HEAD - // - itc1 = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(itc1, _marker_get); - elm_map_marker_class_del_cb_set(itc1, NULL); - - itc2 = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(itc2, _marker_get); - elm_map_marker_class_del_cb_set(itc2, NULL); - elm_map_marker_class_style_set(itc2, "radio2"); - - itc_parking = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(itc_parking, _marker_get); - elm_map_marker_class_del_cb_set(itc_parking, NULL); - elm_map_marker_class_icon_cb_set(itc_parking, _icon_get); - elm_map_marker_class_style_set(itc_parking, "empty"); - // - - // - itc_group1 = elm_map_group_class_new(map); - elm_map_group_class_data_set(itc_group1, (void *)PACKAGE_DATA_DIR"/images/plant_01.jpg"); - - itc_group2 = elm_map_group_class_new(map); - elm_map_group_class_style_set(itc_group2, "radio2"); - elm_map_group_class_zoom_displayed_set(itc_group1, 3); - - itc_group_parking = elm_map_group_class_new(map); - elm_map_group_class_icon_cb_set(itc_group_parking, _group_icon_get); - elm_map_group_class_data_set(itc_group_parking, (void *)PACKAGE_DATA_DIR"/images/parking.png"); - elm_map_group_class_style_set(itc_group_parking, "empty"); - elm_map_group_class_zoom_displayed_set(itc_group_parking, 5); - // - - rect = evas_object_rectangle_add(evas_object_evas_get(win)); - evas_object_color_set(rect, 0, 0, 0, 0); - evas_object_repeat_events_set(rect,1); - evas_object_show(rect); - evas_object_raise(rect); - - evas_object_event_callback_add(map, EVAS_CALLBACK_RESIZE, - _map_move_resize_cb, map); - evas_object_event_callback_add(map, EVAS_CALLBACK_MOVE, - _map_move_resize_cb, map); -======= ->>>>>>> remotes/origin/upstream evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_DOWN, _map_mouse_down, map); evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_MOVE, @@ -1173,44 +812,6 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __ evas_object_event_callback_add(map, EVAS_CALLBACK_MOUSE_UP, _map_mouse_up, map); -<<<<<<< HEAD - elm_map_marker_add(map, 2.352, 48.857, itc1, itc_group1, &data1); - elm_map_marker_add(map, 2.355, 48.857, itc1, itc_group1, &data3); - elm_map_marker_add(map, 3, 48.857, itc2, itc_group1, &data2); - elm_map_marker_add(map, 2.352, 49, itc2, itc_group1, &data1); - - elm_map_marker_add(map, 7.31451, 48.857127, itc1, itc_group1, &data10); - elm_map_marker_add(map, 7.314704, 48.857119, itc1, itc_group1, &data4); - elm_map_marker_add(map, 7.314704, 48.857119, itc2, itc_group1, &data5); - elm_map_marker_add(map, 7.31432, 48.856785, itc2, itc_group1, &data6); - elm_map_marker_add(map, 7.3148, 48.85725, itc1, itc_group2, &data7); - elm_map_marker_add(map, 7.316445, 48.8572210000694, itc1, itc_group1, &data8); - elm_map_marker_add(map, 7.316527000125, 48.85609, itc2, itc_group2, &data9); - elm_map_marker_add(map, 7.3165409990833, 48.856078, itc2, itc_group1, &data11); - elm_map_marker_add(map, 7.319812, 48.856561, itc2, itc_group2, &data10); - - nb_elts = 13; - - evas_object_smart_callback_add(map, "clicked", my_map_clicked, map); - evas_object_smart_callback_add(map, "press", my_map_press, map); - evas_object_smart_callback_add(map, "longpressed", my_map_longpressed, map); - evas_object_smart_callback_add(map, "clicked,double", my_map_clicked_double, map); - evas_object_smart_callback_add(map, "load,detail", my_map_load_detail, map); - evas_object_smart_callback_add(map, "loaded,detail", my_map_loaded_detail, map); - evas_object_smart_callback_add(map, "zoom,start", my_map_zoom_start, map); - evas_object_smart_callback_add(map, "zoom,stop", my_map_zoom_stop, map); - evas_object_smart_callback_add(map, "zoom,change", my_map_zoom_change, map); - evas_object_smart_callback_add(map, "scroll,anim,start", my_map_anim_start, map); - evas_object_smart_callback_add(map, "scroll,anim,stop", my_map_anim_stop, map); - evas_object_smart_callback_add(map, "scroll,drag,start", my_map_drag_start, map); - evas_object_smart_callback_add(map, "scroll,drag,stop", my_map_drag_stop, map); - evas_object_smart_callback_add(map, "scroll", my_map_scroll, map); - evas_object_smart_callback_add(map, "downloaded", my_map_downloaded, map); - evas_object_smart_callback_add(map, "route,load", my_map_route_load, map); - evas_object_smart_callback_add(map, "route,loaded", my_map_route_loaded, map); - evas_object_smart_callback_add(map, "name,load", my_map_name_load, map); - evas_object_smart_callback_add(map, "name,loaded", my_map_name_loaded, map); -======= evas_object_smart_callback_add(map, "clicked", _map_clicked, map); evas_object_smart_callback_add(map, "clicked,double", _map_clicked_double, map); evas_object_smart_callback_add(map, "press", _map_press, map); @@ -1298,7 +899,6 @@ test_map(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __ elm_map_overlay_class_append(grp_parking, parking3); elm_map_overlay_class_append(grp_parking, parking4); elm_map_overlay_class_append(grp_parking, parking5); ->>>>>>> remotes/origin/upstream evas_object_show(map); } diff --git a/src/bin/test_menu.c b/src/bin/test_menu.c index e86c2ac..a6a78bc 100644 --- a/src/bin/test_menu.c +++ b/src/bin/test_menu.c @@ -77,32 +77,19 @@ _populate_2(Elm_Object_Item *menu_it) } static void -<<<<<<< HEAD -_populate_1(Evas_Object *win, Elm_Object_Item *menu_it) -{ - Elm_Object_Item *menu_it2; - Evas_Object *radio; - - radio = elm_radio_add(win); -======= _populate_1(Evas_Object *obj, Elm_Object_Item *menu_it) { Elm_Object_Item *menu_it2, *menu_it3; Evas_Object *radio; radio = elm_radio_add(obj); ->>>>>>> remotes/origin/upstream elm_radio_state_value_set(radio, 0); elm_radio_value_set(radio, 0); elm_object_text_set(radio, "radio in menu"); menu_it2 = elm_menu_item_add(menu, menu_it, "object-rotate-left", "menu 1", NULL, NULL); -<<<<<<< HEAD - elm_menu_item_add_object(menu, menu_it, radio, NULL, NULL); -======= menu_it3 = elm_menu_item_add(menu, menu_it, NULL, NULL, NULL, NULL); elm_object_item_content_set(menu_it3, radio); ->>>>>>> remotes/origin/upstream _populate_2(menu_it2); } @@ -123,10 +110,7 @@ test_menu(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ rect = evas_object_rectangle_add(evas_object_evas_get(win)); elm_win_resize_object_add(win, rect); -<<<<<<< HEAD -======= evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); ->>>>>>> remotes/origin/upstream evas_object_color_set(rect, 0, 0, 0, 0); evas_object_show(rect); diff --git a/src/bin/test_web.c b/src/bin/test_web.c index 86cf89c..b8a4d88 100644 --- a/src/bin/test_web.c +++ b/src/bin/test_web.c @@ -69,13 +69,8 @@ _uri_changed_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info) elm_object_text_set(wt->url_entry, event_info); -<<<<<<< HEAD - elm_object_disabled_set(wt->btn_back, !elm_web_back_possible(wt->web)); - elm_object_disabled_set(wt->btn_fwd, !elm_web_forward_possible(wt->web)); -======= elm_object_disabled_set(wt->btn_back, !elm_web_back_possible_get(wt->web)); elm_object_disabled_set(wt->btn_fwd, !elm_web_forward_possible_get(wt->web)); ->>>>>>> remotes/origin/upstream } static void @@ -138,11 +133,7 @@ _alert_hook(void *data __UNUSED__, Evas_Object *obj, const char *message) elm_notify_orient_set(popup, ELM_NOTIFY_ORIENT_CENTER); // Using the timeout doesn't seem to go well with the second main loop //elm_notify_timeout_set(popup, 2.0); -<<<<<<< HEAD - elm_notify_repeat_events_set(popup, EINA_FALSE); -======= elm_notify_allow_events_set(popup, EINA_FALSE); ->>>>>>> remotes/origin/upstream evas_object_show(popup); evas_object_smart_callback_add(popup, "block,clicked", _alert_del, NULL); @@ -182,11 +173,7 @@ _confirm_hook(void *data __UNUSED__, Evas_Object *obj, const char *message, Eina popup = elm_notify_add(obj); elm_notify_orient_set(popup, ELM_NOTIFY_ORIENT_CENTER); -<<<<<<< HEAD - elm_notify_repeat_events_set(popup, EINA_FALSE); -======= elm_notify_allow_events_set(popup, EINA_FALSE); ->>>>>>> remotes/origin/upstream evas_object_show(popup); box = elm_box_add(obj); diff --git a/src/edje_externals/elm_map.c b/src/edje_externals/elm_map.c index d8f67a6..11c0ece 100644 --- a/src/edje_externals/elm_map.c +++ b/src/edje_externals/elm_map.c @@ -41,15 +41,6 @@ external_map_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from if (p->map_source) { -<<<<<<< HEAD - elm_map_source_name_set(obj, p->map_source); - } - if (p->zoom_mode) - { - Elm_Map_Zoom_Mode set = _zoom_mode_get(p->zoom_mode); - if (set == ELM_MAP_ZOOM_MODE_LAST) return; - elm_map_zoom_mode_set(obj, set); -======= elm_map_source_set(obj, ELM_MAP_SOURCE_TYPE_TILE, p->map_source); } if (p->zoom_mode) @@ -57,7 +48,6 @@ external_map_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from Elm_Map_Zoom_Mode set = _zoom_mode_get(p->zoom_mode); if (set == ELM_MAP_ZOOM_MODE_LAST) return; elm_map_zoom_mode_set(obj, set); ->>>>>>> remotes/origin/upstream } if (p->zoom_set) elm_map_zoom_set(obj, p->zoom); } @@ -69,11 +59,7 @@ external_map_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Exter { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) { -<<<<<<< HEAD - elm_map_source_name_set(obj, param->s); -======= elm_map_source_set(obj, ELM_MAP_SOURCE_TYPE_TILE, param->s); ->>>>>>> remotes/origin/upstream return EINA_TRUE; } } @@ -109,11 +95,7 @@ external_map_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Exter { if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) { -<<<<<<< HEAD - const char *set = elm_map_source_name_get(obj); -======= const char *set = elm_map_source_get(obj, ELM_MAP_SOURCE_TYPE_TILE); ->>>>>>> remotes/origin/upstream param->s = set; return EINA_TRUE; } diff --git a/src/examples/map_example_01.c b/src/examples/map_example_01.c index 324fa6e..6339745 100644 --- a/src/examples/map_example_01.c +++ b/src/examples/map_example_01.c @@ -19,59 +19,31 @@ static void _bt_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - int zoom; - - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL); - zoom = elm_map_zoom_get(map); - elm_map_zoom_set(map, zoom + 1); -======= int zoom; elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); zoom = elm_map_zoom_get(data); elm_map_zoom_set(data, zoom + 1); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - int zoom; - - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL); - zoom = elm_map_zoom_get(map); - elm_map_zoom_set(map, zoom - 1); -======= int zoom; elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); zoom = elm_map_zoom_get(data); elm_map_zoom_set(data, zoom - 1); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_AUTO_FIT); -======= elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_AUTO_FILL); -======= elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); ->>>>>>> remotes/origin/upstream } static void @@ -139,14 +111,8 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__) evas_object_show(bt); evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fill, map); -<<<<<<< HEAD - elm_map_geo_region_show(map, -43.2, -22.9); - elm_map_zoom_set(map, 12); - -======= elm_map_zoom_set(map, 12); elm_map_region_show(map, -43.2, -22.9); ->>>>>>> remotes/origin/upstream evas_object_resize(win, 512, 512); evas_object_show(win); diff --git a/src/examples/map_example_02.c b/src/examples/map_example_02.c index 1cb1794..e0c9215 100644 --- a/src/examples/map_example_02.c +++ b/src/examples/map_example_02.c @@ -1,9 +1,5 @@ /** -<<<<<<< HEAD - * Simple Elementary's map widget example, illustrating markers -======= * Simple Elementary's map widget example, illustrating overlays ->>>>>>> remotes/origin/upstream * usage. * * See stdout/stderr for output. Compile with: @@ -20,90 +16,6 @@ # define __UNUSED__ #endif -<<<<<<< HEAD -typedef struct _Marker_Data -{ - const char *name; - const char *file; -} Marker_Data; - -Marker_Data data_argentina = {"Argentina", - PACKAGE_DATA_DIR"/images/rock_01.jpg"}; -Marker_Data data_chile = {"Chile", - PACKAGE_DATA_DIR"/images/rock_02.jpg"}; -Marker_Data data_sampa = {"São Paulo", - PACKAGE_DATA_DIR"/images/sky_01.jpg"}; -Marker_Data data_rio = {"Rio de Janeiro", - PACKAGE_DATA_DIR"/images/sky_02.jpg"}; -Marker_Data data_brasilia = {"Brasília", - PACKAGE_DATA_DIR"/images/sky_03.jpg"}; - -static Evas_Object * -_marker_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data) -{ - Evas_Object *bx, *im, *lbl; - Marker_Data *md = data; - - bx = elm_box_add(obj); - evas_object_show(bx); - - im = elm_image_add(obj); - elm_image_file_set(im, md->file, NULL); - evas_object_size_hint_min_set(im, 64, 64); - evas_object_show(im); - elm_box_pack_end(bx, im); - - lbl = elm_label_add(obj); - elm_object_text_set(lbl, md->name); - evas_object_show(lbl); - elm_box_pack_end(bx, lbl); - - return bx; -} - -static Evas_Object * -_marker_city_content_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data __UNUSED__) -{ - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, PACKAGE_DATA_DIR"/images/icon_07.png", NULL); - evas_object_show(icon); - - return icon; -} - -static Evas_Object * -_group_city_content_get(Evas_Object *obj, void *data __UNUSED__) -{ - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, PACKAGE_DATA_DIR"/images/icon_05.png", NULL); - evas_object_show(icon); - return icon; -} - -static Evas_Object * -_marker_country_content_get(Evas_Object *obj, Elm_Map_Marker *marker __UNUSED__, void *data __UNUSED__) -{ - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, PACKAGE_DATA_DIR"/images/icon_06.png", NULL); - evas_object_show(icon); - return icon; -} - -static Evas_Object * -_group_country_content_get(Evas_Object *obj, void *data __UNUSED__) -{ - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, PACKAGE_DATA_DIR"/images/icon_04.png", NULL); - evas_object_show(icon); - return icon; -} - -static void -_map_downloaded(void *data __UNUSED__, Evas_Object *obj, void *ev __UNUSED__) -{ - elm_map_zoom_set(obj, 3); - evas_object_smart_callback_del(obj, "downloaded", _map_downloaded); -======= typedef struct _Overlay_Data { const char *name; @@ -191,7 +103,6 @@ _overlay_cb(void *data __UNUSED__, Evas_Object *map, void *ev) elm_map_overlay_bubble_content_clear(bubble); bx = _box_get(map, elm_map_overlay_data_get(overlay)); elm_map_overlay_bubble_content_append(bubble, bx); ->>>>>>> remotes/origin/upstream } static void @@ -253,21 +164,11 @@ EAPI_MAIN int elm_main(int argc __UNUSED__, char **argv __UNUSED__) { Evas_Object *win, *bg, *map, *box, *bt; -<<<<<<< HEAD - static Elm_Map_Marker_Class *mc_city, *mc_country; - static Elm_Map_Group_Class *gc_city, *gc_country; - Eina_List *markers = NULL; - Elm_Map_Marker *m; - - win = elm_win_add(NULL, "map", ELM_WIN_BASIC); - elm_win_title_set(win, "Map Markers Example"); -======= Eina_List *ovls = NULL; Elm_Map_Overlay *ovl, *city_clas, *country_clas; win = elm_win_add(NULL, "map", ELM_WIN_BASIC); elm_win_title_set(win, "Map Overlay Example"); ->>>>>>> remotes/origin/upstream evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); bg = elm_bg_add(win); @@ -307,45 +208,6 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__) evas_object_show(bt); evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fill, map); -<<<<<<< HEAD - mc_city = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(mc_city, _marker_get); - elm_map_marker_class_icon_cb_set(mc_city, _marker_city_content_get); - elm_map_marker_class_style_set(mc_city, "radio"); - - gc_city = elm_map_group_class_new(map); - elm_map_group_class_style_set(gc_city, "radio2"); - elm_map_group_class_icon_cb_set(gc_city, _group_city_content_get); - elm_map_group_class_zoom_displayed_set(gc_city, 3); - - mc_country = elm_map_marker_class_new(map); - elm_map_marker_class_get_cb_set(mc_country, _marker_get); - elm_map_marker_class_icon_cb_set(mc_country, _marker_country_content_get); - elm_map_marker_class_style_set(mc_country, "empty"); - - gc_country = elm_map_group_class_new(map); - elm_map_group_class_style_set(gc_country, "empty"); - elm_map_group_class_icon_cb_set(gc_country, _group_country_content_get); - elm_map_group_class_zoom_displayed_set(gc_country, 1); - - m = elm_map_marker_add(map, -43.2, -22.9, mc_city, gc_city, &data_rio); - markers = eina_list_append(markers, m); - m = elm_map_marker_add(map, -46.63, -23.55, mc_city, gc_city, &data_sampa); - markers = eina_list_append(markers, m); - m = elm_map_marker_add(map, -47.88, -15.78, mc_city, gc_city, - &data_brasilia); - markers = eina_list_append(markers, m); - - m = elm_map_marker_add(map, -65.23, -35.1, mc_country, gc_country, - &data_argentina); - markers = eina_list_append(markers, m); - m = elm_map_marker_add(map, -71.3, -31.75, mc_country, gc_country, - &data_chile); - markers = eina_list_append(markers, m); - - elm_map_markers_list_show(markers); - evas_object_smart_callback_add(map, "downloaded", _map_downloaded, NULL); -======= evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, NULL); city_clas = elm_map_overlay_class_add(map); @@ -387,7 +249,6 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__) ovls = eina_list_append(ovls, ovl); elm_map_overlays_show(ovls); ->>>>>>> remotes/origin/upstream evas_object_resize(win, 512, 512); evas_object_show(win); diff --git a/src/examples/map_example_03.c b/src/examples/map_example_03.c index d9e2611..c033e14 100644 --- a/src/examples/map_example_03.c +++ b/src/examples/map_example_03.c @@ -22,17 +22,12 @@ typedef struct _Example_Data Elm_Map_Route *route; double start_lon, start_lat, dest_lon, dest_lat; Elm_Map_Name *name; -<<<<<<< HEAD -======= Elm_Map_Overlay *route_ovl; ->>>>>>> remotes/origin/upstream } Example_Data; static Example_Data example_data; static void -<<<<<<< HEAD -======= _route_loaded(void *data, Evas_Object *obj, void *ev __UNUSED__) { Example_Data *example_data = data; @@ -42,7 +37,6 @@ _route_loaded(void *data, Evas_Object *obj, void *ev __UNUSED__) } static void ->>>>>>> remotes/origin/upstream _name_loaded(void *data, Evas_Object *obj, void *ev __UNUSED__) { Example_Data *example_data = data; @@ -57,13 +51,8 @@ _name_loaded(void *data, Evas_Object *obj, void *ev __UNUSED__) example_data->route = elm_map_route_add(map, ELM_MAP_ROUTE_TYPE_FOOT, ELM_MAP_ROUTE_METHOD_SHORTEST, example_data->start_lon, example_data->start_lat, -<<<<<<< HEAD - example_data->dest_lon, example_data->dest_lat); - elm_map_route_color_set(example_data->route, 0, 255, 0, 255); -======= example_data->dest_lon, example_data->dest_lat, NULL, NULL); ->>>>>>> remotes/origin/upstream } static void @@ -76,74 +65,40 @@ _bt_route(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) map = example_data->map; address = (char *)elm_object_text_get(example_data->entry); -<<<<<<< HEAD - example_data->name = elm_map_utils_convert_name_into_coord(map, address); - - evas_object_smart_callback_add(map, "name,loaded", _name_loaded, data); -======= example_data->name = elm_map_name_add(map, address, 0, 0, NULL, NULL); evas_object_smart_callback_add(map, "name,loaded", _name_loaded, data); evas_object_smart_callback_add(map, "route,loaded", _route_loaded, data); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_in(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - int zoom; - - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL); - zoom = elm_map_zoom_get(map); - elm_map_zoom_set(map, zoom + 1); -======= int zoom; elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); zoom = elm_map_zoom_get(data); elm_map_zoom_set(data, zoom + 1); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_out(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - int zoom; - - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_MANUAL); - zoom = elm_map_zoom_get(map); - elm_map_zoom_set(map, zoom - 1); -======= int zoom; elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL); zoom = elm_map_zoom_get(data); elm_map_zoom_set(data, zoom - 1); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_fit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_AUTO_FIT); -======= elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT); ->>>>>>> remotes/origin/upstream } static void _bt_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { -<<<<<<< HEAD - Evas_Object *map = data; - elm_map_zoom_mode_set(map, ELM_MAP_ZOOM_MODE_AUTO_FILL); -======= elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL); ->>>>>>> remotes/origin/upstream } static void @@ -242,13 +197,8 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__) example_data.start_lon = -43.175; example_data.start_lat = -22.97; -<<<<<<< HEAD - elm_map_geo_region_show(map, example_data.start_lon, example_data.start_lat); - elm_map_zoom_set(map, 12); -======= elm_map_zoom_set(map, 12); elm_map_region_show(map, example_data.start_lon, example_data.start_lat); ->>>>>>> remotes/origin/upstream evas_object_resize(win, 512, 512); evas_object_show(win); diff --git a/src/examples/menu_example_01.c b/src/examples/menu_example_01.c index 5a76343..5b33d47 100644 --- a/src/examples/menu_example_01.c +++ b/src/examples/menu_example_01.c @@ -28,11 +28,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *menu, *button, *rect; -<<<<<<< HEAD - Elm_Object_Item *menu_it; -======= Elm_Object_Item *menu_it, *menu_it1; ->>>>>>> remotes/origin/upstream win = elm_win_add(NULL, "menu", ELM_WIN_BASIC); elm_win_title_set(win, "Menu"); @@ -55,12 +51,8 @@ elm_main(int argc, char **argv) elm_menu_item_add(menu, menu_it, "object-rotate-left", "menu 1", NULL, NULL); button = elm_button_add(win); elm_object_text_set(button, "button - delete items"); -<<<<<<< HEAD - elm_menu_item_add_object(menu, menu_it, button, NULL, NULL); -======= menu_it1 = elm_menu_item_add(menu, menu_it, NULL, NULL, NULL, NULL); elm_object_item_content_set(menu_it1, button); ->>>>>>> remotes/origin/upstream evas_object_smart_callback_add(button, "clicked", _del_it, menu); elm_menu_item_separator_add(menu, menu_it); elm_menu_item_add(menu, menu_it, NULL, "third item", NULL, NULL); diff --git a/src/examples/web_example.c b/src/examples/web_example.c index 671bf91..6aa6a2a 100644 --- a/src/examples/web_example.c +++ b/src/examples/web_example.c @@ -17,11 +17,7 @@ typedef struct { Evas_Object *win; Evas_Object *main_box; -<<<<<<< HEAD - Evas_Object *pager; -======= Evas_Object *naviframe; ->>>>>>> remotes/origin/upstream Evas_Object *url; Evas_Object *default_web; Evas_Object *tabs; @@ -77,11 +73,7 @@ tab_current_set(Tab_Data *td) nav_button_update(td->app); elm_entry_icon_visible_set(td->app->url, EINA_TRUE); -<<<<<<< HEAD - elm_pager_content_promote(td->app->pager, td->web); -======= elm_naviframe_item_simple_promote(td->app->naviframe, td->web); ->>>>>>> remotes/origin/upstream } static void @@ -159,11 +151,7 @@ tab_add(App_Data *ad) evas_object_size_hint_weight_set(td->web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(td->web, EVAS_HINT_FILL, EVAS_HINT_FILL); -<<<<<<< HEAD - elm_pager_content_push(ad->pager, td->web); -======= elm_naviframe_item_simple_push(ad->naviframe, td->web); ->>>>>>> remotes/origin/upstream td->app = ad; td->tab = elm_toolbar_item_append(td->app->tabs, NULL, "New tab", @@ -475,11 +463,7 @@ default_content_set(Evas_Object *web) int elm_main(int argc __UNUSED__, char *argv[] __UNUSED__) { -<<<<<<< HEAD - Evas_Object *win, *bg, *box, *box2, *btn, *ic, *url, *pager, *tabs, *web; -======= Evas_Object *win, *bg, *box, *box2, *btn, *ic, *url, *naviframe, *tabs, *web; ->>>>>>> remotes/origin/upstream Evas *e; Evas_Modifier_Mask ctrl_mask; App_Data *ad; @@ -586,11 +570,7 @@ elm_main(int argc __UNUSED__, char *argv[] __UNUSED__) tabs = elm_toolbar_add(win); elm_toolbar_align_set(tabs, 0.0); -<<<<<<< HEAD - elm_toolbar_always_select_mode_set(tabs, EINA_TRUE); -======= elm_toolbar_select_mode_set(tabs, ELM_OBJECT_SELECT_MODE_ALWAYS); ->>>>>>> remotes/origin/upstream elm_toolbar_homogeneous_set(tabs, EINA_FALSE); elm_toolbar_shrink_mode_set(tabs, ELM_TOOLBAR_SHRINK_MENU); evas_object_size_hint_weight_set(tabs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -608,22 +588,6 @@ elm_main(int argc __UNUSED__, char *argv[] __UNUSED__) elm_icon_standard_set(ic, "close"); elm_object_part_content_set(btn, "icon", ic); -<<<<<<< HEAD - pager = elm_pager_add(win); - evas_object_size_hint_weight_set(pager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(pager, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_pack_end(box, pager); - evas_object_show(pager); - - elm_toolbar_menu_parent_set(tabs, pager); - - web = elm_web_add(win); - elm_web_window_create_hook_set(web, _web_create_window_cb, ad); - elm_web_history_enable_set(web, EINA_FALSE); - evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(web, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_pager_content_push(pager, web); -======= naviframe = elm_naviframe_add(win); evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -638,17 +602,12 @@ elm_main(int argc __UNUSED__, char *argv[] __UNUSED__) evas_object_size_hint_weight_set(web, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(web, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_naviframe_item_simple_push(naviframe, web); ->>>>>>> remotes/origin/upstream default_content_set(web); ad->win = win; ad->main_box = box; -<<<<<<< HEAD - ad->pager = pager; -======= ad->naviframe = naviframe; ->>>>>>> remotes/origin/upstream ad->url = url; ad->default_web = web; ad->tabs = tabs; diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index 1baa130..63012df 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -201,11 +201,7 @@ _activate(Evas_Object *obj) if (item->icon_file) { ic = elm_icon_add(obj); -<<<<<<< HEAD - elm_icon_scale_set(ic, 0, 1); -======= elm_icon_resizable_set(ic, EINA_FALSE, EINA_TRUE); ->>>>>>> remotes/origin/upstream if (item->icon_type == ELM_ICON_FILE) elm_icon_file_set(ic, item->icon_file, item->icon_group); else if (item->icon_type == ELM_ICON_STANDARD) @@ -308,27 +304,15 @@ _content_unset_hook(Evas_Object *obj, const char *part) static const char * _item_text_get_hook(const Elm_Object_Item *it, const char *part) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); - if (part && strcmp(part, "default")) return NULL; - return ((Elm_Hoversel_Item *) it)->label; -======= if (part && strcmp(part, "default")) return NULL; return ((Elm_Hoversel_Item *)it)->label; ->>>>>>> remotes/origin/upstream } static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); - Widget_Data *wd; - Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it; -======= Widget_Data *wd; Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it; ->>>>>>> remotes/origin/upstream wd = elm_widget_data_get(WIDGET(item)); if (!wd) return EINA_FALSE; elm_hoversel_hover_end(WIDGET(item)); @@ -408,21 +392,6 @@ elm_hoversel_hover_parent_get(const Evas_Object *obj) } EAPI void -<<<<<<< HEAD -elm_hoversel_label_set(Evas_Object *obj, const char *label) -{ - _elm_hoversel_label_set(obj, NULL, label); -} - -EAPI const char * -elm_hoversel_label_get(const Evas_Object *obj) -{ - return _elm_hoversel_label_get(obj, NULL); -} - -EAPI void -======= ->>>>>>> remotes/origin/upstream elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) { ELM_CHECK_WIDTYPE(obj, widtype); @@ -441,27 +410,6 @@ elm_hoversel_horizontal_get(const Evas_Object *obj) } EAPI void -<<<<<<< HEAD -elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon) -{ - _content_set_hook(obj, "icon", icon); -} - -EAPI Evas_Object * -elm_hoversel_icon_get(const Evas_Object *obj) -{ - return _content_get_hook(obj, "icon"); -} - -EAPI Evas_Object * -elm_hoversel_icon_unset(Evas_Object *obj) -{ - return _content_unset_hook(obj, "icon"); -} - -EAPI void -======= ->>>>>>> remotes/origin/upstream elm_hoversel_hover_begin(Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype); @@ -533,46 +481,14 @@ elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file item->icon_type = icon_type; item->func = func; item->base.data = data; -<<<<<<< HEAD - return (Elm_Object_Item *) item; -} - -EAPI void -elm_hoversel_item_del(Elm_Object_Item *it) -{ - elm_object_item_del(it); -} - -EAPI void -elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) -{ - elm_object_item_del_cb_set(it, func); -} - -EAPI void * -elm_hoversel_item_data_get(const Elm_Object_Item *it) -{ - return elm_object_item_data_get(it); -} - -EAPI const char * -elm_hoversel_item_label_get(const Elm_Object_Item *it) -{ - return _item_text_get_hook(it, NULL); -======= return (Elm_Object_Item *)item; ->>>>>>> remotes/origin/upstream } EAPI void elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it); -<<<<<<< HEAD - Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it; -======= Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it; ->>>>>>> remotes/origin/upstream eina_stringshare_replace(&item->icon_file, icon_file); eina_stringshare_replace(&item->icon_group, icon_group); item->icon_type = icon_type; @@ -582,11 +498,7 @@ EAPI void elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it); -<<<<<<< HEAD - Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it; -======= Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it; ->>>>>>> remotes/origin/upstream if (icon_file) *icon_file = item->icon_file; if (icon_group) *icon_group = item->icon_group; if (icon_type) *icon_type = item->icon_type; diff --git a/src/lib/elc_hoversel.h b/src/lib/elc_hoversel.h index 521bc33..79f4db7 100644 --- a/src/lib/elc_hoversel.h +++ b/src/lib/elc_hoversel.h @@ -16,11 +16,7 @@ * "selected" - an item in the hoversel list is selected. event_info is the item * "dismissed" - the hover is dismissed * -<<<<<<< HEAD - * Default contents parts of the hoversel widget that you can use for are: -======= * Default content parts of the hoversel widget that you can use for are: ->>>>>>> remotes/origin/upstream * @li "icon" - An icon of the hoversel * * Default text parts of the hoversel widget that you can use for are: @@ -82,10 +78,7 @@ EAPI Eina_Bool elm_hoversel_horizontal_get(const Evas_Object * in. See @ref Hover objects for more information. */ EAPI void elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent); -<<<<<<< HEAD -======= ->>>>>>> remotes/origin/upstream /** * @brief Get the Hover parent * @@ -159,17 +152,10 @@ EAPI const Eina_List *elm_hoversel_items_get(const Evas_Object *obj) * * This adds an item to the hoversel to show when it is clicked. Note: if you * need to use an icon from an edje file then use -<<<<<<< HEAD - * elm_hoversel_item_icon_set() right after the this function, and set - * icon_file to NULL here. - * - * For more information on what @p icon_file and @p icon_type are see the -======= * elm_hoversel_item_icon_set() right after this function, and set * icon_file to NULL here. * * For more information on what @p icon_file and @p icon_type are, see the ->>>>>>> remotes/origin/upstream * @ref Icon "icon documentation". */ EAPI Elm_Object_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data); diff --git a/src/lib/elm_hover.c b/src/lib/elm_hover.c index 34b4801..b3aea0d 100644 --- a/src/lib/elm_hover.c +++ b/src/lib/elm_hover.c @@ -677,21 +677,6 @@ _elm_hover_sub_obj_placement_eval_cb(void *data, Evas *e __UNUSED__, Evas_Object _elm_hover_sub_obj_placement_eval(data); } -<<<<<<< HEAD -EAPI void -elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content) -{ - _content_set_hook(obj, swallow, content); -} - -EAPI Evas_Object * -elm_hover_content_get(const Evas_Object *obj, const char *swallow) -{ - return _content_get_hook(obj, swallow); -} - -======= ->>>>>>> remotes/origin/upstream static void _elm_hover_sub_obj_unparent(Evas_Object *obj) { @@ -708,15 +693,6 @@ _elm_hover_sub_obj_unparent(Evas_Object *obj) wd->smt_sub = NULL; } -<<<<<<< HEAD -EAPI Evas_Object * -elm_hover_content_unset(Evas_Object *obj, const char *swallow) -{ - return _content_unset_hook(obj, swallow); -} - -======= ->>>>>>> remotes/origin/upstream EAPI const char * elm_hover_best_content_location_get(const Evas_Object *obj, Elm_Hover_Axis pref_axis) { diff --git a/src/lib/elm_hover.h b/src/lib/elm_hover.h index fd60a6d..593d65c 100644 --- a/src/lib/elm_hover.h +++ b/src/lib/elm_hover.h @@ -40,11 +40,7 @@ * @li "smart,changed" - a content object placed under the "smart" * policy was replaced to a new slot direction. * -<<<<<<< HEAD - * Default contents parts of the hover widget that you can use for are: -======= * Default content parts of the hover widget that you can use for are: ->>>>>>> remotes/origin/upstream * @li "left" * @li "top-left" * @li "top" @@ -56,20 +52,12 @@ * @li "middle" * @li "smart" * -<<<<<<< HEAD - * @note These contents parts indicates the direction that the content will be -======= * @note These content parts indicates the direction that the content will be ->>>>>>> remotes/origin/upstream * displayed * * All directions may have contents at the same time, except for * "smart". This is a special placement hint and its use case -<<<<<<< HEAD - * independs of the calculations coming from -======= * depends of the calculations coming from ->>>>>>> remotes/origin/upstream * elm_hover_best_content_location_get(). Its use is for cases when * one desires only one hover content, but with a dynamic special * placement within the hover area. The content's geometry, whenever @@ -94,11 +82,7 @@ */ typedef enum { -<<<<<<< HEAD - ELM_HOVER_AXIS_NONE, /**< ELM_HOVER_AXIS_NONE -- no prefered orientation */ -======= ELM_HOVER_AXIS_NONE, /**< ELM_HOVER_AXIS_NONE -- no preferred orientation */ ->>>>>>> remotes/origin/upstream ELM_HOVER_AXIS_HORIZONTAL, /**< ELM_HOVER_AXIS_HORIZONTAL -- horizontal */ ELM_HOVER_AXIS_VERTICAL, /**< ELM_HOVER_AXIS_VERTICAL -- vertical */ ELM_HOVER_AXIS_BOTH /**< ELM_HOVER_AXIS_BOTH -- both */ @@ -165,26 +149,15 @@ EAPI Evas_Object *elm_hover_parent_get(const Evas_Object *obj); * space. * * @p pref_axis may be one of -<<<<<<< HEAD - * - @c ELM_HOVER_AXIS_NONE -- no prefered orientation -======= * - @c ELM_HOVER_AXIS_NONE -- no preferred orientation ->>>>>>> remotes/origin/upstream * - @c ELM_HOVER_AXIS_HORIZONTAL -- horizontal * - @c ELM_HOVER_AXIS_VERTICAL -- vertical * - @c ELM_HOVER_AXIS_BOTH -- both * -<<<<<<< HEAD - * If ELM_HOVER_AXIS_HORIZONTAL is choosen the returned position will - * nescessarily be along the horizontal axis("left" or "right"). If - * ELM_HOVER_AXIS_VERTICAL is choosen the returned position will nescessarily - * be along the vertical axis("top" or "bottom"). Chossing -======= * If ELM_HOVER_AXIS_HORIZONTAL is chosen the returned position will * necessarily be along the horizontal axis("left" or "right"). If * ELM_HOVER_AXIS_VERTICAL is chosen the returned position will necessarily * be along the vertical axis("top" or "bottom"). Choosing ->>>>>>> remotes/origin/upstream * ELM_HOVER_AXIS_BOTH or ELM_HOVER_AXIS_NONE has the same effect and the * returned position may be in either axis. * diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c index 5e84262..7ce92c0 100644 --- a/src/lib/elm_map.c +++ b/src/lib/elm_map.c @@ -6,16 +6,14 @@ #include "elm_priv.h" #include "els_scroller.h" +#define OVERLAY_CLASS_ZOOM_MAX 255 + #ifdef HAVE_ELEMENTARY_ECORE_CON typedef struct _Widget_Data Widget_Data; typedef struct _Pan Pan; typedef struct _Grid Grid; typedef struct _Grid_Item Grid_Item; -<<<<<<< HEAD -typedef struct _Marker_Group Marker_Group; -typedef struct _Event Event; -======= typedef struct _Overlay_Default Overlay_Default; typedef struct _Overlay_Group Overlay_Group; typedef struct _Overlay_Class Overlay_Class; @@ -23,55 +21,11 @@ typedef struct _Overlay_Bubble Overlay_Bubble; typedef struct _Overlay_Route Overlay_Route; typedef struct _Marker_Group Marker_Group; typedef struct _Marker_Bubble Marker_Bubble; ->>>>>>> remotes/origin/upstream typedef struct _Path_Node Path_Node; typedef struct _Path_Waypoint Path_Waypoint; typedef struct _Url_Data Url_Data; typedef struct _Route_Dump Route_Dump; typedef struct _Name_Dump Name_Dump; -<<<<<<< HEAD -typedef struct _Track_Dump Track_Dump; - -#define CACHE_ROOT_PATH "/tmp/elm_map" -#define CACHE_PATH CACHE_ROOT_PATH"/%d/%d/%d" -#define CACHE_FILE_PATH "%s/%d.png" -#define DEST_ROUTE_XML_FILE "/tmp/elm_map-route-XXXXXX" -#define DEST_NAME_XML_FILE "/tmp/elm_map-name-XXXXXX" - -#define ROUTE_YOURS_URL "http://www.yournavigation.org/api/dev/route.php" -#define ROUTE_TYPE_MOTORCAR "motocar" -#define ROUTE_TYPE_BICYCLE "bicycle" -#define ROUTE_TYPE_FOOT "foot" -#define YOURS_DISTANCE "distance" -#define YOURS_DESCRIPTION "description" -#define YOURS_COORDINATES "coordinates" - -// TODO: fix monav & ors url -#define ROUTE_MONAV_URL "http://" -#define ROUTE_ORS_URL "http:///" - -#define NAME_NOMINATIM_URL "http://nominatim.openstreetmap.org" -#define NOMINATIM_RESULT "result" -#define NOMINATIM_PLACE "place" -#define NOMINATIM_ATTR_LON "lon" -#define NOMINATIM_ATTR_LAT "lat" - -#define PINCH_ZOOM_MIN 0.25 -#define PINCH_ZOOM_MAX 4.0 -#define MAX_CONCURRENT_DOWNLOAD 10 - -#define GPX_NAME "name>" -#define GPX_COORDINATES "trkpt " -#define GPX_LON "lon" -#define GPX_LAT "lat" -#define GPX_ELE "ele>" -#define GPX_TIME "time>" - -// Map sources -// Currently the size of a tile must be 256*256 -// and the size of the map must be pow(2.0, z)*tile_size -typedef struct _Map_Sources_Tab -======= typedef struct _Delayed_Data Delayed_Data; typedef struct _Source_Tile Source_Tile; typedef struct _Source_Route Source_Route; @@ -91,7 +45,6 @@ typedef char *(*Elm_Map_Module_Name_Url_Func)(Evas_Object * #define DEFAULT_TILE_SIZE 256 #define MAX_CONCURRENT_DOWNLOAD 10 #define MARER_MAX_NUMBER 30 -#define OVERLAY_CLASS_ZOOM_MAX 255 #define OVERLAY_GROUPING_SCALE 2 #define CACHE_ROOT "/tmp/elm_map" @@ -154,42 +107,10 @@ struct _Delayed_Data // FIXME: Currently tile size must be 256*256 // and the map size is pow(2.0, z) * (tile size) struct _Source_Tile ->>>>>>> remotes/origin/upstream { const char *name; int zoom_min; int zoom_max; -<<<<<<< HEAD - ElmMapModuleUrlFunc url_cb; - Elm_Map_Route_Sources route_source; - ElmMapModuleRouteUrlFunc route_url_cb; - ElmMapModuleNameUrlFunc name_url_cb; - ElmMapModuleGeoIntoCoordFunc geo_into_coord; - ElmMapModuleCoordIntoGeoFunc coord_into_geo; -} Map_Sources_Tab; - -//Zemm min is supposed to be 0 -static char *_mapnik_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_osmarender_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_cyclemap_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_mapquest_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_mapquest_aerial_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); - -static char *_yours_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat); -/* -static char *_monav_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) -static char *_ors_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat); - */ -static char *_nominatim_url_cb(Evas_Object *obj, int method, char *name, double lon, double lat); - -static Map_Sources_Tab default_map_sources_tab[] = -{ - {"Mapnik", 0, 18, _mapnik_url_cb, ELM_MAP_ROUTE_SOURCE_YOURS, _yours_url_cb, _nominatim_url_cb, NULL, NULL}, - {"Osmarender", 0, 17, _osmarender_url_cb, ELM_MAP_ROUTE_SOURCE_YOURS, _yours_url_cb, _nominatim_url_cb, NULL, NULL}, - {"CycleMap", 0, 16, _cyclemap_url_cb, ELM_MAP_ROUTE_SOURCE_YOURS, _yours_url_cb, _nominatim_url_cb, NULL, NULL}, - {"MapQuest", 0, 18, _mapquest_url_cb, ELM_MAP_ROUTE_SOURCE_YOURS, _yours_url_cb, _nominatim_url_cb, NULL, NULL}, - {"MapQuest Open Aerial", 0, 11, _mapquest_aerial_url_cb, ELM_MAP_ROUTE_SOURCE_YOURS, _yours_url_cb, _nominatim_url_cb, NULL, NULL}, -======= Elm_Map_Module_Tile_Url_Func url_cb; Elm_Map_Module_Tile_Geo_to_Coord_Func geo_to_coord; Elm_Map_Module_Tile_Coord_to_Geo_Func coord_to_geo; @@ -207,7 +128,6 @@ struct _Source_Name { const char *name; Elm_Map_Module_Name_Url_Func url_cb; ->>>>>>> remotes/origin/upstream }; struct _Url_Data @@ -218,39 +138,6 @@ struct _Url_Data char *fname; }; -<<<<<<< HEAD -struct _Elm_Map_Marker_Class -{ - const char *style; - int zoom_displayed; - - struct _Elm_Map_Marker_Class_Func - { - ElmMapMarkerGetFunc get; - ElmMapMarkerDelFunc del; //if NULL the object will be destroyed with evas_object_del() - ElmMapMarkerIconGetFunc icon_get; - } func; - - struct - { //this part is private, do not modify these values - Eina_Bool set : 1; - Evas_Coord edje_w, edje_h; - } priv; -}; - -struct _Elm_Map_Marker -{ - Widget_Data *wd; - Elm_Map_Marker_Class *clas; - Elm_Map_Group_Class *clas_group; - double longitude, latitude; - - Evas_Coord map_size; - Evas_Coord *x, *y; - void *data; - Marker_Group **groups; - Evas_Object *content; -======= struct _Overlay_Default { Evas_Coord w, h; @@ -347,33 +234,10 @@ struct _Elm_Map_Marker_Class Elm_Map_Marker_Del_Func del; //if NULL the object will be destroyed with evas_object_del() Elm_Map_Marker_Icon_Get_Func icon_get; } func; ->>>>>>> remotes/origin/upstream }; struct _Elm_Map_Group_Class { -<<<<<<< HEAD - const char *style; - void *data; - int zoom_displayed; // display the group if the zoom is >= to zoom_display - int zoom_grouped; // group the markers only if the zoom is <= to zoom_groups - Eina_Bool hide : 1; - - struct - { - ElmMapGroupIconGetFunc icon_get; - } func; - - struct - { //this part is private, do not modify these values - Eina_Bool set : 1; - Evas_Coord edje_w, edje_h; - Evas_Coord edje_max_w, edje_max_h; - - Eina_List *objs_used; - Eina_List *objs_notused; - } priv; -======= Widget_Data *wd; Eina_List *markers; @@ -413,29 +277,11 @@ struct _Elm_Map_Marker Marker_Bubble *bubble; Evas_Object *content; void *data; ->>>>>>> remotes/origin/upstream }; struct _Marker_Group { Widget_Data *wd; -<<<<<<< HEAD - Eina_Matrixsparse_Cell *cell; - Elm_Map_Group_Class *clas; - - Eina_List *markers; - long long sum_x, sum_y; - Evas_Coord x, y; - Evas_Coord w, h; - - Evas_Object *obj, *bubble, *sc, *bx, *rect; - Eina_Bool open : 1; - Eina_Bool bringin : 1; - Eina_Bool update_nbelems : 1; - Eina_Bool update_resize : 1; - Eina_Bool update_raise : 1; - Eina_Bool delete_object : 1; -======= Elm_Map_Group_Class *clas; Evas_Coord w, h; Evas_Object *obj; @@ -444,27 +290,12 @@ struct _Marker_Group Eina_List *markers; Marker_Bubble *bubble; ->>>>>>> remotes/origin/upstream }; struct _Elm_Map_Route { Widget_Data *wd; -<<<<<<< HEAD - Path_Node *n; - Path_Waypoint *w; - Ecore_Con_Url *con_url; - - int type; - int method; - int x, y; - double flon, flat, tlon, tlat; - - Eina_List *nodes, *path; - Eina_List *waypoint; - -======= char *fname; Elm_Map_Route_Type type; Elm_Map_Route_Method method; @@ -476,7 +307,6 @@ struct _Elm_Map_Route Eina_List *nodes; Eina_List *waypoint; ->>>>>>> remotes/origin/upstream struct { int node_count; @@ -486,24 +316,9 @@ struct _Elm_Map_Route double distance; /* unit : km */ } info; -<<<<<<< HEAD - Eina_List *handlers; - Url_Data ud; - - struct - { - int r; - int g; - int b; - int a; - } color; - - Eina_Bool inbound : 1; -======= Path_Node *n; Path_Waypoint *w; ->>>>>>> remotes/origin/upstream }; struct _Path_Node @@ -529,14 +344,6 @@ struct _Elm_Map_Name { Widget_Data *wd; -<<<<<<< HEAD - Ecore_Con_Url *con_url; - int method; - char *address; - double lon, lat; - Url_Data ud; - Ecore_Event_Handler *handler; -======= int method; char *address; double lon, lat; @@ -562,28 +369,10 @@ struct _Name_Dump char *address; double lon; double lat; ->>>>>>> remotes/origin/upstream }; struct _Grid_Item { -<<<<<<< HEAD - Widget_Data *wd; - Grid *g; - int zoom; - Evas_Object *img; - //Evas_Object *txt; - const char *file; - const char *source; - struct - { - int x, y, w, h; - } src, out; - - Eina_Bool file_have : 1; - Ecore_File_Download_Job *job; - int try_num; -======= Grid *g; Widget_Data *wd; @@ -594,22 +383,11 @@ struct _Grid_Item Eina_Bool file_have : 1; Ecore_File_Download_Job *job; ->>>>>>> remotes/origin/upstream }; struct _Grid { Widget_Data *wd; -<<<<<<< HEAD - int tsize; // size of tile (tsize x tsize pixels) - int zoom; // zoom level tiles want for optimal display (1, 2, 4, 8) - int iw, ih; // size of image in pixels - int w, h; // size of grid image in pixels (represented by grid) - int gw, gh; // size of grid in tiles - Eina_Matrixsparse *grid; -}; - -======= int zoom; // zoom level tiles want for optimal display (1, 2, 4, 8) int tw, th; // size of grid in tiles Eina_Matrixsparse *grid; @@ -621,88 +399,12 @@ struct _Pan Widget_Data *wd; }; ->>>>>>> remotes/origin/upstream struct _Widget_Data { Evas_Object *obj; Evas_Object *scr; Evas_Object *ges; Evas_Object *pan_smart; -<<<<<<< HEAD - Evas_Object *rect; - Evas_Object *sep_maps_markers; //map objects are below this object and marker objects are on top - Pan *pan; - Evas_Coord pan_x, pan_y, minw, minh; - - int id; - int zoom; - int zoom_method; - Elm_Map_Zoom_Mode mode; - - Ecore_Job *calc_job; - Ecore_Timer *scr_timer; - Ecore_Timer *long_timer; - Ecore_Animator *zoom_animator; - double t; - struct - { - int w, h; - int ow, oh, nw, nh; - struct - { - double x, y; - } spos; - } size; - struct - { - Eina_Bool show : 1; - Evas_Coord x, y ,w ,h; - } show; - int tsize; - int nosmooth; - Eina_List *grids; - Eina_Bool resized : 1; - Eina_Bool on_hold : 1; - Eina_Bool paused : 1; - Eina_Bool paused_markers : 1; - - struct - { - Eina_Bool enabled; - double lon, lat; - } center_on; - - Ecore_Job *markers_place_job; - Eina_Matrixsparse **markers; - Eina_List *cells_displayed; // list of Eina_Matrixsparse_Cell - Evas_Coord markers_max_num; - int marker_max_w, marker_max_h; - int marker_zoom; - Eina_List *opened_bubbles; //opened bubbles, list of Map_Group * - - Eina_List *groups_clas; // list of Elm_Map_Group_Class* - Eina_List *markers_clas; // list of Elm_Map_Markers_Class* - - Elm_Map_Route_Sources route_source; - Eina_List *s_event_list; - int try_num; - int finish_num; - - Eina_Hash *ua; - const char *user_agent; - Eina_List *route; - Eina_List *track; - Evas_Event_Mouse_Down ev; - Eina_List *names; - int multi_count; - - struct - { - Evas_Coord cx, cy; - double level, diff; - } pinch; - -======= Evas_Object *sep_maps_markers; // Tiles are below this and overlays are on top Evas_Map *map; @@ -764,3879 +466,1218 @@ struct _Widget_Data Eina_Bool paused : 1; double pinch_zoom; ->>>>>>> remotes/origin/upstream struct { Evas_Coord cx, cy; double a, d; } rotate; -<<<<<<< HEAD - int wheel_diff; Eina_Bool wheel_disabled : 1; - Eina_Bool scr_started : 1; - - Eina_Array *modules; - Eina_List *map_sources_tab; - const char **source_names; - Evas_Map *map; - Ecore_Timer *zoom_timer; - Map_Sources_Tab *src; - const char *gpx_file; - int zoom_min, zoom_max; - Eina_List *download_list; - int download_num; -}; - -struct _Pan -{ - Evas_Object_Smart_Clipped_Data __clipped_data; - Widget_Data *wd; -}; - -struct _Event -{ - int device; - - struct - { - Evas_Coord x, y; - } start; - - struct - { - Evas_Coord x, y; - } prev; - Evas_Coord x, y, w, h; - - Evas_Object *object; + unsigned int markers_max_num; + Eina_Bool paused_markers : 1; + Eina_List *group_classes; + Eina_List *marker_classes; + Eina_List *markers; - int pinch_start_dis; - int pinch_dis; -}; + Eina_List *routes; + Eina_List *track; + Eina_List *names; -struct _Route_Dump -{ - int id; - char *fname; - double distance; - char *description; - char *coordinates; + Eina_List *overlays; }; -enum _Route_Xml_Attribute -{ - ROUTE_XML_NONE, - ROUTE_XML_DISTANCE, - ROUTE_XML_DESCRIPTION, - ROUTE_XML_COORDINATES, - ROUTE_XML_LAST -} Route_Xml_Attibute; +static char *_mapnik_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_osmarender_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_cyclemap_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_mapquest_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_mapquest_aerial_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); +static char *_yours_url_cb(Evas_Object *obj __UNUSED__, const char *type_name, int method, double flon, double flat, double tlon, double tlat); +static char *_nominatim_url_cb(Evas_Object *obj, int method, const char *name, double lon, double lat); +/* +static char *_monav_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) +static char *_ors_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat); +*/ -struct _Name_Dump +const Source_Tile src_tiles[] = { - int id; - char *address; - double lon; - double lat; + {"Mapnik", 0, 18, _mapnik_url_cb, NULL, NULL}, + {"Osmarender", 0, 17, _osmarender_url_cb, NULL, NULL}, + {"CycleMap", 0, 16, _cyclemap_url_cb, NULL, NULL}, + {"MapQuest", 0, 18, _mapquest_url_cb, NULL, NULL}, + {"MapQuest Open Aerial", 0, 11, _mapquest_aerial_url_cb, NULL, NULL}, }; -enum _Name_Xml_Attribute -{ - NAME_XML_NONE, - NAME_XML_NAME, - NAME_XML_LON, - NAME_XML_LAT, - NAME_XML_LAST -} Name_Xml_Attibute; - -enum _Zoom_Method +// FIXME: Fix more open sources +const Source_Route src_routes[] = { - ZOOM_METHOD_NONE, - ZOOM_METHOD_IN, - ZOOM_METHOD_OUT, - ZOOM_METHOD_LAST -} Zoom_Mode; + {"Yours", _yours_url_cb} // http://www.yournavigation.org/ + //{"Monav", _monav_url_cb}, + //{"ORS", _ors_url_cb}, // http://www.openrouteservice.org +}; -enum _Track_Xml_Attribute +// FIXME: Add more open sources +const Source_Name src_names[] = { - TRACK_XML_NONE, - TRACK_XML_COORDINATES, - TRACK_XML_LAST -} Track_Xml_Attibute; + {"Nominatim", _nominatim_url_cb} +}; -static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_NULL; static const char *widtype = NULL; +static Evas_Smart_Class parent_sc = EVAS_SMART_CLASS_INIT_NULL; +static Evas_Smart_Class sc; +static Evas_Smart *smart; static int idnum = 1; -static const char SIG_CHANGED[] = "changed"; -static const char SIG_CLICKED[] = "clicked"; -static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; -static const char SIG_LOADED_DETAIL[] = "loaded,detail"; -static const char SIG_LOAD_DETAIL[] = "load,detail"; -static const char SIG_LONGPRESSED[] = "longpressed"; -static const char SIG_PRESS[] = "press"; -static const char SIG_SCROLL[] = "scroll"; -static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; -static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; -static const char SIG_ZOOM_CHANGE[] = "zoom,change"; -static const char SIG_ZOOM_START[] = "zoom,start"; -static const char SIG_ZOOM_STOP[] = "zoom,stop"; -static const char SIG_DOWNLOADED[] = "downloaded"; -static const char SIG_ROUTE_LOAD[] = "route,load"; -static const char SIG_ROUTE_LOADED[] = "route,loaded"; -static const char SIG_NAME_LOAD[] = "name,load"; -static const char SIG_NAME_LOADED[] = "name,loaded"; +static const char SIG_CLICKED[] = "clicked"; +static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; +static const char SIG_PRESS[] = "press"; +static const char SIG_LONGPRESSED[] = "longpressed"; +static const char SIG_SCROLL[] = "scroll"; +static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; +static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; +static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; +static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; +static const char SIG_ZOOM_START[] = "zoom,start"; +static const char SIG_ZOOM_STOP[] = "zoom,stop"; +static const char SIG_ZOOM_CHANGE[] = "zoom,change"; +static const char SIG_TILE_LOAD[] = "tile,load"; +static const char SIG_TILE_LOADED[] = "tile,loaded"; +static const char SIG_TILE_LOADED_FAIL[] = "tile,loaded,fail"; +static const char SIG_ROUTE_LOAD[] = "route,load"; +static const char SIG_ROUTE_LOADED[] = "route,loaded"; +static const char SIG_ROUTE_LOADED_FAIL[] = "route,loaded,fail"; +static const char SIG_NAME_LOAD[] = "name,load"; +static const char SIG_NAME_LOADED[] = "name,loaded"; +static const char SIG_NAME_LOADED_FAIL[] = "name,loaded,fail"; +static const char SIG_OVERLAY_CLICKED[] = "overlay,clicked"; static const Evas_Smart_Cb_Description _signals[] = { - {SIG_CHANGED, ""}, {SIG_CLICKED, ""}, {SIG_CLICKED_DOUBLE, ""}, - {SIG_LOADED_DETAIL, ""}, - {SIG_LOAD_DETAIL, ""}, - {SIG_LONGPRESSED, ""}, {SIG_PRESS, ""}, + {SIG_LONGPRESSED, ""}, {SIG_SCROLL, ""}, {SIG_SCROLL_DRAG_START, ""}, {SIG_SCROLL_DRAG_STOP, ""}, - {SIG_ZOOM_CHANGE, ""}, + {SIG_SCROLL_ANIM_START, ""}, + {SIG_SCROLL_ANIM_STOP, ""}, {SIG_ZOOM_START, ""}, {SIG_ZOOM_STOP, ""}, - {SIG_DOWNLOADED, ""}, + {SIG_ZOOM_CHANGE, ""}, + {SIG_TILE_LOAD, ""}, + {SIG_TILE_LOADED, ""}, + {SIG_TILE_LOADED_FAIL, ""}, {SIG_ROUTE_LOAD, ""}, {SIG_ROUTE_LOADED, ""}, + {SIG_ROUTE_LOADED_FAIL, ""}, {SIG_NAME_LOAD, ""}, {SIG_NAME_LOADED, ""}, + {SIG_NAME_LOADED_FAIL, ""}, + {SIG_OVERLAY_CLICKED, ""}, {NULL, NULL} }; -static void _pan_calculate(Evas_Object *obj); - -static void _rect_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _del_hook(Evas_Object *obj); -static void _theme_hook(Evas_Object *obj); -static void _on_focus_hook(void *data, Evas_Object *obj); -static void _sizing_eval(Evas_Object *obj); -static void _calc_job(void *data); -static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, - Evas_Callback_Type type, void *event_info); -static void grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh); -static void grid_load(Evas_Object *obj, Grid *g); - -static void _process_download_list(Evas_Object *obj); -static void _add_download_list(Evas_Object *obj, Grid_Item *gi); - -static void _group_object_create(Marker_Group *group); -static void _group_object_free(Marker_Group *group); -static void _group_open_cb(void *data, Evas_Object *obj, const char *emission, const char *soure); -static void _group_bringin_cb(void *data, Evas_Object *obj, const char *emission, const char *soure); -static void _group_bubble_create(Marker_Group *group); -static void _group_bubble_free(Marker_Group *group); -static void _group_bubble_place(Marker_Group *group); - -static int _group_bubble_content_update(Marker_Group *group); -static void _group_bubble_content_free(Marker_Group *group); -static void marker_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh); -static void _bubble_sc_hints_changed_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); - -static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info); - -static void route_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh); -static void track_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh); +static void +_edj_marker_size_get(Widget_Data *wd, Evas_Coord *w, Evas_Coord *h) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(w); + EINA_SAFETY_ON_NULL_RETURN(h); -static Eina_Bool -module_list_cb(Eina_Module *m, void *data) -{ - ELM_CHECK_WIDTYPE(data, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(data); - Map_Sources_Tab *s; - ElmMapModuleSourceFunc source; - ElmMapModuleZoomMinFunc zoom_min; - ElmMapModuleZoomMaxFunc zoom_max; - ElmMapModuleUrlFunc url; - ElmMapModuleRouteSourceFunc route_source; - ElmMapModuleRouteUrlFunc route_url; - ElmMapModuleNameUrlFunc name_url; - ElmMapModuleGeoIntoCoordFunc geo_into_coord; - ElmMapModuleCoordIntoGeoFunc coord_into_geo; - const char *file; + Evas_Object *edj; + const char *s; - if (!wd) return EINA_FALSE; + edj = edje_object_add(evas_object_evas_get(wd->obj)); + _elm_theme_object_set(wd->obj, edj, "map/marker", "radio", + elm_widget_style_get(wd->obj)); + s = edje_object_data_get(edj, "size_w"); + if (s) *w = atoi(s); + else *w = 0; + s = edje_object_data_get(edj, "size_h"); + if (s) *h = atoi(s); + else *h = 0; + evas_object_del(edj); +} - file = eina_module_file_get(m); - if (!eina_module_load(m)) - { - ERR("could not load module \"%s\": %s", file, eina_error_msg_get(eina_error_get())); - return EINA_FALSE; - } +static void +_coord_rotate(Evas_Coord x, Evas_Coord y, Evas_Coord cx, Evas_Coord cy, double degree, Evas_Coord *xx, Evas_Coord *yy) +{ + EINA_SAFETY_ON_NULL_RETURN(xx); + EINA_SAFETY_ON_NULL_RETURN(yy); - source = eina_module_symbol_get(m, "map_module_source_get"); - zoom_min = eina_module_symbol_get(m, "map_module_zoom_min_get"); - zoom_max = eina_module_symbol_get(m, "map_module_zoom_max_get"); - url = eina_module_symbol_get(m, "map_module_url_get"); - route_source = eina_module_symbol_get(m, "map_module_route_source_get"); - route_url = eina_module_symbol_get(m, "map_module_route_url_get"); - name_url = eina_module_symbol_get(m, "map_module_name_url_get"); - geo_into_coord = eina_module_symbol_get(m, "map_module_geo_into_coord"); - coord_into_geo = eina_module_symbol_get(m, "map_module_coord_into_geo"); - if ((!source) || (!zoom_min) || (!zoom_max) || (!url) || (!route_source) || (!route_url) || (!name_url) || (!geo_into_coord) || (!coord_into_geo)) - { - WRN("could not find map_module_source_get() in module \"%s\": %s", file, eina_error_msg_get(eina_error_get())); - eina_module_unload(m); - return EINA_FALSE; - } - s = calloc(1, sizeof(Map_Sources_Tab)); - EINA_SAFETY_ON_NULL_RETURN_VAL(s, EINA_FALSE); - s->name = source(); - s->zoom_min = zoom_min(); - s->zoom_max = zoom_max(); - s->url_cb = url; - s->route_source = route_source(); - s->route_url_cb = route_url; - s->name_url_cb = name_url; - s->geo_into_coord = geo_into_coord; - s->coord_into_geo = coord_into_geo; - wd->map_sources_tab = eina_list_append(wd->map_sources_tab, s); + double r = (degree * M_PI) / 180.0; - return EINA_TRUE; + if (xx) *xx = ((x - cx) * cos(r)) + ((y - cy) * cos(r + M_PI_2)) + cx; + if (yy) *yy = ((x - cx) * sin(r)) + ((y - cy) * sin(r + M_PI_2)) + cy; } static void -module_init(void *data) +_obj_rotate(Widget_Data *wd, Evas_Object *obj) { - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); + Evas_Coord w, h, ow, oh; + evas_map_util_points_populate_from_object(wd->map, obj); + + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + evas_object_image_size_get(obj, &w, &h); + if ((w > ow) || (h > oh)) + { + evas_map_point_image_uv_set(wd->map, 0, 0, 0); + evas_map_point_image_uv_set(wd->map, 1, w, 0); + evas_map_point_image_uv_set(wd->map, 2, w, h); + evas_map_point_image_uv_set(wd->map, 3, 0, h); + } + evas_map_util_rotate(wd->map, wd->rotate.d, wd->rotate.cx, wd->rotate.cy); - if (!wd) return; - wd->modules = eina_module_list_get(wd->modules, MODULES_PATH, 1, &module_list_cb, data); + evas_object_map_set(obj, wd->map); + evas_object_map_enable_set(obj, EINA_TRUE); } static void -source_init(void *data) +_obj_place(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - Map_Sources_Tab *s; - Eina_List *l; - unsigned int idx; + EINA_SAFETY_ON_NULL_RETURN(obj); - if (!wd) return; - for (idx = 0; idx < sizeof(default_map_sources_tab)/sizeof(Map_Sources_Tab); idx++) - { - s = calloc(1, sizeof(Map_Sources_Tab)); - EINA_SAFETY_ON_NULL_RETURN(s); - s->name = default_map_sources_tab[idx].name; - s->zoom_min = default_map_sources_tab[idx].zoom_min; - s->zoom_max = default_map_sources_tab[idx].zoom_max; - s->url_cb = default_map_sources_tab[idx].url_cb; - s->route_source = default_map_sources_tab[idx].route_source; - s->route_url_cb = default_map_sources_tab[idx].route_url_cb; - s->name_url_cb = default_map_sources_tab[idx].name_url_cb; - s->geo_into_coord = default_map_sources_tab[idx].geo_into_coord; - s->coord_into_geo = default_map_sources_tab[idx].coord_into_geo; - wd->map_sources_tab = eina_list_append(wd->map_sources_tab, s); - if (!idx) wd->src = s; - } - module_init(data); - - int n = eina_list_count(wd->map_sources_tab); - wd->source_names = malloc(sizeof(char *) * (n + 1)); - if (!wd->source_names) - { - ERR("init source names failed."); - return; - } - idx = 0; - EINA_LIST_FOREACH(wd->map_sources_tab, l, s) - { - wd->source_names[idx] = strdup(s->name); - INF("source : %s", wd->source_names[idx]); - if (s->zoom_min < wd->zoom_min) wd->zoom_min = s->zoom_min; - if (s->zoom_max > wd->zoom_max) wd->zoom_max = s->zoom_max; - idx++; - } - wd->source_names[idx] = NULL; + evas_object_move(obj, x, y); + evas_object_resize(obj, w, h); + evas_object_show(obj); } static void -obj_rotate_zoom(void *data, Evas_Object *obj) +_coord_to_region_convert(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord size, double *lon, double *lat) { - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - int ow, oh, iw, ih; - if ((!wd->pinch.cx) && (!wd->pinch.cy)) + EINA_SAFETY_ON_NULL_RETURN(wd); + + int zoom = floor(log(size / wd->size.tile) / log(2)); + if ((wd->src_tile) && (wd->src_tile->coord_to_geo)) { - wd->pinch.cx = wd->rotate.cx; - wd->pinch.cy = wd->rotate.cy; + if (wd->src_tile->coord_to_geo(wd->obj, zoom, x, y, size, lon, lat)) + return; } - evas_map_util_points_populate_from_object_full(wd->map, obj, 0); - evas_object_image_size_get(obj, &iw, &ih); - evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); - if ((ow < iw) || (oh < ih)) + if (lon) *lon = (x / (double)size * 360.0) - 180; + if (lat) { - ow *= (double)iw / ow; - oh *= (double)ih / oh; - evas_map_point_image_uv_set(wd->map, 1, ow, 0); - evas_map_point_image_uv_set(wd->map, 2, ow, oh); - evas_map_point_image_uv_set(wd->map, 3, 0, oh); + double n = ELM_PI - (2.0 * ELM_PI * y / size); + *lat = 180.0 / ELM_PI * atan(0.5 * (exp(n) - exp(-n))); } - evas_map_util_zoom(wd->map, wd->pinch.level, wd->pinch.level, wd->pinch.cx, wd->pinch.cy); - evas_map_util_rotate(wd->map, wd->rotate.d, wd->rotate.cx, wd->rotate.cy); - evas_object_map_enable_set(obj, EINA_TRUE); - evas_object_map_set(obj, wd->map); } static void -#ifdef ELM_EMAP -track_place(Evas_Object *obj, Grid *g __UNUSED__, Evas_Coord px, Evas_Coord py, Evas_Coord ox __UNUSED__, Evas_Coord oy __UNUSED__, Evas_Coord ow, Evas_Coord oh) -#else -track_place(Evas_Object *obj __UNUSED__, Grid *g __UNUSED__, Evas_Coord px __UNUSED__, Evas_Coord py __UNUSED__, Evas_Coord ox __UNUSED__, Evas_Coord oy __UNUSED__, Evas_Coord ow __UNUSED__, Evas_Coord oh __UNUSED__) -#endif +_region_to_coord_convert(Widget_Data *wd, double lon, double lat, Evas_Coord size, Evas_Coord *x, Evas_Coord *y) { -#ifdef ELM_EMAP - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Eina_List *l; - Evas_Object *route; - int xmin, xmax, ymin, ymax; - - if (!wd) return; - Evas_Coord size = pow(2.0, wd->zoom)*wd->tsize; + EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_LIST_FOREACH(wd->track, l, route) + int zoom = floor(log(size / 256) / log(2)); + if ((wd->src_tile) && (wd->src_tile->geo_to_coord)) { - elm_map_utils_convert_geo_into_coord(wd->obj, elm_route_lon_min_get(route), elm_route_lat_max_get(route), size, &xmin, &ymin); - elm_map_utils_convert_geo_into_coord(wd->obj, elm_route_lon_max_get(route), elm_route_lat_min_get(route), size, &xmax, &ymax); + if (wd->src_tile->geo_to_coord(wd->obj, zoom, lon, lat, size, x, y)) return; + } - if( !(xmin < px && xmax < px) && !(xmin > px+ow && xmax > px+ow)) - { - if( !(ymin < py && ymax < py) && !(ymin > py+oh && ymax > py+oh)) - { - //display the route - evas_object_move(route, xmin - px + ox, ymin - py + oy); - evas_object_resize(route, xmax - xmin, ymax - ymin); + if (x) *x = floor((lon + 180.0) / 360.0 * size); + if (y) + *y = floor((1.0 - log(tan(lat * ELM_PI / 180.0) + (1.0 / cos(lat * ELM_PI / 180.0))) + / ELM_PI) / 2.0 * size); +} - evas_object_raise(route); - obj_rotate_zoom(obj, route); - evas_object_show(route); +static void +_viewport_size_get(Widget_Data *wd, Evas_Coord *vw, Evas_Coord *vh) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); - continue; - } - } - //the route is not display - evas_object_hide(route); - } -#endif + Evas_Coord x, y, w, h; + evas_object_geometry_get(wd->pan_smart, &x, &y, &w, &h); + if (vw) *vw = (x * 2) + w; + if (vh) *vh = (y * 2) + h; } + static void -route_place(Evas_Object *obj, Grid *g __UNUSED__, Evas_Coord px, Evas_Coord py, Evas_Coord ox __UNUSED__, Evas_Coord oy __UNUSED__, Evas_Coord ow, Evas_Coord oh) +_pan_geometry_get(Widget_Data *wd, Evas_Coord *px, Evas_Coord *py) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Eina_List *lr, *lp, *ln; - Path_Node *n; - Evas_Object *p; - Elm_Map_Route *r; - int nodes; - int x, y, rx, ry; - double a; - - if (!wd) return; - Evas_Coord size = pow(2.0, wd->zoom)*wd->tsize; + EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_LIST_FOREACH(wd->route, lr, r) - { - EINA_LIST_FOREACH(r->path, lp, p) - { - evas_object_polygon_points_clear(p); - } + Evas_Coord x, y, vx, vy, vw, vh; + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + evas_object_geometry_get(wd->pan_smart, &vx, &vy, &vw, &vh); + x = -x; + y = -y; + if (vw > wd->size.w) x += (((vw - wd->size.w) / 2) + vx); + else x -= vx; + if (vh > wd->size.h) y += (((vh - wd->size.h) / 2) + vy); + else y -= vy; + if (px) *px = x; + if (py) *py = y; + } - evas_object_geometry_get(wd->rect, &rx, &ry, NULL, NULL); - nodes = eina_list_count(r->nodes); +static void +_region_show(void *data) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Delayed_Data *dd = data; + int x, y, w, h; - EINA_LIST_FOREACH(r->nodes, ln, n) - { - if ((!wd->zoom) || ((n->idx) && - ((n->idx % (int)ceil((double)nodes/(double)size*100.0))))) continue; - if (r->inbound) - { - elm_map_utils_convert_geo_into_coord(wd->obj, n->pos.lon, n->pos.lat, size, &x, &y); - if ((x >= px - ow) && (x <= (px + ow*2)) && - (y >= py - oh) && (y <= (py + oh*2))) - { - x = x - px + rx; - y = y - py + ry; - - p = eina_list_nth(r->path, n->idx); - a = (double)(y - r->y) / (double)(x - r->x); - if ((abs(a) >= 1) || (r->x == x)) - { - evas_object_polygon_point_add(p, r->x - 3, r->y); - evas_object_polygon_point_add(p, r->x + 3, r->y); - evas_object_polygon_point_add(p, x + 3, y); - evas_object_polygon_point_add(p, x - 3, y); - } - else - { - evas_object_polygon_point_add(p, r->x, r->y - 3); - evas_object_polygon_point_add(p, r->x, r->y + 3); - evas_object_polygon_point_add(p, x, y + 3); - evas_object_polygon_point_add(p, x, y - 3); - } - - evas_object_color_set(p, r->color.r, r->color.g, r->color.b, r->color.a); - evas_object_raise(p); - obj_rotate_zoom(obj, p); - evas_object_show(p); - r->x = x; - r->y = y; - } - else r->inbound = EINA_FALSE; - } - else - { - elm_map_utils_convert_geo_into_coord(wd->obj, n->pos.lon, n->pos.lat, size, &x, &y); - if ((x >= px - ow) && (x <= (px + ow*2)) && - (y >= py - oh) && (y <= (py + oh*2))) - { - r->x = x - px + rx; - r->y = y - py + ry; - r->inbound = EINA_TRUE; - } - else r->inbound = EINA_FALSE; - } - } - r->inbound = EINA_FALSE; - } + _region_to_coord_convert(dd->wd, dd->lon, dd->lat, dd->wd->size.w, &x, &y); + _viewport_size_get(dd->wd, &w, &h); + x = x - (w / 2); + y = y - (h / 2); + elm_smart_scroller_child_region_show(dd->wd->scr, x, y, w, h); + evas_object_smart_changed(dd->wd->pan_smart); } static void -rect_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +_bubble_update(Marker_Bubble *bubble, Eina_List *contents) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord ax, ay, gw, gh, hh, ww; - - if (!wd) return; - evas_object_geometry_get(wd->rect, NULL, NULL, &ww, &hh); - - ax = 0; - ay = 0; - gw = wd->size.w; - gh = wd->size.h; - - if ((ww == gw) && (hh == gh)) return; + EINA_SAFETY_ON_NULL_RETURN(bubble); + EINA_SAFETY_ON_NULL_RETURN(contents); - if (ow > gw) ax = (ow - gw) / 2; - if (oh > gh) ay = (oh - gh) / 2; - evas_object_move(wd->rect, - ox + 0 - px + ax, - oy + 0 - py + ay); - evas_object_resize(wd->rect, gw, gh); + Eina_List *l; + Evas_Object *c; - if (wd->show.show) - { - wd->show.show = EINA_FALSE; - elm_smart_scroller_child_region_show(wd->scr, wd->show.x, wd->show.y, wd->show.w, wd->show.h); - } + elm_box_clear(bubble->bx); + EINA_LIST_FOREACH(contents, l, c) elm_box_pack_end(bubble->bx, c); } static void -marker_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +_bubble_place(Marker_Bubble *bubble) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord ax, ay, gw, gh, tx, ty; - Eina_List *l, *markers; - Eina_Matrixsparse_Cell *cell; - Marker_Group *group; - int xx, yy, ww, hh; - char buf[PATH_MAX]; - int y, x; - int g_xx, g_yy, g_hh, g_ww; - - if (!wd) return; - - ax = 0; - ay = 0; - gw = wd->size.w; - gh = wd->size.h; - if (ow > gw) ax = (ow - gw) / 2; - if (oh > gh) ay = (oh - gh) / 2; + EINA_SAFETY_ON_NULL_RETURN(bubble); - if (wd->zoom != wd->marker_zoom) - { - EINA_LIST_FREE(wd->cells_displayed, cell) - { - EINA_LIST_FOREACH(eina_matrixsparse_cell_data_get(cell), l, group) - { - if (group->obj) _group_object_free(group); - } - } - } - wd->marker_zoom = wd->zoom; + Evas_Coord x, y, w, h; + Evas_Coord xx, yy, ww, hh; + const char *s; - if ((wd->paused_markers) - && ((wd->size.nw != wd->size.w) || (wd->size.nh != wd->size.h)) ) - return; + if ((!bubble->obj) || (!bubble->pobj)) return; + evas_object_geometry_get(bubble->pobj, &x, &y, &w, NULL); - g_xx = wd->pan_x / wd->tsize; - if (g_xx < 0) g_xx = 0; - g_yy = wd->pan_y / wd->tsize; - if (g_yy < 0) g_yy = 0; - g_ww = (ow / wd->tsize) + 1; - if (g_xx + g_ww >= g->gw) g_ww = g->gw - g_xx - 1; - g_hh = (oh / wd->tsize) + 1; - if (g_yy + g_hh >= g->gh) g_hh = g->gh - g_yy - 1; + s = edje_object_data_get(bubble->obj, "size_w"); + if (s) ww = atoi(s); + else ww = 0; - //hide groups no more displayed - EINA_LIST_FREE(wd->cells_displayed, cell) - { - eina_matrixsparse_cell_position_get(cell, (unsigned long *)&y, (unsigned long *)&x); - if ((y < g_yy) || (y > g_yy + g_hh) || (x < g_xx) || (x > g_xx + g_ww)) - { - EINA_LIST_FOREACH(eina_matrixsparse_cell_data_get(cell), l, group) - { - if (group->obj) _group_object_free(group); - } - } - } + edje_object_size_min_calc(bubble->obj, NULL, &hh); + s = edje_object_data_get(bubble->obj, "size_h"); + if (s) h = atoi(s); + else h = 0; + if (hh < h) hh = h; - if (!wd->marker_zoom) - { - g_ww = 0; - g_hh = 0; - } + xx = x + (w / 2) - (ww / 2); + yy = y - hh; - for (y = g_yy; y <= g_yy + g_hh; y++) - { - for (x = g_xx; x <= g_xx + g_ww; x++) - { - if (!wd->markers[wd->zoom]) continue; - eina_matrixsparse_cell_idx_get(wd->markers[wd->zoom], y, x, &cell); - if (!cell) continue; - wd->cells_displayed = eina_list_append(wd->cells_displayed, cell); - markers = eina_matrixsparse_cell_data_get(cell); - EINA_LIST_FOREACH(markers, l, group) - { - if (!group->markers) continue; - if (group->clas->zoom_displayed > wd->zoom) continue; + _obj_place(bubble->obj, xx, yy, ww, hh); + evas_object_raise(bubble->obj); +} - xx = group->x; - yy = group->y; - ww = group->w; - hh = group->h; +static void +_bubble_sc_hints_changed_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Marker_Bubble *bubble = data; + EINA_SAFETY_ON_NULL_RETURN(bubble); + _bubble_place(data); +} - if (eina_list_count(group->markers) == 1) - { - Elm_Map_Marker *m = eina_list_data_get(group->markers); - ww = m->clas->priv.edje_w; - hh = m->clas->priv.edje_h; - } +static void +_bubble_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Marker_Bubble *bubble = data; + EINA_SAFETY_ON_NULL_RETURN(bubble); + _bubble_place(bubble); +} - if (ww <= 0) ww = 1; - if (hh <= 0) hh = 1; +static void +_bubble_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Marker_Bubble *bubble = data; + EINA_SAFETY_ON_NULL_RETURN(bubble); + evas_object_hide(bubble->obj); +} - if ((gw != g->w) && (g->w > 0)) - { - tx = xx; - xx = ((long long )gw * xx) / g->w; - ww = (((long long)gw * (tx + ww)) / g->w) - xx; - } - if ((gh != g->h) && (g->h > 0)) - { - ty = yy; - yy = ((long long)gh * yy) / g->h; - hh = (((long long)gh * (ty + hh)) / g->h) - yy; - } +static void +_bubble_show_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Marker_Bubble *bubble = data; + EINA_SAFETY_ON_NULL_RETURN(bubble); + _bubble_place(bubble); +} - if ((!group->clas->hide) - && (xx-px+ax+ox >= ox) && (xx-px+ax+ox<= ox+ow) - && (yy-py+ay+oy >= oy) && (yy-py+ay+oy<= oy+oh)) - { - if (!group->obj) _group_object_create(group); - - if (group->update_nbelems) - { - group->update_nbelems = EINA_FALSE; - if (eina_list_count(group->markers) > 1) - { - snprintf(buf, sizeof(buf), "%d", eina_list_count(group->markers)); - edje_object_part_text_set(elm_layout_edje_get(group->obj), "elm.text", buf); - } - else - edje_object_part_text_set(elm_layout_edje_get(group->obj), "elm.text", ""); - } - evas_object_move(group->obj, - xx - px + ax + ox - ww/2, - yy - py + ay + oy - hh/2); - if ((!wd->paused_markers) || (group->update_resize)) - { - group->update_resize = EINA_FALSE; - evas_object_resize(group->obj, ww, hh); - obj_rotate_zoom(obj, group->obj); - } - if (group->update_raise) - { - group->update_raise = EINA_FALSE; - evas_object_raise(group->obj); - obj_rotate_zoom(obj, group->obj); - evas_object_show(group->obj); - } - if (group->bubble) _group_bubble_place(group); - } - else if (group->obj) - { - _group_object_free(group); - } - } - } - } +static void +_bubble_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Marker_Bubble *bubble = data; + EINA_SAFETY_ON_NULL_RETURN(bubble); + _bubble_place(bubble); } static void -grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh) +_bubble_free(Marker_Bubble* bubble) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord ax, ay, gw, gh, tx, ty; - int xx, yy, ww, hh; + EINA_SAFETY_ON_NULL_RETURN(bubble); - if (!wd) return; - ax = 0; - ay = 0; - gw = wd->size.w; - gh = wd->size.h; - if (ow > gw) ax = (ow - gw) / 2; - if (oh > gh) ay = (oh - gh) / 2; + evas_object_del(bubble->bx); + evas_object_del(bubble->sc); + evas_object_del(bubble->obj); + free(bubble); +} - Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); - Eina_Matrixsparse_Cell *cell; +static Marker_Bubble* +_bubble_create(Evas_Object *pobj, Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(pobj, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - EINA_ITERATOR_FOREACH(it, cell) - { - Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); + Marker_Bubble *bubble = ELM_NEW(Marker_Bubble); + EINA_SAFETY_ON_NULL_RETURN_VAL(bubble, NULL); - xx = gi->out.x; - yy = gi->out.y; - ww = gi->out.w; - hh = gi->out.h; - if ((gw != g->w) && (g->w > 0)) - { - tx = xx; - xx = ((long long )gw * xx) / g->w; - ww = (((long long)gw * (tx + ww)) / g->w) - xx; - } - if ((gh != g->h) && (g->h > 0)) - { - ty = yy; - yy = ((long long)gh * yy) / g->h; - hh = (((long long)gh * (ty + hh)) / g->h) - yy; - } - evas_object_move(gi->img, - xx - px + ax + ox, - yy - py + ay + oy); + bubble->wd = wd; + bubble->pobj = pobj; + evas_object_event_callback_add(pobj, EVAS_CALLBACK_HIDE, _bubble_hide_cb, + bubble); + evas_object_event_callback_add(pobj, EVAS_CALLBACK_SHOW, _bubble_show_cb, + bubble); + evas_object_event_callback_add(pobj, EVAS_CALLBACK_MOVE, _bubble_move_cb, + bubble); - evas_object_resize(gi->img, ww, hh); + bubble->obj = edje_object_add(evas_object_evas_get(pobj)); + _elm_theme_object_set(wd->obj, bubble->obj , "map", "marker_bubble", + elm_widget_style_get(wd->obj)); + evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_UP, + _bubble_mouse_up_cb, bubble); - obj_rotate_zoom(obj, gi->img); - /*evas_object_move(gi->txt, - xx - px + ax + ox, - yy - py + ay + oy); + bubble->sc = elm_scroller_add(bubble->obj); + elm_widget_style_set(bubble->sc, "map_bubble"); + elm_scroller_content_min_limit(bubble->sc, EINA_FALSE, EINA_TRUE); + elm_scroller_policy_set(bubble->sc, ELM_SCROLLER_POLICY_AUTO, + ELM_SCROLLER_POLICY_OFF); + elm_scroller_bounce_set(bubble->sc, _elm_config->thumbscroll_bounce_enable, + EINA_FALSE); + edje_object_part_swallow(bubble->obj, "elm.swallow.content", bubble->sc); + evas_object_event_callback_add(bubble->sc, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _bubble_sc_hints_changed_cb, bubble); - evas_object_resize(gi->txt, ww, hh); - */ - } - eina_iterator_free(it); -} + bubble->bx = elm_box_add(bubble->sc); + evas_object_size_hint_align_set(bubble->bx, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bubble->bx, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_box_horizontal_set(bubble->bx, EINA_TRUE); + elm_object_content_set(bubble->sc, bubble->bx); -static void -_tile_update(Grid_Item *gi) -{ - evas_object_image_file_set(gi->img, gi->file, NULL); - Evas_Load_Error err = evas_object_image_load_error_get(gi->img); - if (err != EVAS_LOAD_ERROR_NONE) - { - ERR("Image loading error (%s): %s", gi->file, evas_load_error_str(err)); - ecore_file_remove(gi->file); - gi->file_have = EINA_FALSE; - } - else - { - obj_rotate_zoom(gi->wd->obj, gi->img); - evas_object_show(gi->img); - gi->file_have = EINA_TRUE; - //evas_object_text_text_set(gi->txt, gi->file); - //evas_object_show(gi->txt); - } + return bubble; } static void -_tile_downloaded(void *data, const char *file __UNUSED__, int status) +_marker_group_update(Marker_Group* group, Elm_Map_Group_Class *clas, Eina_List *markers) { - Grid_Item *gi = data; - - gi->job = NULL; + EINA_SAFETY_ON_NULL_RETURN(group); + EINA_SAFETY_ON_NULL_RETURN(clas); + EINA_SAFETY_ON_NULL_RETURN(markers); + Widget_Data *wd = clas->wd; + EINA_SAFETY_ON_NULL_RETURN(wd); - if (status == 200) - { - DBG("Download success from %s to %s", gi->source, gi->file); - _tile_update(gi); - gi->wd->finish_num++; - } - else - { - WRN("Download failed from %s to %s (%d) ", gi->source, gi->file, status); - ecore_file_remove(gi->file); - gi->file_have = EINA_FALSE; - } + char buf[PATH_MAX]; + Eina_List *l; + Elm_Map_Marker *marker; + int cnt = 0; + int sum_x = 0, sum_y = 0; - gi->wd->download_num--; - evas_object_smart_callback_call(gi->wd->obj, SIG_DOWNLOADED, NULL); - if (!gi->wd->download_num) + EINA_LIST_FOREACH(markers, l, marker) { - edje_object_signal_emit(elm_smart_scroller_edje_object_get(gi->wd->scr), "elm,state,busy,stop", "elm"); - evas_object_smart_callback_call(gi->wd->obj, SIG_LOADED_DETAIL, NULL); + sum_x += marker->x; + sum_y += marker->y; + cnt++; } - _process_download_list(gi->wd->obj); -} -static void -_process_download_list(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Eina_List *l, *ll; - Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh, tx, ty, gw, gh, xx, yy, ww, hh; - Grid_Item *gi; + group->x = sum_x / cnt; + group->y = sum_y / cnt; + _edj_marker_size_get(wd, &group->w, &group->h); + group->w *=2; + group->h *=2; + group->clas = clas; + group->markers = markers; - evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); - evas_output_viewport_get(evas_object_evas_get(wd->obj), &cvx, &cvy, &cvw, &cvh); + if (clas->style) elm_layout_theme_set(group->obj, "map/marker", clas->style, + elm_widget_style_get(wd->obj)); + else elm_layout_theme_set(group->obj, "map/marker", "radio", + elm_widget_style_get(wd->obj)); - gw = wd->size.w; - gh = wd->size.h; - EINA_LIST_REVERSE_FOREACH_SAFE(wd->download_list, l, ll, gi) + if (clas->func.icon_get) { - xx = gi->out.x; - yy = gi->out.y; - ww = gi->out.w; - hh = gi->out.h; - - if ((gw != gi->g->w) && (gi->g->w > 0)) - { - tx = xx; - xx = ((long long )gw * xx) / gi->g->w; - ww = (((long long)gw * (tx + ww)) / gi->g->w) - xx; - } - if ((gh != gi->g->h) && (gi->g->h > 0)) - { - ty = yy; - yy = ((long long)gh * yy) / gi->g->h; - hh = (((long long)gh * (ty + hh)) / gi->g->h) - yy; - } - if (!ELM_RECTS_INTERSECT(xx - wd->pan_x + ox, - yy - wd->pan_y + oy, - ww, hh, - cvx, cvy, cvw, cvh) || - (gi->zoom != wd->zoom)) - { - wd->download_list = eina_list_remove(wd->download_list, gi); - continue; - } + Evas_Object *icon = NULL; - if (gi->wd->download_num >= MAX_CONCURRENT_DOWNLOAD) break; + icon = elm_object_part_content_get(group->obj, "elm.icon"); + if (icon) evas_object_del(icon); - Eina_Bool ret = ecore_file_download_full(gi->source, gi->file, _tile_downloaded, NULL, gi, &(gi->job), wd->ua); - if (!ret || !gi->job) ERR("Can't start to download from %s to %s", gi->source, gi->file); - else - { - gi->wd->download_num++; - wd->try_num++; - wd->download_list = eina_list_remove(wd->download_list, gi); - if (wd->download_num == 1) - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,state,busy,start", "elm"); - } + icon = clas->func.icon_get(wd->obj, clas->data); + elm_object_part_content_set(group->obj, "elm.icon", icon); } -} + snprintf(buf, sizeof(buf), "%d", cnt); + edje_object_part_text_set(elm_layout_edje_get(group->obj), "elm.text", buf); -static void -_add_download_list(Evas_Object *obj, Grid_Item *gi) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); + if (group->bubble) + { + Eina_List *contents = NULL; - wd->download_list = eina_list_remove(wd->download_list, gi); - wd->download_list = eina_list_append(wd->download_list, gi); - _process_download_list(obj); + EINA_LIST_FOREACH(group->markers, l, marker) + { + Evas_Object *c = marker->clas->func.get(marker->wd->obj, + marker, marker->data); + if (c) contents = eina_list_append(contents, c); + } + _bubble_update(group->bubble, contents); + } } static void -grid_create_all(Evas_Object *obj) +_marker_group_bubble_open_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Grid *g; - int zoom = 0; + EINA_SAFETY_ON_NULL_RETURN(data); + Marker_Group *group = data; + Eina_List *l; + Elm_Map_Marker *marker; + Eina_List *contents = NULL; - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(wd->src); + if (!group->bubble) group->bubble = _bubble_create(group->obj, group->wd); - for (zoom = wd->src->zoom_min; zoom <= wd->src->zoom_max; zoom++) + EINA_LIST_FOREACH(group->markers, l, marker) { - g = calloc(1, sizeof(Grid)); - EINA_SAFETY_ON_NULL_RETURN(g); - g->zoom = zoom; - g->tsize = wd->tsize; - g->wd = wd; - int size = pow(2.0, g->zoom); - g->gw = size; - g->gh = size; - g->w = g->tsize * g->gw; - g->h = g->tsize * g->gh; - - g->grid = eina_matrixsparse_new(g->gh, g->gw, NULL, NULL); - wd->grids = eina_list_append(wd->grids, g); + if (group->wd->markers_max_num <= eina_list_count(contents)) break; + Evas_Object *c = marker->clas->func.get(marker->wd->obj, + marker, marker->data); + if (c) contents = eina_list_append(contents, c); } + _bubble_update(group->bubble, contents); + _bubble_place(group->bubble); } static void -grid_clear_all(Evas_Object *obj) +_marker_group_bringin_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Grid *g; - Grid_Item *gi; - - EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(data); - EINA_LIST_FREE(wd->grids, g) - { - Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); - Eina_Matrixsparse_Cell *cell; + double lon, lat; + Marker_Group *group = data; + _coord_to_region_convert(group->wd, group->x, group->y, group->wd->size.w, + &lon, &lat); + elm_map_region_bring_in(group->wd->obj, lon, lat); +} - EINA_ITERATOR_FOREACH(it, cell) - { - gi = eina_matrixsparse_cell_data_get(cell); - evas_object_del(gi->img); - //evas_object_del(gi->txt); +static void +_marker_group_free(Marker_Group* group) +{ + EINA_SAFETY_ON_NULL_RETURN(group); - if (gi->job) - { - DBG("DOWNLOAD abort %s", gi->file); - ecore_file_download_abort(gi->job); - ecore_file_remove(gi->file); - gi->file_have = EINA_FALSE; - gi->job = NULL; - wd->try_num--; - } - if (gi->file) eina_stringshare_del(gi->file); - if (gi->source) eina_stringshare_del(gi->source); - free(gi); - } - eina_matrixsparse_free(g->grid); - eina_iterator_free(it); - free(g); - } + if (group->bubble) _bubble_free(group->bubble); - EINA_LIST_FREE(wd->download_list, gi); - if (!ecore_file_recursive_rm("/tmp/elm_map/")) WRN("Deletion of /tmp/elm_map/ failed"); + eina_list_free(group->markers); + evas_object_del(group->obj); + free(group); } -static void -grid_unload(Evas_Object *obj, Grid *g) +static Marker_Group* +_marker_group_create(Widget_Data *wd) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - Eina_Iterator *it; - Eina_Matrixsparse_Cell *cell; - Grid_Item *gi; + Marker_Group *group = ELM_NEW(Marker_Group); - EINA_SAFETY_ON_NULL_RETURN(wd); + group->wd = wd; + group->obj = elm_layout_add(wd->obj); + evas_object_smart_member_add(group->obj, wd->pan_smart); + evas_object_stack_above(group->obj, wd->sep_maps_markers); + elm_layout_theme_set(group->obj, "map/marker", "radio", + elm_widget_style_get(wd->obj)); + edje_object_signal_callback_add(elm_layout_edje_get(group->obj), + "open", "elm", _marker_group_bubble_open_cb, + group); + edje_object_signal_callback_add(elm_layout_edje_get(group->obj), + "bringin", "elm", _marker_group_bringin_cb, + group); + return group; +} - it = eina_matrixsparse_iterator_new(g->grid); - EINA_ITERATOR_FOREACH(it, cell) +static void +_marker_bringin_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) +{ + Elm_Map_Marker *marker = data; + EINA_SAFETY_ON_NULL_RETURN(marker); + elm_map_region_bring_in(marker->wd->obj, marker->longitude, marker->latitude); +} + +static void +_marker_bubble_open_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) +{ + EINA_SAFETY_ON_NULL_RETURN(data); + Elm_Map_Marker *marker = data; + + if (!marker->bubble) marker->bubble = _bubble_create(marker->obj, marker->wd); + evas_object_smart_changed(marker->wd->pan_smart); +} + +static void +_marker_update(Elm_Map_Marker *marker) +{ + EINA_SAFETY_ON_NULL_RETURN(marker); + Elm_Map_Marker_Class *clas = marker->clas; + EINA_SAFETY_ON_NULL_RETURN(clas); + + if (clas->style) elm_layout_theme_set(marker->obj, "map/marker", clas->style, + elm_widget_style_get(marker->wd->obj)); + else elm_layout_theme_set(marker->obj, "map/marker", "radio", + elm_widget_style_get(marker->wd->obj)); + + if (clas->func.icon_get) { - gi = eina_matrixsparse_cell_data_get(cell); + Evas_Object *icon = NULL; - if (gi->file_have) - { - evas_object_hide(gi->img); - //evas_object_hide(gi->txt); - evas_object_image_file_set(gi->img, NULL, NULL); - } - else if (gi->job) + icon = elm_object_part_content_get(marker->obj, "elm.icon"); + if (icon) evas_object_del(icon); + + icon = clas->func.icon_get(marker->wd->obj, marker, marker->data); + elm_object_part_content_set(marker->obj, "elm.icon", icon); + } + _region_to_coord_convert(marker->wd, marker->longitude, marker->latitude, + marker->wd->size.w, &(marker->x), &(marker->y)); + + if (marker->bubble) + { + if (marker->content) evas_object_del(marker->content); + if (marker->clas->func.get) + marker->content = marker->clas->func.get(marker->wd->obj, marker, + marker->data); + if (marker->content) { - DBG("DOWNLOAD abort %s", gi->file); - ecore_file_download_abort(gi->job); - ecore_file_remove(gi->file); - gi->job = NULL; - wd->try_num--; + Eina_List *contents = NULL; + contents = eina_list_append(contents, marker->content); + _bubble_update(marker->bubble, contents); } - } - eina_iterator_free(it); + } } + static void -grid_load(Evas_Object *obj, Grid *g) +_marker_place(Widget_Data *wd) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - int x, y; - int size; - Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh, tx, ty, gw, gh, xx, yy, ww, hh; - Eina_Iterator *it; - Eina_Matrixsparse_Cell *cell; - Grid_Item *gi; - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(wd->src); - evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); - evas_output_viewport_get(evas_object_evas_get(wd->obj), &cvx, &cvy, &cvw, &cvh); + Eina_List *l; + + Elm_Map_Marker *marker; + Elm_Map_Group_Class *group_clas; - gw = wd->size.w; - gh = wd->size.h; + Evas_Coord gw, gh; + Evas_Coord px, py; - if ((gw <= 0) || (gh <= 0)) return; + if (wd->paused_markers || (!eina_list_count(wd->markers))) return; - size = g->tsize; - if ((gw != g->w) && (g->w > 0)) - size = ((long long)gw * size) / g->w; - if (size < (g->tsize / 2)) return; // else we will load to much tiles + _pan_geometry_get(wd, &px, &py); - it = eina_matrixsparse_iterator_new(g->grid); + _edj_marker_size_get(wd, &gw, &gh); + gw *= 2; + gh *= 2; - EINA_ITERATOR_FOREACH(it, cell) + EINA_LIST_FOREACH(wd->markers, l, marker) { - gi = eina_matrixsparse_cell_data_get(cell); - - xx = gi->out.x; - yy = gi->out.y; - ww = gi->out.w; - hh = gi->out.h; + _marker_update(marker); + marker->grouped = EINA_FALSE; + marker->leader = EINA_FALSE; + } - if ((gw != g->w) && (g->w > 0)) - { - tx = xx; - xx = ((long long )gw * xx) / g->w; - ww = (((long long)gw * (tx + ww)) / g->w) - xx; - } - if ((gh != g->h) && (g->h > 0)) + EINA_LIST_FOREACH(wd->group_classes, l, group_clas) + { + Eina_List *ll; + EINA_LIST_FOREACH(group_clas->markers, ll, marker) { - ty = yy; - yy = ((long long)gh * yy) / g->h; - hh = (((long long)gh * (ty + hh)) / g->h) - yy; - } + Eina_List *lll; + Elm_Map_Marker *mm; + Eina_List *markers = NULL; - if (!ELM_RECTS_INTERSECT(xx - wd->pan_x + ox, - yy - wd->pan_y + oy, - ww, hh, - cvx, cvy, cvw, cvh)) - { - if (gi->file_have) + if (marker->grouped) continue; + if (group_clas->zoom_grouped < wd->zoom) { - evas_object_hide(gi->img); - //evas_object_hide(gi->txt); - evas_object_image_file_set(gi->img, NULL, NULL); + marker->grouped = EINA_FALSE; + continue; } - else if (gi->job) + + EINA_LIST_FOREACH(group_clas->markers, lll, mm) { - DBG("Download abort %s", gi->file); - ecore_file_download_abort(gi->job); - ecore_file_remove(gi->file); - gi->job = NULL; - wd->try_num--; + if (marker == mm || mm->grouped) continue; + if (ELM_RECTS_INTERSECT(mm->x, mm->y, mm->w, mm->h, + marker->x, marker->y, gw, gh)) + { + // mm is group follower. + mm->leader = EINA_FALSE; + mm->grouped = EINA_TRUE; + markers = eina_list_append(markers, mm); + } } + if (eina_list_count(markers) >= 1) + { + // marker is group leader. + marker->leader = EINA_TRUE; + marker->grouped = EINA_TRUE; + markers = eina_list_append(markers, marker); + + if (!marker->group) marker->group = _marker_group_create(wd); + _marker_group_update(marker->group, group_clas, markers); + } } } - eina_iterator_free(it); - - xx = wd->pan_x / size - 1; - if (xx < 0) xx = 0; - - yy = wd->pan_y / size - 1; - if (yy < 0) yy = 0; - ww = ow / size + 2; - if (xx + ww >= g->gw) ww = g->gw - xx - 1; + EINA_LIST_FOREACH(wd->markers, l, marker) + { - hh = oh / size + 2; - if (yy + hh >= g->gh) hh = g->gh - yy - 1; + if (marker->grouped || + (marker->group_clas && + (marker->group_clas->hide || + marker->group_clas->zoom_displayed > wd->zoom))) + evas_object_hide(marker->obj); + else + { + Evas_Coord x, y; + _coord_rotate(marker->x + px, marker->y + py, wd->rotate.cx, + wd->rotate.cy, wd->rotate.d, &x, &y); + _obj_place(marker->obj, x - (marker->w / 2), y - (marker->h / 2), + marker->w, marker->h); + } + } - for (y = yy; y <= yy + hh; y++) + EINA_LIST_FOREACH(wd->markers, l, marker) { - for (x = xx; x <= xx + ww; x++) + Marker_Group *group = marker->group; + if (!group) continue; + + if (!marker->leader || (group->clas->hide) || + (group->clas->zoom_displayed > wd->zoom)) + evas_object_hide(group->obj); + else { - gi = eina_matrixsparse_data_idx_get(g->grid, y, x); + Evas_Coord x, y; + _coord_rotate(group->x + px, group->y + py, wd->rotate.cx, + wd->rotate.cy, wd->rotate.d, &x, &y); + _obj_place(group->obj, x - (group->w / 2), y - (group->h / 2), + group->w, group->h); + } + } +} - if (!gi) - { - char buf[PATH_MAX]; - char buf2[PATH_MAX]; - char *source; - - gi = calloc(1, sizeof(Grid_Item)); - EINA_SAFETY_ON_NULL_RETURN(gi); - - gi->wd = wd; - gi->g = g; - gi->zoom = g->zoom; - gi->file_have = EINA_FALSE; - gi->job = NULL; - - gi->src.x = x * g->tsize; - gi->src.y = y * g->tsize; - gi->src.w = g->tsize; - gi->src.h = g->tsize; - - gi->out.x = gi->src.x; - gi->out.y = gi->src.y; - gi->out.w = gi->src.w; - gi->out.h = gi->src.h; - - gi->img = evas_object_image_add(evas_object_evas_get(obj)); - evas_object_image_scale_hint_set(gi->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); - evas_object_image_filled_set(gi->img, 1); - - evas_object_smart_member_add(gi->img, wd->pan_smart); - elm_widget_sub_object_add(obj, gi->img); - evas_object_pass_events_set(gi->img, EINA_TRUE); - evas_object_stack_below(gi->img, wd->sep_maps_markers); - -/* gi->txt = evas_object_text_add(evas_object_evas_get(obj)); - evas_object_text_font_set(gi->txt, "Vera", 12); - evas_object_color_set(gi->txt, 100, 100, 100, 255); - evas_object_smart_member_add(gi->txt, - wd->pan_smart); - elm_widget_sub_object_add(obj, gi->txt); - evas_object_pass_events_set(gi->txt, EINA_TRUE); -*/ - snprintf(buf, sizeof(buf), CACHE_PATH, wd->id, g->zoom, x); - snprintf(buf2, sizeof(buf2), CACHE_FILE_PATH, buf, y); - if (!ecore_file_exists(buf)) ecore_file_mkpath(buf); +static void +_grid_item_coord_get(Grid_Item *gi, int *x, int *y, int *w, int *h) +{ + EINA_SAFETY_ON_NULL_RETURN(gi); - eina_stringshare_replace(&gi->file, buf2); - source = wd->src->url_cb(obj, x, y, g->zoom); - if ((!source) || (strlen(source)==0)) - { - eina_stringshare_replace(&gi->source, NULL); - WRN("Getting source url failed: %s", gi->file); - } - else eina_stringshare_replace(&gi->source, source); - if (source) free(source); + if (x) *x = gi->x * gi->wd->size.tile; + if (y) *y = gi->y * gi->wd->size.tile; + if (w) *w = gi->wd->size.tile; + if (h) *h = gi->wd->size.tile; +} - eina_matrixsparse_data_idx_set(g->grid, y, x, gi); - } +static Eina_Bool +_grid_item_intersect(Grid_Item *gi) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(gi, EINA_FALSE); - if (gi->file_have) - { - DBG("File exists: %s", gi->file); - _tile_update(gi); - } - else if (!gi->job) - { - DBG("Added to download list: %s", gi->file); - _add_download_list(obj, gi); - } -======= - Eina_Bool wheel_disabled : 1; + Evas_Coord px, py; + Evas_Coord vw, vh; + Evas_Coord x, y, w, h; - unsigned int markers_max_num; - Eina_Bool paused_markers : 1; - Eina_List *group_classes; - Eina_List *marker_classes; - Eina_List *markers; + _pan_geometry_get(gi->wd, &px, &py); + _viewport_size_get(gi->wd, &vw, &vh); + _grid_item_coord_get(gi, &x, &y, &w, &h); + return ELM_RECTS_INTERSECT(x + px, y + py, w, h, 0, 0, vw, vh); +} - Eina_List *routes; - Eina_List *track; - Eina_List *names; +static void +_grid_item_update(Grid_Item *gi) +{ + evas_object_image_file_set(gi->img, gi->file, NULL); + if (!gi->wd->zoom_timer && !gi->wd->scr_timer) + evas_object_image_smooth_scale_set(gi->img, EINA_TRUE); + else evas_object_image_smooth_scale_set(gi->img, EINA_FALSE); - Eina_List *overlays; -}; + Evas_Load_Error err = evas_object_image_load_error_get(gi->img); + if (err != EVAS_LOAD_ERROR_NONE) + { + ERR("Image loading error (%s): %s", gi->file, evas_load_error_str(err)); + ecore_file_remove(gi->file); + gi->file_have = EINA_FALSE; + } + else + { + Evas_Coord px, py; + Evas_Coord x, y, w, h; -static char *_mapnik_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_osmarender_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_cyclemap_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_mapquest_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_mapquest_aerial_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom); -static char *_yours_url_cb(Evas_Object *obj __UNUSED__, const char *type_name, int method, double flon, double flat, double tlon, double tlat); -static char *_nominatim_url_cb(Evas_Object *obj, int method, const char *name, double lon, double lat); -/* -static char *_monav_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) -static char *_ors_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat); -*/ + _pan_geometry_get(gi->wd, &px, &py); + _grid_item_coord_get(gi, &x, &y, &w, &h); -const Source_Tile src_tiles[] = -{ - {"Mapnik", 0, 18, _mapnik_url_cb, NULL, NULL}, - {"Osmarender", 0, 17, _osmarender_url_cb, NULL, NULL}, - {"CycleMap", 0, 16, _cyclemap_url_cb, NULL, NULL}, - {"MapQuest", 0, 18, _mapquest_url_cb, NULL, NULL}, - {"MapQuest Open Aerial", 0, 11, _mapquest_aerial_url_cb, NULL, NULL}, -}; - -// FIXME: Fix more open sources -const Source_Route src_routes[] = -{ - {"Yours", _yours_url_cb} // http://www.yournavigation.org/ - //{"Monav", _monav_url_cb}, - //{"ORS", _ors_url_cb}, // http://www.openrouteservice.org -}; + _obj_place(gi->img, x + px, y + py, w, h); + _obj_rotate(gi->wd, gi->img); + gi->file_have = EINA_TRUE; + } +} -// FIXME: Add more open sources -const Source_Name src_names[] = +static void +_grid_item_load(Grid_Item *gi) { - {"Nominatim", _nominatim_url_cb} -}; - -static const char *widtype = NULL; -static Evas_Smart_Class parent_sc = EVAS_SMART_CLASS_INIT_NULL; -static Evas_Smart_Class sc; -static Evas_Smart *smart; -static int idnum = 1; - -static const char SIG_CLICKED[] = "clicked"; -static const char SIG_CLICKED_DOUBLE[] = "clicked,double"; -static const char SIG_PRESS[] = "press"; -static const char SIG_LONGPRESSED[] = "longpressed"; -static const char SIG_SCROLL[] = "scroll"; -static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; -static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; -static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start"; -static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; -static const char SIG_ZOOM_START[] = "zoom,start"; -static const char SIG_ZOOM_STOP[] = "zoom,stop"; -static const char SIG_ZOOM_CHANGE[] = "zoom,change"; -static const char SIG_TILE_LOAD[] = "tile,load"; -static const char SIG_TILE_LOADED[] = "tile,loaded"; -static const char SIG_TILE_LOADED_FAIL[] = "tile,loaded,fail"; -static const char SIG_ROUTE_LOAD[] = "route,load"; -static const char SIG_ROUTE_LOADED[] = "route,loaded"; -static const char SIG_ROUTE_LOADED_FAIL[] = "route,loaded,fail"; -static const char SIG_NAME_LOAD[] = "name,load"; -static const char SIG_NAME_LOADED[] = "name,loaded"; -static const char SIG_NAME_LOADED_FAIL[] = "name,loaded,fail"; -static const char SIG_OVERLAY_CLICKED[] = "overlay,clicked"; -static const Evas_Smart_Cb_Description _signals[] = { - {SIG_CLICKED, ""}, - {SIG_CLICKED_DOUBLE, ""}, - {SIG_PRESS, ""}, - {SIG_LONGPRESSED, ""}, - {SIG_SCROLL, ""}, - {SIG_SCROLL_DRAG_START, ""}, - {SIG_SCROLL_DRAG_STOP, ""}, - {SIG_SCROLL_ANIM_START, ""}, - {SIG_SCROLL_ANIM_STOP, ""}, - {SIG_ZOOM_START, ""}, - {SIG_ZOOM_STOP, ""}, - {SIG_ZOOM_CHANGE, ""}, - {SIG_TILE_LOAD, ""}, - {SIG_TILE_LOADED, ""}, - {SIG_TILE_LOADED_FAIL, ""}, - {SIG_ROUTE_LOAD, ""}, - {SIG_ROUTE_LOADED, ""}, - {SIG_ROUTE_LOADED_FAIL, ""}, - {SIG_NAME_LOAD, ""}, - {SIG_NAME_LOADED, ""}, - {SIG_NAME_LOADED_FAIL, ""}, - {SIG_OVERLAY_CLICKED, ""}, - {NULL, NULL} -}; + EINA_SAFETY_ON_NULL_RETURN(gi); + if (gi->file_have) _grid_item_update(gi); + else if (!gi->job) + { + gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi); + gi->wd->download_list = eina_list_append(gi->wd->download_list, gi); + } +} static void -_edj_marker_size_get(Widget_Data *wd, Evas_Coord *w, Evas_Coord *h) +_grid_item_unload(Grid_Item *gi) { - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(w); - EINA_SAFETY_ON_NULL_RETURN(h); - - Evas_Object *edj; - const char *s; + EINA_SAFETY_ON_NULL_RETURN(gi); + if (gi->file_have) + { + evas_object_hide(gi->img); + evas_object_image_file_set(gi->img, NULL, NULL); + } + else if (gi->job) + { + ecore_file_download_abort(gi->job); + ecore_file_remove(gi->file); + gi->job = NULL; + gi->wd->try_num--; + } + else gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi); - edj = edje_object_add(evas_object_evas_get(wd->obj)); - _elm_theme_object_set(wd->obj, edj, "map/marker", "radio", - elm_widget_style_get(wd->obj)); - s = edje_object_data_get(edj, "size_w"); - if (s) *w = atoi(s); - else *w = 0; - s = edje_object_data_get(edj, "size_h"); - if (s) *h = atoi(s); - else *h = 0; - evas_object_del(edj); } -static void -_coord_rotate(Evas_Coord x, Evas_Coord y, Evas_Coord cx, Evas_Coord cy, double degree, Evas_Coord *xx, Evas_Coord *yy) +static Grid_Item * +_grid_item_create(Grid *g, Evas_Coord x, Evas_Coord y) { - EINA_SAFETY_ON_NULL_RETURN(xx); - EINA_SAFETY_ON_NULL_RETURN(yy); + EINA_SAFETY_ON_NULL_RETURN_VAL(g, NULL); + char buf[PATH_MAX]; + char buf2[PATH_MAX]; + char *url; + Grid_Item *gi; - double r = (degree * M_PI) / 180.0; + gi = ELM_NEW(Grid_Item); + gi->wd = g->wd; + gi->g = g; + gi->x = x; + gi->y = y; - if (xx) *xx = ((x - cx) * cos(r)) + ((y - cy) * cos(r + M_PI_2)) + cx; - if (yy) *yy = ((x - cx) * sin(r)) + ((y - cy) * sin(r + M_PI_2)) + cy; -} + gi->file_have = EINA_FALSE; + gi->job = NULL; -static void -_obj_rotate(Widget_Data *wd, Evas_Object *obj) -{ - Evas_Coord w, h, ow, oh; - evas_map_util_points_populate_from_object(wd->map, obj); + gi->img = evas_object_image_add(evas_object_evas_get(g->wd->obj)); + evas_object_image_smooth_scale_set(gi->img, EINA_FALSE); + evas_object_image_scale_hint_set(gi->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); + evas_object_image_filled_set(gi->img, 1); + evas_object_smart_member_add(gi->img, g->wd->pan_smart); + evas_object_pass_events_set(gi->img, EINA_TRUE); + evas_object_stack_below(gi->img, g->wd->sep_maps_markers); - evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); - evas_object_image_size_get(obj, &w, &h); - if ((w > ow) || (h > oh)) + snprintf(buf, sizeof(buf), CACHE_TILE_ROOT, g->wd->id, g->zoom, x); + snprintf(buf2, sizeof(buf2), CACHE_TILE_PATH, buf, y); + if (!ecore_file_exists(buf)) ecore_file_mkpath(buf); + + eina_stringshare_replace(&gi->file, buf2); + url = g->wd->src_tile->url_cb(g->wd->obj, x, y, g->zoom); + if ((!url) || (!strlen(url))) { - evas_map_point_image_uv_set(wd->map, 0, 0, 0); - evas_map_point_image_uv_set(wd->map, 1, w, 0); - evas_map_point_image_uv_set(wd->map, 2, w, h); - evas_map_point_image_uv_set(wd->map, 3, 0, h); + eina_stringshare_replace(&gi->url, NULL); + ERR("Getting source url failed: %s", gi->file); } - evas_map_util_rotate(wd->map, wd->rotate.d, wd->rotate.cx, wd->rotate.cy); - - evas_object_map_set(obj, wd->map); - evas_object_map_enable_set(obj, EINA_TRUE); + else eina_stringshare_replace(&gi->url, url); + if (url) free(url); + eina_matrixsparse_data_idx_set(g->grid, y, x, gi); + return gi; } static void -_obj_place(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +_grid_item_free(Grid_Item *gi) { - EINA_SAFETY_ON_NULL_RETURN(obj); - - evas_object_move(obj, x, y); - evas_object_resize(obj, w, h); - evas_object_show(obj); + EINA_SAFETY_ON_NULL_RETURN(gi); + _grid_item_unload(gi); + if (gi->g && gi->g->grid) eina_matrixsparse_data_idx_set(gi->g->grid, + gi->y, gi->x, NULL); + if (gi->url) eina_stringshare_del(gi->url); + if (gi->file) eina_stringshare_del(gi->file); + if (gi->img) evas_object_del(gi->img); + if (gi->file_have) ecore_file_remove(gi->file); + free(gi); } static void -_coord_to_region_convert(Widget_Data *wd, Evas_Coord x, Evas_Coord y, Evas_Coord size, double *lon, double *lat) +_downloaded_cb(void *data, const char *file __UNUSED__, int status) { - EINA_SAFETY_ON_NULL_RETURN(wd); + Grid_Item *gi = data; - int zoom = floor(log(size / wd->size.tile) / log(2)); - if ((wd->src_tile) && (wd->src_tile->coord_to_geo)) + if (status == 200) { - if (wd->src_tile->coord_to_geo(wd->obj, zoom, x, y, size, lon, lat)) - return; + DBG("Download success from %s to %s", gi->url, gi->file); + _grid_item_update(gi); + gi->wd->finish_num++; + evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOADED, NULL); } - - if (lon) *lon = (x / (double)size * 360.0) - 180; - if (lat) + else { - double n = ELM_PI - (2.0 * ELM_PI * y / size); - *lat = 180.0 / ELM_PI * atan(0.5 * (exp(n) - exp(-n))); + WRN("Download failed from %s to %s (%d) ", gi->url, gi->file, status); + ecore_file_remove(gi->file); + gi->file_have = EINA_FALSE; + evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOADED_FAIL, NULL); } + + gi->job = NULL; + gi->wd->download_num--; + if (!gi->wd->download_num) + edje_object_signal_emit(elm_smart_scroller_edje_object_get(gi->wd->scr), + "elm,state,busy,stop", "elm"); } -static void -_region_to_coord_convert(Widget_Data *wd, double lon, double lat, Evas_Coord size, Evas_Coord *x, Evas_Coord *y) +static Eina_Bool +_download_job(void *data) { - EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); + Widget_Data *wd = data; - int zoom = floor(log(size / 256) / log(2)); - if ((wd->src_tile) && (wd->src_tile->geo_to_coord)) + Eina_List *l, *ll; + Grid_Item *gi; + + if (!eina_list_count(wd->download_list)) { - if (wd->src_tile->geo_to_coord(wd->obj, zoom, lon, lat, size, x, y)) return; + wd->download_idler = NULL; + return ECORE_CALLBACK_CANCEL; } - if (x) *x = floor((lon + 180.0) / 360.0 * size); - if (y) - *y = floor((1.0 - log(tan(lat * ELM_PI / 180.0) + (1.0 / cos(lat * ELM_PI / 180.0))) - / ELM_PI) / 2.0 * size); -} + EINA_LIST_REVERSE_FOREACH_SAFE(wd->download_list, l, ll, gi) + { + if (gi->g->zoom != wd->zoom || !_grid_item_intersect(gi)) + { + wd->download_list = eina_list_remove(wd->download_list, gi); + continue; + } + if (wd->download_num >= MAX_CONCURRENT_DOWNLOAD) + return ECORE_CALLBACK_RENEW; -static void -_viewport_size_get(Widget_Data *wd, Evas_Coord *vw, Evas_Coord *vh) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - - Evas_Coord x, y, w, h; - evas_object_geometry_get(wd->pan_smart, &x, &y, &w, &h); - if (vw) *vw = (x * 2) + w; - if (vh) *vh = (y * 2) + h; -} - -static void -_pan_geometry_get(Widget_Data *wd, Evas_Coord *px, Evas_Coord *py) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - - Evas_Coord x, y, vx, vy, vw, vh; - elm_smart_scroller_child_pos_get(wd->scr, &x, &y); - evas_object_geometry_get(wd->pan_smart, &vx, &vy, &vw, &vh); - x = -x; - y = -y; - if (vw > wd->size.w) x += (((vw - wd->size.w) / 2) + vx); - else x -= vx; - if (vh > wd->size.h) y += (((vh - wd->size.h) / 2) + vy); - else y -= vy; - if (px) *px = x; - if (py) *py = y; - } - -static void -_region_show(void *data) -{ - EINA_SAFETY_ON_NULL_RETURN(data); - Delayed_Data *dd = data; - int x, y, w, h; - - _region_to_coord_convert(dd->wd, dd->lon, dd->lat, dd->wd->size.w, &x, &y); - _viewport_size_get(dd->wd, &w, &h); - x = x - (w / 2); - y = y - (h / 2); - elm_smart_scroller_child_region_show(dd->wd->scr, x, y, w, h); - evas_object_smart_changed(dd->wd->pan_smart); -} - -static void -_bubble_update(Marker_Bubble *bubble, Eina_List *contents) -{ - EINA_SAFETY_ON_NULL_RETURN(bubble); - EINA_SAFETY_ON_NULL_RETURN(contents); - - Eina_List *l; - Evas_Object *c; - - elm_box_clear(bubble->bx); - EINA_LIST_FOREACH(contents, l, c) elm_box_pack_end(bubble->bx, c); -} - -static void -_bubble_place(Marker_Bubble *bubble) -{ - EINA_SAFETY_ON_NULL_RETURN(bubble); - - Evas_Coord x, y, w, h; - Evas_Coord xx, yy, ww, hh; - const char *s; - - if ((!bubble->obj) || (!bubble->pobj)) return; - evas_object_geometry_get(bubble->pobj, &x, &y, &w, NULL); - - s = edje_object_data_get(bubble->obj, "size_w"); - if (s) ww = atoi(s); - else ww = 0; - - edje_object_size_min_calc(bubble->obj, NULL, &hh); - s = edje_object_data_get(bubble->obj, "size_h"); - if (s) h = atoi(s); - else h = 0; - if (hh < h) hh = h; - - xx = x + (w / 2) - (ww / 2); - yy = y - hh; - - _obj_place(bubble->obj, xx, yy, ww, hh); - evas_object_raise(bubble->obj); -} - -static void -_bubble_sc_hints_changed_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Marker_Bubble *bubble = data; - EINA_SAFETY_ON_NULL_RETURN(bubble); - _bubble_place(data); -} - -static void -_bubble_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Marker_Bubble *bubble = data; - EINA_SAFETY_ON_NULL_RETURN(bubble); - _bubble_place(bubble); -} - -static void -_bubble_hide_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Marker_Bubble *bubble = data; - EINA_SAFETY_ON_NULL_RETURN(bubble); - evas_object_hide(bubble->obj); -} - -static void -_bubble_show_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Marker_Bubble *bubble = data; - EINA_SAFETY_ON_NULL_RETURN(bubble); - _bubble_place(bubble); -} - -static void -_bubble_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Marker_Bubble *bubble = data; - EINA_SAFETY_ON_NULL_RETURN(bubble); - _bubble_place(bubble); -} - -static void -_bubble_free(Marker_Bubble* bubble) -{ - EINA_SAFETY_ON_NULL_RETURN(bubble); - - evas_object_del(bubble->bx); - evas_object_del(bubble->sc); - evas_object_del(bubble->obj); - free(bubble); -} - -static Marker_Bubble* -_bubble_create(Evas_Object *pobj, Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(pobj, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - - Marker_Bubble *bubble = ELM_NEW(Marker_Bubble); - EINA_SAFETY_ON_NULL_RETURN_VAL(bubble, NULL); - - bubble->wd = wd; - bubble->pobj = pobj; - evas_object_event_callback_add(pobj, EVAS_CALLBACK_HIDE, _bubble_hide_cb, - bubble); - evas_object_event_callback_add(pobj, EVAS_CALLBACK_SHOW, _bubble_show_cb, - bubble); - evas_object_event_callback_add(pobj, EVAS_CALLBACK_MOVE, _bubble_move_cb, - bubble); - - bubble->obj = edje_object_add(evas_object_evas_get(pobj)); - _elm_theme_object_set(wd->obj, bubble->obj , "map", "marker_bubble", - elm_widget_style_get(wd->obj)); - evas_object_event_callback_add(bubble->obj, EVAS_CALLBACK_MOUSE_UP, - _bubble_mouse_up_cb, bubble); - - bubble->sc = elm_scroller_add(bubble->obj); - elm_widget_style_set(bubble->sc, "map_bubble"); - elm_scroller_content_min_limit(bubble->sc, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(bubble->sc, ELM_SCROLLER_POLICY_AUTO, - ELM_SCROLLER_POLICY_OFF); - elm_scroller_bounce_set(bubble->sc, _elm_config->thumbscroll_bounce_enable, - EINA_FALSE); - edje_object_part_swallow(bubble->obj, "elm.swallow.content", bubble->sc); - evas_object_event_callback_add(bubble->sc, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _bubble_sc_hints_changed_cb, bubble); - - bubble->bx = elm_box_add(bubble->sc); - evas_object_size_hint_align_set(bubble->bx, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(bubble->bx, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_box_horizontal_set(bubble->bx, EINA_TRUE); - elm_object_content_set(bubble->sc, bubble->bx); - - return bubble; -} - -static void -_marker_group_update(Marker_Group* group, Elm_Map_Group_Class *clas, Eina_List *markers) -{ - EINA_SAFETY_ON_NULL_RETURN(group); - EINA_SAFETY_ON_NULL_RETURN(clas); - EINA_SAFETY_ON_NULL_RETURN(markers); - Widget_Data *wd = clas->wd; - EINA_SAFETY_ON_NULL_RETURN(wd); - - char buf[PATH_MAX]; - Eina_List *l; - Elm_Map_Marker *marker; - int cnt = 0; - int sum_x = 0, sum_y = 0; - - EINA_LIST_FOREACH(markers, l, marker) - { - sum_x += marker->x; - sum_y += marker->y; - cnt++; - } - - group->x = sum_x / cnt; - group->y = sum_y / cnt; - _edj_marker_size_get(wd, &group->w, &group->h); - group->w *=2; - group->h *=2; - group->clas = clas; - group->markers = markers; - - if (clas->style) elm_layout_theme_set(group->obj, "map/marker", clas->style, - elm_widget_style_get(wd->obj)); - else elm_layout_theme_set(group->obj, "map/marker", "radio", - elm_widget_style_get(wd->obj)); - - - if (clas->func.icon_get) - { - Evas_Object *icon = NULL; - - icon = elm_object_part_content_get(group->obj, "elm.icon"); - if (icon) evas_object_del(icon); - - icon = clas->func.icon_get(wd->obj, clas->data); - elm_object_part_content_set(group->obj, "elm.icon", icon); - } - snprintf(buf, sizeof(buf), "%d", cnt); - edje_object_part_text_set(elm_layout_edje_get(group->obj), "elm.text", buf); - - if (group->bubble) - { - Eina_List *contents = NULL; - - EINA_LIST_FOREACH(group->markers, l, marker) - { - Evas_Object *c = marker->clas->func.get(marker->wd->obj, - marker, marker->data); - if (c) contents = eina_list_append(contents, c); - } - _bubble_update(group->bubble, contents); - } -} - -static void -_marker_group_bubble_open_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) -{ - EINA_SAFETY_ON_NULL_RETURN(data); - Marker_Group *group = data; - Eina_List *l; - Elm_Map_Marker *marker; - Eina_List *contents = NULL; - - if (!group->bubble) group->bubble = _bubble_create(group->obj, group->wd); - - EINA_LIST_FOREACH(group->markers, l, marker) - { - if (group->wd->markers_max_num <= eina_list_count(contents)) break; - Evas_Object *c = marker->clas->func.get(marker->wd->obj, - marker, marker->data); - if (c) contents = eina_list_append(contents, c); - } - _bubble_update(group->bubble, contents); - _bubble_place(group->bubble); -} - -static void -_marker_group_bringin_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) -{ - EINA_SAFETY_ON_NULL_RETURN(data); - - double lon, lat; - Marker_Group *group = data; - _coord_to_region_convert(group->wd, group->x, group->y, group->wd->size.w, - &lon, &lat); - elm_map_region_bring_in(group->wd->obj, lon, lat); -} - -static void -_marker_group_free(Marker_Group* group) -{ - EINA_SAFETY_ON_NULL_RETURN(group); - - if (group->bubble) _bubble_free(group->bubble); - - eina_list_free(group->markers); - evas_object_del(group->obj); - - free(group); -} - -static Marker_Group* -_marker_group_create(Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - - Marker_Group *group = ELM_NEW(Marker_Group); - - group->wd = wd; - group->obj = elm_layout_add(wd->obj); - evas_object_smart_member_add(group->obj, wd->pan_smart); - evas_object_stack_above(group->obj, wd->sep_maps_markers); - elm_layout_theme_set(group->obj, "map/marker", "radio", - elm_widget_style_get(wd->obj)); - edje_object_signal_callback_add(elm_layout_edje_get(group->obj), - "open", "elm", _marker_group_bubble_open_cb, - group); - edje_object_signal_callback_add(elm_layout_edje_get(group->obj), - "bringin", "elm", _marker_group_bringin_cb, - group); - return group; -} - -static void -_marker_bringin_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) -{ - Elm_Map_Marker *marker = data; - EINA_SAFETY_ON_NULL_RETURN(marker); - elm_map_region_bring_in(marker->wd->obj, marker->longitude, marker->latitude); -} - -static void -_marker_bubble_open_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) -{ - EINA_SAFETY_ON_NULL_RETURN(data); - Elm_Map_Marker *marker = data; - - if (!marker->bubble) marker->bubble = _bubble_create(marker->obj, marker->wd); - evas_object_smart_changed(marker->wd->pan_smart); -} - -static void -_marker_update(Elm_Map_Marker *marker) -{ - EINA_SAFETY_ON_NULL_RETURN(marker); - Elm_Map_Marker_Class *clas = marker->clas; - EINA_SAFETY_ON_NULL_RETURN(clas); - - if (clas->style) elm_layout_theme_set(marker->obj, "map/marker", clas->style, - elm_widget_style_get(marker->wd->obj)); - else elm_layout_theme_set(marker->obj, "map/marker", "radio", - elm_widget_style_get(marker->wd->obj)); - - if (clas->func.icon_get) - { - Evas_Object *icon = NULL; - - icon = elm_object_part_content_get(marker->obj, "elm.icon"); - if (icon) evas_object_del(icon); - - icon = clas->func.icon_get(marker->wd->obj, marker, marker->data); - elm_object_part_content_set(marker->obj, "elm.icon", icon); - } - _region_to_coord_convert(marker->wd, marker->longitude, marker->latitude, - marker->wd->size.w, &(marker->x), &(marker->y)); - - if (marker->bubble) - { - if (marker->content) evas_object_del(marker->content); - if (marker->clas->func.get) - marker->content = marker->clas->func.get(marker->wd->obj, marker, - marker->data); - if (marker->content) - { - Eina_List *contents = NULL; - contents = eina_list_append(contents, marker->content); - _bubble_update(marker->bubble, contents); - } - } -} - - - -static void -_marker_place(Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - - Eina_List *l; - - Elm_Map_Marker *marker; - Elm_Map_Group_Class *group_clas; - - Evas_Coord gw, gh; - Evas_Coord px, py; - - if (wd->paused_markers || (!eina_list_count(wd->markers))) return; - - _pan_geometry_get(wd, &px, &py); - - _edj_marker_size_get(wd, &gw, &gh); - gw *= 2; - gh *= 2; - - EINA_LIST_FOREACH(wd->markers, l, marker) - { - _marker_update(marker); - marker->grouped = EINA_FALSE; - marker->leader = EINA_FALSE; - } - - EINA_LIST_FOREACH(wd->group_classes, l, group_clas) - { - Eina_List *ll; - EINA_LIST_FOREACH(group_clas->markers, ll, marker) - { - Eina_List *lll; - Elm_Map_Marker *mm; - Eina_List *markers = NULL; - - if (marker->grouped) continue; - if (group_clas->zoom_grouped < wd->zoom) - { - marker->grouped = EINA_FALSE; - continue; - } - - EINA_LIST_FOREACH(group_clas->markers, lll, mm) - { - if (marker == mm || mm->grouped) continue; - if (ELM_RECTS_INTERSECT(mm->x, mm->y, mm->w, mm->h, - marker->x, marker->y, gw, gh)) - { - // mm is group follower. - mm->leader = EINA_FALSE; - mm->grouped = EINA_TRUE; - markers = eina_list_append(markers, mm); - } - } - if (eina_list_count(markers) >= 1) - { - // marker is group leader. - marker->leader = EINA_TRUE; - marker->grouped = EINA_TRUE; - markers = eina_list_append(markers, marker); - - if (!marker->group) marker->group = _marker_group_create(wd); - _marker_group_update(marker->group, group_clas, markers); - } - } - } - - EINA_LIST_FOREACH(wd->markers, l, marker) - { - - if (marker->grouped || - (marker->group_clas && - (marker->group_clas->hide || - marker->group_clas->zoom_displayed > wd->zoom))) - evas_object_hide(marker->obj); - else - { - Evas_Coord x, y; - _coord_rotate(marker->x + px, marker->y + py, wd->rotate.cx, - wd->rotate.cy, wd->rotate.d, &x, &y); - _obj_place(marker->obj, x - (marker->w / 2), y - (marker->h / 2), - marker->w, marker->h); - } - } - - EINA_LIST_FOREACH(wd->markers, l, marker) - { - Marker_Group *group = marker->group; - if (!group) continue; - - if (!marker->leader || (group->clas->hide) || - (group->clas->zoom_displayed > wd->zoom)) - evas_object_hide(group->obj); - else - { - Evas_Coord x, y; - _coord_rotate(group->x + px, group->y + py, wd->rotate.cx, - wd->rotate.cy, wd->rotate.d, &x, &y); - _obj_place(group->obj, x - (group->w / 2), y - (group->h / 2), - group->w, group->h); ->>>>>>> remotes/origin/upstream - } - } -} - -static void -<<<<<<< HEAD -_smooth_update(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Eina_List *l; - Grid *g; - - if (!wd) return; - EINA_LIST_FOREACH(wd->grids, l, g) - { - Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); - Eina_Matrixsparse_Cell *cell; - - EINA_ITERATOR_FOREACH(it, cell) - { - Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); - evas_object_image_smooth_scale_set(gi->img, (!wd->nosmooth)); - } - eina_iterator_free(it); - } -} - -static Eina_Bool -_scr_timeout(void *data) -{ - ELM_CHECK_WIDTYPE(data, widtype) ECORE_CALLBACK_CANCEL; - Widget_Data *wd = elm_widget_data_get(data); - - if (!wd) return ECORE_CALLBACK_CANCEL; - wd->nosmooth--; - if (!wd->nosmooth) _smooth_update(data); - wd->scr_timer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -static void -_scr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - - if (!wd) return; - if (!wd->scr_timer) - { - wd->nosmooth++; - if (wd->nosmooth == 1) _smooth_update(data); - } - if (wd->scr_timer) ecore_timer_del(wd->scr_timer); - wd->scr_timer = ecore_timer_add(0.5, _scr_timeout, data); -} - -static void -zoom_do(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord xx, yy, ow, oh; - - if (!wd) return; - wd->size.w = wd->size.nw; - wd->size.h = wd->size.nh; - - elm_smart_scroller_child_viewport_size_get(wd->scr, &ow, &oh); - - if (wd->center_on.enabled) - { - elm_map_utils_convert_geo_into_coord(obj, wd->center_on.lon, wd->center_on.lat, wd->size.w, &xx, &yy); - xx -= ow / 2; - yy -= oh / 2; - } - else - { - xx = (wd->size.spos.x * wd->size.w) - (ow / 2); - yy = (wd->size.spos.y * wd->size.h) - (oh / 2); - } - - - if (xx < 0) xx = 0; - else if (xx > (wd->size.w - ow)) xx = wd->size.w - ow; - if (yy < 0) yy = 0; - else if (yy > (wd->size.h - oh)) yy = wd->size.h - oh; - - wd->show.show = EINA_TRUE; - wd->show.x = xx; - wd->show.y = yy; - wd->show.w = ow; - wd->show.h = oh; - - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); -} - -static Eina_Bool -_zoom_timeout(void *data) -{ - ELM_CHECK_WIDTYPE(data, widtype) ECORE_CALLBACK_CANCEL; - Widget_Data *wd = elm_widget_data_get(data); - - if (!wd) return ECORE_CALLBACK_CANCEL; - wd->zoom_timer = NULL; - wd->pinch.level = 1.0; - zoom_do(data); - evas_object_smart_callback_call(data, SIG_ZOOM_STOP, NULL); - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_zoom_anim(void *data) -{ - ELM_CHECK_WIDTYPE(data, widtype) ECORE_CALLBACK_CANCEL; - Evas_Object *obj = data; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return ECORE_CALLBACK_CANCEL; - if (wd->zoom_method == ZOOM_METHOD_IN) wd->t += 0.1 ; - else if (wd->zoom_method == ZOOM_METHOD_OUT) wd->t -= 0.05; - else - { - wd->zoom_animator = NULL; - zoom_do(obj); - evas_object_smart_callback_call(data, SIG_ZOOM_STOP, NULL); - return ECORE_CALLBACK_CANCEL; - } - - if (wd->t >= 2.0) - { - wd->zoom_animator = NULL; - wd->pinch.level = 2.0; - if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer); - wd->zoom_timer = ecore_timer_add(0.35, _zoom_timeout, obj); - return ECORE_CALLBACK_CANCEL; - } - else if (wd->t <= 0.5) - { - wd->zoom_animator = NULL; - wd->pinch.level = 0.5; - if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer); - wd->zoom_timer = ecore_timer_add(1.35, _zoom_timeout, obj); - return ECORE_CALLBACK_CANCEL; - } - else if (wd->t != 1.0) - { - Evas_Coord x, y, w, h; - float half_w, half_h; - evas_object_geometry_get(data, &x, &y, &w, &h); - half_w = (float)w * 0.5; - half_h = (float)h * 0.5; - wd->pinch.cx = x + half_w; - wd->pinch.cy = y + half_h; - wd->pinch.level = wd->t; - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); -======= -_grid_item_coord_get(Grid_Item *gi, int *x, int *y, int *w, int *h) -{ - EINA_SAFETY_ON_NULL_RETURN(gi); - - if (x) *x = gi->x * gi->wd->size.tile; - if (y) *y = gi->y * gi->wd->size.tile; - if (w) *w = gi->wd->size.tile; - if (h) *h = gi->wd->size.tile; -} - -static Eina_Bool -_grid_item_intersect(Grid_Item *gi) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(gi, EINA_FALSE); - - Evas_Coord px, py; - Evas_Coord vw, vh; - Evas_Coord x, y, w, h; - - _pan_geometry_get(gi->wd, &px, &py); - _viewport_size_get(gi->wd, &vw, &vh); - _grid_item_coord_get(gi, &x, &y, &w, &h); - return ELM_RECTS_INTERSECT(x + px, y + py, w, h, 0, 0, vw, vh); -} - -static void -_grid_item_update(Grid_Item *gi) -{ - evas_object_image_file_set(gi->img, gi->file, NULL); - if (!gi->wd->zoom_timer && !gi->wd->scr_timer) - evas_object_image_smooth_scale_set(gi->img, EINA_TRUE); - else evas_object_image_smooth_scale_set(gi->img, EINA_FALSE); - - Evas_Load_Error err = evas_object_image_load_error_get(gi->img); - if (err != EVAS_LOAD_ERROR_NONE) - { - ERR("Image loading error (%s): %s", gi->file, evas_load_error_str(err)); - ecore_file_remove(gi->file); - gi->file_have = EINA_FALSE; - } - else - { - Evas_Coord px, py; - Evas_Coord x, y, w, h; - - _pan_geometry_get(gi->wd, &px, &py); - _grid_item_coord_get(gi, &x, &y, &w, &h); - - _obj_place(gi->img, x + px, y + py, w, h); - _obj_rotate(gi->wd, gi->img); - gi->file_have = EINA_TRUE; - } -} - -static void -_grid_item_load(Grid_Item *gi) -{ - EINA_SAFETY_ON_NULL_RETURN(gi); - if (gi->file_have) _grid_item_update(gi); - else if (!gi->job) - { - gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi); - gi->wd->download_list = eina_list_append(gi->wd->download_list, gi); - } -} - -static void -_grid_item_unload(Grid_Item *gi) -{ - EINA_SAFETY_ON_NULL_RETURN(gi); - if (gi->file_have) - { - evas_object_hide(gi->img); - evas_object_image_file_set(gi->img, NULL, NULL); - } - else if (gi->job) - { - ecore_file_download_abort(gi->job); - ecore_file_remove(gi->file); - gi->job = NULL; - gi->wd->try_num--; - } - else gi->wd->download_list = eina_list_remove(gi->wd->download_list, gi); - -} - -static Grid_Item * -_grid_item_create(Grid *g, Evas_Coord x, Evas_Coord y) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(g, NULL); - char buf[PATH_MAX]; - char buf2[PATH_MAX]; - char *url; - Grid_Item *gi; - - gi = ELM_NEW(Grid_Item); - gi->wd = g->wd; - gi->g = g; - gi->x = x; - gi->y = y; - - gi->file_have = EINA_FALSE; - gi->job = NULL; - - gi->img = evas_object_image_add(evas_object_evas_get(g->wd->obj)); - evas_object_image_smooth_scale_set(gi->img, EINA_FALSE); - evas_object_image_scale_hint_set(gi->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC); - evas_object_image_filled_set(gi->img, 1); - evas_object_smart_member_add(gi->img, g->wd->pan_smart); - evas_object_pass_events_set(gi->img, EINA_TRUE); - evas_object_stack_below(gi->img, g->wd->sep_maps_markers); - - snprintf(buf, sizeof(buf), CACHE_TILE_ROOT, g->wd->id, g->zoom, x); - snprintf(buf2, sizeof(buf2), CACHE_TILE_PATH, buf, y); - if (!ecore_file_exists(buf)) ecore_file_mkpath(buf); - - eina_stringshare_replace(&gi->file, buf2); - url = g->wd->src_tile->url_cb(g->wd->obj, x, y, g->zoom); - if ((!url) || (!strlen(url))) - { - eina_stringshare_replace(&gi->url, NULL); - ERR("Getting source url failed: %s", gi->file); - } - else eina_stringshare_replace(&gi->url, url); - if (url) free(url); - eina_matrixsparse_data_idx_set(g->grid, y, x, gi); - return gi; -} - -static void -_grid_item_free(Grid_Item *gi) -{ - EINA_SAFETY_ON_NULL_RETURN(gi); - _grid_item_unload(gi); - if (gi->g && gi->g->grid) eina_matrixsparse_data_idx_set(gi->g->grid, - gi->y, gi->x, NULL); - if (gi->url) eina_stringshare_del(gi->url); - if (gi->file) eina_stringshare_del(gi->file); - if (gi->img) evas_object_del(gi->img); - if (gi->file_have) ecore_file_remove(gi->file); - free(gi); -} - -static void -_downloaded_cb(void *data, const char *file __UNUSED__, int status) -{ - Grid_Item *gi = data; - - if (status == 200) - { - DBG("Download success from %s to %s", gi->url, gi->file); - _grid_item_update(gi); - gi->wd->finish_num++; - evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOADED, NULL); - } - else - { - WRN("Download failed from %s to %s (%d) ", gi->url, gi->file, status); - ecore_file_remove(gi->file); - gi->file_have = EINA_FALSE; - evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOADED_FAIL, NULL); - } - - gi->job = NULL; - gi->wd->download_num--; - if (!gi->wd->download_num) - edje_object_signal_emit(elm_smart_scroller_edje_object_get(gi->wd->scr), - "elm,state,busy,stop", "elm"); -} - -static Eina_Bool -_download_job(void *data) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); - Widget_Data *wd = data; - - Eina_List *l, *ll; - Grid_Item *gi; - - if (!eina_list_count(wd->download_list)) - { - wd->download_idler = NULL; - return ECORE_CALLBACK_CANCEL; - } - - EINA_LIST_REVERSE_FOREACH_SAFE(wd->download_list, l, ll, gi) - { - if (gi->g->zoom != wd->zoom || !_grid_item_intersect(gi)) - { - wd->download_list = eina_list_remove(wd->download_list, gi); - continue; - } - if (wd->download_num >= MAX_CONCURRENT_DOWNLOAD) - return ECORE_CALLBACK_RENEW; - - Eina_Bool ret = ecore_file_download_full(gi->url, gi->file, - _downloaded_cb, NULL, - gi, &(gi->job), wd->ua); - if ((!ret) || (!gi->job)) - ERR("Can't start to download from %s to %s", gi->url, gi->file); - else - { - wd->download_list = eina_list_remove(wd->download_list, gi); - wd->try_num++; - wd->download_num++; - evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOAD, - NULL); - if (wd->download_num == 1) - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,start", "elm"); - - } ->>>>>>> remotes/origin/upstream - } - return ECORE_CALLBACK_RENEW; -} - -<<<<<<< HEAD -static Eina_Bool -_long_press(void *data) -{ - ELM_CHECK_WIDTYPE(data, widtype) ECORE_CALLBACK_CANCEL; - Widget_Data *wd = elm_widget_data_get(data); - - if (!wd) return ECORE_CALLBACK_CANCEL; - wd->long_timer = NULL; - evas_object_smart_callback_call(data, SIG_LONGPRESSED, &wd->ev); - return ECORE_CALLBACK_CANCEL; -} - -static void -_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - Evas_Event_Mouse_Down *ev = event_info; - - if (ev->button != 1) return; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; - else wd->on_hold = EINA_FALSE; - if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, ev); - else - evas_object_smart_callback_call(data, SIG_PRESS, ev); - if (wd->long_timer) ecore_timer_del(wd->long_timer); - wd->ev = *ev; - wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data); -} - -static void -_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - EINA_SAFETY_ON_NULL_RETURN(wd); - - Evas_Event_Mouse_Up *ev = event_info; - EINA_SAFETY_ON_NULL_RETURN(ev); - - if (ev->button != 1) return; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE; - else wd->on_hold = EINA_FALSE; - if (wd->long_timer) - { - ecore_timer_del(wd->long_timer); - wd->long_timer = NULL; - } - if (!wd->on_hold) evas_object_smart_callback_call(data, SIG_CLICKED, ev); - wd->on_hold = EINA_FALSE; -} - -static void -_mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - EINA_SAFETY_ON_NULL_RETURN(wd); - - if (!wd->paused) - { - int zoom_diff = 0; - Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info; - Evas_Coord x, y, w, h; - - evas_object_geometry_get(data, &x, &y, &w, &h); - - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); - - wd->wheel_diff -= ev->z; - wd->pinch.level = wd->pinch.diff * pow(2.0, (double)wd->wheel_diff/10); - wd->pinch.cx = x + ((double)w * 0.5); - wd->pinch.cy = y + ((double)h * 0.5); - - if (wd->pinch.level > 1.99 || wd->pinch.level < 1.01) - { - wd->wheel_diff = 0; - if (wd->pinch.level > 1.99) - { - zoom_diff = 1; - wd->pinch.diff = wd->pinch.level / 2.0; - wd->pinch.level = wd->pinch.level / 2.0; - } - else if (wd->pinch.level < 1.01) - { - zoom_diff = -1; - wd->pinch.diff = wd->pinch.level * 2.0; - wd->pinch.level = wd->pinch.level * 2.0; - } - - Elm_Map_Zoom_Mode temp; - temp = wd->mode; - wd->mode = ELM_MAP_ZOOM_MODE_MANUAL; - wd->paused = EINA_TRUE; - elm_map_zoom_set(data, wd->zoom + zoom_diff); - wd->paused = EINA_FALSE; - wd->mode = temp; - } - else - { - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); -======= -static void -_grid_viewport_get(Grid *g, int *x, int *y, int *w, int *h) -{ - EINA_SAFETY_ON_NULL_RETURN(g); - int xx, yy, ww, hh; - Evas_Coord px, py, vw, vh; - - _pan_geometry_get(g->wd, &px, &py); - _viewport_size_get(g->wd, &vw, &vh); - if (px > 0) px = 0; - if (py > 0) py = 0; - - xx = (-px / g->wd->size.tile) - 1; - if (xx < 0) xx = 0; - - yy = (-py / g->wd->size.tile) - 1; - if (yy < 0) yy = 0; - - ww = (vw / g->wd->size.tile) + 3; - if (xx + ww >= g->tw) ww = g->tw - xx; - - hh = (vh / g->wd->size.tile) + 3; - if (yy + hh >= g->th) hh = g->th - yy; - - if (x) *x = xx; - if (y) *y = yy; - if (w) *w = ww; - if (h) *h = hh; -} - -static void -_grid_unload(Grid *g) -{ - EINA_SAFETY_ON_NULL_RETURN(g); - Eina_Iterator *it; - Eina_Matrixsparse_Cell *cell; - Grid_Item *gi; - - it = eina_matrixsparse_iterator_new(g->grid); - EINA_ITERATOR_FOREACH(it, cell) - { - gi = eina_matrixsparse_cell_data_get(cell); - _grid_item_unload(gi); - } - eina_iterator_free(it); -} - -static void -_grid_load(Grid *g) -{ - EINA_SAFETY_ON_NULL_RETURN(g); - int x, y, xx, yy, ww, hh; - Eina_Iterator *it; - Eina_Matrixsparse_Cell *cell; - Grid_Item *gi; - - it = eina_matrixsparse_iterator_new(g->grid); - EINA_ITERATOR_FOREACH(it, cell) - { - gi = eina_matrixsparse_cell_data_get(cell); - if (!_grid_item_intersect(gi)) _grid_item_unload(gi); - } - eina_iterator_free(it); - - _grid_viewport_get(g, &xx, &yy, &ww, &hh); - for (y = yy; y < yy + hh; y++) - { - for (x = xx; x < xx + ww; x++) - { - gi = eina_matrixsparse_data_idx_get(g->grid, y, x); - if (!gi) gi = _grid_item_create(g, x, y); - _grid_item_load(gi); ->>>>>>> remotes/origin/upstream - } - } -} - -static void -<<<<<<< HEAD -_rect_resize_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - ELM_CHECK_WIDTYPE(data, widtype); - Widget_Data *wd = elm_widget_data_get(data); - int x, y, w, h; - - evas_object_geometry_get(wd->rect, &x, &y, &w, &h); - evas_object_geometry_get(wd->pan_smart, &x, &y, &w, &h); - evas_object_resize(wd->rect, w, h); - evas_object_move(wd->rect, x, y); -} - -static void -_del_hook(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Elm_Map_Group_Class *group_clas; - Elm_Map_Marker_Class *marker_clas; - Eina_List *l; - Evas_Object *p; - Path_Node *n; - Path_Waypoint *w; - Ecore_Event_Handler *h; - Elm_Map_Route *r; - Elm_Map_Name *na; - Evas_Object *route; - - if (!wd) return; - EINA_LIST_FREE(wd->groups_clas, group_clas) - { - if (group_clas->style) - eina_stringshare_del(group_clas->style); - free(group_clas); - } - - EINA_LIST_FREE(wd->markers_clas, marker_clas) - { - if (marker_clas->style) - eina_stringshare_del(marker_clas->style); - free(marker_clas); - } - - EINA_LIST_FOREACH(wd->route, l, r) - { - EINA_LIST_FREE(r->path, p) - { - evas_object_del(p); - } - - EINA_LIST_FREE(r->waypoint, w) - { - if (w->point) eina_stringshare_del(w->point); - free(w); - } - - EINA_LIST_FREE(r->nodes, n) - { - if (n->pos.address) eina_stringshare_del(n->pos.address); - free(n); - } - - EINA_LIST_FREE(r->handlers, h) - { - ecore_event_handler_del(h); - } - - if (r->con_url) ecore_con_url_free(r->con_url); - if (r->info.nodes) eina_stringshare_del(r->info.nodes); - if (r->info.waypoints) eina_stringshare_del(r->info.waypoints); - } - - EINA_LIST_FREE(wd->names, na) - { - if (na->address) free(na->address); - if (na->handler) ecore_event_handler_del(na->handler); - if (na->ud.fname) - { - ecore_file_remove(na->ud.fname); - free(na->ud.fname); - na->ud.fname = NULL; - } - } - - EINA_LIST_FREE(wd->track, route) - { - evas_object_del(route); - } - - if (wd->map) evas_map_free(wd->map); - if (wd->source_names) free(wd->source_names); - if (wd->calc_job) ecore_job_del(wd->calc_job); - if (wd->scr_timer) ecore_timer_del(wd->scr_timer); - if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); - if (wd->long_timer) ecore_timer_del(wd->long_timer); - if (wd->user_agent) eina_stringshare_del(wd->user_agent); - if (wd->ua) eina_hash_free(wd->ua); - if (wd->markers) free(wd->markers); - - free(wd); -} - -static void -_del_pre_hook(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Marker_Group *group; - Elm_Map_Marker *marker; - int i; - Eina_Bool free_marker = EINA_TRUE; - Eina_List *l; - - if (!wd) return; - grid_clear_all(obj); - for (i = 0; i <= wd->zoom_max; i++) - { - if (!wd->markers[i]) continue; - Eina_Iterator *it = eina_matrixsparse_iterator_new(wd->markers[i]); -======= -_grid_place(Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - Eina_List *l; - Grid *g; - - EINA_LIST_FOREACH(wd->grids, l, g) - { - if (wd->zoom == g->zoom) _grid_load(g); - else _grid_unload(g); - } - if (!wd->download_idler) wd->download_idler = ecore_idler_add(_download_job, wd); -} - -static void -_grid_all_create(Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(wd->src_tile); - - int zoom; - for (zoom = wd->src_tile->zoom_min; zoom <= wd->src_tile->zoom_max; zoom++) - { - Grid *g; - int tnum; - g = ELM_NEW(Grid); - g->wd = wd; - g->zoom = zoom; - tnum = pow(2.0, g->zoom); - g->tw = tnum; - g->th = tnum; - g->grid = eina_matrixsparse_new(g->th, g->tw, NULL, NULL); - wd->grids = eina_list_append(wd->grids, g); - } -} - -static void -_grid_all_clear(Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - - Grid *g; - EINA_LIST_FREE(wd->grids, g) - { - Eina_Matrixsparse_Cell *cell; - Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); - EINA_ITERATOR_FOREACH(it, cell) - { - Grid_Item *gi; - gi = eina_matrixsparse_cell_data_get(cell); - if (gi) _grid_item_free(gi); - } - eina_iterator_free(it); - - eina_matrixsparse_free(g->grid); - free(g); - } -} - -static void -_track_place(Widget_Data *wd) -{ -#ifdef ELM_EMAP - EINA_SAFETY_ON_NULL_RETURN(wd); - - Eina_List *l; - Evas_Object *route; - int xmin, xmax, ymin, ymax; - Evas_Coord px, py, ow, oh; - px = wd->pan_x; - py = wd->pan_y; - _viewport_size_get(wd, &ow, &oh); - - Evas_Coord size = wd->size.w; - - EINA_LIST_FOREACH(wd->track, l, route) - { - double lon_min, lon_max; - double lat_min, lat_max; - elm_route_longitude_min_max_get(route, &lon_min, &lon_max); - elm_route_latitude_min_max_get(route, &lat_min, &lat_max); - _region_to_coord_convert(wd, lon_min, lat_max, size, &xmin, &ymin); - _region_to_coord_convert(wd, lon_max, lat_min, size, &xmax, &ymax); - - if( !(xmin < px && xmax < px) && !(xmin > px+ow && xmax > px+ow)) - { - if( !(ymin < py && ymax < py) && !(ymin > py+oh && ymax > py+oh)) - { - //display the route - evas_object_move(route, xmin - px, ymin - py); - evas_object_resize(route, xmax - xmin, ymax - ymin); - - evas_object_raise(route); - _obj_rotate(wd, route); - evas_object_show(route); - - continue; - } - } - //the route is not display - evas_object_hide(route); - } -#else - (void) wd; -#endif -} - -static void -_delayed_do(Widget_Data *wd) -{ - Delayed_Data *dd; - dd = eina_list_nth(wd->delayed_jobs, 0); - if (dd && !dd->wd->zoom_animator) - { - dd->func(dd); - wd->delayed_jobs = eina_list_remove(wd->delayed_jobs, dd); - free(dd); - } -} - -static void -_smooth_update(Widget_Data *wd) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - Eina_List *l; - Grid *g; - - EINA_LIST_FOREACH(wd->grids, l, g) - { - Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); ->>>>>>> remotes/origin/upstream - Eina_Matrixsparse_Cell *cell; - - EINA_ITERATOR_FOREACH(it, cell) - { -<<<<<<< HEAD - l = eina_matrixsparse_cell_data_get(cell); - EINA_LIST_FREE(l, group) - { - EINA_LIST_FREE(group->markers, marker) - { - evas_object_event_callback_del_full(group->sc, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _bubble_sc_hints_changed_cb, group); - if (free_marker) free(marker); - } - free(group); - } - free_marker = EINA_FALSE; - } - eina_iterator_free(it); - eina_matrixsparse_free(wd->markers[i]); - } - - evas_object_del(wd->sep_maps_markers); - evas_object_del(wd->pan_smart); - wd->pan_smart = NULL; -} - -static void -_on_focus_hook(void *data __UNUSED__, Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if (elm_widget_focus_get(obj)) - { - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,focus", "elm"); - evas_object_focus_set(wd->obj, EINA_TRUE); - } - else - { - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,unfocus", "elm"); - evas_object_focus_set(wd->obj, EINA_FALSE); -======= - Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); - if (_grid_item_intersect(gi)) - evas_object_image_smooth_scale_set(gi->img, EINA_TRUE); - } - eina_iterator_free(it); - } -} - -static Eina_Bool -_zoom_timeout(void *data) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); - Widget_Data *wd = data; - _smooth_update(wd); - wd->zoom_timer = NULL; - evas_object_smart_callback_call(wd->obj, SIG_ZOOM_STOP, NULL); - return ECORE_CALLBACK_CANCEL; -} - -static void -zoom_do(Widget_Data *wd, double zoom) -{ - EINA_SAFETY_ON_NULL_RETURN(wd); - if (zoom > wd->zoom_max) zoom = wd->zoom_max; - else if (zoom < wd->zoom_min) zoom = wd->zoom_min; - - Evas_Coord px, py, vw, vh; - Evas_Coord ow, oh; - - wd->zoom = ROUND(zoom); - wd->zoom_detail = zoom; - ow = wd->size.w; - oh = wd->size.h; - wd->size.tile = pow(2.0, (zoom - wd->zoom)) * wd->tsize; - wd->size.w = pow(2.0, wd->zoom) * wd->size.tile; - wd->size.h = wd->size.w;; - - // Fix to zooming with (viewport center px, py) as the center to prevent - // from zooming with (0,0) as the cetner. (scroller default behavior) - _pan_geometry_get(wd, &px, &py); - _viewport_size_get(wd, &vw, &vh); - if ((vw > 0) && (vh > 0) && (ow > 0) && (oh > 0)) - { - Evas_Coord xx, yy; - double sx, sy; - if (vw > ow) sx = 0.5; - else sx = (double)(-px + (vw / 2)) / ow; - if (vh > oh) sy = 0.5; - else sy = (double)(-py + (vh / 2)) / oh; - - if (sx > 1.0) sx = 1.0; - if (sy > 1.0) sy = 1.0; - - xx = (sx * wd->size.w) - (vw / 2); - yy = (sy * wd->size.h) - (vh / 2); - if (xx < 0) xx = 0; - else if (xx > (wd->size.w - vw)) xx = wd->size.w - vw; - if (yy < 0) yy = 0; - else if (yy > (wd->size.h - vh)) yy = wd->size.h - vh; - elm_smart_scroller_child_region_show(wd->scr, xx, yy, vw, vh); - } - if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer); - else evas_object_smart_callback_call(wd->obj, SIG_ZOOM_START, NULL); - wd->zoom_timer = ecore_timer_add(0.25, _zoom_timeout, wd); - evas_object_smart_callback_call(wd->obj, SIG_ZOOM_CHANGE, NULL); - - evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); - evas_object_smart_changed(wd->pan_smart); -} - -static Eina_Bool -_zoom_anim(void *data) -{ - Widget_Data *wd = data; - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, ECORE_CALLBACK_CANCEL); - - if (wd->ani.cnt <= 0) - { - wd->zoom_animator = NULL; - evas_object_smart_changed(wd->pan_smart); - return ECORE_CALLBACK_CANCEL; - } - else - { - wd->ani.zoom += wd->ani.diff; - wd->ani.cnt--; - zoom_do(wd, wd->ani.zoom); - return ECORE_CALLBACK_RENEW; ->>>>>>> remotes/origin/upstream - } -} - -static void -<<<<<<< HEAD -_theme_hook(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - elm_smart_scroller_object_theme_set(obj, wd->scr, "map", "base", elm_widget_style_get(obj)); - // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); - _sizing_eval(obj); -} - -static void -_sizing_eval(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; - - if (!wd) return; - evas_object_size_hint_max_get(wd->scr, &maxw, &maxh); - evas_object_size_hint_min_set(obj, minw, minh); - evas_object_size_hint_max_set(obj, maxw, maxh); -} - -static void -_calc_job(void *data) -{ - Widget_Data *wd = data; - Evas_Coord minw, minh; - - if (!wd) return; - minw = wd->size.w; - minh = wd->size.h; - if (wd->resized) - { - wd->resized = EINA_FALSE; - if (wd->mode != ELM_MAP_ZOOM_MODE_MANUAL) - { - double tz = wd->zoom; - wd->zoom = 0.0; - elm_map_zoom_set(wd->obj, tz); - } - } - if ((minw != wd->minw) || (minh != wd->minh)) - { - wd->minw = minw; - wd->minh = minh; - evas_object_smart_callback_call(wd->pan_smart, SIG_CHANGED, NULL); - _sizing_eval(wd->obj); - } - wd->calc_job = NULL; - evas_object_smart_changed(wd->pan_smart); -} - -static void -_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) -{ - Pan *sd = evas_object_smart_data_get(obj); - if (!sd) return; - if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return; - sd->wd->pan_x = x; - sd->wd->pan_y = y; - evas_object_smart_changed(obj); -} - -static void -_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) -{ - Pan *sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (x) *x = sd->wd->pan_x; - if (y) *y = sd->wd->pan_y; -} - -static void -_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) -{ - Pan *sd = evas_object_smart_data_get(obj); - Evas_Coord ow, oh; - if (!sd) return; - evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); - ow = sd->wd->minw - ow; - if (ow < 0) ow = 0; - oh = sd->wd->minh - oh; - if (oh < 0) oh = 0; - if (x) *x = ow; - if (y) *y = oh; -} - -static void -_pan_min_get(Evas_Object *obj __UNUSED__, Evas_Coord *x, Evas_Coord *y) -{ - if (x) *x = 0; - if (y) *y = 0; -} - -static void -_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) -{ - Pan *sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (w) *w = sd->wd->minw; - if (h) *h = sd->wd->minh; -} - -static void -_pan_add(Evas_Object *obj) -{ - Pan *sd; - Evas_Object_Smart_Clipped_Data *cd; - _pan_sc.add(obj); - cd = evas_object_smart_data_get(obj); - if (!cd) return; - sd = calloc(1, sizeof(Pan)); - if (!sd) return; - sd->__clipped_data = *cd; - free(cd); - evas_object_smart_data_set(obj, sd); -} - -static void -_pan_del(Evas_Object *obj) -{ - Pan *sd = evas_object_smart_data_get(obj); - if (!sd) return; - _pan_sc.del(obj); -} - -static void -_pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) -{ - Pan *sd = evas_object_smart_data_get(obj); - Evas_Coord ow, oh; - if (!sd) return; - evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); - if ((ow == w) && (oh == h)) return; - sd->wd->resized = EINA_TRUE; - if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); - sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); -} - -static void -_pan_calculate(Evas_Object *obj) -{ - Pan *sd = evas_object_smart_data_get(obj); - Evas_Coord ox, oy, ow, oh; - Eina_List *l; - Grid *g; - - EINA_SAFETY_ON_NULL_RETURN(sd); - EINA_SAFETY_ON_NULL_RETURN(sd->wd); - - evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); - rect_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); - EINA_LIST_FOREACH(sd->wd->grids, l, g) - { - if (sd->wd->zoom == g->zoom) grid_load(sd->wd->obj, g); - else if (sd->wd->zoom-1 != g->zoom && sd->wd->zoom+1 != g->zoom) grid_unload(sd->wd->obj, g); // remain only adjacent grids - grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); - if (sd->wd->zoom == g->zoom) marker_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); - if (!sd->wd->zoom_animator) route_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); - if (!sd->wd->zoom_animator) track_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh); - } -} - -static void -_pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__) -{ - Pan *sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job); - sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd); -} - -static void -_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - elm_smart_scroller_hold_set(wd->scr, 1); -} - -static void -_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - elm_smart_scroller_hold_set(wd->scr, 0); -} - -static void -_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - elm_smart_scroller_freeze_set(wd->scr, 1); -} - -static void -_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - elm_smart_scroller_freeze_set(wd->scr, 0); -} - -static void -_scr_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - evas_object_smart_callback_call(data, "scroll,anim,start", NULL); -} - -static void -_scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - evas_object_smart_callback_call(data, "scroll,anim,stop", NULL); -} - -static void -_scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Widget_Data *wd = elm_widget_data_get(data); - EINA_SAFETY_ON_NULL_RETURN(wd); - wd->center_on.enabled = EINA_FALSE; - - // FIXME: els_scoller sometimes give start event again & again... it confuses app. (els_scr bug?) - if (!wd->scr_started) - { - wd->scr_started = EINA_TRUE; - evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL); - } -} - -static void -_scr_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Widget_Data *wd = elm_widget_data_get(data); - EINA_SAFETY_ON_NULL_RETURN(wd); - wd->center_on.enabled = EINA_FALSE; - - // FIXME: els_scoller sometimes give start event again & again... it confuses app. (els_scr bug?) - if (wd->scr_started) - { - wd->scr_started = EINA_FALSE; - evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL); - } -} - -static void -_scr_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - evas_object_smart_callback_call(data, SIG_SCROLL, NULL); -} - - -static void -_group_object_create(Marker_Group *group) -{ - const char *style = "radio"; - Evas_Object *icon = NULL; - - if (group->obj) return; - if ((!group->clas->priv.objs_notused) || (eina_list_count(group->markers) == 1)) - { - //set icon and style - if (eina_list_count(group->markers) == 1) - { - Elm_Map_Marker *m = eina_list_data_get(group->markers); - if (m->clas->style) - style = m->clas->style; - - if (m->clas->func.icon_get) - icon = m->clas->func.icon_get(group->wd->obj, m, m->data); - - group->delete_object = EINA_TRUE; - } - else - { - if (group->clas->style) - style = group->clas->style; - - if (group->clas->func.icon_get) - icon = group->clas->func.icon_get(group->wd->obj, group->clas->data); - - group->delete_object = EINA_FALSE; - } - - group->obj = elm_layout_add(group->wd->obj); - elm_layout_theme_set(group->obj, "map/marker", style, elm_widget_style_get(group->wd->obj)); - - if (icon) elm_object_part_content_set(group->obj, "elm.icon", icon); - - evas_object_smart_member_add(group->obj, group->wd->pan_smart); - elm_widget_sub_object_add(group->wd->obj, group->obj); - evas_object_stack_above(group->obj, group->wd->sep_maps_markers); - - if (!group->delete_object) - group->clas->priv.objs_used = eina_list_append(group->clas->priv.objs_used, group->obj); - } - else - { - group->delete_object = EINA_FALSE; - - group->obj = eina_list_data_get(group->clas->priv.objs_notused); - group->clas->priv.objs_used = eina_list_append(group->clas->priv.objs_used, group->obj); - group->clas->priv.objs_notused = eina_list_remove(group->clas->priv.objs_notused, group->obj); - evas_object_show(group->obj); - } - - edje_object_signal_callback_add(elm_layout_edje_get(group->obj), "open", "elm", _group_open_cb, group); - edje_object_signal_callback_add(elm_layout_edje_get(group->obj), "bringin", "elm", _group_bringin_cb, group); - - group->update_nbelems = EINA_TRUE; - group->update_resize = EINA_TRUE; - group->update_raise = EINA_TRUE; - - if (group->open) _group_bubble_create(group); -} - -static void -_group_object_free(Marker_Group *group) -{ - if (!group->obj) return; - if (!group->delete_object) - { - group->clas->priv.objs_notused = eina_list_append(group->clas->priv.objs_notused, group->obj); - group->clas->priv.objs_used = eina_list_remove(group->clas->priv.objs_used, group->obj); - evas_object_hide(group->obj); - - edje_object_signal_callback_del(elm_layout_edje_get(group->obj), "open", "elm", _group_open_cb); - edje_object_signal_callback_del(elm_layout_edje_get(group->obj), "bringin", "elm", _group_bringin_cb); - } - else - evas_object_del(group->obj); - - group->obj = NULL; - _group_bubble_free(group); -} - -static void -_group_bubble_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Marker_Group *group = data; - - if (!evas_object_above_get(group->rect)) return; - evas_object_raise(group->bubble); - evas_object_raise(group->sc); - evas_object_raise(group->rect); -} - -static void -_group_bubble_create(Marker_Group *group) -{ - if (group->bubble) return; - - group->wd->opened_bubbles = eina_list_append(group->wd->opened_bubbles, group); - group->bubble = edje_object_add(evas_object_evas_get(group->obj)); - _elm_theme_object_set(group->wd->obj, group->bubble, "map", "marker_bubble", - elm_widget_style_get(group->wd->obj)); - evas_object_smart_member_add(group->bubble, - group->wd->obj); - elm_widget_sub_object_add(group->wd->obj, group->bubble); - - _group_bubble_content_free(group); - if (!_group_bubble_content_update(group)) - { - //no content, we can delete the bubble - _group_bubble_free(group); - return; - } - - group->rect = evas_object_rectangle_add(evas_object_evas_get(group->obj)); - evas_object_color_set(group->rect, 0, 0, 0, 0); - evas_object_repeat_events_set(group->rect, EINA_TRUE); - evas_object_smart_member_add(group->rect, group->wd->obj); - elm_widget_sub_object_add(group->wd->obj, group->rect); - - evas_object_event_callback_add(group->rect, EVAS_CALLBACK_MOUSE_UP, _group_bubble_mouse_up_cb, group); - - _group_bubble_place(group); -} - -static void _bubble_sc_hints_changed_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - _group_bubble_place(data); -} - -static int -_group_bubble_content_update(Marker_Group *group) -{ - Eina_List *l; - Elm_Map_Marker *marker; - int i = 0; - - if (!group->bubble) return 1; - - if (!group->sc) - { - group->sc = elm_scroller_add(group->bubble); - elm_widget_style_set(group->sc, "map_bubble"); - elm_scroller_content_min_limit(group->sc, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(group->sc, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF); - elm_scroller_bounce_set(group->sc, _elm_config->thumbscroll_bounce_enable, EINA_FALSE); - edje_object_part_swallow(group->bubble, "elm.swallow.content", group->sc); - evas_object_show(group->sc); - evas_object_smart_member_add(group->sc, - group->wd->obj); - elm_widget_sub_object_add(group->wd->obj, group->sc); - - group->bx = elm_box_add(group->bubble); - evas_object_size_hint_align_set(group->bx, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(group->bx, 0.5, 0.5); - elm_box_horizontal_set(group->bx, EINA_TRUE); - evas_object_show(group->bx); - - elm_object_content_set(group->sc, group->bx); - - evas_object_event_callback_add(group->sc, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _bubble_sc_hints_changed_cb, group); - } - - EINA_LIST_FOREACH(group->markers, l, marker) - { - if (i >= group->wd->markers_max_num) break; - if ((!marker->content) && (marker->clas->func.get)) - marker->content = marker->clas->func.get(group->wd->obj, marker, marker->data); - else if (marker->content) - elm_box_unpack(group->bx, marker->content); - if (marker->content) - { - elm_box_pack_end(group->bx, marker->content); - i++; - } - } - return i; -} - -static void -_group_bubble_content_free(Marker_Group *group) -{ - Eina_List *l; - Elm_Map_Marker *marker; - - if (!group->sc) return; - EINA_LIST_FOREACH(group->markers, l, marker) - { - if ((marker->content) && (marker->clas->func.del)) - marker->clas->func.del(group->wd->obj, marker, marker->data, marker->content); - else if (marker->content) - evas_object_del(marker->content); - marker->content = NULL; - } - evas_object_del(group->sc); - group->sc = NULL; -} - -static void -_group_bubble_free(Marker_Group *group) -{ - if (!group->bubble) return; - group->wd->opened_bubbles = eina_list_remove(group->wd->opened_bubbles, group); - evas_object_event_callback_del_full(group->sc, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _bubble_sc_hints_changed_cb, group); - evas_object_del(group->bubble); - evas_object_del(group->rect); - group->bubble = NULL; - _group_bubble_content_free(group); -} - -static void -_group_bubble_place(Marker_Group *group) -{ - Evas_Coord x, y, w; - Evas_Coord xx, yy, ww, hh; - const char *s; - - if ((!group->bubble) || (!group->obj)) return; - - evas_object_geometry_get(group->obj, &x, &y, &w, NULL); - edje_object_size_min_calc(group->bubble, NULL, &hh); - - s = edje_object_data_get(group->bubble, "size_w"); - if (s) ww = atoi(s); - else ww = 0; - xx = x + w / 2 - ww / 2; - yy = y-hh; - - evas_object_move(group->bubble, xx, yy); - evas_object_resize(group->bubble, ww, hh); - obj_rotate_zoom(group->wd->obj, group->bubble); - evas_object_show(group->bubble); - - evas_object_move(group->rect, xx, yy); - evas_object_resize(group->rect, ww, hh); - obj_rotate_zoom(group->wd->obj, group->rect); - evas_object_show(group->rect); -} - -static void -_group_bringin_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) -{ - Marker_Group *group = data; - Elm_Map_Marker *marker = eina_list_data_get(group->markers); - if (!marker) return; - group->bringin = EINA_TRUE; - elm_map_geo_region_bring_in(group->wd->obj, marker->longitude, marker->latitude); -} - -static void -_group_open_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *soure __UNUSED__) -{ - Marker_Group *group = data; - - if (group->bringin) - { - group->bringin = EINA_FALSE; - return; - } - - if (group->bubble) - { - group->open = EINA_FALSE; - _group_bubble_free(group); - return; - } - group->open = EINA_TRUE; - _group_bubble_create(group); -} - -static Eina_Bool -_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info) -{ - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - int zoom; - Evas_Coord x = 0; - Evas_Coord y = 0; - Evas_Coord step_x = 0; - Evas_Coord step_y = 0; - Evas_Coord v_w = 0; - Evas_Coord v_h = 0; - Evas_Coord page_x = 0; - Evas_Coord page_y = 0; - - if (!wd) return EINA_FALSE; - if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; - Evas_Event_Key_Down *ev = event_info; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; - - elm_smart_scroller_child_pos_get(wd->scr, &x, &y); - elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); - elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); - elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h); - - if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left"))) - { - x -= step_x; - } - else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right"))) - { - x += step_x; - } - else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up"))) - { - y -= step_y; - } - else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down"))) - { - y += step_y; - } - else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior"))) - { - if (page_y < 0) - y -= -(page_y * v_h) / 100; - else - y -= page_y; - } - else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next"))) - { - if (page_y < 0) - y += -(page_y * v_h) / 100; + Eina_Bool ret = ecore_file_download_full(gi->url, gi->file, + _downloaded_cb, NULL, + gi, &(gi->job), wd->ua); + if ((!ret) || (!gi->job)) + ERR("Can't start to download from %s to %s", gi->url, gi->file); else - y += page_y; - } - else if (!strcmp(ev->keyname, "KP_Add")) - { - zoom = elm_map_zoom_get(obj) + 1; - elm_map_zoom_mode_set(obj, ELM_MAP_ZOOM_MODE_MANUAL); - elm_map_zoom_set(obj, zoom); - return EINA_TRUE; - } - else if (!strcmp(ev->keyname, "KP_Subtract")) - { - zoom = elm_map_zoom_get(obj) - 1; - elm_map_zoom_mode_set(obj, ELM_MAP_ZOOM_MODE_MANUAL); - elm_map_zoom_set(obj, zoom); - return EINA_TRUE; - } - else return EINA_FALSE; - - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - elm_smart_scroller_child_pos_set(wd->scr, x, y); - - return EINA_TRUE; -} - -static Eina_Bool -cb_dump_name_attrs(void *data, const char *key, const char *value) -{ - Name_Dump *dump = (Name_Dump*)data; - if (!dump) return EINA_FALSE; - - if (!strncmp(key, NOMINATIM_ATTR_LON, sizeof(NOMINATIM_ATTR_LON))) dump->lon = atof(value); - else if (!strncmp(key, NOMINATIM_ATTR_LAT, sizeof(NOMINATIM_ATTR_LAT))) dump->lat = atof(value); - - return EINA_TRUE; -} - - -static Eina_Bool -cb_route_dump(void *data, Eina_Simple_XML_Type type, const char *value, unsigned offset __UNUSED__, unsigned length) -{ - Route_Dump *dump = data; - if (!dump) return EINA_FALSE; - - switch (type) - { - case EINA_SIMPLE_XML_OPEN: - case EINA_SIMPLE_XML_OPEN_EMPTY: - { - const char *attrs; - - attrs = eina_simple_xml_tag_attributes_find(value, length); - if (!attrs) - { - if (!strncmp(value, YOURS_DISTANCE, length)) dump->id = ROUTE_XML_DISTANCE; - else if (!strncmp(value, YOURS_DESCRIPTION, length)) dump->id = ROUTE_XML_DESCRIPTION; - else if (!strncmp(value, YOURS_COORDINATES, length)) dump->id = ROUTE_XML_COORDINATES; - else dump->id = ROUTE_XML_NONE; - } - } - break; - case EINA_SIMPLE_XML_DATA: - { - char *buf = malloc(length); - if (!buf) return EINA_FALSE; - snprintf(buf, length, "%s", value); - if (dump->id == ROUTE_XML_DISTANCE) dump->distance = atof(buf); - else if (!(dump->description) && (dump->id == ROUTE_XML_DESCRIPTION)) dump->description = strdup(buf); - else if (dump->id == ROUTE_XML_COORDINATES) dump->coordinates = strdup(buf); - free(buf); - } - break; - default: - break; - } - - return EINA_TRUE; -} - -static Eina_Bool -cb_name_dump(void *data, Eina_Simple_XML_Type type, const char *value, unsigned offset __UNUSED__, unsigned length) -{ - Name_Dump *dump = data; - if (!dump) return EINA_FALSE; - - switch (type) - { - case EINA_SIMPLE_XML_OPEN: - case EINA_SIMPLE_XML_OPEN_EMPTY: - { - const char *attrs; - attrs = eina_simple_xml_tag_attributes_find(value, length); - if (attrs) - { - if (!strncmp(value, NOMINATIM_RESULT, sizeof(NOMINATIM_RESULT) - 1)) dump->id = NAME_XML_NAME; - else dump->id = NAME_XML_NONE; - - eina_simple_xml_attributes_parse - (attrs, length - (attrs - value), cb_dump_name_attrs, dump); - } - } - break; - case EINA_SIMPLE_XML_DATA: - { - char *buf = malloc(length + 1); - if (!buf) return EINA_FALSE; - snprintf(buf, length + 1, "%s", value); - if (dump->id == NAME_XML_NAME) dump->address = strdup(buf); - free(buf); - } - break; - default: - break; - } - - return EINA_TRUE; -} - -static void -_parse_kml(void *data) -{ - Elm_Map_Route *r = (Elm_Map_Route*)data; - if (!r || !r->ud.fname) return; - - FILE *f; - char **str; - unsigned int ele, idx; - double lon, lat; - Evas_Object *path; - - Route_Dump dump = {0, r->ud.fname, 0.0, NULL, NULL}; - - f = fopen(r->ud.fname, "rb"); - if (f) - { - long sz; - - fseek(f, 0, SEEK_END); - sz = ftell(f); - if (sz > 0) - { - char *buf; - - fseek(f, 0, SEEK_SET); - buf = malloc(sz); - if (buf) - { - if (fread(buf, 1, sz, f)) - { - eina_simple_xml_parse(buf, sz, EINA_TRUE, cb_route_dump, &dump); - free(buf); - } - } - } - fclose(f); - - if (dump.distance) r->info.distance = dump.distance; - if (dump.description) - { - eina_stringshare_replace(&r->info.waypoints, dump.description); - str = eina_str_split_full(dump.description, "\n", 0, &ele); - r->info.waypoint_count = ele; - for (idx = 0 ; idx < ele ; idx++) - { - Path_Waypoint *wp = ELM_NEW(Path_Waypoint); - if (wp) - { - wp->wd = r->wd; - wp->point = eina_stringshare_add(str[idx]); - DBG("%s", str[idx]); - r->waypoint = eina_list_append(r->waypoint, wp); - } - } - if (str && str[0]) - { - free(str[0]); - free(str); - } - } - else WRN("description is not found !"); - - if (dump.coordinates) { - eina_stringshare_replace(&r->info.nodes, dump.coordinates); - str = eina_str_split_full(dump.coordinates, "\n", 0, &ele); - r->info.node_count = ele; - for (idx = 0 ; idx < ele ; idx++) - { - sscanf(str[idx], "%lf,%lf", &lon, &lat); - Path_Node *n = ELM_NEW(Path_Node); - if (n) - { - n->wd = r->wd; - n->pos.lon = lon; - n->pos.lat = lat; - n->idx = idx; - DBG("%lf:%lf", lon, lat); - n->pos.address = NULL; - r->nodes = eina_list_append(r->nodes, n); - - path = evas_object_polygon_add(evas_object_evas_get(r->wd->obj)); - evas_object_smart_member_add(path, r->wd->pan_smart); - r->path = eina_list_append(r->path, path); - } - } - if (str && str[0]) - { - free(str[0]); - free(str); - } + wd->download_list = eina_list_remove(wd->download_list, gi); + wd->try_num++; + wd->download_num++; + evas_object_smart_callback_call(gi->wd->obj, SIG_TILE_LOAD, + NULL); + if (wd->download_num == 1) + edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), + "elm,state,busy,start", "elm"); + } } + return ECORE_CALLBACK_RENEW; } static void -_parse_name(void *data) +_grid_viewport_get(Grid *g, int *x, int *y, int *w, int *h) { - Elm_Map_Name *n = (Elm_Map_Name*)data; - if (!n || !n->ud.fname) return; + EINA_SAFETY_ON_NULL_RETURN(g); + int xx, yy, ww, hh; + Evas_Coord px, py, vw, vh; - FILE *f; + _pan_geometry_get(g->wd, &px, &py); + _viewport_size_get(g->wd, &vw, &vh); + if (px > 0) px = 0; + if (py > 0) py = 0; - Name_Dump dump = {0, NULL, 0.0, 0.0}; + xx = (-px / g->wd->size.tile) - 1; + if (xx < 0) xx = 0; - f = fopen(n->ud.fname, "rb"); - if (f) - { - long sz; + yy = (-py / g->wd->size.tile) - 1; + if (yy < 0) yy = 0; - fseek(f, 0, SEEK_END); - sz = ftell(f); - if (sz > 0) - { - char *buf; + ww = (vw / g->wd->size.tile) + 3; + if (xx + ww >= g->tw) ww = g->tw - xx; - fseek(f, 0, SEEK_SET); - buf = malloc(sz); - if (buf) - { - if (fread(buf, 1, sz, f)) - { - eina_simple_xml_parse(buf, sz, EINA_TRUE, cb_name_dump, &dump); - free(buf); - } - } - } - fclose(f); + hh = (vh / g->wd->size.tile) + 3; + if (yy + hh >= g->th) hh = g->th - yy; - if (dump.address) - { - INF("[%lf : %lf] ADDRESS : %s", n->lon, n->lat, dump.address); - n->address = strdup(dump.address); - } - n->lon = dump.lon; - n->lat = dump.lat; - } + if (x) *x = xx; + if (y) *y = yy; + if (w) *w = ww; + if (h) *h = hh; } -Grid *_get_current_grid(Widget_Data *wd) +static void +_grid_unload(Grid *g) { - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - Eina_List *l; - Grid *g = NULL, *ret = NULL; - EINA_LIST_FOREACH(wd->grids, l, g) + EINA_SAFETY_ON_NULL_RETURN(g); + Eina_Iterator *it; + Eina_Matrixsparse_Cell *cell; + Grid_Item *gi; + + it = eina_matrixsparse_iterator_new(g->grid); + EINA_ITERATOR_FOREACH(it, cell) { - if (wd->zoom == g->zoom) - { - ret = g; - break; - } + gi = eina_matrixsparse_cell_data_get(cell); + _grid_item_unload(gi); } - return ret; + eina_iterator_free(it); } -static Eina_Bool -_route_complete_cb(void *data, int ev_type __UNUSED__, void *event) +static void +_grid_load(Grid *g) { - Ecore_Con_Event_Url_Complete *ev = event; - Elm_Map_Route *r = (Elm_Map_Route*)data; - Widget_Data *wd = r->wd; - - if ((!r) || (!ev)) return EINA_TRUE; - Elm_Map_Route *rr = ecore_con_url_data_get(r->con_url); - ecore_con_url_data_set(r->con_url, NULL); - if (r!=rr) return EINA_TRUE; + EINA_SAFETY_ON_NULL_RETURN(g); + int x, y, xx, yy, ww, hh; + Eina_Iterator *it; + Eina_Matrixsparse_Cell *cell; + Grid_Item *gi; - if (r->ud.fd) fclose(r->ud.fd); - _parse_kml(r); + it = eina_matrixsparse_iterator_new(g->grid); + EINA_ITERATOR_FOREACH(it, cell) + { + gi = eina_matrixsparse_cell_data_get(cell); + if (!_grid_item_intersect(gi)) _grid_item_unload(gi); + } + eina_iterator_free(it); - if (wd->grids) + _grid_viewport_get(g, &xx, &yy, &ww, &hh); + for (y = yy; y < yy + hh; y++) { - Grid *g; - Evas_Coord ox, oy, ow, oh; - evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh); - g = _get_current_grid(wd); - route_place(wd->obj, g, wd->pan_x, wd->pan_y, ox, oy, ow, oh); + for (x = xx; x < xx + ww; x++) + { + gi = eina_matrixsparse_data_idx_get(g->grid, y, x); + if (!gi) gi = _grid_item_create(g, x, y); + _grid_item_load(gi); + } } - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,stop", "elm"); - evas_object_smart_callback_call(wd->obj, SIG_ROUTE_LOADED, NULL); - return EINA_TRUE; } -static Eina_Bool -_name_complete_cb(void *data, int ev_type __UNUSED__, void *event) +static void +_grid_place(Widget_Data *wd) { - Ecore_Con_Event_Url_Complete *ev = event; - Elm_Map_Name *n = (Elm_Map_Name*)data; - Widget_Data *wd = n->wd; - - if ((!n) || (!ev)) return EINA_TRUE; - Elm_Map_Name *nn = ecore_con_url_data_get(n->con_url); - ecore_con_url_data_set(n->con_url, NULL); - if (n!=nn) return EINA_TRUE; - - if (n->ud.fd) fclose(n->ud.fd); - _parse_name(n); + EINA_SAFETY_ON_NULL_RETURN(wd); + Eina_List *l; + Grid *g; - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,stop", "elm"); - evas_object_smart_callback_call(wd->obj, SIG_NAME_LOADED, NULL); - return EINA_TRUE; + EINA_LIST_FOREACH(wd->grids, l, g) + { + if (wd->zoom == g->zoom) _grid_load(g); + else _grid_unload(g); + } + if (!wd->download_idler) wd->download_idler = ecore_idler_add(_download_job, wd); } -static Elm_Map_Name * -_utils_convert_name(const Evas_Object *obj, int method, char *address, double lon, double lat) +static void +_grid_all_create(Widget_Data *wd) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - char buf[PATH_MAX]; - char *source; - int fd; - - if ((!wd) || (!wd->src)) return NULL; - Elm_Map_Name *name = ELM_NEW(Elm_Map_Name); - if (!name) return NULL; + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(wd->src_tile); - snprintf(buf, sizeof(buf), DEST_NAME_XML_FILE); - fd = mkstemp(buf); - if (fd < 0) + int zoom; + for (zoom = wd->src_tile->zoom_min; zoom <= wd->src_tile->zoom_max; zoom++) { - free(name); - return NULL; + Grid *g; + int tnum; + g = ELM_NEW(Grid); + g->wd = wd; + g->zoom = zoom; + tnum = pow(2.0, g->zoom); + g->tw = tnum; + g->th = tnum; + g->grid = eina_matrixsparse_new(g->th, g->tw, NULL, NULL); + wd->grids = eina_list_append(wd->grids, g); } +} - name->con_url = ecore_con_url_new(NULL); - name->ud.fname = strdup(buf); - INF("xml file : %s", name->ud.fname); +static void +_grid_all_clear(Widget_Data *wd) +{ + EINA_SAFETY_ON_NULL_RETURN(wd); - name->ud.fd = fdopen(fd, "w+"); - if ((!name->con_url) || (!name->ud.fd)) + Grid *g; + EINA_LIST_FREE(wd->grids, g) { - ecore_con_url_free(name->con_url); - free(name); - return NULL; - } - - name->wd = wd; - name->handler = ecore_event_handler_add (ECORE_CON_EVENT_URL_COMPLETE, _name_complete_cb, name); - name->method = method; - if (method == ELM_MAP_NAME_METHOD_SEARCH) name->address = strdup(address); - else if (method == ELM_MAP_NAME_METHOD_REVERSE) name->address = NULL; - name->lon = lon; - name->lat = lat; - - source = wd->src->name_url_cb(wd->obj, method, address, lon, lat); - INF("name url = %s", source); - - wd->names = eina_list_append(wd->names, name); - ecore_con_url_url_set(name->con_url, source); - ecore_con_url_fd_set(name->con_url, fileno(name->ud.fd)); - ecore_con_url_data_set(name->con_url, name); - - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,start", "elm"); - evas_object_smart_callback_call(wd->obj, SIG_NAME_LOAD, NULL); - ecore_con_url_get(name->con_url); - if (source) free(source); - - return name; + Eina_Matrixsparse_Cell *cell; + Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); + EINA_ITERATOR_FOREACH(it, cell) + { + Grid_Item *gi; + gi = eina_matrixsparse_cell_data_get(cell); + if (gi) _grid_item_free(gi); + } + eina_iterator_free(it); + eina_matrixsparse_free(g->grid); + free(g); + } } -static Evas_Event_Flags -zoom_start_cb(void *data, void *event_info __UNUSED__) +static void +_track_place(Widget_Data *wd) { - Widget_Data *wd = data; - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); - - // FIXME: scroller can be jumping strangely when resizing & scrolling at the sametime (els_scr bug?) - elm_smart_scroller_hold_set(wd->scr, 1); - elm_smart_scroller_freeze_set(wd->scr, 1); - _scr_drag_start(wd->obj, NULL, NULL); +#ifdef ELM_EMAP + EINA_SAFETY_ON_NULL_RETURN(wd); - wd->pinch.diff += 0.001; + Eina_List *l; + Evas_Object *route; + int xmin, xmax, ymin, ymax; + Evas_Coord px, py, ow, oh; + px = wd->pan_x; + py = wd->pan_y; + _viewport_size_get(wd, &ow, &oh); - return EVAS_EVENT_FLAG_NONE; -} + Evas_Coord size = wd->size.w; -static Evas_Event_Flags -zoom_end_cb(void *data, void *event_info __UNUSED__) -{ - Widget_Data *wd = data; - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); + EINA_LIST_FOREACH(wd->track, l, route) + { + double lon_min, lon_max; + double lat_min, lat_max; + elm_route_longitude_min_max_get(route, &lon_min, &lon_max); + elm_route_latitude_min_max_get(route, &lat_min, &lat_max); + _region_to_coord_convert(wd, lon_min, lat_max, size, &xmin, &ymin); + _region_to_coord_convert(wd, lon_max, lat_min, size, &xmax, &ymax); - // FIXME: scroller can be jumping strangely when resizing & scrolling at the sametime (els_scr bug?) - elm_smart_scroller_hold_set(wd->scr, 0); - elm_smart_scroller_freeze_set(wd->scr, 0); - _scr_drag_stop(wd->obj, NULL, NULL); + if( !(xmin < px && xmax < px) && !(xmin > px+ow && xmax > px+ow)) + { + if( !(ymin < py && ymax < py) && !(ymin > py+oh && ymax > py+oh)) + { + //display the route + evas_object_move(route, xmin - px, ymin - py); + evas_object_resize(route, xmax - xmin, ymax - ymin); - wd->pinch.diff = wd->pinch.level; + evas_object_raise(route); + _obj_rotate(wd, route); + evas_object_show(route); - return EVAS_EVENT_FLAG_NONE; + continue; + } + } + //the route is not display + evas_object_hide(route); + } +#else + (void) wd; +#endif } -static Evas_Event_Flags -zoom_cb(void *data, void *event_info) +static void +_delayed_do(Widget_Data *wd) { - Widget_Data *wd = data; - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); - - if (!wd->paused) - { - int zoom_diff = 0; - int x, y, w, h; - Elm_Gesture_Zoom_Info *ei = event_info; - evas_object_geometry_get(wd->obj, &x, &y, &w, &h); - - wd->pinch.level = wd->pinch.diff * ei->zoom; - wd->pinch.cx = x + ((double)w * 0.5); - wd->pinch.cy = y + ((double)h * 0.5); - - if (wd->pinch.level > 1.999 || wd->pinch.level < 1.001) - { - if (wd->pinch.level > 1.999) - { - zoom_diff = 1; - wd->pinch.diff = wd->pinch.level / 2.0; - wd->pinch.level = wd->pinch.level / 2.0; - } - else if (wd->pinch.level < 1.001) - { - zoom_diff = -1; - wd->pinch.diff = wd->pinch.level * 2.0; - wd->pinch.level = wd->pinch.level * 2.0; - } - Elm_Map_Zoom_Mode temp; - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, NULL, wd); // ei->zoom is refreshed - temp = wd->mode; - wd->mode = ELM_MAP_ZOOM_MODE_MANUAL; - wd->paused = EINA_TRUE; - elm_map_zoom_set(wd->obj, wd->zoom + zoom_diff); - wd->paused = EINA_FALSE; - wd->mode = temp; - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, zoom_cb, wd); // ei->zoom is refreshed - } - else - { - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); - } - evas_object_smart_callback_call(wd->obj, SIG_ZOOM_CHANGE, NULL); + Delayed_Data *dd; + dd = eina_list_nth(wd->delayed_jobs, 0); + if (dd && !dd->wd->zoom_animator) + { + dd->func(dd); + wd->delayed_jobs = eina_list_remove(wd->delayed_jobs, dd); + free(dd); } - - // FIXME: scroller can be jumping strangely when resizing & scrolling at the sametime (els_scr bug?) - _scr_scroll(wd->obj, NULL, NULL); - - return EVAS_EVENT_FLAG_NONE; } -static Evas_Event_Flags -rotate_cb(void *data, void *event_info) +static void +_smooth_update(Widget_Data *wd) { - Widget_Data *wd = data; - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); + EINA_SAFETY_ON_NULL_RETURN(wd); + Eina_List *l; + Grid *g; - if (!wd->paused) + EINA_LIST_FOREACH(wd->grids, l, g) { - int x, y, w, h; - Elm_Gesture_Rotate_Info *ei = event_info; - evas_object_geometry_get(wd->obj, &x, &y, &w, &h); - - wd->rotate.d = wd->rotate.a + ei->angle - ei->base_angle; - wd->rotate.cx = x + ((double)w * 0.5); - wd->rotate.cy = y + ((double)h * 0.5); + Eina_Iterator *it = eina_matrixsparse_iterator_new(g->grid); + Eina_Matrixsparse_Cell *cell; - if (wd->calc_job) ecore_job_del(wd->calc_job); - wd->calc_job = ecore_job_add(_calc_job, wd); + EINA_ITERATOR_FOREACH(it, cell) + { + Grid_Item *gi = eina_matrixsparse_cell_data_get(cell); + if (_grid_item_intersect(gi)) + evas_object_image_smooth_scale_set(gi->img, EINA_TRUE); + } + eina_iterator_free(it); } - return EVAS_EVENT_FLAG_NONE; } -static Evas_Event_Flags -rotate_end_cb(void *data, void *event_info __UNUSED__) +static Eina_Bool +_zoom_timeout(void *data) { + EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL); Widget_Data *wd = data; - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EVAS_EVENT_FLAG_NONE); - - wd->rotate.a = wd->rotate.d; - - return EVAS_EVENT_FLAG_NONE; + _smooth_update(wd); + wd->zoom_timer = NULL; + evas_object_smart_callback_call(wd->obj, SIG_ZOOM_STOP, NULL); + return ECORE_CALLBACK_CANCEL; } static void -_region_get(Widget_Data *wd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *w, Evas_Coord *h) +zoom_do(Widget_Data *wd, double zoom) { EINA_SAFETY_ON_NULL_RETURN(wd); - Evas_Coord sx, sy, tx, ty, tcx, tcy, sw, sh, tw, th, rw, rh; + if (zoom > wd->zoom_max) zoom = wd->zoom_max; + else if (zoom < wd->zoom_min) zoom = wd->zoom_min; - elm_smart_scroller_child_pos_get(wd->scr, &sx, &sy); - elm_smart_scroller_child_viewport_size_get(wd->scr, &sw, &sh); - rw = wd->size.w * wd->pinch.level; - rh = wd->size.h * wd->pinch.level; + Evas_Coord px, py, vw, vh; + Evas_Coord ow, oh; - if (wd->size.w < sw) - { - tw = rw; - tcx = sx + tw/2; - tx = sx + (sw - tw)/2; - } - else + wd->zoom = ROUND(zoom); + wd->zoom_detail = zoom; + ow = wd->size.w; + oh = wd->size.h; + wd->size.tile = pow(2.0, (zoom - wd->zoom)) * wd->tsize; + wd->size.w = pow(2.0, wd->zoom) * wd->size.tile; + wd->size.h = wd->size.w;; + + // Fix to zooming with (viewport center px, py) as the center to prevent + // from zooming with (0,0) as the cetner. (scroller default behavior) + _pan_geometry_get(wd, &px, &py); + _viewport_size_get(wd, &vw, &vh); + if ((vw > 0) && (vh > 0) && (ow > 0) && (oh > 0)) { - tw = sw; - tcx = (sx + tw/2) * wd->pinch.level; - tx = tcx - tw/2; + Evas_Coord xx, yy; + double sx, sy; + if (vw > ow) sx = 0.5; + else sx = (double)(-px + (vw / 2)) / ow; + if (vh > oh) sy = 0.5; + else sy = (double)(-py + (vh / 2)) / oh; + + if (sx > 1.0) sx = 1.0; + if (sy > 1.0) sy = 1.0; + xx = (sx * wd->size.w) - (vw / 2); + yy = (sy * wd->size.h) - (vh / 2); + if (xx < 0) xx = 0; + else if (xx > (wd->size.w - vw)) xx = wd->size.w - vw; + if (yy < 0) yy = 0; + else if (yy > (wd->size.h - vh)) yy = wd->size.h - vh; + elm_smart_scroller_child_region_show(wd->scr, xx, yy, vw, vh); } - if (wd->size.h < sh) + if (wd->zoom_timer) ecore_timer_del(wd->zoom_timer); + else evas_object_smart_callback_call(wd->obj, SIG_ZOOM_START, NULL); + wd->zoom_timer = ecore_timer_add(0.25, _zoom_timeout, wd); + evas_object_smart_callback_call(wd->obj, SIG_ZOOM_CHANGE, NULL); + + evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); + evas_object_smart_changed(wd->pan_smart); +} + +static Eina_Bool +_zoom_anim(void *data) +{ + Widget_Data *wd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, ECORE_CALLBACK_CANCEL); + + if (wd->ani.cnt <= 0) { - th = rh; - ty = sy + (sh - th)/2; - tcy = sy + th/2; + wd->zoom_animator = NULL; + evas_object_smart_changed(wd->pan_smart); + return ECORE_CALLBACK_CANCEL; } else { - th = sw; - tcy = (sy + th/2) * wd->pinch.level; - ty = tcy - th/2; + wd->ani.zoom += wd->ani.diff; + wd->ani.cnt--; + zoom_do(wd, wd->ani.zoom); + return ECORE_CALLBACK_RENEW; } - - if (x) *x = tx; - if (y) *y = ty; - if (cx) *cx= tcx; - if (cy) *cy = tcy; - if (w) *w = tw; - if (h) *h = th; } static void -_coord_rotate(const Evas_Coord x, const Evas_Coord y, const Evas_Coord cx, const Evas_Coord cy, const double degree, Evas_Coord *xx, Evas_Coord *yy) -{ - EINA_SAFETY_ON_NULL_RETURN(xx); - EINA_SAFETY_ON_NULL_RETURN(yy); - - double r = (degree * M_PI) / 180.0; - double tx, ty, ttx, tty; - - tx = x - cx; - ty = y - cy; - - ttx = tx * cos(r); - tty = tx * sin(r); - tx = ttx + (ty * cos(r + M_PI_2)); - ty = tty + (ty * sin(r + M_PI_2)); - - *xx = tx + cx; - *yy = ty + cy; -} - -======= zoom_with_animation(Widget_Data *wd, double zoom, int cnt) { EINA_SAFETY_ON_NULL_RETURN(wd); @@ -6952,220 +3993,72 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty Widget_Data *wd = elm_widget_data_get(obj); EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); - Evas_Coord x, y; - Evas_Coord vh; - Evas_Coord step_x, step_y, page_x, page_y; - - if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; - Evas_Event_Key_Down *ev = event_info; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; - - elm_smart_scroller_child_pos_get(wd->scr, &x, &y); - elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); - elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); - _viewport_size_get(wd, NULL, &vh); - - if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left"))) - { - x -= step_x; - } - else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right"))) - { - x += step_x; - } - else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up"))) - { - y -= step_y; - } - else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down"))) - { - y += step_y; - } - else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior"))) - { - if (page_y < 0) - y -= -(page_y * vh) / 100; - else - y -= page_y; - } - else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next"))) - { - if (page_y < 0) - y += -(page_y * vh) / 100; - else - y += page_y; - } - else if (!strcmp(ev->keyname, "KP_Add")) - { - zoom_with_animation(wd, wd->zoom + 1, 10); - return EINA_TRUE; - } - else if (!strcmp(ev->keyname, "KP_Subtract")) - { - zoom_with_animation(wd, wd->zoom - 1, 10); - return EINA_TRUE; - } - else return EINA_FALSE; - - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - elm_smart_scroller_child_pos_set(wd->scr, x, y); - - return EINA_TRUE; -} ->>>>>>> remotes/origin/upstream -#endif - -EAPI Evas_Object * -elm_map_add(Evas_Object *parent) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON -<<<<<<< HEAD - Evas *e; - Widget_Data *wd; - Evas_Coord minw, minh; - Evas_Object *obj; - static Evas_Smart *smart = NULL; - Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable; - - ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); - - ELM_SET_WIDTYPE(widtype, "map"); - elm_widget_type_set(obj, "map"); - elm_widget_sub_object_add(parent, obj); - elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); - elm_widget_data_set(obj, wd); - elm_widget_del_hook_set(obj, _del_hook); - elm_widget_del_pre_hook_set(obj, _del_pre_hook); - elm_widget_theme_hook_set(obj, _theme_hook); - elm_widget_can_focus_set(obj, EINA_TRUE); - elm_widget_event_hook_set(obj, _event_hook); - - wd->scr = elm_smart_scroller_add(e); - elm_smart_scroller_widget_set(wd->scr, obj); - elm_smart_scroller_object_theme_set(obj, wd->scr, "map", "base", "default"); - evas_object_smart_callback_add(wd->scr, "scroll", _scr, obj); - evas_object_smart_callback_add(wd->scr, "drag", _scr, obj); - elm_widget_resize_object_set(obj, wd->scr); - elm_smart_scroller_wheel_disabled_set(wd->scr, EINA_TRUE); - - evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj); - evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj); - evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj); - evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj); - evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj); - - elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce); - - wd->zoom_min = 0xFF; - wd->zoom_max = 0X00; - source_init(obj); - - wd->obj = obj; - wd->map = evas_map_new(4); - if (!wd->map) return NULL; - - wd->markers_max_num = 30; - wd->pinch.level = 1.0; - wd->pinch.diff = 1.0; - wd->markers = calloc(wd->zoom_max + 1, sizeof(void*)); - - evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj); - evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj); - evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); - evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj); - - if (!smart) - { - static Evas_Smart_Class sc; - - evas_object_smart_clipped_smart_set(&_pan_sc); - sc = _pan_sc; - sc.name = "elm_map_pan"; - sc.version = EVAS_SMART_CLASS_VERSION; - sc.add = _pan_add; - sc.del = _pan_del; - sc.resize = _pan_resize; - sc.move = _pan_move; - sc.calculate = _pan_calculate; - smart = evas_smart_class_new(&sc); - } - if (smart) - { - wd->pan_smart = evas_object_smart_add(e, smart); - wd->pan = evas_object_smart_data_get(wd->pan_smart); - wd->pan->wd = wd; - } - - elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart, - _pan_set, _pan_get, _pan_max_get, - _pan_min_get, _pan_child_size_get); - - wd->rect = evas_object_rectangle_add(e); - evas_object_event_callback_add(wd->rect, EVAS_CALLBACK_RESIZE, - _rect_resize_cb, obj); - evas_object_event_callback_add(wd->rect, EVAS_CALLBACK_MOUSE_DOWN, - _mouse_down, obj); - evas_object_event_callback_add(wd->rect, EVAS_CALLBACK_MOUSE_UP, - _mouse_up, obj); - evas_object_event_callback_add(wd->rect, EVAS_CALLBACK_MOUSE_WHEEL, - _mouse_wheel_cb, obj); - - evas_object_smart_member_add(wd->rect, wd->pan_smart); - elm_widget_sub_object_add(obj, wd->rect); - evas_object_show(wd->rect); - evas_object_color_set(wd->rect, 0, 0, 0, 0); - - wd->ges = elm_gesture_layer_add(obj); - if (!wd->ges) ERR("elm_gesture_layer_add() failed"); - elm_gesture_layer_attach(wd->ges, wd->rect); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, - zoom_start_cb, wd); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, - zoom_cb, wd); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, - zoom_end_cb, wd); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, - zoom_end_cb, wd); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_MOVE, - rotate_cb, wd); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_END, - rotate_end_cb, wd); - elm_gesture_layer_cb_set(wd->ges, ELM_GESTURE_ROTATE, ELM_GESTURE_STATE_ABORT, - rotate_end_cb, wd); - - wd->mode = ELM_MAP_ZOOM_MODE_MANUAL; - wd->id = ((int)getpid() << 16) | idnum; - idnum++; - - wd->tsize = 256; - edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), - &minw, &minh); - evas_object_size_hint_min_set(obj, minw, minh); - - wd->sep_maps_markers = evas_object_rectangle_add(evas_object_evas_get(obj)); - evas_object_smart_member_add(wd->sep_maps_markers, wd->pan_smart); - - grid_create_all(obj); + Evas_Coord x, y; + Evas_Coord vh; + Evas_Coord step_x, step_y, page_x, page_y; - wd->paused = EINA_TRUE; - elm_map_zoom_set(obj, 0); - wd->paused = EINA_FALSE; - _sizing_eval(obj); + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + Evas_Event_Key_Down *ev = event_info; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; - // TODO: convert Elementary to subclassing of Evas_Smart_Class - // TODO: and save some bytes, making descriptions per-class and not instance! - evas_object_smart_callbacks_descriptions_set(obj, _signals); + elm_smart_scroller_child_pos_get(wd->scr, &x, &y); + elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y); + elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y); + _viewport_size_get(wd, NULL, &vh); - if (!ecore_file_download_protocol_available("http://")) + if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left"))) + { + x -= step_x; + } + else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right"))) + { + x += step_x; + } + else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up"))) + { + y -= step_y; + } + else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down"))) + { + y += step_y; + } + else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior"))) + { + if (page_y < 0) + y -= -(page_y * vh) / 100; + else + y -= page_y; + } + else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next"))) + { + if (page_y < 0) + y += -(page_y * vh) / 100; + else + y += page_y; + } + else if (!strcmp(ev->keyname, "KP_Add")) + { + zoom_with_animation(wd, wd->zoom + 1, 10); + return EINA_TRUE; + } + else if (!strcmp(ev->keyname, "KP_Subtract")) { - ERR("Ecore must be built with curl support for the map widget!"); + zoom_with_animation(wd, wd->zoom - 1, 10); + return EINA_TRUE; } + else return EINA_FALSE; - return obj; -#else - (void) parent; - return NULL; -======= + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + elm_smart_scroller_child_pos_set(wd->scr, x, y); + + return EINA_TRUE; +} +#endif + +EAPI Evas_Object * +elm_map_add(Evas_Object *parent) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON Evas *e; Widget_Data *wd; Evas_Object *obj; @@ -7571,436 +4464,168 @@ elm_map_rotate_set(Evas_Object *obj, double degree, Evas_Coord cx, Evas_Coord cy #endif } -EAPI void -elm_map_rotate_get(const Evas_Object *obj, double *degree, Evas_Coord *cx, Evas_Coord *cy) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - - if (degree) *degree = wd->rotate.d; - if (cx) *cx = wd->rotate.cx; - if (cy) *cy = wd->rotate.cy; -#else - (void) obj; - (void) degree; - (void) cx; - (void) cy; -#endif -} - -EAPI void -elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - - if ((!wd->wheel_disabled) && (disabled)) - evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, obj); - else if ((wd->wheel_disabled) && (!disabled)) - evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, obj); - wd->wheel_disabled = !!disabled; -#else - (void) obj; - (void) disabled; -#endif -} - -EAPI Eina_Bool -elm_map_wheel_disabled_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); - - return wd->wheel_disabled; -#else - (void) obj; - return EINA_FALSE; -#endif -} - -EAPI void -elm_map_tile_load_status_get(const Evas_Object *obj, int *try_num, int *finish_num) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - - if (try_num) *try_num = wd->try_num; - if (finish_num) *finish_num = wd->finish_num; -#else - (void) obj; - (void) try_num; - (void) finish_num; -#endif -} - -EAPI void -elm_map_canvas_to_region_convert(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, double *lon, double *lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(lon); - EINA_SAFETY_ON_NULL_RETURN(lat); - - Evas_Coord px, py, vw, vh; - _pan_geometry_get(wd, &px, &py); - _viewport_size_get(wd, &vw, &vh); - _coord_rotate(x - px, y - py, (vw / 2) - px, (vh / 2) - py, -wd->rotate.d, - &x, &y); - _coord_to_region_convert(wd, x, y, wd->size.w, lon, lat); -#else - (void) obj; - (void) x; - (void) y; - (void) lon; - (void) lat; -#endif -} - -EAPI void -elm_map_region_to_canvas_convert(const Evas_Object *obj, double lon, double lat, Evas_Coord *x, Evas_Coord *y) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(x); - EINA_SAFETY_ON_NULL_RETURN(y); - - Evas_Coord px, py, vw, vh; - _pan_geometry_get(wd, &px, &py); - _viewport_size_get(wd, &vw, &vh); - _region_to_coord_convert(wd, lon, lat, wd->size.w, x, y); - _coord_rotate(*x, *y, (vw / 2) - px, (vh / 2) - py, wd->rotate.d, - x, y); - *x += px; - *y += py; -#else - (void) obj; - (void) lon; - (void) lat; - (void) x; - (void) y; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_zoom_set(Evas_Object *obj, int zoom) -======= -elm_map_user_agent_set(Evas_Object *obj, const char *user_agent) ->>>>>>> remotes/origin/upstream -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); -<<<<<<< HEAD - Eina_List *l; - Evas_Coord rx, ry, rw, rh; - Evas_Object *p; - Elm_Map_Route *r; - Evas_Object *route; - int z = 0; - - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(wd->src); - if (wd->zoom_animator) return; - - if (zoom < 0) zoom = 0; - if (zoom > wd->src->zoom_max) zoom = wd->src->zoom_max; - if (zoom < wd->src->zoom_min) zoom = wd->src->zoom_min; - - if ((wd->zoom - zoom) > 0) wd->zoom_method = ZOOM_METHOD_OUT; - else if ((wd->zoom - zoom) < 0) wd->zoom_method = ZOOM_METHOD_IN; - else wd->zoom_method = ZOOM_METHOD_NONE; - - wd->zoom = zoom; - wd->size.ow = wd->size.w; - wd->size.oh = wd->size.h; - elm_smart_scroller_child_pos_get(wd->scr, &rx, &ry); - elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); - - EINA_LIST_FOREACH(wd->route, l, r) - { - if (r) - { - EINA_LIST_FOREACH(r->path, l, p) - { - evas_object_polygon_points_clear(p); - } - } - } - - EINA_LIST_FOREACH(wd->track, l, route) - { - evas_object_hide(route); - } - - if (wd->mode != ELM_MAP_ZOOM_MODE_MANUAL) - { - int p2w, p2h; - int cumulw, cumulh; - - cumulw = wd->tsize; - p2w = 0; - while (cumulw <= rw) - { - p2w++; - cumulw *= 2; - } - p2w--; - - cumulh = wd->tsize; - p2h = 0; - while (cumulh <= rh) - { - p2h++; - cumulh *= 2; - } - p2h--; - - if (wd->mode == ELM_MAP_ZOOM_MODE_AUTO_FIT) - { - if (p2w < p2h) z = p2w; - else z = p2h; - } - else if (wd->mode == ELM_MAP_ZOOM_MODE_AUTO_FILL) - { - if (p2w > p2h) z = p2w; - else z = p2h; - } - wd->zoom = z; - } - - wd->size.nw = pow(2.0, wd->zoom) * wd->tsize; - wd->size.nh = pow(2.0, wd->zoom) * wd->tsize; - wd->t = 1.0; - - if ((wd->size.w > 0) && (wd->size.h > 0)) - { - wd->size.spos.x = (double)(rx + (rw / 2)) / (double)wd->size.ow; - wd->size.spos.y = (double)(ry + (rh / 2)) / (double)wd->size.oh; - } - else - { - wd->size.spos.x = 0.5; - wd->size.spos.y = 0.5; - } - - if (rw > wd->size.ow) wd->size.spos.x = 0.5; - if (rh > wd->size.oh) wd->size.spos.y = 0.5; - if (wd->size.spos.x > 1.0) wd->size.spos.x = 1.0; - if (wd->size.spos.y > 1.0) wd->size.spos.y = 1.0; - - if (wd->paused) - { - zoom_do(obj); - } - else - { - if (!wd->zoom_animator) - { - wd->zoom_animator = ecore_animator_add(_zoom_anim, obj); - wd->nosmooth++; - if (wd->nosmooth == 1) _smooth_update(obj); - evas_object_smart_callback_call(obj, SIG_ZOOM_START, NULL); - } - } - - if (wd->zoom_method != ZOOM_METHOD_NONE) evas_object_smart_callback_call(obj, SIG_ZOOM_CHANGE, NULL); -#else - (void) obj; - (void) zoom; -#endif -} - -EAPI int -elm_map_zoom_get(const Evas_Object *obj) +EAPI void +elm_map_rotate_get(const Evas_Object *obj, double *degree, Evas_Coord *cx, Evas_Coord *cy) { #ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) 0; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); - if (!wd) return 0; - return wd->zoom; + if (degree) *degree = wd->rotate.d; + if (cx) *cx = wd->rotate.cx; + if (cy) *cy = wd->rotate.cy; #else (void) obj; - return 0; -======= - EINA_SAFETY_ON_NULL_RETURN(wd); - EINA_SAFETY_ON_NULL_RETURN(user_agent); + (void) degree; + (void) cx; + (void) cy; +#endif +} - eina_stringshare_replace(&wd->user_agent, user_agent); +EAPI void +elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); - if (!wd->ua) wd->ua = eina_hash_string_small_new(NULL); - eina_hash_set(wd->ua, "User-Agent", wd->user_agent); + if ((!wd->wheel_disabled) && (disabled)) + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, obj); + else if ((wd->wheel_disabled) && (!disabled)) + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, obj); + wd->wheel_disabled = !!disabled; #else (void) obj; - (void) user_agent; + (void) disabled; #endif } -EAPI const char * -elm_map_user_agent_get(const Evas_Object *obj) +EAPI Eina_Bool +elm_map_wheel_disabled_get(const Evas_Object *obj) { #ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); - return wd->user_agent; + return wd->wheel_disabled; #else (void) obj; - return NULL; ->>>>>>> remotes/origin/upstream + return EINA_FALSE; #endif } EAPI void -<<<<<<< HEAD -elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode) -======= -elm_map_source_set(Evas_Object *obj, Elm_Map_Source_Type type, const char *source_name) ->>>>>>> remotes/origin/upstream +elm_map_tile_load_status_get(const Evas_Object *obj, int *try_num, int *finish_num) { #ifdef HAVE_ELEMENTARY_ECORE_CON ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); -<<<<<<< HEAD - - if (!wd) return; - if (wd->mode == mode) return; - wd->mode = mode; + EINA_SAFETY_ON_NULL_RETURN(wd); - if (wd->mode != ELM_MAP_ZOOM_MODE_MANUAL) - { - int tz = wd->zoom; - wd->zoom = 0; - elm_map_zoom_set(wd->obj, tz); - } + if (try_num) *try_num = wd->try_num; + if (finish_num) *finish_num = wd->finish_num; #else (void) obj; - (void) mode; + (void) try_num; + (void) finish_num; #endif } -EAPI Elm_Map_Zoom_Mode -elm_map_zoom_mode_get(const Evas_Object *obj) +EAPI void +elm_map_canvas_to_region_convert(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, double *lon, double *lat) { #ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) ELM_MAP_ZOOM_MODE_MANUAL; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(lon); + EINA_SAFETY_ON_NULL_RETURN(lat); - if (!wd) return ELM_MAP_ZOOM_MODE_MANUAL; - return wd->mode; + Evas_Coord px, py, vw, vh; + _pan_geometry_get(wd, &px, &py); + _viewport_size_get(wd, &vw, &vh); + _coord_rotate(x - px, y - py, (vw / 2) - px, (vh / 2) - py, -wd->rotate.d, + &x, &y); + _coord_to_region_convert(wd, x, y, wd->size.w, lon, lat); #else (void) obj; - return ELM_MAP_ZOOM_MODE_MANUAL; + (void) x; + (void) y; + (void) lon; + (void) lat; #endif } EAPI void -elm_map_geo_region_bring_in(Evas_Object *obj, double lon, double lat) +elm_map_region_to_canvas_convert(const Evas_Object *obj, double lon, double lat, Evas_Coord *x, Evas_Coord *y) { #ifdef HAVE_ELEMENTARY_ECORE_CON ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - int rx, ry, rw, rh; - - if (!wd) return; - elm_map_utils_convert_geo_into_coord(obj, lon, lat, wd->size.w, &rx, &ry); - elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); - - rx = rx - rw / 2; - ry = ry - rh / 2; - - if (wd->zoom_animator) - { - wd->nosmooth--; - if (!wd->nosmooth) _smooth_update(obj); - ecore_animator_del(wd->zoom_animator); - wd->zoom_animator = NULL; - zoom_do(obj); - evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); - } - elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh); + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(x); + EINA_SAFETY_ON_NULL_RETURN(y); - wd->center_on.enabled = EINA_TRUE; - wd->center_on.lon = lon; - wd->center_on.lat = lat; + Evas_Coord px, py, vw, vh; + _pan_geometry_get(wd, &px, &py); + _viewport_size_get(wd, &vw, &vh); + _region_to_coord_convert(wd, lon, lat, wd->size.w, x, y); + _coord_rotate(*x, *y, (vw / 2) - px, (vh / 2) - py, wd->rotate.d, + x, y); + *x += px; + *y += py; #else (void) obj; (void) lon; (void) lat; + (void) x; + (void) y; #endif } EAPI void -elm_map_geo_region_show(Evas_Object *obj, double lon, double lat) +elm_map_user_agent_set(Evas_Object *obj, const char *user_agent) { #ifdef HAVE_ELEMENTARY_ECORE_CON ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - int rx, ry, rw, rh; + EINA_SAFETY_ON_NULL_RETURN(wd); + EINA_SAFETY_ON_NULL_RETURN(user_agent); - if (!wd) return; - elm_map_utils_convert_geo_into_coord(obj, lon, lat, wd->size.w, &rx, &ry); - elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); + eina_stringshare_replace(&wd->user_agent, user_agent); - rx = rx - rw / 2; - ry = ry - rh / 2; + if (!wd->ua) wd->ua = eina_hash_string_small_new(NULL); + eina_hash_set(wd->ua, "User-Agent", wd->user_agent); +#else + (void) obj; + (void) user_agent; +#endif +} - if (wd->zoom_animator) - { - wd->nosmooth--; - ecore_animator_del(wd->zoom_animator); - wd->zoom_animator = NULL; - zoom_do(obj); - evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); - } - elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh); +EAPI const char * +elm_map_user_agent_get(const Evas_Object *obj) +{ +#ifdef HAVE_ELEMENTARY_ECORE_CON + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - wd->center_on.enabled = EINA_TRUE; - wd->center_on.lon = lon; - wd->center_on.lat = lat; + return wd->user_agent; #else (void) obj; - (void) lon; - (void) lat; + return NULL; #endif } EAPI void -elm_map_geo_region_get(const Evas_Object *obj, double *lon, double *lat) +elm_map_source_set(Evas_Object *obj, Elm_Map_Source_Type type, const char *source_name) { #ifdef HAVE_ELEMENTARY_ECORE_CON ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - Evas_Coord cx, cy; - int rw; - double tlon, tlat; - EINA_SAFETY_ON_NULL_RETURN(wd); - - _region_get(wd, NULL, NULL, &cx, &cy, NULL, NULL); - rw = wd->size.w * wd->pinch.level; - elm_map_utils_convert_coord_into_geo(obj, cx, cy, rw, &tlon, &tlat); - if (lon) *lon = tlon; - if (lat) *lat = tlat; -#else - (void) obj; - (void) lon; - (void) lat; -======= EINA_SAFETY_ON_NULL_RETURN(wd); EINA_SAFETY_ON_NULL_RETURN(source_name); @@ -8226,89 +4851,10 @@ elm_map_name_add(const Evas_Object *obj, const char *address, double lon, double (void) name_cb; (void) data; return NULL; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_paused_set(Evas_Object *obj, Eina_Bool paused) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if (wd->paused == !!paused) return; - wd->paused = !!paused; - if (wd->paused) - { - if (wd->zoom_animator) - { - if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator); - wd->zoom_animator = NULL; - zoom_do(obj); - evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL); - } - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,stop", "elm"); - } - else - { - if (wd->download_num >= 1) - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,start", "elm"); - } -#else - (void) obj; - (void) paused; #endif } EAPI void -elm_map_paused_markers_set(Evas_Object *obj, Eina_Bool paused) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if (wd->paused_markers == !!paused) return; - wd->paused_markers = paused; -#else - (void) obj; - (void) paused; -#endif -} - -EAPI Eina_Bool -elm_map_paused_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return EINA_FALSE; - return wd->paused; -#else - (void) obj; - return EINA_FALSE; -#endif -} - -EAPI Eina_Bool -elm_map_paused_markers_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return EINA_FALSE; - return wd->paused_markers; -#else - (void) obj; - return EINA_FALSE; -======= elm_map_name_del(Elm_Map_Name *name) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -8363,89 +4909,33 @@ elm_map_name_region_get(const Elm_Map_Name *name, double *lon, double *lat) #endif } -EAPI Elm_Map_Overlay * -elm_map_overlay_add(Evas_Object *obj, double lon, double lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - - Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); - overlay->wd = wd; - overlay->type = ELM_MAP_OVERLAY_TYPE_DEFAULT; - overlay->ovl = _overlay_default_new(wd, lon, lat, "radio"); - _overlay_default_cb_add(overlay->ovl, _overlay_clicked_cb, overlay); - overlay->grp = _overlay_group_new(wd); - wd->overlays = eina_list_append(wd->overlays, overlay); - - evas_object_smart_changed(wd->pan_smart); - return overlay; -#else - (void) obj; - (void) lon; - (void) lat; - return NULL; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_utils_downloading_status_get(const Evas_Object *obj, int *try_num, int *finish_num) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if (try_num) - { - *try_num = wd->try_num; - } - - if (finish_num) - { - *finish_num = wd->finish_num; - } -#else - (void) obj; - (void) try_num; - (void) finish_num; -#endif -} - -EAPI void -elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat) +EAPI Elm_Map_Overlay * +elm_map_overlay_add(Evas_Object *obj, double lon, double lat) { #ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); + ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); - if (!wd) return; - int zoom = floor(log(size / 256) / log(2)); - if ((wd->src) && (wd->src->coord_into_geo)) - { - if (wd->src->coord_into_geo(obj, zoom, x, y, size, lon, lat)) return; - } + Elm_Map_Overlay *overlay = ELM_NEW(Elm_Map_Overlay); + overlay->wd = wd; + overlay->type = ELM_MAP_OVERLAY_TYPE_DEFAULT; + overlay->ovl = _overlay_default_new(wd, lon, lat, "radio"); + _overlay_default_cb_add(overlay->ovl, _overlay_clicked_cb, overlay); + overlay->grp = _overlay_group_new(wd); + wd->overlays = eina_list_append(wd->overlays, overlay); - if (lon) - { - *lon = x / (double)size * 360.0 - 180; - } - if (lat) - { - double n = ELM_PI - 2.0 * ELM_PI * y / size; - *lat = 180.0 / ELM_PI * atan(0.5 * (exp(n) - exp(-n))); - } + evas_object_smart_changed(wd->pan_smart); + return overlay; #else (void) obj; - (void) x; - (void) y; - (void) size; (void) lon; (void) lat; -======= + return NULL; +#endif +} + +EAPI void elm_map_overlay_del(Elm_Map_Overlay *overlay) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -8495,51 +4985,11 @@ elm_map_overlay_type_get(const Elm_Map_Overlay *overlay) return overlay->type; #else (void) overlay; - return OVERLAY_TYPE_NONE; ->>>>>>> remotes/origin/upstream + return ELM_MAP_OVERLAY_TYPE_NONE; #endif } EAPI void -<<<<<<< HEAD -elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - int zoom = floor(log(size / 256) / log(2)); - if ((wd->src) && (wd->src->geo_into_coord)) - { - if (wd->src->geo_into_coord(obj, zoom, lon, lat, size, x, y)) return; - } - - if (x) - *x = floor((lon + 180.0) / 360.0 * size); - if (y) - *y = floor((1.0 - log( tan(lat * ELM_PI / 180.0) + 1.0 / cos(lat * ELM_PI / 180.0)) / ELM_PI) / 2.0 * size); -#else - (void) obj; - (void) lon; - (void) lat; - (void) size; - (void) x; - (void) y; -#endif -} - -EAPI Elm_Map_Name * -elm_map_utils_convert_coord_into_name(const Evas_Object *obj, double lon, double lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - return _utils_convert_name(obj, ELM_MAP_NAME_METHOD_REVERSE, NULL, lon, lat); -#else - (void) obj; - (void) lon; - (void) lat; -======= elm_map_overlay_data_set(Elm_Map_Overlay *overlay, void *data) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -8565,41 +5015,10 @@ elm_map_overlay_data_get(const Elm_Map_Overlay *overlay) return overlay->data; #else (void) overlay; ->>>>>>> remotes/origin/upstream - return NULL; -#endif -} - -<<<<<<< HEAD -EAPI Elm_Map_Name * -elm_map_utils_convert_name_into_coord(const Evas_Object *obj, char *address) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - if (!address) return NULL; - return _utils_convert_name(obj, ELM_MAP_NAME_METHOD_SEARCH, address, 0.0, 0.0); -#else - (void) obj; - (void) address; return NULL; #endif } -EINA_DEPRECATED EAPI void -elm_map_utils_rotate_coord(const Evas_Object *obj, const Evas_Coord x, const Evas_Coord y, const Evas_Coord cx, const Evas_Coord cy, const double degree, Evas_Coord *xx, Evas_Coord *yy) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - _coord_rotate(x, y, cx, cy, degree, xx, yy); -#else - (void) x; - (void) y; - (void) cx; - (void) cy; - (void) degree; - (void) xx; - (void) yy; -======= EAPI void elm_map_overlay_hide_set(Elm_Map_Overlay *overlay, Eina_Bool hide) { @@ -8630,243 +5049,10 @@ elm_map_overlay_hide_get(const Elm_Map_Overlay *overlay) #else (void) overlay; return EINA_FALSE; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_canvas_to_geo_convert(const Evas_Object *obj, const Evas_Coord x, const Evas_Coord y, double *lon, double *lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(lon); - EINA_SAFETY_ON_NULL_RETURN(lat); - EINA_SAFETY_ON_NULL_RETURN(wd); - - Evas_Coord xx, yy, w, h, mw, tx, ty, cx, cy; - double d; - - _region_get(wd, &xx, &yy, &cx, &cy, &w, &h); - mw = wd->size.w * wd->pinch.level; - if (w < mw) - { - xx += x; - yy += y; - } - else - { - xx = x - xx; - yy = y - yy; - } - - elm_map_rotate_get(obj, &d, NULL, NULL); - _coord_rotate(xx, yy, cx, cy, -d, &tx, &ty); - elm_map_utils_convert_coord_into_geo(obj, tx, ty, mw, lon, lat); -#else - (void) obj; - (void) x; - (void) y; - (void) lon; - (void) lat; -#endif -} - -EAPI Elm_Map_Marker * -elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *clas, Elm_Map_Group_Class *clas_group, void *data) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - int i, j; - Eina_List *l; - Marker_Group *group; - int mpi, mpj; - int tabi[9]; - int tabj[9]; - const char *s; - const char *style; - Evas_Object *o; - - if (!wd) return NULL; - EINA_SAFETY_ON_NULL_RETURN_VAL(clas_group, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL(clas, NULL); - - Elm_Map_Marker *marker = ELM_NEW(Elm_Map_Marker); - - marker->wd = wd; - marker->clas = clas; - marker->clas_group = clas_group; - marker->longitude = lon; - marker->latitude = lat; - marker->data = data; - marker->x = calloc(wd->zoom_max + 1, sizeof(Evas_Coord)); - marker->y = calloc(wd->zoom_max + 1, sizeof(Evas_Coord)); - marker->groups = calloc(wd->zoom_max + 1, sizeof(Marker_Group*)); - - tabi[1] = tabi[4] = tabi[6] = -1; - tabi[2] = tabi[0] = tabi[7] = 0; - tabi[3] = tabi[5] = tabi[8] = 1; - - tabj[1] = tabj[2] = tabj[3] = -1; - tabj[4] = tabj[0] = tabj[5] = 0; - tabj[6] = tabj[7] = tabj[8] = 1; - - if (!clas_group->priv.set) - { - style = "radio"; - if (marker->clas_group && marker->clas_group->style) - style = marker->clas_group->style; - - o = edje_object_add(evas_object_evas_get(obj)); - _elm_theme_object_set(obj, o, "map/marker", style, elm_widget_style_get(obj)); - s = edje_object_data_get(o, "size_w"); - if (s) clas_group->priv.edje_w = atoi(s); - else clas_group->priv.edje_w = 0; - s = edje_object_data_get(o, "size_h"); - if (s) clas_group->priv.edje_h = atoi(s); - else clas_group->priv.edje_h = 0; - s = edje_object_data_get(o, "size_max_w"); - if (s) clas_group->priv.edje_max_w = atoi(s); - else clas_group->priv.edje_max_w = 0; - s = edje_object_data_get(o, "size_max_h"); - if (s) clas_group->priv.edje_max_h = atoi(s); - else clas_group->priv.edje_max_h = 0; - evas_object_del(o); - - clas_group->priv.set = EINA_TRUE; - } - - if (!clas->priv.set) - { - style = "radio"; - if (marker->clas && marker->clas->style) - style = marker->clas->style; - - o = edje_object_add(evas_object_evas_get(obj)); - _elm_theme_object_set(obj, o, "map/marker", style, elm_widget_style_get(obj)); - s = edje_object_data_get(o, "size_w"); - if (s) clas->priv.edje_w = atoi(s); - else clas->priv.edje_w = 0; - s = edje_object_data_get(o, "size_h"); - if (s) clas->priv.edje_h = atoi(s); - else clas->priv.edje_h = 0; - evas_object_del(o); - - clas->priv.set = EINA_TRUE; - } - - for (i = clas_group->zoom_displayed; i <= wd->zoom_max; i++) - { - elm_map_utils_convert_geo_into_coord(obj, lon, lat, pow(2.0, i)*wd->tsize, - &(marker->x[i]), &(marker->y[i])); - - //search in the matrixsparse the region where the marker will be - mpi = marker->x[i] / wd->tsize; - mpj = marker->y[i] / wd->tsize; - - if (!wd->markers[i]) - { - int size = pow(2.0, i); - wd->markers[i] = eina_matrixsparse_new(size, size, NULL, NULL); - } - - group = NULL; - if (i <= clas_group->zoom_grouped) - { - for (j = 0, group = NULL; j < 9 && !group; j++) - { - EINA_LIST_FOREACH(eina_matrixsparse_data_idx_get(wd->markers[i], mpj + tabj[j], mpi + tabi[j]), - l, group) - { - if (group->clas == marker->clas_group - && ELM_RECTS_INTERSECT(marker->x[i]-clas->priv.edje_w/4, - marker->y[i]-clas->priv.edje_h/4, clas->priv.edje_w, clas->priv.edje_h, - group->x-group->w/4, group->y-group->h/4, group->w, group->h)) - { - group->markers = eina_list_append(group->markers, marker); - group->update_nbelems = EINA_TRUE; - group->update_resize = EINA_TRUE; - - group->sum_x += marker->x[i]; - group->sum_y += marker->y[i]; - group->x = group->sum_x / eina_list_count(group->markers); - group->y = group->sum_y / eina_list_count(group->markers); - - group->w = group->clas->priv.edje_w + group->clas->priv.edje_w/8. - * eina_list_count(group->markers); - group->h = group->clas->priv.edje_h + group->clas->priv.edje_h/8. - * eina_list_count(group->markers); - if (group->w > group->clas->priv.edje_max_w) group->w = group->clas->priv.edje_max_w; - if (group->h > group->clas->priv.edje_max_h) group->h = group->clas->priv.edje_max_h; - - if (group->obj && eina_list_count(group->markers) == 2) - { - _group_object_free(group); - _group_object_create(group); - } - if (group->bubble) - _group_bubble_content_update(group); - - break; - } - } - } - } - if (!group) - { - group = calloc(1, sizeof(Marker_Group)); - group->wd = wd; - group->sum_x = marker->x[i]; - group->sum_y = marker->y[i]; - group->x = marker->x[i]; - group->y = marker->y[i]; - group->w = clas_group->priv.edje_w; - group->h = clas_group->priv.edje_h; - group->clas = clas_group; - - group->markers = eina_list_append(group->markers, marker); - group->update_nbelems = EINA_TRUE; - group->update_resize = EINA_TRUE; - - eina_matrixsparse_cell_idx_get(wd->markers[i], mpj, mpi, &(group->cell)); - - if (!group->cell) - { - l = eina_list_append(NULL, group); - eina_matrixsparse_data_idx_set(wd->markers[i], mpj, mpi, l); - eina_matrixsparse_cell_idx_get(wd->markers[i], mpj, mpi, &(group->cell)); - } - else - { - l = eina_matrixsparse_cell_data_get(group->cell); - l = eina_list_append(l, group); - eina_matrixsparse_cell_data_set(group->cell, l); - } - } - marker->groups[i] = group; - } - - if (wd->grids) - { - Grid *g; - Evas_Coord ox, oy, ow, oh; - evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); - g = _get_current_grid(wd); - marker_place(obj, g, wd->pan_x, wd->pan_y, ox, oy, ow, oh); - } - - return marker; -#else - (void) obj; - (void) lon; - (void) lat; - (void) clas; - (void) clas_group; - (void) data; - return NULL; -======= elm_map_overlay_displayed_zoom_min_set(Elm_Map_Overlay *overlay, int zoom) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9013,82 +5199,10 @@ elm_map_overlay_region_set(Elm_Map_Overlay *overlay, double lon, double lat) (void) overlay; (void) lon; (void) lat; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_marker_remove(Elm_Map_Marker *marker) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - int i; - Eina_List *groups; - Widget_Data *wd; - - EINA_SAFETY_ON_NULL_RETURN(marker); - wd = marker->wd; - if (!wd) return; - for (i = marker->clas_group->zoom_displayed; i <= wd->zoom_max; i++) - { - marker->groups[i]->markers = eina_list_remove(marker->groups[i]->markers, marker); - if (!eina_list_count(marker->groups[i]->markers)) - { - groups = eina_matrixsparse_cell_data_get(marker->groups[i]->cell); - groups = eina_list_remove(groups, marker->groups[i]); - eina_matrixsparse_cell_data_set(marker->groups[i]->cell, groups); - - _group_object_free(marker->groups[i]); - _group_bubble_free(marker->groups[i]); - free(marker->groups[i]); - } - else - { - marker->groups[i]->sum_x -= marker->x[i]; - marker->groups[i]->sum_y -= marker->y[i]; - - marker->groups[i]->x = marker->groups[i]->sum_x / eina_list_count(marker->groups[i]->markers); - marker->groups[i]->y = marker->groups[i]->sum_y / eina_list_count(marker->groups[i]->markers); - - marker->groups[i]->w = marker->groups[i]->clas->priv.edje_w - + marker->groups[i]->clas->priv.edje_w/8. * eina_list_count(marker->groups[i]->markers); - marker->groups[i]->h = marker->groups[i]->clas->priv.edje_h - + marker->groups[i]->clas->priv.edje_h/8. * eina_list_count(marker->groups[i]->markers); - if (marker->groups[i]->w > marker->groups[i]->clas->priv.edje_max_w) - marker->groups[i]->w = marker->groups[i]->clas->priv.edje_max_w; - if (marker->groups[i]->h > marker->groups[i]->clas->priv.edje_max_h) - marker->groups[i]->h = marker->groups[i]->clas->priv.edje_max_h; - - if ((marker->groups[i]->obj) && (eina_list_count(marker->groups[i]->markers) == 1)) - { - _group_object_free(marker->groups[i]); - _group_object_create(marker->groups[i]); - } - } - } - - if ((marker->content) && (marker->clas->func.del)) - marker->clas->func.del(marker->wd->obj, marker, marker->data, marker->content); - else if (marker->content) - evas_object_del(marker->content); - - if (marker->x) free(marker->x); - if (marker->y) free(marker->y); - if (marker->groups) free(marker->groups); - - free(marker); - - if (wd->grids) - { - Grid *g; - Evas_Coord ox, oy, ow, oh; - evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh); - g = _get_current_grid(wd); - marker_place(wd->obj, g, wd->pan_x, wd->pan_y, ox, oy, ow, oh); - } -#else - (void) marker; -======= elm_map_overlay_region_get(const Elm_Map_Overlay *overlay, double *lon, double *lat) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9113,34 +5227,10 @@ elm_map_overlay_region_get(const Elm_Map_Overlay *overlay, double *lon, double * (void) overlay; (void) lon; (void) lat; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_marker_region_get(const Elm_Map_Marker *marker, double *lon, double *lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(marker); - if (lon) *lon = marker->longitude; - if (lat) *lat = marker->latitude; -#else - (void) marker; - (void) lon; - (void) lat; #endif } EAPI void -elm_map_marker_bring_in(Elm_Map_Marker *marker) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(marker); - elm_map_geo_region_bring_in(marker->wd->obj, marker->longitude, marker->latitude); -#else - (void) marker; -======= elm_map_overlay_icon_set(Elm_Map_Overlay *overlay, Evas_Object *icon) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9189,20 +5279,10 @@ elm_map_overlay_icon_get(const Elm_Map_Overlay *overlay) #else (void) overlay; return NULL; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_marker_show(Elm_Map_Marker *marker) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(marker); - elm_map_geo_region_show(marker->wd->obj, marker->longitude, marker->latitude); -#else - (void) marker; -======= elm_map_overlay_content_set(Elm_Map_Overlay *overlay, Evas_Object *obj) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9249,63 +5329,12 @@ elm_map_overlay_content_get(const Elm_Map_Overlay *overlay) return NULL; } #else - (void) overlay; - return NULL; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_markers_list_show(Eina_List *markers) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - int zoom; - double lon, lat; - Eina_List *l; - Elm_Map_Marker *marker, *m_max_lon = NULL, *m_max_lat = NULL, *m_min_lon = NULL, *m_min_lat = NULL; - Evas_Coord rw, rh, xc, yc; - Widget_Data *wd; - - EINA_SAFETY_ON_NULL_RETURN(markers); - EINA_LIST_FOREACH(markers, l, marker) - { - wd = marker->wd; - - if ((!m_min_lon) || (marker->longitude < m_min_lon->longitude)) - m_min_lon = marker; - - if ((!m_max_lon) || (marker->longitude > m_max_lon->longitude)) - m_max_lon = marker; - - if ((!m_min_lat) || (marker->latitude > m_min_lat->latitude)) - m_min_lat = marker; - - if ((!m_max_lat) || (marker->latitude < m_max_lat->latitude)) - m_max_lat = marker; - } - - lon = (m_max_lon->longitude - m_min_lon->longitude) / 2. + m_min_lon->longitude; - lat = (m_max_lat->latitude - m_min_lat->latitude) / 2. + m_min_lat->latitude; - - elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh); - for (zoom = wd->src->zoom_max; zoom > wd->src->zoom_min; zoom--) - { - Evas_Coord size = pow(2.0, zoom)*wd->tsize; - elm_map_utils_convert_geo_into_coord(wd->obj, lon, lat, size, &xc, &yc); - - if ((m_min_lon->x[zoom] - wd->marker_max_w >= xc-rw/2) - && (m_min_lat->y[zoom] - wd->marker_max_h >= yc-rh/2) - && (m_max_lon->x[zoom] + wd->marker_max_w <= xc+rw/2) - && (m_max_lat->y[zoom] + wd->marker_max_h <= yc+rh/2)) - break; - } - - elm_map_geo_region_show(wd->obj, lon, lat); - elm_map_zoom_set(wd->obj, zoom); -#else - (void) markers; -======= + (void) overlay; + return NULL; +#endif +} + +EAPI void elm_map_overlay_color_set(Elm_Map_Overlay *overlay, int r, int g , int b, int a) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9364,35 +5393,10 @@ elm_map_overlay_color_get(const Elm_Map_Overlay *overlay, int *r, int *g , int * (void) g; (void) b; (void) a; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_max_marker_per_group_set(Evas_Object *obj, int max) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - wd->markers_max_num = max; -#else - (void) obj; - (void) max; -#endif -} - -EAPI Evas_Object * -elm_map_marker_object_get(const Elm_Map_Marker *marker) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN_VAL(marker, NULL); - return marker->content; -#else - (void) marker; -======= elm_map_overlay_get_cb_set(Elm_Map_Overlay *overlay, Elm_Map_Overlay_Get_Cb get_cb, void *data) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9428,29 +5432,11 @@ elm_map_overlay_class_add(Evas_Object *obj) return overlay; #else (void) obj; ->>>>>>> remotes/origin/upstream return NULL; #endif } EAPI void -<<<<<<< HEAD -elm_map_marker_update(Elm_Map_Marker *marker) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(marker); - if (marker->content) - { - if (marker->clas->func.del) - marker->clas->func.del(marker->wd->obj, marker, marker->data, marker->content); - else - evas_object_del(marker->content); - marker->content = NULL; - _group_bubble_content_update(marker->groups[marker->wd->zoom]); - } -#else - (void) marker; -======= elm_map_overlay_class_append(Elm_Map_Overlay *group, Elm_Map_Overlay *overlay) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9479,68 +5465,10 @@ elm_map_overlay_class_append(Elm_Map_Overlay *group, Elm_Map_Overlay *overlay) #else (void) group; (void) overlay; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_bubbles_close(Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Marker_Group *group; - Eina_List *l, *l_next; - - if (!wd) return; - EINA_LIST_FOREACH_SAFE(wd->opened_bubbles, l, l_next, group) - _group_bubble_free(group); -#else - (void) obj; -#endif -} - -EAPI Elm_Map_Group_Class * -elm_map_group_class_new(Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return NULL; - Elm_Map_Group_Class *clas = calloc(1, sizeof(Elm_Map_Group_Class)); - clas->zoom_grouped = wd->zoom_max; - wd->groups_clas = eina_list_append(wd->groups_clas, clas); - return clas; -#else - (void) obj; - return NULL; #endif } EAPI void -elm_map_group_class_style_set(Elm_Map_Group_Class *clas, const char *style) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - eina_stringshare_replace(&clas->style, style); -#else - (void) clas; - (void) style; -#endif -} - -EAPI void -elm_map_group_class_icon_cb_set(Elm_Map_Group_Class *clas, ElmMapGroupIconGetFunc icon_get) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->func.icon_get = icon_get; -#else - (void) clas; - (void) icon_get; -======= elm_map_overlay_class_remove(Elm_Map_Overlay *group, Elm_Map_Overlay *overlay) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9625,21 +5553,10 @@ elm_map_overlay_bubble_add(Evas_Object *obj) #else (void) obj; return NULL; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_group_class_data_set(Elm_Map_Group_Class *clas, void *data) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->data = data; -#else - (void) clas; - (void) data; -======= elm_map_overlay_bubble_follow(Elm_Map_Overlay *bubble, Elm_Map_Overlay *parent) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9675,21 +5592,10 @@ elm_map_overlay_bubble_follow(Elm_Map_Overlay *bubble, Elm_Map_Overlay *parent) #else (void) bubble; (void) parent; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_group_class_zoom_displayed_set(Elm_Map_Group_Class *clas, int zoom) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->zoom_displayed = zoom; -#else - (void) clas; - (void) zoom; -======= elm_map_overlay_bubble_content_append(Elm_Map_Overlay *bubble, Evas_Object *content) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9705,63 +5611,10 @@ elm_map_overlay_bubble_content_append(Elm_Map_Overlay *bubble, Evas_Object *cont #else (void) bubble; (void) content; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_group_class_zoom_grouped_set(Elm_Map_Group_Class *clas, int zoom) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->zoom_grouped = zoom; -#else - (void) clas; - (void) zoom; #endif } EAPI void -elm_map_group_class_hide_set(Evas_Object *obj, Elm_Map_Group_Class *clas, Eina_Bool hide) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - EINA_SAFETY_ON_NULL_RETURN(clas); - if (clas->hide == hide) return; - clas->hide = hide; - if (wd->grids) - { - Grid *g; - Evas_Coord ox, oy, ow, oh; - evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); - g = _get_current_grid(wd); - marker_place(obj, g, wd->pan_x, wd->pan_y, ox, oy, ow, oh); - } -#else - (void) obj; - (void) clas; - (void) hide; -#endif -} - -EAPI Elm_Map_Marker_Class * -elm_map_marker_class_new(Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return NULL; - Elm_Map_Marker_Class *clas = calloc(1, sizeof(Elm_Map_Marker_Class)); - wd->markers_clas = eina_list_append(wd->markers_clas, clas); - return clas; -#else - (void) obj; -======= elm_map_overlay_bubble_content_clear(Elm_Map_Overlay *bubble) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9823,73 +5676,11 @@ elm_map_track_add(Evas_Object *obj, void *emap) #else (void) obj; (void) emap; ->>>>>>> remotes/origin/upstream return NULL; #endif } EAPI void -<<<<<<< HEAD -elm_map_marker_class_style_set(Elm_Map_Marker_Class *clas, const char *style) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - eina_stringshare_replace(&clas->style, style); -#else - (void) clas; - (void) style; -#endif -} - -EAPI void -elm_map_marker_class_icon_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerIconGetFunc icon_get) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->func.icon_get = icon_get; -#else - (void) clas; - (void) icon_get; -#endif -} - -EAPI void -elm_map_marker_class_get_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerGetFunc get) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->func.get = get; -#else - (void) clas; - (void) get; -#endif -} - -EAPI void -elm_map_marker_class_del_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerDelFunc del) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(clas); - clas->func.del = del; -#else - (void) clas; - (void) del; -#endif -} - -EAPI const char ** -elm_map_source_names_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return NULL; - return wd->source_names; -#else - (void) obj; - return NULL; -======= elm_map_track_remove(Evas_Object *obj, Evas_Object *route) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -9942,133 +5733,45 @@ elm_map_source_zoom_min_get(const Evas_Object *obj) return elm_map_zoom_min_get(obj); } -EAPI void -elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - - _coord_to_region_convert(wd, x, y, size, lon, lat); -#else - (void) obj; - (void) x; - (void) y; - (void) size; - (void) lon; - (void) lat; -#endif -} - -EAPI void -elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - - _region_to_coord_convert(wd, lon, lat, size, x, y); -#else - (void) obj; - (void) lon; - (void) lat; - (void) size; - (void) x; - (void) y; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_source_name_set(Evas_Object *obj, const char *source_name) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - Map_Sources_Tab *s; - Eina_List *l; - int zoom; - - if (!wd) return; - if (wd->src) - { - if (!strcmp(wd->src->name, source_name)) return; - if (!wd->src->url_cb) return; - } - - grid_clear_all(obj); - EINA_LIST_FOREACH(wd->map_sources_tab, l, s) - { - if (!strcmp(s->name, source_name)) - { - wd->src = s; - break; - } - } - zoom = wd->zoom; - wd->zoom = -1; - - if (wd->src) - { - if (wd->src->zoom_max < zoom) - zoom = wd->src->zoom_max; - if (wd->src->zoom_min > zoom) - zoom = wd->src->zoom_min; - } - grid_create_all(obj); - elm_map_zoom_set(obj, zoom); -#else - (void) obj; - (void) source_name; -#endif -} - -EAPI const char * -elm_map_source_name_get(const Evas_Object *obj) +EAPI void +elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat) { #ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); - if ((!wd) || (!wd->src)) return NULL; - return wd->src->name; + _coord_to_region_convert(wd, x, y, size, lon, lat); #else (void) obj; - return NULL; + (void) x; + (void) y; + (void) size; + (void) lon; + (void) lat; #endif } EAPI void -elm_map_route_source_set(Evas_Object *obj, Elm_Map_Route_Sources source) +elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y) { #ifdef HAVE_ELEMENTARY_ECORE_CON ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); - if (!wd) return; - wd->route_source = source; + _region_to_coord_convert(wd, lon, lat, size, x, y); #else (void) obj; - (void) source; + (void) lon; + (void) lat; + (void) size; + (void) x; + (void) y; #endif } -EAPI Elm_Map_Route_Sources -elm_map_route_source_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) ELM_MAP_ROUTE_SOURCE_YOURS; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return ELM_MAP_ROUTE_SOURCE_YOURS; - return wd->route_source; -#else - (void) obj; - return ELM_MAP_ROUTE_SOURCE_YOURS; -======= +EAPI void elm_map_utils_rotate_coord(const Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord cx, const Evas_Coord cy, double degree, Evas_Coord *xx, Evas_Coord *yy) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10172,40 +5875,10 @@ elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Clas (void) group_clas; (void) data; return NULL; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_source_zoom_max_set(Evas_Object *obj, int zoom) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if ((!wd) || (!wd->src)) return; - if ((zoom > wd->zoom_max) || (zoom < wd->zoom_min)) return; - wd->src->zoom_max = zoom; -#else - (void) obj; - (void) zoom; -#endif -} - -EAPI int -elm_map_source_zoom_max_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) 18; - Widget_Data *wd = elm_widget_data_get(obj); - - if ((!wd) || (!wd->src)) return 18; - return wd->src->zoom_max; -#else - (void) obj; - return 18; -======= elm_map_marker_remove(Elm_Map_Marker *marker) { _elm_map_marker_remove(marker); @@ -10222,40 +5895,10 @@ elm_map_marker_region_get(const Elm_Map_Marker *marker, double *lon, double *lat (void) marker; (void) lon; (void) lat; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_source_zoom_min_set(Evas_Object *obj, int zoom) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if ((!wd) || (!wd->src)) return; - if ((zoom > wd->zoom_max) || (zoom < wd->zoom_min)) return; - wd->src->zoom_min = zoom; -#else - (void) obj; - (void) zoom; -#endif -} - -EAPI int -elm_map_source_zoom_min_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) 0; - Widget_Data *wd = elm_widget_data_get(obj); - - if ((!wd) || (!wd->src)) return 0; - return wd->src->zoom_min; -#else - (void) obj; - return 0; -======= elm_map_marker_bring_in(Elm_Map_Marker *marker) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10274,145 +5917,10 @@ elm_map_marker_show(Elm_Map_Marker *marker) elm_map_region_show(marker->wd->obj, marker->longitude, marker->latitude); #else (void) marker; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_user_agent_set(Evas_Object *obj, const char *user_agent) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if (!wd->user_agent) wd->user_agent = eina_stringshare_add(user_agent); - else eina_stringshare_replace(&wd->user_agent, user_agent); - - if (!wd->ua) wd->ua = eina_hash_string_small_new(NULL); - eina_hash_set(wd->ua, "User-Agent", wd->user_agent); -#else - (void) obj; - (void) user_agent; -#endif -} - -EAPI const char * -elm_map_user_agent_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return NULL; - return wd->user_agent; -#else - (void) obj; - return NULL; -#endif -} - -EAPI Elm_Map_Route * -elm_map_route_add(Evas_Object *obj, - Elm_Map_Route_Type type, - Elm_Map_Route_Method method, - double flon, - double flat, - double tlon, - double tlat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - char buf[PATH_MAX]; - char *source; - char *type_name = NULL; - int fd; - - if ((!wd) || (!wd->src)) return NULL; - - Elm_Map_Route *route = ELM_NEW(Elm_Map_Route); - if (!route) return NULL; - - snprintf(buf, sizeof(buf), DEST_ROUTE_XML_FILE); - fd = mkstemp(buf); - if (fd < 0) - { - free(route); - return NULL; - } - - route->con_url = ecore_con_url_new(NULL); - route->ud.fname = strdup(buf); - INF("xml file : %s", route->ud.fname); - - route->ud.fd = fdopen(fd, "w+"); - if ((!route->con_url) || (!route->ud.fd)) - { - ecore_con_url_free(route->con_url); - free(route); - return NULL; - } - - route->wd = wd; - route->color.r = 255; - route->color.g = 0; - route->color.b = 0; - route->color.a = 255; - route->handlers = eina_list_append - (route->handlers, (void *)ecore_event_handler_add - (ECORE_CON_EVENT_URL_COMPLETE, _route_complete_cb, route)); - - route->inbound = EINA_FALSE; - route->type = type; - route->method = method; - route->flon = flon; - route->flat = flat; - route->tlon = tlon; - route->tlat = tlat; - - switch (type) - { - case ELM_MAP_ROUTE_TYPE_MOTOCAR: - type_name = strdup(ROUTE_TYPE_MOTORCAR); - break; - case ELM_MAP_ROUTE_TYPE_BICYCLE: - type_name = strdup(ROUTE_TYPE_BICYCLE); - break; - case ELM_MAP_ROUTE_TYPE_FOOT: - type_name = strdup(ROUTE_TYPE_FOOT); - break; - default: - break; - } - - source = wd->src->route_url_cb(obj, type_name, method, flon, flat, tlon, tlat); - INF("route url = %s", source); - - wd->route = eina_list_append(wd->route, route); - - ecore_con_url_url_set(route->con_url, source); - ecore_con_url_fd_set(route->con_url, fileno(route->ud.fd)); - ecore_con_url_data_set(route->con_url, route); - ecore_con_url_get(route->con_url); - if (type_name) free(type_name); - if (source) free(source); - - edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), - "elm,state,busy,start", "elm"); - evas_object_smart_callback_call(wd->obj, SIG_ROUTE_LOAD, NULL); - return route; -#else - (void) obj; - (void) type; - (void) method; - (void) flon; - (void) flat; - (void) tlon; - (void) tlat; - return NULL; -======= elm_map_markers_list_show(Eina_List *markers) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10453,170 +5961,45 @@ EAPI Eina_Bool elm_map_paused_markers_get(const Evas_Object *obj) { #ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); - - return wd->paused_markers; -#else - (void) obj; - return EINA_FALSE; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_route_remove(Elm_Map_Route *route) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(route); - - Path_Waypoint *w; - Path_Node *n; - Evas_Object *p; - Ecore_Event_Handler *h; - - EINA_LIST_FREE(route->path, p) - { - evas_object_del(p); - } - - EINA_LIST_FREE(route->waypoint, w) - { - if (w->point) eina_stringshare_del(w->point); - free(w); - } - - EINA_LIST_FREE(route->nodes, n) - { - if (n->pos.address) eina_stringshare_del(n->pos.address); - free(n); - } - - EINA_LIST_FREE(route->handlers, h) - { - ecore_event_handler_del(h); - } - - if (route->ud.fname) - { - ecore_file_remove(route->ud.fname); - free(route->ud.fname); - route->ud.fname = NULL; - } -#else - (void) route; -#endif -} - -EAPI void -elm_map_route_color_set(Elm_Map_Route *route, int r, int g , int b, int a) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(route); - route->color.r = r; - route->color.g = g; - route->color.b = b; - route->color.a = a; -#else - (void) route; - (void) r; - (void) g; - (void) b; - (void) a; -======= -elm_map_max_marker_per_group_set(Evas_Object *obj, int max) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - EINA_SAFETY_ON_NULL_RETURN(wd); - - wd->markers_max_num = max; -#else - (void) obj; - (void) max; -#endif -} - -EAPI Evas_Object * -elm_map_marker_object_get(const Elm_Map_Marker *marker) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN_VAL(marker, NULL); - return marker->content; -#else - (void) marker; - return NULL; ->>>>>>> remotes/origin/upstream -#endif -} - -EAPI void -<<<<<<< HEAD -elm_map_route_color_get(const Elm_Map_Route *route, int *r, int *g , int *b, int *a) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(route); - if (r) *r = route->color.r; - if (g) *g = route->color.g; - if (b) *b = route->color.b; - if (a) *a = route->color.a; -#else - (void) route; - (void) r; - (void) g; - (void) b; - (void) a; -#endif -} - -EAPI double -elm_map_route_distance_get(const Elm_Map_Route *route) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN_VAL(route, 0.0); - return route->info.distance; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(wd, EINA_FALSE); + + return wd->paused_markers; #else - (void) route; - return 0.0; + (void) obj; + return EINA_FALSE; #endif } -EAPI const char* -elm_map_route_node_get(const Elm_Map_Route *route) +EAPI void +elm_map_max_marker_per_group_set(Evas_Object *obj, int max) { #ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN_VAL(route, NULL); - return route->info.nodes; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + EINA_SAFETY_ON_NULL_RETURN(wd); + + wd->markers_max_num = max; #else - (void) route; - return NULL; + (void) obj; + (void) max; #endif } -EAPI const char* -elm_map_route_waypoint_get(const Elm_Map_Route *route) +EAPI Evas_Object * +elm_map_marker_object_get(const Elm_Map_Marker *marker) { #ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN_VAL(route, NULL); - return route->info.waypoints; + EINA_SAFETY_ON_NULL_RETURN_VAL(marker, NULL); + return marker->content; #else - (void) route; + (void) marker; return NULL; #endif } -EAPI const char * -elm_map_name_address_get(const Elm_Map_Name *name) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL); - return name->address; -#else - (void) name; -======= +EAPI void elm_map_marker_update(Elm_Map_Marker *marker) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10675,24 +6058,11 @@ elm_map_group_class_new(Evas_Object *obj) return clas; #else (void) obj; ->>>>>>> remotes/origin/upstream return NULL; #endif } EAPI void -<<<<<<< HEAD -elm_map_name_region_get(const Elm_Map_Name *name, double *lon, double *lat) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(name); - if (lon) *lon = name->lon; - if (lat) *lat = name->lat; -#else - (void) name; - (void) lon; - (void) lat; -======= elm_map_group_class_style_set(Elm_Map_Group_Class *clas, const char *style) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10701,35 +6071,10 @@ elm_map_group_class_style_set(Elm_Map_Group_Class *clas, const char *style) #else (void) clas; (void) style; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_name_remove(Elm_Map_Name *name) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - EINA_SAFETY_ON_NULL_RETURN(name); - if (name->address) - { - free(name->address); - name->address = NULL; - } - if (name->handler) - { - ecore_event_handler_del(name->handler); - name->handler = NULL; - } - if (name->ud.fname) - { - ecore_file_remove(name->ud.fname); - free(name->ud.fname); - name->ud.fname = NULL; - } -#else - (void) name; -======= elm_map_group_class_icon_cb_set(Elm_Map_Group_Class *clas, Elm_Map_Group_Icon_Get_Func icon_get) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10738,29 +6083,10 @@ elm_map_group_class_icon_cb_set(Elm_Map_Group_Class *clas, Elm_Map_Group_Icon_Ge #else (void) clas; (void) icon_get; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_rotate_set(Evas_Object *obj, double degree, Evas_Coord cx, Evas_Coord cy) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - wd->rotate.d = degree; - wd->rotate.cx = cx; - wd->rotate.cy = cy; - wd->calc_job = ecore_job_add(_calc_job, wd); -#else - (void) obj; - (void) degree; - (void) cx; - (void) cy; -======= elm_map_group_class_data_set(Elm_Map_Group_Class *clas, void *data) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10769,28 +6095,10 @@ elm_map_group_class_data_set(Elm_Map_Group_Class *clas, void *data) #else (void) clas; (void) data; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_rotate_get(const Evas_Object *obj, double *degree, Evas_Coord *cx, Evas_Coord *cy) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if (degree) *degree = wd->rotate.d; - if (cx) *cx = wd->rotate.cx; - if (cy) *cy = wd->rotate.cy; -#else - (void) obj; - (void) degree; - (void) cx; - (void) cy; -======= elm_map_group_class_zoom_displayed_set(Elm_Map_Group_Class *clas, int zoom) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10799,49 +6107,10 @@ elm_map_group_class_zoom_displayed_set(Elm_Map_Group_Class *clas, int zoom) #else (void) clas; (void) zoom; ->>>>>>> remotes/origin/upstream #endif } EAPI void -<<<<<<< HEAD -elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return; - if ((!wd->wheel_disabled) && (disabled)) - evas_object_event_callback_del_full(wd->rect, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, obj); - else if ((wd->wheel_disabled) && (!disabled)) - evas_object_event_callback_add(wd->rect, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel_cb, obj); - wd->wheel_disabled = !!disabled; -#else - (void) obj; - (void) disabled; -#endif -} - -EAPI Eina_Bool -elm_map_wheel_disabled_get(const Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return EINA_FALSE; - return wd->wheel_disabled; -#else - (void) obj; - return EINA_FALSE; -#endif -} - -#ifdef ELM_EMAP -EAPI Evas_Object * -elm_map_track_add(Evas_Object *obj, EMap_Route *emap) -======= elm_map_group_class_zoom_grouped_set(Elm_Map_Group_Class *clas, int zoom) { #ifdef HAVE_ELEMENTARY_ECORE_CON @@ -10873,160 +6142,10 @@ elm_map_group_class_hide_set(Evas_Object *obj, Elm_Map_Group_Class *clas, Eina_B EAPI Elm_Map_Marker_Class * elm_map_marker_class_new(Evas_Object *obj) ->>>>>>> remotes/origin/upstream { #ifdef HAVE_ELEMENTARY_ECORE_CON ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); -<<<<<<< HEAD - - if (!wd) return EINA_FALSE; - - Evas_Object *route = elm_route_add(obj); - elm_route_emap_set(route, emap); - wd->track = eina_list_append(wd->track, route); - - return route; -#else - (void) obj; - (void) emap; - return NULL; -#endif -} -#endif - -EAPI void -elm_map_track_remove(Evas_Object *obj, Evas_Object *route) -{ -#ifdef HAVE_ELEMENTARY_ECORE_CON - ELM_CHECK_WIDTYPE(obj, widtype) ; - Widget_Data *wd = elm_widget_data_get(obj); - - if (!wd) return ; - - wd->track = eina_list_remove(wd->track, route); - evas_object_del(route); -#else - (void) obj; - (void) route; -#endif -} - -#ifdef HAVE_ELEMENTARY_ECORE_CON - -static char * -_mapnik_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom) -{ - char buf[PATH_MAX]; - // ((x+y+zoom)%3)+'a' is requesting map images from distributed tile servers (eg., a, b, c) - snprintf(buf, sizeof(buf), "http://%c.tile.openstreetmap.org/%d/%d/%d.png", ((x+y+zoom)%3)+'a', zoom, x, y); - return strdup(buf); -} - -static char * -_osmarender_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "http://%c.tah.openstreetmap.org/Tiles/tile/%d/%d/%d.png", ((x+y+zoom)%3)+'a', zoom, x, y); - return strdup(buf); -} - -static char * -_cyclemap_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "http://%c.tile.opencyclemap.org/cycle/%d/%d/%d.png", ((x+y+zoom)%3)+'a', zoom, x, y); - return strdup(buf); -} - -static char * -_mapquest_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "http://otile%d.mqcdn.com/tiles/1.0.0/osm/%d/%d/%d.png", ((x+y+zoom)%4)+1, zoom, x, y); - return strdup(buf); -} - -static char * -_mapquest_aerial_url_cb(Evas_Object *obj __UNUSED__, int x, int y, int zoom) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "http://oatile%d.mqcdn.com/naip/%d/%d/%d.png", ((x+y+zoom)%4)+1, zoom, x, y); - return strdup(buf); -} - -static char *_yours_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), - "%s?flat=%lf&flon=%lf&tlat=%lf&tlon=%lf&v=%s&fast=%d&instructions=1", - ROUTE_YOURS_URL, flat, flon, tlat, tlon, type_name, method); - - return strdup(buf); -} - -// TODO: fix monav api -/* -static char *_monav_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), - "%s?flat=%f&flon=%f&tlat=%f&tlon=%f&v=%s&fast=%d&instructions=1", - ROUTE_MONAV_URL, flat, flon, tlat, tlon, type_name, method); - - return strdup(buf); -} -*/ - -// TODO: fix ors api -/* -static char *_ors_url_cb(Evas_Object *obj __UNUSED__, char *type_name, int method, double flon, double flat, double tlon, double tlat) -{ - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), - "%s?flat=%f&flon=%f&tlat=%f&tlon=%f&v=%s&fast=%d&instructions=1", - ROUTE_ORS_URL, flat, flon, tlat, tlon, type_name, method); - - return strdup(buf); -} -*/ - -static char * -_nominatim_url_cb(Evas_Object *obj, int method, char *name, double lon, double lat) -{ - ELM_CHECK_WIDTYPE(obj, widtype) strdup(""); - Widget_Data *wd = elm_widget_data_get(obj); - char **str; - unsigned int ele, idx; - char search_url[PATH_MAX]; - char buf[PATH_MAX]; - - if (!wd) return strdup(""); - if (method == ELM_MAP_NAME_METHOD_SEARCH) - { - search_url[0] = '\0'; - str = eina_str_split_full(name, " ", 0, &ele); - for (idx = 0 ; idx < ele ; idx++) - { - eina_strlcat(search_url, str[idx], sizeof(search_url)); - if (!(idx == (ele-1))) eina_strlcat(search_url, "+", sizeof(search_url)); - } - snprintf(buf, sizeof(buf), "%s/search?q=%s&format=xml&polygon=0&addressdetails=0", NAME_NOMINATIM_URL, search_url); - - if (str && str[0]) - { - free(str[0]); - free(str); - } - } - else if (method == ELM_MAP_NAME_METHOD_REVERSE) snprintf(buf, sizeof(buf), "%s/reverse?format=xml&lat=%lf&lon=%lf&zoom=%d&addressdetails=0", NAME_NOMINATIM_URL, lat, lon, wd->zoom); - else strcpy(buf, ""); - - return strdup(buf); -} - -#endif -======= EINA_SAFETY_ON_NULL_RETURN_VAL(wd, NULL); Elm_Map_Marker_Class *clas = ELM_NEW(Elm_Map_Marker_Class); @@ -11112,4 +6231,3 @@ elm_map_name_remove(Elm_Map_Name *name) elm_map_name_del(name); } ->>>>>>> remotes/origin/upstream diff --git a/src/lib/elm_map.h b/src/lib/elm_map.h index 135a99b..b56c2d8 100644 --- a/src/lib/elm_map.h +++ b/src/lib/elm_map.h @@ -19,30 +19,6 @@ * * - "clicked" - This is called when a user has clicked the map without * dragging around. -<<<<<<< HEAD - * - "press" - This is called when a user has pressed down on the map. - * - "longpressed" - This is called when a user has pressed down on the map - * for a long time without dragging around. - * - "clicked,double" - This is called when a user has double-clicked - * the map. - * - "load,detail" - Map detailed data load begins. - * - "loaded,detail" - This is called when all currently visible parts of - * the map are loaded. - * - "zoom,start" - Zoom animation started. - * - "zoom,stop" - Zoom animation stopped. - * - "zoom,change" - Zoom changed when using an auto zoom mode. - * - "scroll" - the content has been scrolled (moved). - * - "scroll,anim,start" - scrolling animation has started. - * - "scroll,anim,stop" - scrolling animation has stopped. - * - "scroll,drag,start" - dragging the contents around has started. - * - "scroll,drag,stop" - dragging the contents around has stopped. - * - "downloaded" - This is called when all currently required map images - * are downloaded. - * - "route,load" - This is called when route request begins. - * - "route,loaded" - This is called when route request ends. - * - "name,load" - This is called when name request begins. - * - "name,loaded- This is called when name request ends. -======= * - "clicked,double" - This is called when a user has double-clicked * the map. * - "press" - This is called when a user has pressed down on the map. @@ -66,7 +42,6 @@ * - "name,loaded" - Name request ends. * - "name,loaded,fail" - Name request fails. * - "overlay,clicked" - A overlay is clicked. ->>>>>>> remotes/origin/upstream * * Available style for map widget: * - @c "default" @@ -95,11 +70,7 @@ * * Default value is #ELM_MAP_ZOOM_MODE_MANUAL. * -<<<<<<< HEAD - * Values don't work as bitmask, only one can be choosen. -======= * Values don't work as bitmask, only one can be chosen. ->>>>>>> remotes/origin/upstream * * @note Valid sizes are 2^zoom, consequently the map may be smaller * than the scroller view. @@ -111,56 +82,28 @@ */ typedef enum { -<<<<<<< HEAD - ELM_MAP_ZOOM_MODE_MANUAL, /**< Zoom controlled manually by elm_map_zoom_set(). It's set by default. */ - ELM_MAP_ZOOM_MODE_AUTO_FIT, /**< Zoom until map fits inside the scroll frame with no pixels outside this area. */ - ELM_MAP_ZOOM_MODE_AUTO_FILL, /**< Zoom until map fills scroll, ensuring no pixels are left unfilled. */ -======= ELM_MAP_ZOOM_MODE_MANUAL, /**< Zoom controlled manually by elm_map_zoom_set(). It's set by default. */ ELM_MAP_ZOOM_MODE_AUTO_FIT, /**< Zoom until map fits inside the scroll frame with no pixels outside this area. */ ELM_MAP_ZOOM_MODE_AUTO_FILL, /**< Zoom until map fills scroll, ensuring no pixels are left unfilled. */ ->>>>>>> remotes/origin/upstream ELM_MAP_ZOOM_MODE_LAST } Elm_Map_Zoom_Mode; /** -<<<<<<< HEAD - * Set route service to be used. By default used source is - * #ELM_MAP_ROUTE_SOURCE_YOURS. - * - * @see elm_map_route_source_set() - * @see elm_map_route_source_get() -======= * Set type of a external source (provider). * * @see elm_map_sources_get() * @see elm_map_source_get() * @see elm_map_source_set() ->>>>>>> remotes/origin/upstream * * @ingroup Map */ typedef enum { -<<<<<<< HEAD - ELM_MAP_ROUTE_SOURCE_YOURS, /**< Routing service http://www.yournavigation.org/ . Set by default.*/ - ELM_MAP_ROUTE_SOURCE_MONAV, /**< MoNav offers exact routing without heuristic assumptions. Its routing core is based on Contraction Hierarchies. It's not working with Map yet. */ - ELM_MAP_ROUTE_SOURCE_ORS, /**< Open Route Service: http://www.openrouteservice.org/ . It's not working with Map yet. */ - ELM_MAP_ROUTE_SOURCE_LAST -} Elm_Map_Route_Sources; - -typedef enum -{ - ELM_MAP_NAME_SOURCE_NOMINATIM, - ELM_MAP_NAME_SOURCE_LAST -} Elm_Map_Name_Sources; -======= ELM_MAP_SOURCE_TYPE_TILE, /**< Map tile provider. */ ELM_MAP_SOURCE_TYPE_ROUTE, /**< Route service provider. */ ELM_MAP_SOURCE_TYPE_NAME, /**< Name service provider. */ ELM_MAP_SOURCE_TYPE_LAST } Elm_Map_Source_Type; ->>>>>>> remotes/origin/upstream /** * Set type of transport used on route. @@ -171,24 +114,14 @@ typedef enum */ typedef enum { -<<<<<<< HEAD - ELM_MAP_ROUTE_TYPE_MOTOCAR, /**< Route should consider an automobile will be used. */ - ELM_MAP_ROUTE_TYPE_BICYCLE, /**< Route should consider a bicycle will be used by the user. */ - ELM_MAP_ROUTE_TYPE_FOOT, /**< Route should consider user will be walking. */ -======= ELM_MAP_ROUTE_TYPE_MOTOCAR, /**< Route should consider an automobile will be used. */ ELM_MAP_ROUTE_TYPE_BICYCLE, /**< Route should consider a bicycle will be used by the user. */ ELM_MAP_ROUTE_TYPE_FOOT, /**< Route should consider user will be walking. */ ->>>>>>> remotes/origin/upstream ELM_MAP_ROUTE_TYPE_LAST } Elm_Map_Route_Type; /** -<<<<<<< HEAD - * Set the routing method, what should be priorized, time or distance. -======= * Set the routing method, what should be prioritized, time or distance. ->>>>>>> remotes/origin/upstream * * @see elm_map_route_add() * @@ -196,13 +129,6 @@ typedef enum */ typedef enum { -<<<<<<< HEAD - ELM_MAP_ROUTE_METHOD_FASTEST, /**< Route should priorize time. */ - ELM_MAP_ROUTE_METHOD_SHORTEST, /**< Route should priorize distance. */ - ELM_MAP_ROUTE_METHOD_LAST -} Elm_Map_Route_Method; - -======= ELM_MAP_ROUTE_METHOD_FASTEST, /**< Route should prioritize time. */ ELM_MAP_ROUTE_METHOD_SHORTEST, /**< Route should prioritized distance. */ ELM_MAP_ROUTE_METHOD_LAST @@ -215,7 +141,6 @@ typedef enum * * @ingroup Map */ ->>>>>>> remotes/origin/upstream typedef enum { ELM_MAP_NAME_METHOD_SEARCH, @@ -223,29 +148,6 @@ typedef enum ELM_MAP_NAME_METHOD_LAST } Elm_Map_Name_Method; -<<<<<<< HEAD -typedef struct _Elm_Map_Marker Elm_Map_Marker; /**< A marker to be shown in a specific point of the map. Can be created with elm_map_marker_add() and deleted with elm_map_marker_remove(). */ -typedef struct _Elm_Map_Marker_Class Elm_Map_Marker_Class; /**< Each marker must be associated to a class. It's required to add a mark. The class defines the style of the marker when a marker is displayed alone (not grouped). A new class can be created with elm_map_marker_class_new(). */ -typedef struct _Elm_Map_Group_Class Elm_Map_Group_Class; /**< Each marker must be associated to a group class. It's required to add a mark. The group class defines the style of the marker when a marker is grouped to other markers. Markers with the same group are grouped if they are close. A new group class can be created with elm_map_marker_group_class_new(). */ -typedef struct _Elm_Map_Route Elm_Map_Route; /**< A route to be shown in the map. Can be created with elm_map_route_add() and deleted with elm_map_route_remove(). */ -typedef struct _Elm_Map_Name Elm_Map_Name; /**< A handle for specific coordinates. */ -typedef struct _Elm_Map_Track Elm_Map_Track; - -typedef Evas_Object *(*ElmMapMarkerGetFunc)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Bubble content fetching class function for marker classes. When the user click on a marker, a bubble is displayed with a content. */ -typedef void (*ElmMapMarkerDelFunc)(Evas_Object *obj, Elm_Map_Marker *marker, void *data, Evas_Object *o); /**< Function to delete bubble content for marker classes. */ -typedef Evas_Object *(*ElmMapMarkerIconGetFunc)(Evas_Object *obj, Elm_Map_Marker *marker, void *data); /**< Icon fetching class function for marker classes. */ -typedef Evas_Object *(*ElmMapGroupIconGetFunc)(Evas_Object *obj, void *data); /**< Icon fetching class function for markers group classes. */ - -typedef char *(*ElmMapModuleSourceFunc)(void); -typedef int (*ElmMapModuleZoomMinFunc)(void); -typedef int (*ElmMapModuleZoomMaxFunc)(void); -typedef char *(*ElmMapModuleUrlFunc)(Evas_Object *obj, int x, int y, int zoom); -typedef int (*ElmMapModuleRouteSourceFunc)(void); -typedef char *(*ElmMapModuleRouteUrlFunc)(Evas_Object *obj, char *type_name, int method, double flon, double flat, double tlon, double tlat); -typedef char *(*ElmMapModuleNameUrlFunc)(Evas_Object *obj, int method, char *name, double lon, double lat); -typedef Eina_Bool (*ElmMapModuleGeoIntoCoordFunc)(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y); -typedef Eina_Bool (*ElmMapModuleCoordIntoGeoFunc)(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat); -======= /** * Set overlay type to be used. This type is resolved * when the overlay is created. @@ -282,7 +184,6 @@ typedef Evas_Object *(*Elm_Map_Group_Icon_Get_Func)(Evas_Object *o typedef void (*Elm_Map_Overlay_Get_Cb)(void *data, Evas_Object *map, const Elm_Map_Overlay *overlay); /**< Get callback function for the overlay. */ typedef void (*Elm_Map_Name_Cb)(void *data, Evas_Object *map, const Elm_Map_Name *name); /**< Async-callback function for the name request. */ typedef void (*Elm_Map_Route_Cb)(void *data, Evas_Object *map, const Elm_Map_Route *route); /**< Async-callback function for the route request. */ ->>>>>>> remotes/origin/upstream /** * Add a new map widget to the given parent Elementary (container) object. @@ -302,1115 +203,240 @@ EAPI Evas_Object *elm_map_add(Evas_Object *parent); * @param obj The map object. * @param zoom The zoom level to set. * - * This sets the zoom level. - * -<<<<<<< HEAD - * It will respect limits defined by elm_map_source_zoom_min_set() and - * elm_map_source_zoom_max_set(). -======= - * It will respect limits defined by elm_map_zoom_min_set() and - * elm_map_zoom_max_set(). ->>>>>>> remotes/origin/upstream - * - * By default these values are 0 (world map) and 18 (maximum zoom). - * - * This function should be used when zoom mode is set to - * #ELM_MAP_ZOOM_MODE_MANUAL. This is the default mode, and can be set - * with elm_map_zoom_mode_set(). - * -<<<<<<< HEAD - * @see elm_map_zoom_mode_set(). - * @see elm_map_zoom_get(). -======= - * @see elm_map_zoom_mode_set() - * @see elm_map_zoom_get() ->>>>>>> remotes/origin/upstream - * - * @ingroup Map - */ -EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom); - -/** - * Get the zoom level of the map. - * - * @param obj The map object. - * @return The current zoom level. - * - * This returns the current zoom level of the map object. - * - * Note that if you set the fill mode to other than #ELM_MAP_ZOOM_MODE_MANUAL - * (which is the default), the zoom level may be changed at any time by the - * map object itself to account for map size and map viewport size. - * - * @see elm_map_zoom_set() for details. - * - * @ingroup Map - */ -EAPI int elm_map_zoom_get(const Evas_Object *obj); - -/** - * Set the zoom mode used by the map object. - * - * @param obj The map object. - * @param mode The zoom mode of the map, being it one of - * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, - * or #ELM_MAP_ZOOM_MODE_AUTO_FILL. - * - * This sets the zoom mode to manual or one of the automatic levels. - * Manual (#ELM_MAP_ZOOM_MODE_MANUAL) means that zoom is set manually by - * elm_map_zoom_set() and will stay at that level until changed by code - * or until zoom mode is changed. This is the default mode. - * - * The Automatic modes will allow the map object to automatically - * adjust zoom mode based on properties. #ELM_MAP_ZOOM_MODE_AUTO_FIT will - * adjust zoom so the map fits inside the scroll frame with no pixels - * outside this area. #ELM_MAP_ZOOM_MODE_AUTO_FILL will be similar but - * ensure no pixels within the frame are left unfilled. Do not forget that - * the valid sizes are 2^zoom, consequently the map may be smaller than - * the scroller view. - * - * @see elm_map_zoom_set() - * - * @ingroup Map - */ -EAPI void elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode); - -/** - * Get the zoom mode used by the map object. - * - * @param obj The map object. - * @return The zoom mode of the map, being it one of - * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, - * or #ELM_MAP_ZOOM_MODE_AUTO_FILL. - * - * This function returns the current zoom mode used by the map object. - * - * @see elm_map_zoom_mode_set() for more details. - * - * @ingroup Map - */ -EAPI Elm_Map_Zoom_Mode elm_map_zoom_mode_get(const Evas_Object *obj); - -/** -<<<<<<< HEAD - * Get the current geographic coordinates of the map. - * - * @param obj The map object. - * @param lon Pointer where to store longitude. - * @param lat Pointer where to store latitude. - * - * This gets the current center coordinates of the map object. It can be - * set by elm_map_geo_region_bring_in() and elm_map_geo_region_show(). - * - * @see elm_map_geo_region_bring_in() - * @see elm_map_geo_region_show() - * - * @ingroup Map - */ -EAPI void elm_map_geo_region_get(const Evas_Object *obj, double *lon, double *lat); -======= - * Set the minimum zoom of the source. - * - * @param obj The map object. - * @param zoom New minimum zoom value to be used. - * - * By default, it's 0. - * - * @ingroup Map - */ -EAPI void elm_map_zoom_min_set(Evas_Object *obj, int zoom); - -/** - * Get the minimum zoom of the source. - * - * @param obj The map object. - * @return Returns the minimum zoom of the source. - * - * @see elm_map_zoom_min_set() for details. - * - * @ingroup Map - */ -EAPI int elm_map_zoom_min_get(const Evas_Object *obj); - -/** - * Set the maximum zoom of the source. - * - * @param obj The map object. - * @param zoom New maximum zoom value to be used. - * - * By default, it's 18. - * - * @ingroup Map - */ -EAPI void elm_map_zoom_max_set(Evas_Object *obj, int zoom); - -/** - * Get the maximum zoom of the source. - * - * @param obj The map object. - * @return Returns the maximum zoom of the source. - * - * @see elm_map_zoom_min_set() for details. - * - * @ingroup Map - */ -EAPI int elm_map_zoom_max_get(const Evas_Object *obj); - -/** - * Get the current geographic coordinates of the map. - * - * @param obj The map object. - * @param lon Pointer to store longitude. - * @param lat Pointer to store latitude. - * - * This gets the current center coordinates of the map object. It can be - * set by elm_map_region_bring_in() and elm_map_region_show(). - * - * @see elm_map_region_bring_in() - * @see elm_map_region_show() - * - * @ingroup Map - */ -EAPI void elm_map_region_get(const Evas_Object *obj, double *lon, double *lat); ->>>>>>> remotes/origin/upstream - -/** - * Animatedly bring in given coordinates to the center of the map. - * - * @param obj The map object. - * @param lon Longitude to center at. - * @param lat Latitude to center at. - * - * This causes map to jump to the given @p lat and @p lon coordinates - * and show it (by scrolling) in the center of the viewport, if it is not - * already centered. This will use animation to do so and take a period - * of time to complete. - * -<<<<<<< HEAD - * @see elm_map_geo_region_show() for a function to avoid animation. - * @see elm_map_geo_region_get() - * - * @ingroup Map - */ -EAPI void elm_map_geo_region_bring_in(Evas_Object *obj, double lon, double lat); -======= - * @see elm_map_region_show() for a function to avoid animation. - * @see elm_map_region_get() - * - * @ingroup Map - */ -EAPI void elm_map_region_bring_in(Evas_Object *obj, double lon, double lat); ->>>>>>> remotes/origin/upstream - -/** - * Show the given coordinates at the center of the map, @b immediately. - * - * @param obj The map object. - * @param lon Longitude to center at. - * @param lat Latitude to center at. - * - * This causes map to @b redraw its viewport's contents to the -<<<<<<< HEAD - * region contining the given @p lat and @p lon, that will be moved to the - * center of the map. - * - * @see elm_map_geo_region_bring_in() for a function to move with animation. - * @see elm_map_geo_region_get() - * - * @ingroup Map - */ -EAPI void elm_map_geo_region_show(Evas_Object *obj, double lon, double lat); - -/** - * Pause or unpause the map. - * - * @param obj The map object. - * @param paused Use @c EINA_TRUE to pause the map @p obj or @c EINA_FALSE - * to unpause it. - * - * This sets the paused state to on (@c EINA_TRUE) or off (@c EINA_FALSE) - * for map. - * - * The default is off. - * - * This will stop zooming using animation, changing zoom levels will - * change instantly. This will stop any existing animations that are running. - * - * @see elm_map_paused_get() - * - * @ingroup Map - */ -EAPI void elm_map_paused_set(Evas_Object *obj, Eina_Bool paused); - -/** - * Get a value whether map is paused or not. - * - * @param obj The map object. - * @return @c EINA_TRUE means map is pause. @c EINA_FALSE indicates - * it is not. If @p obj is @c NULL, @c EINA_FALSE is returned. - * - * This gets the current paused state for the map object. - * - * @see elm_map_paused_set() for details. - * - * @ingroup Map - */ -EAPI Eina_Bool elm_map_paused_get(const Evas_Object *obj); - -/** - * Set to show markers during zoom level changes or not. - * - * @param obj The map object. - * @param paused Use @c EINA_TRUE to @b not show markers or @c EINA_FALSE - * to show them. -======= - * region containing the given @p lat and @p lon, that will be moved to the - * center of the map. - * - * @see elm_map_region_bring_in() for a function to move with animation. - * @see elm_map_region_get() - * - * @ingroup Map - */ -EAPI void elm_map_region_show(Evas_Object *obj, double lon, double lat); - -/** - * Convert canvas coordinates into geographic coordinates - * (longitude, latitude). - * - * @param obj The map object. - * @param x horizontal coordinate of the point to convert. - * @param y vertical coordinate of the point to convert. - * @param lon A pointer to the longitude. - * @param lat A pointer to the latitude. - * - * This gets longitude and latitude from canvas x, y coordinates. The canvas - * coordinates mean x, y coordinate from current viewport. - * - * see elm_map_region_to_canvas_convert() - * - * @ingroup Map - */ -EAPI void elm_map_canvas_to_region_convert(const Evas_Object *obj, const Evas_Coord x, const Evas_Coord y, double *lon, double *lat); - -/** - * Convert geographic coordinates (longitude, latitude) - * into canvas coordinates. - * - * @param obj The map object. - * @param lon The longitude to convert. - * @param lat The latitude to convert. - * @param x A pointer to horizontal coordinate. - * @param y A pointer to vertical coordinate. - * - * This gets canvas x, y coordinates from longitude and latitude. The canvas - * coordinates mean x, y coordinate from current viewport. - * - * see elm_map_canvas_to_region_convert() - * - * @ingroup Map - */ -EAPI void elm_map_region_to_canvas_convert(const Evas_Object *obj, double lon, double lat, Evas_Coord *x, Evas_Coord *y); - -/** - * Pause or unpause the map. - * - * @param obj The map object. - * @param paused Use @c EINA_TRUE to pause the map @p obj or @c EINA_FALSE - * to unpause it. ->>>>>>> remotes/origin/upstream - * - * This sets the paused state to on (@c EINA_TRUE) or off (@c EINA_FALSE) - * for map. - * - * The default is off. - * - * This will stop zooming using animation, changing zoom levels will - * change instantly. This will stop any existing animations that are running. - * -<<<<<<< HEAD - * This sets the paused state to on (@c EINA_TRUE) or off (@c EINA_FALSE) - * for the markers. - * - * The default is off. - * - * Enabling it will force the map to stop displaying the markers during - * zoom level changes. Set to on if you have a large number of markers. - * - * @see elm_map_paused_markers_get() - * - * @ingroup Map - */ -EAPI void elm_map_paused_markers_set(Evas_Object *obj, Eina_Bool paused); - -/** - * Get a value whether markers will be displayed on zoom level changes or not - * - * @param obj The map object. - * @return @c EINA_TRUE means map @b won't display markers or @c EINA_FALSE - * indicates it will. If @p obj is @c NULL, @c EINA_FALSE is returned. - * - * This gets the current markers paused state for the map object. - * - * @see elm_map_paused_markers_set() for details. - * - * @ingroup Map - */ -EAPI Eina_Bool elm_map_paused_markers_get(const Evas_Object *obj); - -/** - * Get the information of downloading status. - * - * @param obj The map object. - * @param try_num Pointer where to store number of tiles being downloaded. - * @param finish_num Pointer where to store number of tiles successfully - * downloaded. - * - * This gets the current downloading status for the map object, the number - * of tiles being downloaded and the number of tiles already downloaded. - * - * @ingroup Map - */ -EAPI void elm_map_utils_downloading_status_get(const Evas_Object *obj, int *try_num, int *finish_num); - -/** - * Convert a pixel coordinate (x,y) into a geographic coordinate - * (longitude, latitude). - * - * @param obj The map object. - * @param x the coordinate. - * @param y the coordinate. - * @param size the size in pixels of the map. - * The map is a square and generally his size is : pow(2.0, zoom)*256. - * @param lon Pointer where to store the longitude that correspond to x. - * @param lat Pointer where to store the latitude that correspond to y. - * - * @note Origin pixel point is the top left corner of the viewport. - * Map zoom and size are taken on account. - * - * @see elm_map_utils_convert_geo_into_coord() if you need the inverse. - * - * @ingroup Map - */ -EAPI void elm_map_utils_convert_coord_into_geo(const Evas_Object *obj, int x, int y, int size, double *lon, double *lat); - -/** - * Convert a geographic coordinate (longitude, latitude) into a pixel - * coordinate (x, y). - * - * @param obj The map object. - * @param lon the longitude. - * @param lat the latitude. - * @param size the size in pixels of the map. The map is a square - * and generally his size is : pow(2.0, zoom)*256. - * @param x Pointer where to store the horizontal pixel coordinate that - * correspond to the longitude. - * @param y Pointer where to store the vertical pixel coordinate that - * correspond to the latitude. - * - * @note Origin pixel point is the top left corner of the viewport. - * Map zoom and size are taken on account. - * - * @see elm_map_utils_convert_coord_into_geo() if you need the inverse. - * - * @ingroup Map - */ -EAPI void elm_map_utils_convert_geo_into_coord(const Evas_Object *obj, double lon, double lat, int size, int *x, int *y); - -/** - * Convert a geographic coordinate (longitude, latitude) into a name - * (address). - * - * @param obj The map object. - * @param lon the longitude. - * @param lat the latitude. - * @return name A #Elm_Map_Name handle for this coordinate. - * - * To get the string for this address, elm_map_name_address_get() - * should be used. - * - * @see elm_map_utils_convert_name_into_coord() if you need the inverse. - * - * @ingroup Map - */ -EAPI Elm_Map_Name *elm_map_utils_convert_coord_into_name(const Evas_Object *obj, double lon, double lat); - -/** - * Convert a name (address) into a geographic coordinate - * (longitude, latitude). - * - * @param obj The map object. - * @param name The address. - * @return name A #Elm_Map_Name handle for this address. - * - * To get the longitude and latitude, elm_map_name_region_get() - * should be used. - * - * @see elm_map_utils_convert_coord_into_name() if you need the inverse. - * - * @ingroup Map - */ -EAPI Elm_Map_Name *elm_map_utils_convert_name_into_coord(const Evas_Object *obj, char *address); - -/** - * Convert canvas coordinates into a geographic coordinate - * (longitude, latitude). - * - * @param obj The map object. - * @param x horizontal coordinate of the point to convert. - * @param y vertical coordinate of the point to convert. - * @param lon A poniter to the longitude. - * @param lat A pointer to the latitude. - * - * This gets longitude and latitude from canvas x, y coordinates. The canvas - * coordinates mean x, y coordinate from current viewport. - * elm_map_utils_convert_coord_into_geo() internally to get the geographic - * location. - * - * see elm_map_rotate_get() - * see elm_map_utils_convert_coord_into_geo() - * - * @ingroup Map - */ -EAPI void elm_map_canvas_to_geo_convert(const Evas_Object *obj, const Evas_Coord x, const Evas_Coord y, double *lon, double *lat); - -/** - * Add a new marker to the map object. - * - * @param obj The map object. - * @param lon The longitude of the marker. - * @param lat The latitude of the marker. - * @param clas The class, to use when marker @b isn't grouped to others. - * @param clas_group The class group, to use when marker is grouped to others - * @param data The data passed to the callbacks. - * - * @return The created marker or @c NULL upon failure. - * - * A marker will be created and shown in a specific point of the map, defined - * by @p lon and @p lat. - * - * It will be displayed using style defined by @p class when this marker - * is displayed alone (not grouped). A new class can be created with - * elm_map_marker_class_new(). - * - * If the marker is grouped to other markers, it will be displayed with - * style defined by @p class_group. Markers with the same group are grouped - * if they are close. A new group class can be created with - * elm_map_marker_group_class_new(). - * - * Markers created with this method can be deleted with - * elm_map_marker_remove(). - * - * A marker can have associated content to be displayed by a bubble, - * when a user click over it, as well as an icon. These objects will - * be fetch using class' callback functions. - * - * @see elm_map_marker_class_new() - * @see elm_map_marker_group_class_new() - * @see elm_map_marker_remove() - * - * @ingroup Map - */ -EAPI Elm_Map_Marker *elm_map_marker_add(Evas_Object *obj, double lon, double lat, Elm_Map_Marker_Class *clas, Elm_Map_Group_Class *clas_group, void *data); - -/** - * Set the maximum numbers of markers' content to be displayed in a group. - * - * @param obj The map object. - * @param max The maximum numbers of items displayed in a bubble. - * - * A bubble will be displayed when the user clicks over the group, - * and will place the content of markers that belong to this group - * inside it. - * - * A group can have a long list of markers, consequently the creation - * of the content of the bubble can be very slow. - * - * In order to avoid this, a maximum number of items is displayed - * in a bubble. - * - * By default this number is 30. - * - * Marker with the same group class are grouped if they are close. - * - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_max_marker_per_group_set(Evas_Object *obj, int max); - -/** - * Remove a marker from the map. - * - * @param marker The marker to remove. - * - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_marker_remove(Elm_Map_Marker *marker); - -/** - * Get the current coordinates of the marker. - * - * @param marker marker. - * @param lat Pointer where to store the marker's latitude. - * @param lon Pointer where to store the marker's longitude. - * - * These values are set when adding markers, with function - * elm_map_marker_add(). - * - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_marker_region_get(const Elm_Map_Marker *marker, double *lon, double *lat); - -/** - * Animatedly bring in given marker to the center of the map. - * - * @param marker The marker to center at. - * - * This causes map to jump to the given @p marker's coordinates - * and show it (by scrolling) in the center of the viewport, if it is not - * already centered. This will use animation to do so and take a period - * of time to complete. - * - * @see elm_map_marker_show() for a function to avoid animation. - * @see elm_map_marker_region_get() - * - * @ingroup Map - */ -EAPI void elm_map_marker_bring_in(Elm_Map_Marker *marker); - -/** - * Show the given marker at the center of the map, @b immediately. - * - * @param marker The marker to center at. - * - * This causes map to @b redraw its viewport's contents to the - * region contining the given @p marker's coordinates, that will be - * moved to the center of the map. - * - * @see elm_map_marker_bring_in() for a function to move with animation. - * @see elm_map_markers_list_show() if more than one marker need to be - * displayed. - * @see elm_map_marker_region_get() - * - * @ingroup Map - */ -EAPI void elm_map_marker_show(Elm_Map_Marker *marker); - -/** - * Move and zoom the map to display a list of markers. - * - * @param markers A list of #Elm_Map_Marker handles. - * - * The map will be centered on the center point of the markers in the list. - * Then the map will be zoomed in order to fit the markers using the maximum - * zoom which allows display of all the markers. - * - * @warning All the markers should belong to the same map object. - * - * @see elm_map_marker_show() to show a single marker. - * @see elm_map_marker_bring_in() - * - * @ingroup Map - */ -EAPI void elm_map_markers_list_show(Eina_List *markers); - -/** - * Get the Evas object returned by the ElmMapMarkerGetFunc callback - * - * @param marker The marker wich content should be returned. - * @return Return the evas object if it exists, else @c NULL. - * - * To set callback function #ElmMapMarkerGetFunc for the marker class, - * elm_map_marker_class_get_cb_set() should be used. - * - * This content is what will be inside the bubble that will be displayed - * when an user clicks over the marker. - * - * This returns the actual Evas object used to be placed inside - * the bubble. This may be @c NULL, as it may - * not have been created or may have been deleted, at any time, by - * the map. Do not modify this object (move, resize, - * show, hide, etc.), as the map is controlling it. This - * function is for querying, emitting custom signals or hooking - * lower level callbacks for events on that object. Do not delete - * this object under any circumstances. - * - * @ingroup Map - */ -EAPI Evas_Object *elm_map_marker_object_get(const Elm_Map_Marker *marker); - -/** - * Update the marker - * - * @param marker The marker to be updated. - * - * If a content is set to this marker, it will call function to delete it, - * #ElmMapMarkerDelFunc, and then will fetch the content again with - * #ElmMapMarkerGetFunc. - * - * These functions are set for the marker class with - * elm_map_marker_class_get_cb_set() and elm_map_marker_class_del_cb_set(). - * - * @ingroup Map - */ -EAPI void elm_map_marker_update(Elm_Map_Marker *marker); - -/** - * Close all the bubbles opened by the user. - * - * @param obj The map object. - * - * A bubble is displayed with a content fetched with #ElmMapMarkerGetFunc - * when the user clicks on a marker. - * - * This functions is set for the marker class with - * elm_map_marker_class_get_cb_set(). - * - * @ingroup Map - */ -EAPI void elm_map_bubbles_close(Evas_Object *obj); - -/** - * Create a new group class. - * - * @param obj The map object. - * @return Returns the new group class. - * - * Each marker must be associated to a group class. Markers in the same - * group are grouped if they are close. - * - * The group class defines the style of the marker when a marker is grouped - * to others markers. When it is alone, another class will be used. - * - * A group class will need to be provided when creating a marker with - * elm_map_marker_add(). - * - * Some properties and functions can be set by class, as: - * - style, with elm_map_group_class_style_set() - * - data - to be associated to the group class. It can be set using - * elm_map_group_class_data_set(). - * - min zoom to display markers, set with - * elm_map_group_class_zoom_displayed_set(). - * - max zoom to group markers, set using - * elm_map_group_class_zoom_grouped_set(). - * - visibility - set if markers will be visible or not, set with - * elm_map_group_class_hide_set(). - * - #ElmMapGroupIconGetFunc - used to fetch icon for markers group classes. - * It can be set using elm_map_group_class_icon_cb_set(). - * - * @see elm_map_marker_add() - * @see elm_map_group_class_style_set() - * @see elm_map_group_class_data_set() - * @see elm_map_group_class_zoom_displayed_set() - * @see elm_map_group_class_zoom_grouped_set() - * @see elm_map_group_class_hide_set() - * @see elm_map_group_class_icon_cb_set() - * - * @ingroup Map - */ -EAPI Elm_Map_Group_Class *elm_map_group_class_new(Evas_Object *obj); - -/** - * Set the marker's style of a group class. - * - * @param clas The group class. - * @param style The style to be used by markers. - * - * Each marker must be associated to a group class, and will use the style - * defined by such class when grouped to other markers. - * - * The following styles are provided by default theme: - * @li @c radio - blue circle - * @li @c radio2 - green circle - * @li @c empty - * - * @see elm_map_group_class_new() for more details. - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_group_class_style_set(Elm_Map_Group_Class *clas, const char *style); - -/** - * Set the icon callback function of a group class. - * - * @param clas The group class. - * @param icon_get The callback function that will return the icon. - * - * Each marker must be associated to a group class, and it can display a - * custom icon. The function @p icon_get must return this icon. - * - * @see elm_map_group_class_new() for more details. - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_group_class_icon_cb_set(Elm_Map_Group_Class *clas, ElmMapGroupIconGetFunc icon_get); - -/** - * Set the data associated to the group class. - * - * @param clas The group class. - * @param data The new user data. - * - * This data will be passed for callback functions, like icon get callback, - * that can be set with elm_map_group_class_icon_cb_set(). - * - * If a data was previously set, the object will lose the pointer for it, - * so if needs to be freed, you must do it yourself. - * - * @see elm_map_group_class_new() for more details. - * @see elm_map_group_class_icon_cb_set() - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_group_class_data_set(Elm_Map_Group_Class *clas, void *data); - -/** - * Set the minimum zoom from where the markers are displayed. - * - * @param clas The group class. - * @param zoom The minimum zoom. - * - * Markers only will be displayed when the map is displayed at @p zoom - * or bigger. - * - * @see elm_map_group_class_new() for more details. - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_group_class_zoom_displayed_set(Elm_Map_Group_Class *clas, int zoom); - -/** - * Set the zoom from where the markers are no more grouped. - * - * @param clas The group class. - * @param zoom The maximum zoom. - * - * Markers only will be grouped when the map is displayed at - * less than @p zoom. - * - * @see elm_map_group_class_new() for more details. - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_group_class_zoom_grouped_set(Elm_Map_Group_Class *clas, int zoom); - -/** - * Set if the markers associated to the group class @p clas are hidden or not. - * - * @param clas The group class. - * @param hide Use @c EINA_TRUE to hide markers or @c EINA_FALSE - * to show them. - * - * If @p hide is @c EINA_TRUE the markers will be hidden, but default - * is to show them. - * - * @ingroup Map - */ -EAPI void elm_map_group_class_hide_set(Evas_Object *obj, Elm_Map_Group_Class *clas, Eina_Bool hide); - -/** - * Create a new marker class. - * - * @param obj The map object. - * @return Returns the new group class. - * - * Each marker must be associated to a class. - * - * The marker class defines the style of the marker when a marker is - * displayed alone, i.e., not grouped to to others markers. When grouped - * it will use group class style. - * - * A marker class will need to be provided when creating a marker with - * elm_map_marker_add(). - * - * Some properties and functions can be set by class, as: - * - style, with elm_map_marker_class_style_set() - * - #ElmMapMarkerIconGetFunc - used to fetch icon for markers classes. - * It can be set using elm_map_marker_class_icon_cb_set(). - * - #ElmMapMarkerGetFunc - used to fetch bubble content for marker classes. - * Set using elm_map_marker_class_get_cb_set(). - * - #ElmMapMarkerDelFunc - used to delete bubble content for marker classes. - * Set using elm_map_marker_class_del_cb_set(). - * - * @see elm_map_marker_add() - * @see elm_map_marker_class_style_set() - * @see elm_map_marker_class_icon_cb_set() - * @see elm_map_marker_class_get_cb_set() - * @see elm_map_marker_class_del_cb_set() - * - * @ingroup Map - */ -EAPI Elm_Map_Marker_Class *elm_map_marker_class_new(Evas_Object *obj); - -/** - * Set the marker's style of a marker class. - * - * @param clas The marker class. - * @param style The style to be used by markers. - * - * Each marker must be associated to a marker class, and will use the style - * defined by such class when alone, i.e., @b not grouped to other markers. - * - * The following styles are provided by default theme: - * @li @c radio - * @li @c radio2 - * @li @c empty - * - * @see elm_map_marker_class_new() for more details. - * @see elm_map_marker_add() - * - * @ingroup Map - */ -EAPI void elm_map_marker_class_style_set(Elm_Map_Marker_Class *clas, const char *style); - -/** - * Set the icon callback function of a marker class. + * This sets the zoom level. + * + * It will respect limits defined by elm_map_zoom_min_set() and + * elm_map_zoom_max_set(). * - * @param clas The marker class. - * @param icon_get The callback function that will return the icon. + * By default these values are 0 (world map) and 18 (maximum zoom). * - * Each marker must be associated to a marker class, and it can display a - * custom icon. The function @p icon_get must return this icon. + * This function should be used when zoom mode is set to + * #ELM_MAP_ZOOM_MODE_MANUAL. This is the default mode, and can be set + * with elm_map_zoom_mode_set(). * - * @see elm_map_marker_class_new() for more details. - * @see elm_map_marker_add() + * @see elm_map_zoom_mode_set() + * @see elm_map_zoom_get() * * @ingroup Map */ -EAPI void elm_map_marker_class_icon_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerIconGetFunc icon_get); +EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom); /** - * Set the bubble content callback function of a marker class. + * Get the zoom level of the map. * - * @param clas The marker class. - * @param get The callback function that will return the content. + * @param obj The map object. + * @return The current zoom level. * - * Each marker must be associated to a marker class, and it can display a - * a content on a bubble that opens when the user click over the marker. - * The function @p get must return this content object. + * This returns the current zoom level of the map object. * - * If this content will need to be deleted, elm_map_marker_class_del_cb_set() - * can be used. + * Note that if you set the fill mode to other than #ELM_MAP_ZOOM_MODE_MANUAL + * (which is the default), the zoom level may be changed at any time by the + * map object itself to account for map size and map viewport size. * - * @see elm_map_marker_class_new() for more details. - * @see elm_map_marker_class_del_cb_set() - * @see elm_map_marker_add() + * @see elm_map_zoom_set() for details. * * @ingroup Map */ -EAPI void elm_map_marker_class_get_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerGetFunc get); +EAPI int elm_map_zoom_get(const Evas_Object *obj); /** - * Set the callback function used to delete bubble content of a marker class. - * - * @param clas The marker class. - * @param del The callback function that will delete the content. + * Set the zoom mode used by the map object. * - * Each marker must be associated to a marker class, and it can display a - * a content on a bubble that opens when the user click over the marker. - * The function to return such content can be set with - * elm_map_marker_class_get_cb_set(). + * @param obj The map object. + * @param mode The zoom mode of the map, being it one of + * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, + * or #ELM_MAP_ZOOM_MODE_AUTO_FILL. * - * If this content must be freed, a callback function need to be - * set for that task with this function. + * This sets the zoom mode to manual or one of the automatic levels. + * Manual (#ELM_MAP_ZOOM_MODE_MANUAL) means that zoom is set manually by + * elm_map_zoom_set() and will stay at that level until changed by code + * or until zoom mode is changed. This is the default mode. * - * If this callback is defined it will have to delete (or not) the - * object inside, but if the callback is not defined the object will be - * destroyed with evas_object_del(). + * The Automatic modes will allow the map object to automatically + * adjust zoom mode based on properties. #ELM_MAP_ZOOM_MODE_AUTO_FIT will + * adjust zoom so the map fits inside the scroll frame with no pixels + * outside this area. #ELM_MAP_ZOOM_MODE_AUTO_FILL will be similar but + * ensure no pixels within the frame are left unfilled. Do not forget that + * the valid sizes are 2^zoom, consequently the map may be smaller than + * the scroller view. * - * @see elm_map_marker_class_new() for more details. - * @see elm_map_marker_class_get_cb_set() - * @see elm_map_marker_add() + * @see elm_map_zoom_set() * * @ingroup Map */ -EAPI void elm_map_marker_class_del_cb_set(Elm_Map_Marker_Class *clas, ElmMapMarkerDelFunc del); +EAPI void elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode); /** - * Get the list of available sources. + * Get the zoom mode used by the map object. * * @param obj The map object. - * @return The source names list. - * - * It will provide a list with all available sources, that can be set as - * current source with elm_map_source_name_set(), or get with - * elm_map_source_name_get(). + * @return The zoom mode of the map, being it one of + * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, + * or #ELM_MAP_ZOOM_MODE_AUTO_FILL. * - * Available sources: - * @li "Mapnik" - * @li "Osmarender" - * @li "CycleMap" - * @li "Maplint" + * This function returns the current zoom mode used by the map object. * - * @see elm_map_source_name_set() for more details. - * @see elm_map_source_name_get() + * @see elm_map_zoom_mode_set() for more details. * * @ingroup Map */ -EAPI const char **elm_map_source_names_get(const Evas_Object *obj); +EAPI Elm_Map_Zoom_Mode elm_map_zoom_mode_get(const Evas_Object *obj); /** - * Set the source of the map. + * Set the minimum zoom of the source. * * @param obj The map object. - * @param source The source to be used. - * - * Map widget retrieves images that composes the map from a web service. - * This web service can be set with this method. - * - * A different service can return a different maps with different - * information and it can use different zoom values. - * - * The @p source_name need to match one of the names provided by - * elm_map_source_names_get(). - * - * The current source can be get using elm_map_source_name_get(). - * - * @see elm_map_source_names_get() - * @see elm_map_source_name_get() + * @param zoom New minimum zoom value to be used. * + * By default, it's 0. * * @ingroup Map */ -EAPI void elm_map_source_name_set(Evas_Object *obj, const char *source_name); +EAPI void elm_map_zoom_min_set(Evas_Object *obj, int zoom); /** - * Get the name of currently used source. + * Get the minimum zoom of the source. * * @param obj The map object. - * @return Returns the name of the source in use. + * @return Returns the minimum zoom of the source. * - * @see elm_map_source_name_set() for more details. + * @see elm_map_zoom_min_set() for details. * * @ingroup Map */ -EAPI const char *elm_map_source_name_get(const Evas_Object *obj); +EAPI int elm_map_zoom_min_get(const Evas_Object *obj); /** - * Set the source of the route service to be used by the map. + * Set the maximum zoom of the source. * * @param obj The map object. - * @param source The route service to be used, being it one of - * #ELM_MAP_ROUTE_SOURCE_YOURS (default), #ELM_MAP_ROUTE_SOURCE_MONAV, - * and #ELM_MAP_ROUTE_SOURCE_ORS. - * - * Each one has its own algorithm, so the route retrieved may - * differ depending on the source route. Now, only the default is working. - * - * #ELM_MAP_ROUTE_SOURCE_YOURS is the routing service provided at - * http://www.yournavigation.org/. - * - * #ELM_MAP_ROUTE_SOURCE_MONAV, offers exact routing without heuristic - * assumptions. Its routing core is based on Contraction Hierarchies. - * - * #ELM_MAP_ROUTE_SOURCE_ORS, is provided at http://www.openrouteservice.org/ + * @param zoom New maximum zoom value to be used. * - * @see elm_map_route_source_get(). + * By default, it's 18. * * @ingroup Map */ -EAPI void elm_map_route_source_set(Evas_Object *obj, Elm_Map_Route_Sources source); +EAPI void elm_map_zoom_max_set(Evas_Object *obj, int zoom); /** - * Get the current route source. + * Get the maximum zoom of the source. * * @param obj The map object. - * @return The source of the route service used by the map. + * @return Returns the maximum zoom of the source. * - * @see elm_map_route_source_set() for details. + * @see elm_map_zoom_min_set() for details. * * @ingroup Map */ -EAPI Elm_Map_Route_Sources elm_map_route_source_get(const Evas_Object *obj); +EAPI int elm_map_zoom_max_get(const Evas_Object *obj); /** - * Set the minimum zoom of the source. + * Get the current geographic coordinates of the map. * * @param obj The map object. - * @param zoom New minimum zoom value to be used. + * @param lon Pointer to store longitude. + * @param lat Pointer to store latitude. * - * By default, it's 0. + * This gets the current center coordinates of the map object. It can be + * set by elm_map_region_bring_in() and elm_map_region_show(). + * + * @see elm_map_region_bring_in() + * @see elm_map_region_show() * * @ingroup Map */ -EAPI void elm_map_source_zoom_min_set(Evas_Object *obj, int zoom); +EAPI void elm_map_region_get(const Evas_Object *obj, double *lon, double *lat); /** - * Get the minimum zoom of the source. + * Animatedly bring in given coordinates to the center of the map. * * @param obj The map object. - * @return Returns the minimum zoom of the source. + * @param lon Longitude to center at. + * @param lat Latitude to center at. + * + * This causes map to jump to the given @p lat and @p lon coordinates + * and show it (by scrolling) in the center of the viewport, if it is not + * already centered. This will use animation to do so and take a period + * of time to complete. * - * @see elm_map_source_zoom_min_set() for details. + * @see elm_map_region_show() for a function to avoid animation. + * @see elm_map_region_get() * * @ingroup Map */ -EAPI int elm_map_source_zoom_min_get(const Evas_Object *obj); +EAPI void elm_map_region_bring_in(Evas_Object *obj, double lon, double lat); /** - * Set the maximum zoom of the source. + * Show the given coordinates at the center of the map, @b immediately. * * @param obj The map object. - * @param zoom New maximum zoom value to be used. + * @param lon Longitude to center at. + * @param lat Latitude to center at. * - * By default, it's 18. + * This causes map to @b redraw its viewport's contents to the + * region containing the given @p lat and @p lon, that will be moved to the + * center of the map. + * + * @see elm_map_region_bring_in() for a function to move with animation. + * @see elm_map_region_get() * * @ingroup Map */ -EAPI void elm_map_source_zoom_max_set(Evas_Object *obj, int zoom); +EAPI void elm_map_region_show(Evas_Object *obj, double lon, double lat); /** - * Get the maximum zoom of the source. + * Convert canvas coordinates into geographic coordinates + * (longitude, latitude). * * @param obj The map object. - * @return Returns the maximum zoom of the source. + * @param x horizontal coordinate of the point to convert. + * @param y vertical coordinate of the point to convert. + * @param lon A pointer to the longitude. + * @param lat A pointer to the latitude. + * + * This gets longitude and latitude from canvas x, y coordinates. The canvas + * coordinates mean x, y coordinate from current viewport. * - * @see elm_map_source_zoom_min_set() for details. + * see elm_map_region_to_canvas_convert() * * @ingroup Map */ -EAPI int elm_map_source_zoom_max_get(const Evas_Object *obj); +EAPI void elm_map_canvas_to_region_convert(const Evas_Object *obj, const Evas_Coord x, const Evas_Coord y, double *lon, double *lat); /** - * Set the user agent used by the map object to access routing services. + * Convert geographic coordinates (longitude, latitude) + * into canvas coordinates. * * @param obj The map object. - * @param user_agent The user agent to be used by the map. - * - * User agent is a client application implementing a network protocol used - * in communications within a client–server distributed computing system + * @param lon The longitude to convert. + * @param lat The latitude to convert. + * @param x A pointer to horizontal coordinate. + * @param y A pointer to vertical coordinate. * - * The @p user_agent identification string will transmitted in a header - * field @c User-Agent. + * This gets canvas x, y coordinates from longitude and latitude. The canvas + * coordinates mean x, y coordinate from current viewport. * - * @see elm_map_user_agent_get() + * see elm_map_canvas_to_region_convert() * * @ingroup Map */ -EAPI void elm_map_user_agent_set(Evas_Object *obj, const char *user_agent); +EAPI void elm_map_region_to_canvas_convert(const Evas_Object *obj, double lon, double lat, Evas_Coord *x, Evas_Coord *y); /** - * Get the user agent used by the map object. + * Pause or unpause the map. * * @param obj The map object. - * @return The user agent identification string used by the map. + * @param paused Use @c EINA_TRUE to pause the map @p obj or @c EINA_FALSE + * to unpause it. * - * @see elm_map_user_agent_set() for details. + * This sets the paused state to on (@c EINA_TRUE) or off (@c EINA_FALSE) + * for map. + * + * The default is off. + * + * This will stop zooming using animation, changing zoom levels will + * change instantly. This will stop any existing animations that are running. * - * @ingroup Map - */ -EAPI const char *elm_map_user_agent_get(const Evas_Object *obj); -======= * @see elm_map_paused_get() * * @ingroup Map @@ -1976,7 +1002,6 @@ EAPI void elm_map_overlay_class_remove(Elm_Map_Overlay *clas, E * * @ingroup Map */ -EAPI EAPI void elm_map_overlay_class_zoom_max_set(Elm_Map_Overlay *clas, int zoom); /** @@ -2172,18 +1197,13 @@ EAPI void elm_map_source_set(Evas_Object *obj, Elm_Map_Source_T * @ingroup Map */ EAPI const char *elm_map_source_get(const Evas_Object *obj, Elm_Map_Source_Type type); ->>>>>>> remotes/origin/upstream /** * Add a new route to the map object. * * @param obj The map object. * @param type The type of transport to be considered when tracing a route. -<<<<<<< HEAD - * @param method The routing method, what should be priorized. -======= * @param method The routing method, what should be prioritized. ->>>>>>> remotes/origin/upstream * @param flon The start longitude. * @param flat The start latitude. * @param tlon The destination longitude. @@ -2200,11 +1220,7 @@ EAPI const char *elm_map_source_get(const Evas_Object *obj, Elm_Map_So * One of #ELM_MAP_ROUTE_TYPE_MOTOCAR, #ELM_MAP_ROUTE_TYPE_BICYCLE, or * #ELM_MAP_ROUTE_TYPE_FOOT need to be used. * -<<<<<<< HEAD - * Another parameter is what the route should priorize, the minor distance -======= * Another parameter is what the route should prioritize, the minor distance ->>>>>>> remotes/origin/upstream * or the less time to be spend on the route. So @p method should be one * of #ELM_MAP_ROUTE_METHOD_SHORTEST or #ELM_MAP_ROUTE_METHOD_FASTEST. * @@ -2219,11 +1235,7 @@ EAPI const char *elm_map_source_get(const Evas_Object *obj, Elm_Map_So * * @ingroup Map */ -<<<<<<< HEAD -EAPI Elm_Map_Route *elm_map_route_add(Evas_Object *obj, Elm_Map_Route_Type type, Elm_Map_Route_Method method, double flon, double flat, double tlon, double tlat); -======= EAPI Elm_Map_Route *elm_map_route_add(Evas_Object *obj, Elm_Map_Route_Type type, Elm_Map_Route_Method method, double flon, double flat, double tlon, double tlat, Elm_Map_Route_Cb route_cb, void *data); ->>>>>>> remotes/origin/upstream /** * Remove a route from the map. @@ -2234,54 +1246,7 @@ EAPI Elm_Map_Route *elm_map_route_add(Evas_Object *obj, Elm_Map_Route_Typ * * @ingroup Map */ -<<<<<<< HEAD -EAPI void elm_map_route_remove(Elm_Map_Route *route); - -/** - * Set the route color. - * - * @param route The route object. - * @param r Red channel value, from 0 to 255. - * @param g Green channel value, from 0 to 255. - * @param b Blue channel value, from 0 to 255. - * @param a Alpha channel value, from 0 to 255. - * - * It uses an additive color model, so each color channel represents - * how much of each primary colors must to be used. 0 represents - * ausence of this color, so if all of the three are set to 0, - * the color will be black. - * - * These component values should be integers in the range 0 to 255, - * (single 8-bit byte). - * - * This sets the color used for the route. By default, it is set to - * solid red (r = 255, g = 0, b = 0, a = 255). - * - * For alpha channel, 0 represents completely transparent, and 255, opaque. - * - * @see elm_map_route_color_get() - * - * @ingroup Map - */ -EAPI void elm_map_route_color_set(Elm_Map_Route *route, int r, int g, int b, int a); - -/** - * Get the route color. - * - * @param route The route object. - * @param r Pointer where to store the red channel value. - * @param g Pointer where to store the green channel value. - * @param b Pointer where to store the blue channel value. - * @param a Pointer where to store the alpha channel value. - * - * @see elm_map_route_color_set() for details. - * - * @ingroup Map - */ -EAPI void elm_map_route_color_get(const Elm_Map_Route *route, int *r, int *g, int *b, int *a); -======= EAPI void elm_map_route_del(Elm_Map_Route *route); ->>>>>>> remotes/origin/upstream /** * Get the route distance in kilometers. @@ -2314,8 +1279,6 @@ EAPI const char *elm_map_route_node_get(const Elm_Map_Route *route); EAPI const char *elm_map_route_waypoint_get(const Elm_Map_Route *route); /** -<<<<<<< HEAD -======= * Request a address or geographic coordinates(longitude, latitude) * from a given address or geographic coordinate(longitude, latitude). * @@ -2342,7 +1305,6 @@ EAPI const char *elm_map_route_waypoint_get(const Elm_Map_Route *route EAPI Elm_Map_Name *elm_map_name_add(const Evas_Object *obj, const char *address, double lon, double lat, Elm_Map_Name_Cb name_cb, void *data); /** ->>>>>>> remotes/origin/upstream * Get the address of the name. * * @param name The name handle. @@ -2362,13 +1324,8 @@ EAPI const char *elm_map_name_address_get(const Elm_Map_Name *name); * Get the current coordinates of the name. * * @param name The name handle. -<<<<<<< HEAD - * @param lat Pointer where to store the latitude. - * @param lon Pointer where to store The longitude. -======= * @param lat Pointer to store the latitude. * @param lon Pointer to store The longitude. ->>>>>>> remotes/origin/upstream * * This gets the coordinates of the @p name, created with one of the * conversion functions. @@ -2385,11 +1342,7 @@ EAPI void elm_map_name_region_get(const Elm_Map_Name *name, dou * * @param name The name to remove. * -<<<<<<< HEAD - * Basically the struct handled by @p name will be freed, so convertions -======= * Basically the struct handled by @p name will be freed, so conversions ->>>>>>> remotes/origin/upstream * between address and coordinates will be lost. * * @see elm_map_utils_convert_name_into_coord() @@ -2397,77 +1350,9 @@ EAPI void elm_map_name_region_get(const Elm_Map_Name *name, dou * * @ingroup Map */ -<<<<<<< HEAD -EAPI void elm_map_name_remove(Elm_Map_Name *name); - -/** - * Rotate the map. - * - * @param obj The map object. - * @param degree Angle from 0.0 to 360.0 to rotate arount Z axis. - * @param cx Rotation's center horizontal position. - * @param cy Rotation's center vertical position. - * - * @see elm_map_rotate_get() - * - * @ingroup Map - */ -EAPI void elm_map_rotate_set(Evas_Object *obj, double degree, Evas_Coord cx, Evas_Coord cy); - -/** - * Get the rotate degree of the map - * - * @param obj The map object - * @param degree Pointer where to store degrees from 0.0 to 360.0 - * to rotate arount Z axis. - * @param cx Pointer where to store rotation's center horizontal position. - * @param cy Pointer where to store rotation's center vertical position. - * - * @see elm_map_rotate_set() to set map rotation. - * - * @ingroup Map - */ -EAPI void elm_map_rotate_get(const Evas_Object *obj, double *degree, Evas_Coord *cx, Evas_Coord *cy); - -/** - * Enable or disable mouse wheel to be used to zoom in / out the map. - * - * @param obj The map object. - * @param disabled Use @c EINA_TRUE to disable mouse wheel or @c EINA_FALSE - * to enable it. - * - * Mouse wheel can be used for the user to zoom in or zoom out the map. - * - * It's disabled by default. - * - * @see elm_map_wheel_disabled_get() - * - * @ingroup Map - */ -EAPI void elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); - -/** - * Get a value whether mouse wheel is enabled or not. - * - * @param obj The map object. - * @return @c EINA_TRUE means map is disabled. @c EINA_FALSE indicates - * it is enabled. If @p obj is @c NULL, @c EINA_FALSE is returned. - * - * Mouse wheel can be used for the user to zoom in or zoom out the map. - * - * @see elm_map_wheel_disabled_set() for details. - * - * @ingroup Map - */ -EAPI Eina_Bool elm_map_wheel_disabled_get(const Evas_Object *obj); - -#ifdef ELM_EMAP -/** -======= EAPI void elm_map_name_del(Elm_Map_Name *name); /** ->>>>>>> remotes/origin/upstream * Add a track on the map * * @param obj The map object. @@ -2478,12 +1363,7 @@ EAPI void elm_map_name_del(Elm_Map_Name *name); * * @ingroup Map */ -<<<<<<< HEAD -EAPI Evas_Object *elm_map_track_add(Evas_Object *obj, EMap_Route *emap); -#endif -======= EAPI Evas_Object *elm_map_track_add(Evas_Object *obj, void *emap); ->>>>>>> remotes/origin/upstream /** * Remove a track from the map @@ -2495,9 +1375,3 @@ EAPI Evas_Object *elm_map_track_add(Evas_Object *obj, void *emap); */ EAPI void elm_map_track_remove(Evas_Object *obj, Evas_Object *route); -<<<<<<< HEAD -/** - * @} - */ -======= ->>>>>>> remotes/origin/upstream diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c index 74eb95a..e46d65c 100644 --- a/src/lib/elm_menu.c +++ b/src/lib/elm_menu.c @@ -115,36 +115,21 @@ _theme_hook(Evas_Object *obj) _elm_theme_object_set (obj, VIEW(item), "menu", "item_with_submenu", elm_widget_style_get(obj)); -<<<<<<< HEAD - elm_object_item_text_set((Elm_Object_Item *) item, - item->label); - elm_menu_item_object_icon_name_set((Elm_Object_Item *) item, -======= elm_object_item_text_set((Elm_Object_Item *)item, item->label); elm_menu_item_icon_name_set((Elm_Object_Item *)item, ->>>>>>> remotes/origin/upstream item->icon_str); } else { _elm_theme_object_set(obj, VIEW(item), "menu", "item", elm_widget_style_get(obj)); -<<<<<<< HEAD - elm_object_item_text_set((Elm_Object_Item *) item, - item->label); - elm_menu_item_object_icon_name_set((Elm_Object_Item *) item, - item->icon_str); - } - _item_disable_hook((Elm_Object_Item *) item); -======= elm_object_item_text_set((Elm_Object_Item *)item, item->label); elm_menu_item_icon_name_set((Elm_Object_Item *)item, item->icon_str); } _item_disable_hook((Elm_Object_Item *)item); ->>>>>>> remotes/origin/upstream edje_object_scale_set(VIEW(item), elm_widget_scale_get(obj) * _elm_config->scale); } @@ -157,19 +142,11 @@ _item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); -======= ->>>>>>> remotes/origin/upstream Elm_Menu_Item *item; if (part && strcmp(part, "default")) return; -<<<<<<< HEAD - item = (Elm_Menu_Item *) it; -======= item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream eina_stringshare_replace(&item->label, label); @@ -186,14 +163,8 @@ _item_text_set_hook(Elm_Object_Item *it, static const char * _item_text_get_hook(const Elm_Object_Item *it, const char *part) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); - if (part && strcmp(part, "default")) return NULL; - return ((Elm_Menu_Item *) it)->label; -======= if (part && strcmp(part, "default")) return NULL; return ((Elm_Menu_Item *)it)->label; ->>>>>>> remotes/origin/upstream } static void @@ -201,19 +172,11 @@ _item_content_set_hook(Elm_Object_Item *it, const char *part, Evas_Object *content) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); -======= ->>>>>>> remotes/origin/upstream Elm_Menu_Item *item; if (part && strcmp(part, "default")) return; -<<<<<<< HEAD - item = (Elm_Menu_Item *) it; -======= item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream if (item->content) { @@ -231,25 +194,14 @@ _item_content_set_hook(Elm_Object_Item *it, static Evas_Object * _item_content_get_hook(const Elm_Object_Item *it, const char *part) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); - if (part && strcmp(part, "default")) return NULL; - return ((Elm_Menu_Item *) it)->content; -======= if (part && strcmp(part, "default")) return NULL; return ((Elm_Menu_Item *)it)->content; ->>>>>>> remotes/origin/upstream } static void _item_disable_hook(Elm_Object_Item *it) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - Elm_Menu_Item *item = (Elm_Menu_Item *) it; -======= Elm_Menu_Item *item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream if (elm_widget_item_disabled_get(item)) { @@ -451,11 +403,7 @@ _menu_item_activate(void *data, Evas_Object *obj __UNUSED__, const char *emissio EINA_LIST_FOREACH(item->parent->submenu.items, l, item2) { if (item2 != item) -<<<<<<< HEAD - elm_menu_item_selected_set((Elm_Object_Item *) item2, 0); -======= elm_menu_item_selected_set((Elm_Object_Item *)item2, 0); ->>>>>>> remotes/origin/upstream } } else @@ -464,11 +412,7 @@ _menu_item_activate(void *data, Evas_Object *obj __UNUSED__, const char *emissio EINA_LIST_FOREACH(wd->items, l, item2) { if (item2 != item) -<<<<<<< HEAD - elm_menu_item_selected_set((Elm_Object_Item *) item2, 0); -======= elm_menu_item_selected_set((Elm_Object_Item *)item2, 0); ->>>>>>> remotes/origin/upstream } } } @@ -487,11 +431,7 @@ _submenu_open(void *data, Evas_Object *obj __UNUSED__, const char *emission __UN Elm_Menu_Item *item = data; item->submenu.open = EINA_TRUE; evas_object_show(item->submenu.hv); -<<<<<<< HEAD - _sizing_eval(WIDGET(item)); -======= _submenu_sizing_eval(item); ->>>>>>> remotes/origin/upstream } static void @@ -555,17 +495,10 @@ _item_submenu_obj_create(Elm_Menu_Item *item) edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(WIDGET(item))); _elm_theme_object_set(WIDGET(item), VIEW(item), "menu", "item_with_submenu", elm_widget_style_get(WIDGET(item))); -<<<<<<< HEAD - elm_object_item_text_set((Elm_Object_Item *) item, - item->label); - if (item->icon_str) - elm_menu_item_object_icon_name_set((Elm_Object_Item *) item, -======= elm_object_item_text_set((Elm_Object_Item *)item, item->label); if (item->icon_str) elm_menu_item_icon_name_set((Elm_Object_Item *)item, ->>>>>>> remotes/origin/upstream item->icon_str); edje_object_signal_callback_add(VIEW(item), "elm,action,open", "", _submenu_open, item); @@ -692,11 +625,7 @@ elm_menu_close(Evas_Object *obj) EAPI Evas_Object * elm_menu_item_object_get(const Elm_Object_Item *it) { -<<<<<<< HEAD - return VIEW(((Elm_Menu_Item *) it)); -======= return VIEW(((Elm_Menu_Item *)it)); ->>>>>>> remotes/origin/upstream } static void @@ -759,12 +688,7 @@ _elm_menu_item_add_helper(Evas_Object *obj, Elm_Menu_Item *parent, Elm_Menu_Item static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it) { -<<<<<<< HEAD - ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); - Elm_Menu_Item *item = (Elm_Menu_Item *) it; -======= Elm_Menu_Item *item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream Elm_Object_Item *_item; EINA_LIST_FREE(item->submenu.items, _item) elm_object_item_del(_item); @@ -820,22 +744,14 @@ elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, c elm_widget_sub_object_add(WIDGET(subitem), subitem->content); edje_object_part_swallow(VIEW(subitem), "elm.swallow.content", subitem->content); if (icon) -<<<<<<< HEAD - elm_menu_item_object_icon_name_set((Elm_Object_Item *) subitem, icon); -======= elm_menu_item_icon_name_set((Elm_Object_Item *) subitem, icon); ->>>>>>> remotes/origin/upstream _elm_menu_item_add_helper(obj, (Elm_Menu_Item *) parent, subitem, wd); return (Elm_Object_Item *) subitem; } -<<<<<<< HEAD -EAPI Elm_Object_Item * -======= EINA_DEPRECATED EAPI Elm_Object_Item * ->>>>>>> remotes/origin/upstream elm_menu_item_add_object(Evas_Object *obj, Elm_Object_Item *parent, Evas_Object *subobj, Evas_Smart_Cb func, const void *data) { Elm_Menu_Item *subitem; @@ -874,11 +790,7 @@ EAPI unsigned int elm_menu_item_index_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0); -<<<<<<< HEAD - return ((Elm_Menu_Item *) it)->idx; -======= return ((Elm_Menu_Item *)it)->idx; ->>>>>>> remotes/origin/upstream } EAPI void @@ -893,15 +805,6 @@ elm_menu_item_label_get(const Elm_Object_Item *it) return _item_text_get_hook(it, NULL); } -<<<<<<< HEAD -EAPI void -elm_menu_item_object_icon_name_set(Elm_Object_Item *it, const char *icon) -{ - ELM_OBJ_ITEM_CHECK_OR_RETURN(it); - EINA_SAFETY_ON_NULL_RETURN(icon); - char icon_tmp[512]; - Elm_Menu_Item *item = (Elm_Menu_Item *) it; -======= EINA_DEPRECATED EAPI void elm_menu_item_object_icon_name_set(Elm_Object_Item *it, const char *icon) { @@ -915,7 +818,6 @@ elm_menu_item_icon_name_set(Elm_Object_Item *it, const char *icon) EINA_SAFETY_ON_NULL_RETURN(icon); char icon_tmp[512]; Elm_Menu_Item *item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream if (!*icon) return; if ((item->icon_str) && (!strcmp(item->icon_str, icon))) return; @@ -1000,13 +902,6 @@ elm_menu_item_object_content_get(const Elm_Object_Item *it) return _item_content_get_hook(it, NULL); } -<<<<<<< HEAD -EAPI const char * -elm_menu_item_object_icon_name_get(const Elm_Object_Item *it) -{ - ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); - return ((Elm_Menu_Item *) it)->icon_str; -======= EINA_DEPRECATED EAPI const char * elm_menu_item_object_icon_name_get(const Elm_Object_Item *it) { @@ -1018,18 +913,13 @@ elm_menu_item_icon_name_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); return ((Elm_Menu_Item *)it)->icon_str; ->>>>>>> remotes/origin/upstream } EAPI Eina_Bool elm_menu_item_is_separator(Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); -<<<<<<< HEAD - return ((Elm_Menu_Item *) it)->separator; -======= return ((Elm_Menu_Item *)it)->separator; ->>>>>>> remotes/origin/upstream } EAPI void @@ -1060,11 +950,7 @@ EAPI const Eina_List * elm_menu_item_subitems_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); -<<<<<<< HEAD - return ((Elm_Menu_Item *) it)->submenu.items; -======= return ((Elm_Menu_Item *)it)->submenu.items; ->>>>>>> remotes/origin/upstream } EAPI const Eina_List * @@ -1079,11 +965,7 @@ EAPI void elm_menu_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it); -<<<<<<< HEAD - Elm_Menu_Item *item = (Elm_Menu_Item *) it; -======= Elm_Menu_Item *item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream if (selected == item->selected) return; item->selected = selected; @@ -1104,22 +986,14 @@ EAPI Eina_Bool elm_menu_item_selected_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE); -<<<<<<< HEAD - return ((Elm_Menu_Item *) it)->selected; -======= return ((Elm_Menu_Item *)it)->selected; ->>>>>>> remotes/origin/upstream } EAPI Elm_Object_Item * elm_menu_item_prev_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); -<<<<<<< HEAD - Elm_Menu_Item *item = (Elm_Menu_Item *) it; -======= Elm_Menu_Item *item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream if (item->parent) { @@ -1145,11 +1019,7 @@ EAPI Elm_Object_Item * elm_menu_item_next_get(const Elm_Object_Item *it) { ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); -<<<<<<< HEAD - Elm_Menu_Item *item = (Elm_Menu_Item *) it; -======= Elm_Menu_Item *item = (Elm_Menu_Item *)it; ->>>>>>> remotes/origin/upstream if (item->parent) { @@ -1171,11 +1041,7 @@ elm_menu_item_next_get(const Elm_Object_Item *it) return NULL; } -<<<<<<< HEAD -EAPI Evas_Object * -======= EINA_DEPRECATED EAPI Evas_Object * ->>>>>>> remotes/origin/upstream elm_menu_item_menu_get(const Elm_Object_Item *it) { return elm_object_item_widget_get(it); @@ -1212,11 +1078,7 @@ elm_menu_selected_item_get(const Evas_Object * obj) Elm_Menu_Item *item; EINA_LIST_FOREACH(wd->items, l, item) { -<<<<<<< HEAD - if (item->selected) return ((Elm_Object_Item *) item); -======= if (item->selected) return ((Elm_Object_Item *)item); ->>>>>>> remotes/origin/upstream } return NULL; } diff --git a/src/lib/elm_menu.h b/src/lib/elm_menu.h index 8429480..0ba6726 100644 --- a/src/lib/elm_menu.h +++ b/src/lib/elm_menu.h @@ -12,11 +12,7 @@ * Signals that you can add callbacks for are: * @li "clicked" - the user clicked the empty space in the menu to dismiss. * -<<<<<<< HEAD - * Default contents parts of the menu items that you can use for are: -======= * Default content parts of the menu items that you can use for are: ->>>>>>> remotes/origin/upstream * @li "default" - A main content of the menu item * * Default text parts of the menu items that you can use for are: @@ -107,11 +103,7 @@ EAPI Evas_Object *elm_menu_item_object_get(const Elm_Object_Item * * @param obj The menu object. * @param parent The parent menu item (optional) -<<<<<<< HEAD - * @param icon An icon display on the item. The icon will be destryed by the menu. -======= * @param icon An icon display on the item. The icon will be destroyed by the menu. ->>>>>>> remotes/origin/upstream * @param label The label of the item. * @param func Function called when the user select the item. * @param data Data sent by the callback. @@ -120,31 +112,6 @@ EAPI Evas_Object *elm_menu_item_object_get(const Elm_Object_Item EAPI Elm_Object_Item *elm_menu_item_add(Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); /** -<<<<<<< HEAD - * @brief Add an object swallowed in an item at the end of the given menu - * widget - * - * @param obj The menu object. - * @param parent The parent menu item (optional) - * @param subobj The object to swallow - * @param func Function called when the user select the item. - * @param data Data sent by the callback. - * @return Returns the new item. - * - * Add an evas object as an item to the menu. - */ -EAPI Elm_Object_Item *elm_menu_item_add_object(Evas_Object *obj, Elm_Object_Item *parent, Evas_Object *subobj, Evas_Smart_Cb func, const void *data); - -/** - * @brief Set the icon of a menu item to the standard icon with name @p icon - * - * @param it The menu item object. - * @param icon The icon object to set for the content of @p item - * - * Once this icon is set, any previously set icon will be deleted. - */ -EAPI void elm_menu_item_object_icon_name_set(Elm_Object_Item *it, const char *icon); -======= * @brief Set the icon of a menu item to the standard icon with name @p icon * * @param it The menu item object. @@ -153,7 +120,6 @@ EAPI void elm_menu_item_object_icon_name_set(Elm_Object_ * Once this icon is set, any previously set icon will be deleted. */ EAPI void elm_menu_item_icon_name_set(Elm_Object_Item *it, const char *icon); ->>>>>>> remotes/origin/upstream /** * @brief Get the string representation from the icon of a menu item @@ -161,15 +127,9 @@ EAPI void elm_menu_item_icon_name_set(Elm_Object_Item *i * @param it The menu item object. * @return The string representation of @p item's icon or NULL * -<<<<<<< HEAD - * @see elm_menu_item_object_icon_name_set() - */ -EAPI const char *elm_menu_item_object_icon_name_get(const Elm_Object_Item *it); -======= * @see elm_menu_item_icon_name_set() */ EAPI const char *elm_menu_item_icon_name_get(const Elm_Object_Item *it); ->>>>>>> remotes/origin/upstream /** * @brief Set the selected state of @p item. @@ -234,19 +194,6 @@ EAPI const Eina_List *elm_menu_item_subitems_get(const Elm_Object_It EAPI unsigned int elm_menu_item_index_get(const Elm_Object_Item *it); /** -<<<<<<< HEAD - * @brief @brief Return a menu item's owner menu - * - * @param it The menu item - * @return The menu object owning @p item, or NULL on failure - * - * Use this function to get the menu object owning an item. - */ -EAPI Evas_Object *elm_menu_item_menu_get(const Elm_Object_Item *it); - -/** -======= ->>>>>>> remotes/origin/upstream * @brief Get the selected item in the menu * * @param obj The menu object diff --git a/src/lib/elm_web.c b/src/lib/elm_web.c index cef7303..1c84db9 100644 --- a/src/lib/elm_web.c +++ b/src/lib/elm_web.c @@ -138,20 +138,6 @@ static const Evas_Smart_Cb_Description _elm_web_callback_names[] = { { NULL, NULL } }; -<<<<<<< HEAD -static void -_theme_hook(Evas_Object *obj) -{ -#ifdef HAVE_ELEMENTARY_WEB - Elm_Theme *theme = elm_object_theme_get(obj); - Widget_Data *wd = elm_widget_data_get(obj); - const Eina_List *themes, *l; - const char *th; - char *view_theme = NULL; - - themes = elm_theme_list_get(theme); - EINA_LIST_FOREACH(themes, l, th) -======= #ifdef HAVE_ELEMENTARY_WEB static char * _webkit_theme_find(const Eina_List *list) @@ -160,20 +146,10 @@ _webkit_theme_find(const Eina_List *list) const char *th; EINA_LIST_FOREACH(list, l, th) ->>>>>>> remotes/origin/upstream { char *path = elm_theme_list_item_path_get(th, NULL); if (!path) continue; if (edje_file_group_exists(path, "webkit/base")) -<<<<<<< HEAD - { - view_theme = path; - break; - } - free(path); - } - -======= return path; free(path); } @@ -203,7 +179,6 @@ _theme_hook(Evas_Object *obj) view_theme = _webkit_theme_find(themes); set: ->>>>>>> remotes/origin/upstream if (view_theme) { ewk_view_theme_set(wd->ewk_view, view_theme); @@ -943,19 +918,11 @@ _ewk_view_popup_create_cb(void *data, Evas_Object *obj, void *event_info) return; notify = elm_notify_add(obj); -<<<<<<< HEAD - elm_notify_repeat_events_set(notify, EINA_FALSE); - elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); - - list = elm_list_add(obj); - elm_list_always_select_mode_set(list, EINA_TRUE); -======= elm_notify_allow_events_set(notify, EINA_FALSE); elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM); list = elm_list_add(obj); elm_list_select_mode_set(data, ELM_OBJECT_SELECT_MODE_ALWAYS); ->>>>>>> remotes/origin/upstream elm_list_bounce_set(list, EINA_FALSE, EINA_FALSE); elm_list_mode_set(list, ELM_LIST_EXPAND); evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1583,11 +1550,6 @@ elm_web_navigate(Evas_Object *obj, int steps) #endif } -<<<<<<< HEAD -EAPI Eina_Bool -elm_web_back_possible(Evas_Object *obj) -{ -======= EINA_DEPRECATED EAPI Eina_Bool elm_web_back_possible(Evas_Object *obj) { @@ -1597,7 +1559,6 @@ elm_web_back_possible(Evas_Object *obj) EAPI Eina_Bool elm_web_back_possible_get(Evas_Object *obj) { ->>>>>>> remotes/origin/upstream ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; #ifdef HAVE_ELEMENTARY_WEB Widget_Data *wd = elm_widget_data_get(obj); @@ -1608,11 +1569,6 @@ elm_web_back_possible_get(Evas_Object *obj) #endif } -<<<<<<< HEAD -EAPI Eina_Bool -elm_web_forward_possible(Evas_Object *obj) -{ -======= EINA_DEPRECATED EAPI Eina_Bool elm_web_forward_possible(Evas_Object *obj) { @@ -1622,7 +1578,6 @@ elm_web_forward_possible(Evas_Object *obj) EAPI Eina_Bool elm_web_forward_possible_get(Evas_Object *obj) { ->>>>>>> remotes/origin/upstream ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; #ifdef HAVE_ELEMENTARY_WEB Widget_Data *wd = elm_widget_data_get(obj); @@ -1634,7 +1589,7 @@ elm_web_forward_possible_get(Evas_Object *obj) } EAPI Eina_Bool -elm_web_navigate_possible(Evas_Object *obj, int steps) +elm_web_navigate_possible_get(Evas_Object *obj, int steps) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; #ifdef HAVE_ELEMENTARY_WEB @@ -1647,11 +1602,6 @@ elm_web_navigate_possible(Evas_Object *obj, int steps) #endif } -<<<<<<< HEAD -EAPI Eina_Bool -elm_web_history_enable_get(const Evas_Object *obj) -{ -======= EINA_DEPRECATED EAPI Eina_Bool elm_web_history_enable_get(const Evas_Object *obj) { @@ -1661,7 +1611,6 @@ elm_web_history_enable_get(const Evas_Object *obj) EAPI Eina_Bool elm_web_history_enabled_get(const Evas_Object *obj) { ->>>>>>> remotes/origin/upstream ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; #ifdef HAVE_ELEMENTARY_WEB Widget_Data *wd = elm_widget_data_get(obj); @@ -1672,11 +1621,6 @@ elm_web_history_enabled_get(const Evas_Object *obj) #endif } -<<<<<<< HEAD -EAPI void -elm_web_history_enable_set(Evas_Object *obj, Eina_Bool enable) -{ -======= EINA_DEPRECATED EAPI void elm_web_history_enable_set(Evas_Object *obj, Eina_Bool enable) { @@ -1686,7 +1630,6 @@ elm_web_history_enable_set(Evas_Object *obj, Eina_Bool enable) EAPI void elm_web_history_enabled_set(Evas_Object *obj, Eina_Bool enable) { ->>>>>>> remotes/origin/upstream ELM_CHECK_WIDTYPE(obj, widtype); #ifdef HAVE_ELEMENTARY_WEB Widget_Data *wd = elm_widget_data_get(obj); @@ -1928,17 +1871,6 @@ elm_web_window_features_unref(Elm_Web_Window_Features *wf) #endif } -<<<<<<< HEAD -EAPI void -elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Eina_Bool *toolbar_visible, Eina_Bool *statusbar_visible, Eina_Bool *scrollbars_visible, Eina_Bool *menubar_visible, Eina_Bool *locationbar_visible, Eina_Bool *fullscreen) -{ -#ifdef HAVE_ELEMENTARY_WEB - ewk_window_features_bool_property_get((const Ewk_Window_Features *)wf, - toolbar_visible, statusbar_visible, - scrollbars_visible, menubar_visible, - locationbar_visible, fullscreen); -#else -======= EAPI Eina_Bool elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_Window_Feature_Flag flag) { @@ -1986,7 +1918,6 @@ elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_ /* What to do with these ? ->>>>>>> remotes/origin/upstream (void)wf; (void)toolbar_visible; (void)statusbar_visible; @@ -1994,13 +1925,6 @@ elm_web_window_features_property_get(const Elm_Web_Window_Features *wf, Elm_Web_ (void)menubar_visible; (void)locationbar_visible; (void)fullscreen; -<<<<<<< HEAD -#endif -} - -EAPI void -elm_web_window_features_int_property_get(const Elm_Web_Window_Features *wf, int *x, int *y, int *w, int *h) -======= */ @@ -2010,30 +1934,23 @@ elm_web_window_features_int_property_get(const Elm_Web_Window_Features *wf, int EAPI void elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) ->>>>>>> remotes/origin/upstream { #ifdef HAVE_ELEMENTARY_WEB ewk_window_features_int_property_get((const Ewk_Window_Features *)wf, x, y, w, h); #else -<<<<<<< HEAD -======= if (!wf || !x || !y || !w || !h) return; /* What to do with these ? ->>>>>>> remotes/origin/upstream (void)wf; (void)x; (void)y; (void)w; (void)h; -<<<<<<< HEAD -======= */ ->>>>>>> remotes/origin/upstream #endif } diff --git a/src/lib/elm_web.h b/src/lib/elm_web.h index 3739bf7..9fb713f 100644 --- a/src/lib/elm_web.h +++ b/src/lib/elm_web.h @@ -4,11 +4,7 @@ * @image html img/widget/web/preview-00.png * @image latex img/widget/web/preview-00.eps * -<<<<<<< HEAD - * A web object is used for displaying web pages (HTML/CSS/JS) -======= * A web widget is used for displaying web pages (HTML/CSS/JS) ->>>>>>> remotes/origin/upstream * using WebKit-EFL. You must have compiled Elementary with * ewebkit support. * @@ -113,11 +109,7 @@ typedef struct _Elm_Web_Frame_Load_Error Elm_Web_Frame_Load_Error; struct _Elm_Web_Frame_Load_Error { int code; /**< Numeric error code */ -<<<<<<< HEAD - Eina_Bool is_cancellation; /**< Error produced by cancelling a request */ -======= Eina_Bool is_cancellation; /**< Error produced by canceling a request */ ->>>>>>> remotes/origin/upstream const char *domain; /**< Error domain name */ const char *description; /**< Error description (already localized) */ const char *failing_url; /**< The URL that failed to load */ @@ -218,8 +210,6 @@ typedef enum */ typedef struct _Elm_Web_Window_Features Elm_Web_Window_Features; -<<<<<<< HEAD -======= /** * Definitions of web window features. @@ -235,7 +225,6 @@ typedef enum ELM_WEB_WINDOW_FEATURE_FULLSCREEN } Elm_Web_Window_Feature_Flag; ->>>>>>> remotes/origin/upstream /** * Callback type for the create_window hook. * @@ -283,11 +272,7 @@ typedef Evas_Object *(*Elm_Web_Dialog_Alert)(void *data, Evas_Object *obj, const * @li @p data User data pointer set when setting the hook function * @li @p obj The elm_web object requesting the new window * @li @p message The message to show in the confirm dialog -<<<<<<< HEAD - * @li @p ret Pointer where to store the user selection. @c EINA_TRUE if -======= * @li @p ret Pointer to store the user selection. @c EINA_TRUE if ->>>>>>> remotes/origin/upstream * the user selected @c Ok, @c EINA_FALSE otherwise. * * The function should return the object representing the confirm dialog. @@ -309,15 +294,9 @@ typedef Evas_Object *(*Elm_Web_Dialog_Confirm)(void *data, Evas_Object *obj, con * @li @p obj The elm_web object requesting the new window * @li @p message The message to show in the prompt dialog * @li @p def_value The default value to present the user in the entry -<<<<<<< HEAD - * @li @p value Pointer where to store the value given by the user. Must - * be a malloc'ed string or @c NULL if the user cancelled the popup. - * @li @p ret Pointer where to store the user selection. @c EINA_TRUE if -======= * @li @p value Pointer to store the value given by the user. Must * be a malloc'ed string or @c NULL if the user canceled the popup. * @li @p ret Pointer to store the user selection. @c EINA_TRUE if ->>>>>>> remotes/origin/upstream * the user selected @c Ok, @c EINA_FALSE otherwise. * * The function should return the object representing the prompt dialog. @@ -339,17 +318,10 @@ typedef Evas_Object *(*Elm_Web_Dialog_Prompt)(void *data, Evas_Object *obj, cons * @li @p obj The elm_web object requesting the new window * @li @p allows_multiple @c EINA_TRUE if multiple files can be selected. * @li @p accept_types Mime types accepted -<<<<<<< HEAD - * @li @p selected Pointer where to store the list of malloc'ed strings - * containing the path to each file selected. Must be @c NULL if the file - * dialog is cancelled - * @li @p ret Pointer where to store the user selection. @c EINA_TRUE if -======= * @li @p selected Pointer to store the list of malloc'ed strings * containing the path to each file selected. Must be @c NULL if the file * dialog is canceled * @li @p ret Pointer to store the user selection. @c EINA_TRUE if ->>>>>>> remotes/origin/upstream * the user selected @c Ok, @c EINA_FALSE otherwise. * * The function should return the object representing the file selector @@ -397,11 +369,7 @@ EAPI Evas_Object *elm_web_add(Evas_Object *parent); * Change useragent of a elm_web object * * @param obj The object -<<<<<<< HEAD - * @param useragent String for useragent -======= * @param user_agent String for useragent ->>>>>>> remotes/origin/upstream * */ EAPI void elm_web_useragent_set(Evas_Object *obj, const char *user_agent); @@ -552,11 +520,7 @@ EAPI void elm_web_tab_propagate_set(Evas_Object *obj, Eina_Bool pro * * @param obj The web object * @param uri The URI to set -<<<<<<< HEAD - * @return EINA_TRUE if the URI could be, EINA_FALSE if an error occurred -======= * @return EINA_TRUE if the URI could be set, EINA_FALSE if an error occurred ->>>>>>> remotes/origin/upstream */ EAPI Eina_Bool elm_web_uri_set(Evas_Object *obj, const char *uri); @@ -621,11 +585,7 @@ EAPI void elm_web_bg_color_get(const Evas_Object *obj, int *r, int * @return A newly allocated string, or NULL if nothing is selected or an * error occurred */ -<<<<<<< HEAD -EAPI char *elm_view_selection_get(const Evas_Object *obj); -======= EAPI char *elm_web_selection_get(const Evas_Object *obj); ->>>>>>> remotes/origin/upstream /** * Tells the web object which index in the currently open popup was selected @@ -707,11 +667,7 @@ EAPI Eina_Bool elm_web_text_matches_highlight_set(Evas_Object *obj, Eina /** * Gets whether highlighting marks is enabled * -<<<<<<< HEAD - * @param The web object -======= * @param obj The web object ->>>>>>> remotes/origin/upstream * * @return EINA_TRUE is marks are set to be highlighted, EINA_FALSE * otherwise @@ -725,11 +681,7 @@ EAPI Eina_Bool elm_web_text_matches_highlight_get(const Evas_Object *obj * 0.0 and 1.0. This is an estimated progress accounting for all the frames * included in the page. * -<<<<<<< HEAD - * @param The web object -======= * @param obj The web object ->>>>>>> remotes/origin/upstream * * @return A value between 0.0 and 1.0 indicating the progress, or -1.0 on * failure @@ -776,11 +728,7 @@ EAPI Eina_Bool elm_web_reload_full(Evas_Object *obj); * * @return EINA_TRUE on success, EINA_FALSE otherwise * -<<<<<<< HEAD - * @see elm_web_history_enable_set() -======= * @see elm_web_history_enabled_set() ->>>>>>> remotes/origin/upstream * @see elm_web_back_possible() * @see elm_web_forward() * @see elm_web_navigate() @@ -796,13 +744,8 @@ EAPI Eina_Bool elm_web_back(Evas_Object *obj); * * @return EINA_TRUE on success, EINA_FALSE otherwise * -<<<<<<< HEAD - * @see elm_web_history_enable_set() - * @see elm_web_forward_possible() -======= * @see elm_web_history_enabled_set() * @see elm_web_forward_possible_get() ->>>>>>> remotes/origin/upstream * @see elm_web_back() * @see elm_web_navigate() */ @@ -820,13 +763,7 @@ EAPI Eina_Bool elm_web_forward(Evas_Object *obj); * @return EINA_TRUE on success, EINA_FALSE on error or if not enough * history exists to jump the given number of steps * -<<<<<<< HEAD - * @see elm_web_history_enable_set() - * @see elm_web_navigate_possible() -======= * @see elm_web_history_enabled_set() - * @see elm_web_navigate_possible_get() ->>>>>>> remotes/origin/upstream * @see elm_web_back() * @see elm_web_forward() */ @@ -840,11 +777,7 @@ EAPI Eina_Bool elm_web_navigate(Evas_Object *obj, int steps); * @return EINA_TRUE if it's possible to back in history, EINA_FALSE * otherwise */ -<<<<<<< HEAD -EAPI Eina_Bool elm_web_back_possible(Evas_Object *obj); -======= EAPI Eina_Bool elm_web_back_possible_get(Evas_Object *obj); ->>>>>>> remotes/origin/upstream /** * Queries whether it's possible to go forward in history @@ -854,11 +787,7 @@ EAPI Eina_Bool elm_web_back_possible_get(Evas_Object *obj); * @return EINA_TRUE if it's possible to forward in history, EINA_FALSE * otherwise */ -<<<<<<< HEAD -EAPI Eina_Bool elm_web_forward_possible(Evas_Object *obj); -======= EAPI Eina_Bool elm_web_forward_possible_get(Evas_Object *obj); ->>>>>>> remotes/origin/upstream /** * Queries whether it's possible to jump the given number of steps @@ -872,11 +801,7 @@ EAPI Eina_Bool elm_web_forward_possible_get(Evas_Object *obj); * @return EINA_TRUE if enough history exists to perform the given jump, * EINA_FALSE otherwise */ -<<<<<<< HEAD -EAPI Eina_Bool elm_web_navigate_possible(Evas_Object *obj, int steps); -======= EAPI Eina_Bool elm_web_navigate_possible_get(Evas_Object *obj, int steps); ->>>>>>> remotes/origin/upstream /** * Gets whether browsing history is enabled for the given object @@ -885,25 +810,15 @@ EAPI Eina_Bool elm_web_navigate_possible_get(Evas_Object *obj, int steps * * @return EINA_TRUE if history is enabled, EINA_FALSE otherwise */ -<<<<<<< HEAD -EAPI Eina_Bool elm_web_history_enable_get(const Evas_Object *obj); -======= EAPI Eina_Bool elm_web_history_enabled_get(const Evas_Object *obj); ->>>>>>> remotes/origin/upstream /** * Enables or disables the browsing history * * @param obj The web object -<<<<<<< HEAD - * @param enable Whether to enable or disable the browsing history - */ -EAPI void elm_web_history_enable_set(Evas_Object *obj, Eina_Bool enable); -======= * @param enabled Whether to enable or disable the browsing history */ EAPI void elm_web_history_enabled_set(Evas_Object *obj, Eina_Bool enabled); ->>>>>>> remotes/origin/upstream /** * Sets the zoom level of the web object @@ -1010,10 +925,6 @@ EAPI Eina_Bool elm_web_inwin_mode_get(const Evas_Object *obj); EAPI void elm_web_window_features_ref(Elm_Web_Window_Features *wf); EAPI void elm_web_window_features_unref(Elm_Web_Window_Features *wf); -<<<<<<< HEAD -EAPI void elm_web_window_features_bool_property_get(const Elm_Web_Window_Features *wf, Eina_Bool *toolbar_visible, Eina_Bool *statusbar_visible, Eina_Bool *scrollbars_visible, Eina_Bool *menubar_visible, Eina_Bool *locationbar_visble, Eina_Bool *fullscreen); -EAPI void elm_web_window_features_int_property_get(const Elm_Web_Window_Features *wf, int *x, int *y, int *w, int *h); -======= /** * Gets boolean properties from Elm_Web_Window_Features @@ -1035,7 +946,6 @@ EAPI Eina_Bool elm_web_window_features_property_get(const Elm_Web_W * */ EAPI void elm_web_window_features_region_get(const Elm_Web_Window_Features *wf, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); ->>>>>>> remotes/origin/upstream /** * @} diff --git a/src/modules/test_map/mod.c b/src/modules/test_map/mod.c index 6a7a75e..a075cdd 100644 --- a/src/modules/test_map/mod.c +++ b/src/modules/test_map/mod.c @@ -5,41 +5,25 @@ #endif EAPI char * -<<<<<<< HEAD -map_module_source_get(void) -======= map_module_source_name_get(void) ->>>>>>> remotes/origin/upstream { return strdup("test_map"); } EAPI int -<<<<<<< HEAD -map_module_zoom_min_get(void) -======= map_module_tile_zoom_min_get(void) ->>>>>>> remotes/origin/upstream { return 0; } EAPI int -<<<<<<< HEAD -map_module_zoom_max_get(void) -======= map_module_tile_zoom_max_get(void) ->>>>>>> remotes/origin/upstream { return 18; } EAPI char * -<<<<<<< HEAD -map_module_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) -======= map_module_tile_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) ->>>>>>> remotes/origin/upstream { char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png", @@ -47,16 +31,6 @@ map_module_tile_url_get(Evas_Object *obj __UNUSED__, int x, int y, int zoom) return strdup(buf); } -<<<<<<< HEAD -EAPI int -map_module_route_source_get(void) -{ - return 0; -} - -EAPI char * -map_module_route_url_get(Evas_Object *obj __UNUSED__, char *type_name __UNUSED__, int method __UNUSED__, double flon __UNUSED__, double flat __UNUSED__, double tlon __UNUSED__, double tlat __UNUSED__) -======= EAPI char * map_module_route_source_get(void) { @@ -65,37 +39,24 @@ map_module_route_source_get(void) EAPI char * map_module_route_url_get(Evas_Object *obj __UNUSED__, const char *type_name __UNUSED__, int method __UNUSED__, double flon __UNUSED__, double flat __UNUSED__, double tlon __UNUSED__, double tlat __UNUSED__) ->>>>>>> remotes/origin/upstream { return strdup(""); } EAPI char * -<<<<<<< HEAD -map_module_name_url_get(Evas_Object *obj __UNUSED__, int method __UNUSED__, char *name __UNUSED__, double lon __UNUSED__, double lat __UNUSED__) -======= map_module_name_url_get(Evas_Object *obj __UNUSED__, int method __UNUSED__, const char *name __UNUSED__, double lon __UNUSED__, double lat __UNUSED__) ->>>>>>> remotes/origin/upstream { return strdup(""); } EAPI Eina_Bool -<<<<<<< HEAD -map_module_geo_into_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__) -======= map_module_tile_geo_to_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__) ->>>>>>> remotes/origin/upstream { return EINA_FALSE; } EAPI Eina_Bool -<<<<<<< HEAD -map_module_coord_into_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__) -======= map_module_tile_coord_to_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__) ->>>>>>> remotes/origin/upstream { return EINA_FALSE; } -- 2.7.4