From a9de11e02a978a923955c143d97b3943010536ce Mon Sep 17 00:00:00 2001 From: jaehwan Date: Tue, 5 Oct 2010 15:01:28 +0900 Subject: [PATCH] [controlbar] ellipsis font [xml_animator] new --- configure.ac | 30 ++ data/Makefile.am | 2 +- debian/libelm.install | 1 + src/lib/Elementary.h.in | 10 +- src/lib/Makefile.am | 6 +- src/lib/elm_controlbar.c | 338 +++++++------ src/lib/elm_tickernoti.c | 8 +- src/lib/elm_xml_animator.c | 1125 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 1370 insertions(+), 150 deletions(-) create mode 100644 src/lib/elm_xml_animator.c diff --git a/configure.ac b/configure.ac index 4bcf7e8..06b88ab 100755 --- a/configure.ac +++ b/configure.ac @@ -463,6 +463,34 @@ if test "x$want_elementary_ethumb" = "xyes" -a "x$have_elementary_ethumb" = "xno fi AC_SUBST(ELM_ETHUMB_DEF) +ELM_LIBXML2_DEF="#undef" +have_elementary_libxml-2.0="no" +want_elementary_libxml-2.0="auto" +AC_ARG_ENABLE([libxml-2.0], + [AC_HELP_STRING([--disable-libxml-2.0], [disable libxml-2.0 support. @<:@default=detect@:>@])], + [want_elementary_libxml-2.0=$enableval], []) + +if test "x$want_elementary_libxml-2.0" != "xno"; then + PKG_CHECK_MODULES([ELEMENTARY_LIBXML2], + [ + libxml-2.0 + ], + [ + AC_DEFINE(HAVE_ELEMENTARY_LIBXML2, 1, [Libxml2 support for Elementary]) + have_elementary_libxml-2.0="yes" + ELM_ETHUMB_DEF="#define" + requirement_elm="libxml-2.0 ${requirement_elm}" + ], + [have_elementary_libxml-2.0="no"] + ) +else + have_elementary_libxml-2.0="no" +fi +if test "x$want_elementary_libxml-2.0" = "xyes" -a "x$have_elementary_libxml-2.0" = "xno"; then + AC_MSG_ERROR(Libxml2 support requested, but no libxml-2.0 found by pkg-config.]) +fi +AC_SUBST(ELM_LIBXML2_DEF) + ELM_ALLOCA_H_DEF="#undef" AC_CHECK_HEADER(alloca.h, [ELM_ALLOCA_H_DEF="#define"]) AC_SUBST(ELM_ALLOCA_H_DEF) @@ -500,6 +528,7 @@ data/themes/Makefile data/images/Makefile data/objects/Makefile data/desktop/Makefile +data/xmls/Makefile data/edje_externals/Makefile config/Makefile config/default/Makefile @@ -532,6 +561,7 @@ echo " EFreet.............: ${have_elementary_efreet}" echo " EWeather...........: ${have_elementary_eweather}" echo " Ethumb.............: ${have_elementary_ethumb}" echo " EWebKit............: ${have_elementary_ewebkit}" +echo " Xml2...............: ${have_elementary_libxml-2.0}" echo echo " eet..................: ${eet_eet}" echo " edje_cc..............: ${edje_cc}" diff --git a/data/Makefile.am b/data/Makefile.am index 17807ed..b3453dc 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,3 +1,3 @@ AUTOMAKE_OPTIONS = 1.4 foreign MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = themes images objects desktop edje_externals +SUBDIRS = themes images objects desktop edje_externals xmls diff --git a/debian/libelm.install b/debian/libelm.install index f360d4e..6f6e84f 100644 --- a/debian/libelm.install +++ b/debian/libelm.install @@ -4,5 +4,6 @@ debian/tmp/usr/lib/edje/* debian/tmp/usr/share/elementary/images/* debian/tmp/usr/share/elementary/objects/* debian/tmp/usr/share/elementary/themes/* +debian/tmp/usr/share/xmls/* debian/tmp/usr/share/icons/elementary.png debian/tmp/usr/lib/elementary/* diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 52cc0b4..fdc640d 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2326,7 +2326,6 @@ extern "C" { EAPI void elm_controlbar_item_select(Elm_Controlbar_Item *it); EAPI void elm_controlbar_item_visible_set(Elm_Controlbar_Item *it, Eina_Bool bar); EAPI Eina_Bool elm_controlbar_item_visible_get(Elm_Controlbar_Item * it); - EAPI void elm_controlbar_item_editable_set(Elm_Controlbar_Item *it, Eina_Bool editable); EAPI void elm_controlbar_item_disable_set(Elm_Controlbar_Item * it, Eina_Bool disable); EAPI Evas_Object *elm_controlbar_item_icon_get(Elm_Controlbar_Item *it); EAPI const char *elm_controlbar_item_label_get(Elm_Controlbar_Item *it); @@ -2339,8 +2338,10 @@ extern "C" { EAPI Elm_Controlbar_Item *elm_controlbar_item_next(Elm_Controlbar_Item *it); EAPI void elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view); EAPI void elm_controlbar_mode_set(Evas_Object *obj, int mode); + EAPI void elm_controlbar_item_auto_align_set(Evas_Object *obj, Eina_Bool auto_align); /*======= Please don't use this APIs =======*/ EAPI void elm_controlbar_edit_start(Evas_Object *obj); + EAPI void elm_controlbar_item_editable_set(Elm_Controlbar_Item *it, Eina_Bool editable); EAPI void elm_controlbar_view_set(Evas_Object *obj, Evas_Object *view); EAPI void elm_controlbar_animation_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data); EAPI void elm_controlbar_item_animation_set(Evas_Object *obj, Eina_Bool auto_animation, Eina_Bool selected_animation); @@ -2863,7 +2864,14 @@ extern "C" { EAPI Eina_Bool elm_cbhm_helper_init(Evas_Object *self); EAPI void elm_cbhm_send_raw_data(char *cmd); + /* Xml Animator */ + typedef struct _Elm_Xml_Animator Elm_Xml_Animator; + EAPI Eina_Bool elm_xml_animator_file_set(Elm_Xml_Animator *xa, const char *file); +EAPI Eina_Bool elm_xml_animator_object_add(Elm_Xml_Animator *xa, Evas_Object *obj, const char *title, void (*end_func)(void *data, Evas_Object *obj), void *data); +EAPI void elm_xml_animator_object_del(Elm_Xml_Animator *xa, Evas_Object *obj); +EAPI void elm_xml_animator_del(Elm_Xml_Animator *xa); +EAPI void elm_xml_animator_run(Elm_Xml_Animator *xa); #ifdef __cplusplus } diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 82c07ed..acc1b7b 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -18,7 +18,8 @@ AM_CPPFLAGS = \ @ELEMENTARY_EDBUS_CFLAGS@ \ @ELEMENTARY_EFREET_CFLAGS@ \ @ELEMENTARY_ETHUMB_CFLAGS@ \ -@ELEMENTARY_EWEBKIT_CFLAGS@ +@ELEMENTARY_EWEBKIT_CFLAGS@ \ +@ELEMENTARY_LIBXML2_CFLAGS@ if ELEMENTARY_WINDOWS_BUILD AM_CPPFLAGS += -DELEMENTARY_BUILD @@ -134,6 +135,7 @@ elm_imageslider.c \ elm_multibuttonentry.c \ elm_stackedicon.c \ elm_calendar.c \ +elm_xml_animator.c \ \ elc_anchorblock.c \ elc_anchorview.c \ @@ -161,5 +163,5 @@ els_webview_container.c libelementary_la_CFLAGS = -libelementary_la_LIBADD = @my_libs@ @dlopen_libs@ @ELEMENTARY_LIBS@ @ELEMENTARY_X_LIBS@ @ELEMENTARY_FB_LIBS@ @ELEMENTARY_SDL_LIBS@ @ELEMENTARY_WIN32_LIBS@ @ELEMENTARY_WINCE_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_ETHUMB_LIBS@ +libelementary_la_LIBADD = @my_libs@ @dlopen_libs@ @ELEMENTARY_LIBS@ @ELEMENTARY_X_LIBS@ @ELEMENTARY_FB_LIBS@ @ELEMENTARY_SDL_LIBS@ @ELEMENTARY_WIN32_LIBS@ @ELEMENTARY_WINCE_LIBS@ @ELEMENTARY_EDBUS_LIBS@ @ELEMENTARY_EFREET_LIBS@ @ELEMENTARY_ETHUMB_LIBS@ @ELEMENTARY_LIBXML2_LIBS@ libelementary_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ diff --git a/src/lib/elm_controlbar.c b/src/lib/elm_controlbar.c index 3643210..3f03db6 100644 --- a/src/lib/elm_controlbar.c +++ b/src/lib/elm_controlbar.c @@ -73,17 +73,24 @@ struct _Widget_Data Ecore_Timer *effect_timer; Eina_Bool selected_animation; + + Elm_Xml_Animator *xa; }; struct _Elm_Controlbar_Item { Evas_Object * obj; Evas_Object * base; + Evas_Object * base_item; + Evas_Object * edit; Evas_Object * edit_item; Evas_Object * view; + Evas_Object * label; Evas_Object * icon; + Evas_Object * edit_label; + Evas_Object * edit_icon; const char *icon_path; - const char *label; + const char *text; void (*func) (void *data, Evas_Object * obj, void *event_info); void *data; int order; @@ -117,6 +124,7 @@ struct _Animation_Data // prototype +static int check_bar_item_number(Widget_Data *wd); static void selected_box(Elm_Controlbar_Item * it); static int pressed_box(Elm_Controlbar_Item * it); static void object_color_set(Evas_Object *ly, const char *color_part, const char *obj_part); @@ -137,7 +145,7 @@ print_all_items(Widget_Data *wd) EINA_LIST_FOREACH(wd->items, l, item) { - printf("item label : %s order : %d address : %p\n", item->label, item->order, item); + printf("item label : %s order : %d address : %p\n", item->text, item->order, item); } } @@ -171,6 +179,8 @@ static void _controlbar_resize(void *data, Evas_Object * obj) { Widget_Data * wd; + Elm_Controlbar_Item *item; + const Eina_List *l; Evas_Coord y, y_, w, h, height; if (!data) return; @@ -190,6 +200,12 @@ _controlbar_resize(void *data, Evas_Object * obj) evas_object_resize(wd->edit_box, w, h + y - y_); //evas_object_resize(wd->event_box, w, h); evas_object_resize(wd->event_box, w, h + y - y_); + + EINA_LIST_FOREACH(wd->items, l, item) + { + elm_label_wrap_width_set(item->label, (int)(wd->w/check_bar_item_number(wd))-20); + elm_label_wrap_width_set(item->edit_label, (int)(wd->w/check_bar_item_number(wd))-20); + } } static void @@ -254,11 +270,15 @@ _del_hook(Evas_Object * obj) if(item == wd->more_item) if(item->view) evas_object_del(item->view); - eina_stringshare_del(item->label); + eina_stringshare_del(item->text); if (item->icon) evas_object_del(item->icon); if (item->base) evas_object_del(item->base); + if (item->base_item) + evas_object_del(item->base_item); + if (item->edit) + evas_object_del(item->edit); if (item->edit_item) evas_object_del(item->edit_item); free(item); @@ -301,6 +321,11 @@ _del_hook(Evas_Object * obj) evas_object_del(wd->event_box); wd->event_box = NULL; } + if (wd->xa) + { + elm_xml_animator_del(wd->xa); + wd->xa = NULL; + } if (wd->effect_timer) { ecore_timer_del(wd->effect_timer); @@ -334,31 +359,31 @@ _theme_hook(Evas_Object * obj) { if (item->style != OBJECT) { - elm_layout_theme_set(item->base, "controlbar", "item", + elm_layout_theme_set(item->base, "controlbar", "item_bg", elm_widget_style_get(obj)); - object_color_set(item->base, "elm.item.default.color", "elm.swallow.icon"); - elm_layout_theme_set(item->edit_item, "controlbar", "item", + //object_color_set(item->base, "elm.item.default.color", "elm.swallow.icon"); + elm_layout_theme_set(item->edit, "controlbar", "item_bg", elm_widget_style_get(obj)); if (!item->editable) { color = (Evas_Object *) - edje_object_part_object_get(_EDJ(item->edit_item), + edje_object_part_object_get(_EDJ(item->edit), "elm.item.uneditable.color"); if (color) evas_object_color_get(color, &r, &g, &b, &a); evas_object_color_set(item->edit_item, r, g, b, a); } - if (item->label) - { - edje_object_part_text_set(_EDJ(item->base), "elm.text", - item->label); - edje_object_part_text_set(_EDJ(item->edit_item), "elm.text", - item->label); - } + //if (item->label) + //{ + //edje_object_part_text_set(_EDJ(item->base), "elm.text", + // item->label); + //edje_object_part_text_set(_EDJ(item->edit_item), "elm.text", + // item->label); + //} if (item->label && item->icon) { - edje_object_signal_emit(_EDJ(item->base), + edje_object_signal_emit(_EDJ(item->base_item), "elm,state,icon_text", "elm"); edje_object_signal_emit(_EDJ(item->edit_item), "elm,state,icon_text", "elm"); @@ -704,6 +729,12 @@ move_object_with_animation(Evas_Object * obj, Evas_Coord x, Evas_Coord y, ad->timer = ecore_animator_add(mv_func, ad); } +static void +end_item_animation_effect(void *data, Evas_Object *obj) +{ + Widget_Data *wd = (Widget_Data *)data; + elm_xml_animator_object_del(wd->xa, obj); +} static Eina_Bool item_animation_effect(void *data) @@ -712,33 +743,44 @@ item_animation_effect(void *data) const Eina_List *l; Elm_Controlbar_Item * item; int rand; + Eina_Bool check; + + if(!wd->xa){ + wd->xa = elm_xml_animator_add(wd->object); + elm_xml_animator_file_set(wd->xa, "/usr/share/xmls/elementary.xml"); + } srand(time(NULL)); EINA_LIST_FOREACH(wd->items, l, item) { rand = random()%100; -// printf("rand :: %d\n", rand); if(rand > 65 && item->order > 0) { - rand = random()%3; + rand = random()%4; switch(rand) { case 0: - edje_object_signal_emit(_EDJ(item->base), "elm,animation,pop", "elm"); - return ECORE_CALLBACK_RENEW; + check = elm_xml_animator_object_add(wd->xa, item->base_item, "test", end_item_animation_effect, wd); + break; case 1: - edje_object_signal_emit(_EDJ(item->base), "elm,animation,vibration", "elm"); - return ECORE_CALLBACK_RENEW; + elm_xml_animator_object_add(wd->xa, item->base_item, "test2", end_item_animation_effect, wd); + break; case 2: - edje_object_signal_emit(_EDJ(item->base), "elm,animation,jump", "elm"); - return ECORE_CALLBACK_RENEW; + elm_xml_animator_object_add(wd->xa, item->base_item, "test3", end_item_animation_effect, wd); + break; + case 3: + elm_xml_animator_object_add(wd->xa, item->base_item, "test4", end_item_animation_effect, wd); + break; default: - return ECORE_CALLBACK_RENEW; + break; } + break; } } + elm_xml_animator_run(wd->xa); + return ECORE_CALLBACK_RENEW; } @@ -900,7 +942,7 @@ item_exchange_in_bar(Elm_Controlbar_Item * it1, Elm_Controlbar_Item * it2) Evas_Coord x, y, w, h; Evas_Coord x_, y_, w_, h_; Widget_Data * wd = elm_widget_data_get(it1->obj); - evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h); + evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h); set_evas_map(wd->moving_obj, (wd->x + wd->w / 2), (wd->y + wd->h / 2), 0, 0); evas_object_geometry_get(it1->base, &x, &y, &w, &h); @@ -950,7 +992,7 @@ item_change_in_bar(Elm_Controlbar_Item * it) return; if (wd->moving_item == NULL) return; - evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h); + evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h); set_evas_map(wd->moving_obj, x, y, w, h); elm_table_unpack(wd->box, it->base); wd->moving_item->order = it->order; @@ -961,7 +1003,7 @@ item_change_in_bar(Elm_Controlbar_Item * it) evas_render_updates_free(evas_render_updates (evas_object_evas_get(wd->moving_item->base))); evas_object_geometry_get(it->base, &x, &y, &w, &h); - evas_object_geometry_get(it->edit_item, &x_, &y_, &w_, &h_); + evas_object_geometry_get(it->edit, &x_, &y_, &w_, &h_); wd->animating++; move_object_with_animation(it->base, x, y, w, h, x_, y_, w_, h_, 0.25, move_evas_map, item_change_animation_cb, wd); @@ -1114,7 +1156,7 @@ selected_box(Elm_Controlbar_Item * it) } it->selected = EINA_TRUE; evas_object_smart_callback_call(it->obj, "view,change,before", it); - object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); if(fit != NULL && fit != it) move_selected_box(wd, fit, it); @@ -1155,7 +1197,7 @@ selected_box(Elm_Controlbar_Item * it) }else if(it->style == TOOLBAR){ if (it->func) it->func(it->data, it->obj, it); - object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); edje_object_signal_emit(_EDJ(it->base), "elm,state,text_unselected", "elm"); } @@ -1179,18 +1221,18 @@ unpressed_box_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { if(item->selected) { - object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon"); + //object_color_set(item->base, "elm.tabbar.selected.color", "elm.swallow.icon"); edje_object_signal_emit(_EDJ(item->base), "elm,state,selected", "elm"); } else { - object_color_set(item->base, "elm.item.default.color", "elm.swallow.icon"); + //object_color_set(item->base, "elm.item.default.color", "elm.swallow.icon"); edje_object_signal_emit(_EDJ(item->base), "elm,state,unselected", "elm"); } } else if (item->style == TOOLBAR) { - object_color_set(item->base, "elm.item.default.color", "elm.swallow.icon"); + //object_color_set(item->base, "elm.item.default.color", "elm.swallow.icon"); edje_object_signal_emit(_EDJ(item->base), "elm,state,text_unselected", "elm"); } } @@ -1223,14 +1265,14 @@ pressed_box(Elm_Controlbar_Item * it) if (it->style == TABBAR) { - object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.tabbar.selected.color", "elm.swallow.icon"); edje_object_signal_emit(_EDJ(it->base), "elm,state,pressed", "elm"); } else if (it->style == TOOLBAR) { - object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.toolbar.pressed.color", "elm.swallow.icon"); edje_object_signal_emit(_EDJ(it->base), "elm,state,text_selected", "elm"); } @@ -1248,42 +1290,83 @@ pressed_box(Elm_Controlbar_Item * it) } static Evas_Object * -create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it) +create_item_label(Evas_Object *obj, Elm_Controlbar_Item * it) +{ + Widget_Data * wd = elm_widget_data_get(it->obj); + + Evas_Object *label; + label = elm_label_add(obj); + elm_object_style_set(label, "controlbar"); + elm_label_label_set(label, it->text); + elm_label_text_align_set(label, "center"); + elm_label_text_color_set(label, 255, 255, 255, 255); + elm_label_line_wrap_set(label, EINA_TRUE); + elm_label_ellipsis_set(label, EINA_TRUE); + elm_label_wrap_mode_set(label, 1); + + elm_layout_content_set(obj, "elm.text", label); + + return label; +} + +static Evas_Object * +create_item_icon(Evas_Object *obj, Elm_Controlbar_Item * it) +{ + Evas_Object *icon; + icon = elm_icon_add(obj); + if(!elm_icon_standard_set(icon, it->icon_path)) + { + elm_icon_file_set(icon, it->icon_path, NULL); + } + + evas_object_size_hint_min_set(icon, 40, 40); + evas_object_size_hint_max_set(icon, 100, 100); + evas_object_show(icon); + edje_object_part_swallow(_EDJ(obj), "elm.swallow.icon", icon); + + return icon; +} + +static Evas_Object * +create_item_layout(Evas_Object * parent, Elm_Controlbar_Item * it, Evas_Object **item, Evas_Object **label, Evas_Object **icon) { Evas_Object * obj; - Evas_Object * icon; obj = elm_layout_add(parent); if (obj == NULL) { fprintf(stderr, "Cannot load bg edj\n"); return NULL; } - elm_layout_theme_set(obj, "controlbar", "item", + elm_layout_theme_set(obj, "controlbar", "item_bg", elm_widget_style_get(it->obj)); evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL); - if (it->label) + + *item = elm_layout_add(parent); + if (*item == NULL) { - edje_object_part_text_set(_EDJ(obj), "elm.text", it->label); + fprintf(stderr, "Cannot load bg edj\n"); + return NULL; + } + elm_layout_theme_set(*item, "controlbar", "item", + elm_widget_style_get(it->obj)); + elm_layout_content_set(obj, "item", *item); + + if (it->text) + { + *label = create_item_label(*item, it); } if (it->icon_path) { - icon = elm_icon_add(obj); - if(!elm_icon_standard_set(icon, it->icon_path)) - { - elm_icon_file_set(icon, it->icon_path, NULL); - } - - evas_object_size_hint_min_set(icon, 40, 40); - evas_object_size_hint_max_set(icon, 100, 100); - evas_object_show(icon); - edje_object_part_swallow(_EDJ(obj), "elm.swallow.icon", icon); - it->icon = icon; + *icon = create_item_icon(*item, it); } - if (it->label && it->icon) + if (*label && *icon) { - edje_object_signal_emit(_EDJ(obj), "elm,state,icon_text", "elm"); + edje_object_signal_emit(_EDJ(*item), "elm,state,icon_text", "elm"); + elm_label_line_wrap_set(*label, EINA_FALSE); + elm_label_wrap_mode_set(*label, 0); } + return obj; } @@ -1304,7 +1387,7 @@ edit_item_return_cb(void *data, Evas_Object * obj) { Evas_Coord x, y, w, h; Widget_Data * wd = (Widget_Data *) data; - evas_object_geometry_get(wd->moving_item->edit_item, &x, &y, &w, &h); + evas_object_geometry_get(wd->moving_item->edit, &x, &y, &w, &h); set_evas_map(obj, x, y, 0, 0); evas_object_event_callback_del(wd->event_box, EVAS_CALLBACK_MOUSE_UP, edit_item_up_cb); @@ -1338,7 +1421,7 @@ edit_item_move_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) EINA_LIST_FOREACH(wd->items, l, item) { - if (wd->moving_item->edit_item == item->edit_item || item->style == OBJECT) + if (wd->moving_item->edit == item->edit || item->style == OBJECT) continue; evas_object_geometry_get(item->base, &x, &y, &w, &h); if (ev->cur.output.x > x && ev->cur.output.x < x + w && ev->cur.output.y > y && ev->cur.output.y < y + h @@ -1373,7 +1456,7 @@ edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) // check which change or not EINA_LIST_FOREACH(wd->items, l, item) { - if (wd->moving_item->edit_item == item->edit_item) + if (wd->moving_item->edit == item->edit) continue; if (item->order <= 0) continue; @@ -1403,7 +1486,7 @@ edit_item_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { // return moving object to original location - evas_object_geometry_get(wd->moving_item->edit_item, &x_, &y_, &w_, + evas_object_geometry_get(wd->moving_item->edit, &x_, &y_, &w_, &h_); evas_object_geometry_get(wd->moving_obj, &x, &y, &w, &h); w *= 2.0; @@ -1436,7 +1519,7 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, return; EINA_LIST_FOREACH(wd->items, l, item) { - if (item->edit_item == obj) + if (item->edit == obj) break; } if (item == NULL) @@ -1450,7 +1533,7 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, wd->moving_item = item; color = (Evas_Object *) - edje_object_part_object_get(_EDJ(wd->moving_item->edit_item), + edje_object_part_object_get(_EDJ(wd->moving_item->edit), "elm.item.uneditable.color"); if (color) evas_object_color_get(color, &r, &g, &b, &a); @@ -1458,7 +1541,7 @@ edit_item_down_cb(void *data, Evas * evas, Evas_Object * obj, if (wd->moving_obj) evas_object_del(wd->moving_obj); wd->moving_obj = NULL; - wd->moving_obj = create_item_layout(obj, item); + wd->moving_obj = create_item_layout(obj, item, &(item->base_item), &(item->label), &(item->icon)); evas_object_geometry_get(obj, &x, &y, &w, &h); evas_object_move(wd->moving_obj, -1000, -1000); evas_object_resize(wd->moving_obj, w, h); @@ -1643,7 +1726,7 @@ create_tab_item(Evas_Object * obj, const char *icon_path, const char *label, if (it == NULL) return NULL; it->obj = obj; - it->label = eina_stringshare_add(label); + it->text = eina_stringshare_add(label); it->icon_path = icon_path; it->selected = EINA_FALSE; it->editable = EINA_TRUE; @@ -1651,17 +1734,15 @@ create_tab_item(Evas_Object * obj, const char *icon_path, const char *label, it->sel = 1; it->view = view; it->style = TABBAR; - it->base = create_item_layout(wd->edje, it); + it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon)); evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); - //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm", - // clicked_box_cb, wd); - object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); evas_object_show(it->base); - it->edit_item = create_item_layout(wd->edje, it); - evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN, + it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon)); + evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, edit_item_down_cb, wd); - evas_object_show(it->edit_item); + evas_object_show(it->edit); return it; } @@ -1688,7 +1769,7 @@ create_tool_item(Evas_Object * obj, const char *icon_path, const char *label, if (it == NULL) return NULL; it->obj = obj; - it->label = eina_stringshare_add(label); + it->text = eina_stringshare_add(label); it->icon_path = icon_path; it->selected = EINA_FALSE; it->editable = EINA_TRUE; @@ -1697,17 +1778,17 @@ create_tool_item(Evas_Object * obj, const char *icon_path, const char *label, it->func = func; it->data = data; it->style = TOOLBAR; - it->base = create_item_layout(wd->edje, it); + it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon)); evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); //edje_object_signal_callback_add(_EDJ(it->base), "elm,action,click", "elm", // clicked_box_cb, wd); - object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); evas_object_show(it->base); - it->edit_item = create_item_layout(wd->edje, it); - evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN, + it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon)); + evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, edit_item_down_cb, wd); - evas_object_show(it->edit_item); + evas_object_show(it->edit); return it; } @@ -1777,16 +1858,14 @@ set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it, if (check) { if(item->order > 0){ -// printf("%s +_+_+_+_+_+ %d \n", item->label, item->order); elm_table_unpack(wd->box, item->base); item->order += it->sel; elm_table_pack(wd->box, item->base, item->order - 1, 0, item->sel, 1); } if (item->style != OBJECT && it->style != OBJECT) { -// printf("%s +_+_+_+_+_+ edit :: %d\n", item->label, i); - elm_table_unpack(wd->edit_table, item->edit_item); - elm_table_pack(wd->edit_table, item->edit_item, + elm_table_unpack(wd->edit_table, item->edit); + elm_table_pack(wd->edit_table, item->edit, i % EDIT_ROW_NUM, i / EDIT_ROW_NUM, 1, 1); } } @@ -1806,7 +1885,7 @@ set_items_position(Evas_Object * obj, Elm_Controlbar_Item * it, if(bar) elm_table_pack(wd->box, it->base, it->order - 1, 0, it->sel, 1); else evas_object_hide(it->base); if (it->style != OBJECT) - elm_table_pack(wd->edit_table, it->edit_item, (edit - 1) % EDIT_ROW_NUM, + elm_table_pack(wd->edit_table, it->edit, (edit - 1) % EDIT_ROW_NUM, (edit - 1) / EDIT_ROW_NUM, 1, 1); } @@ -1860,7 +1939,7 @@ create_more_view(Widget_Data *wd) if(item->order <= 0) { evas_object_color_set(item->icon, 0, 0, 0, 255); - elm_list_item_append(list, item->label, item->icon, NULL, list_clicked, item); + elm_list_item_append(list, item->text, item->icon, NULL, list_clicked, item); } } @@ -1878,22 +1957,22 @@ create_more_item(Widget_Data *wd, int style) if (it == NULL) return NULL; it->obj = wd->object; - it->label = eina_stringshare_add("more"); + it->text = eina_stringshare_add("more"); it->icon_path = CONTROLBAR_SYSTEM_ICON_MORE; it->selected = EINA_FALSE; it->badge = 0; it->sel = 1; it->view = create_more_view(wd); it->style = style; - it->base = create_item_layout(wd->edje, it); + it->base = create_item_layout(wd->edje, it, &(it->base_item), &(it->label), &(it->icon)); evas_object_event_callback_add(it->base, EVAS_CALLBACK_MOUSE_DOWN, bar_item_down_cb, wd); - object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); + //object_color_set(it->base, "elm.item.default.color", "elm.swallow.icon"); evas_object_show(it->base); - it->edit_item = create_item_layout(wd->edje, it); - evas_object_event_callback_add(it->edit_item, EVAS_CALLBACK_MOUSE_DOWN, + it->edit = create_item_layout(wd->edje, it, &(it->edit_item), &(it->edit_label), &(it->edit_icon)); + evas_object_event_callback_add(it->edit, EVAS_CALLBACK_MOUSE_DOWN, edit_item_down_cb, wd); - evas_object_show(it->edit_item); + evas_object_show(it->edit); set_items_position(it->obj, it, NULL, EINA_TRUE); @@ -2020,7 +2099,7 @@ create_more_item(Widget_Data *wd, int style) evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _controlbar_object_resize, obj); wd->selected_box = edje_object_add(wd->evas); - _elm_theme_object_set(obj, wd->selected_box, "controlbar", "item_bg", "default"); + _elm_theme_object_set(obj, wd->selected_box, "controlbar", "item_bg_move", "default"); //edje_object_part_swallow(wd->edje, "elm.swallow.panel", wd->selected_box); evas_object_hide(wd->selected_box); @@ -2037,7 +2116,7 @@ create_more_item(Widget_Data *wd, int style) evas_object_color_set(wd->event_box, 255, 255, 255, 0); evas_object_repeat_events_set(wd->event_box, EINA_TRUE); evas_object_show(wd->event_box); - + //FIXME // evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); evas_object_smart_member_add(wd->view, obj); @@ -2093,6 +2172,7 @@ create_more_item(Widget_Data *wd, int style) elm_controlbar_item_view_set(wd->more_item, create_more_view(wd)); if (wd->num == 1) selected_box(it); + _sizing_eval(obj); return it; } @@ -2626,8 +2706,10 @@ elm_controlbar_item_del(Elm_Controlbar_Item * it) } // delete item in list - if (it->label) - eina_stringshare_del(it->label); + if (it->text) + eina_stringshare_del(it->text); + if (it->label) + evas_object_del(it->label); if (it->icon) evas_object_del(it->icon); if (it->base) @@ -2696,7 +2778,7 @@ elm_controlbar_item_select(Elm_Controlbar_Item * it) EAPI const char * elm_controlbar_item_label_get(Elm_Controlbar_Item * it) { - return it->label; + return it->text; } /** @@ -2710,19 +2792,20 @@ elm_controlbar_item_label_get(Elm_Controlbar_Item * it) EAPI void elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) { - char *state; if (!it->base) return; - it->label = eina_stringshare_add(label); - edje_object_part_text_set(_EDJ(it->base), "elm.text", it->label); + it->text = eina_stringshare_add(label); + create_item_label(it->base, it); + create_item_label(it->edit_item, it); if(it->icon){ edje_object_signal_emit(_EDJ(it->base), "elm,state,icon_text", "elm"); + elm_label_line_wrap_set(it->label, EINA_FALSE); } } /** - * Get the selected item. + * Get the selected item * * @param obj The controlbar object * @return The item of controlbar @@ -2749,7 +2832,7 @@ elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) } /** - * Get the first item. + * Get the first item * * @param obj The controlbar object * @return The item of controlbar @@ -2767,7 +2850,7 @@ elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) } /** - * Get the last item. + * Get the last item * * @param obj The controlbar object * @return The item of controlbar @@ -2785,7 +2868,7 @@ elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) } /** - * Get the items. + * Get the items * * @param obj The controlbar object * @return The list of the items @@ -2803,7 +2886,7 @@ elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) } /** - * Get the previous item. + * Get the previous item * * @param it The item of controlbar * @return The previous item of the parameter item @@ -2835,7 +2918,7 @@ elm_controlbar_item_label_set(Elm_Controlbar_Item * it, const char *label) } /** - * Get the next item. + * Get the next item * * @param obj The controlbar object * @return The next item of the parameter item @@ -2901,7 +2984,7 @@ elm_controlbar_edit_start(Evas_Object * obj) } /** - * Set item in bar + * Set the visible status of item in bar * * @param it The item of controlbar * @param bar true or false @@ -2940,7 +3023,7 @@ elm_controlbar_item_visible_set(Elm_Controlbar_Item * it, Eina_Bool visible) /** - * Get the result which or not item is in bar + * Get the result which or not item is visible in bar * * @param it The item of controlbar * @return true or false @@ -2962,14 +3045,6 @@ elm_controlbar_item_visible_get(Elm_Controlbar_Item * it) return EINA_TRUE; } -/** - * Set item editable - * - * @param it The item of controlbar - * @param bar true or false - * - * @ingroup Controlbar - */ EAPI void elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable) { @@ -2992,7 +3067,7 @@ elm_controlbar_item_editable_set(Elm_Controlbar_Item * it, Eina_Bool editable) } /** - * Set item editable + * Set item disable * * @param it The item of controlbar * @param bar true or false @@ -3015,25 +3090,17 @@ elm_controlbar_item_disable_set(Elm_Controlbar_Item * it, Eina_Bool disable) "elm.item.disable.color"); if (color) evas_object_color_get(color, &r, &g, &b, &a); - evas_object_color_set(it->base, r, g, b, a); + evas_object_color_set(it->base_item, r, g, b, a); }else{ color = (Evas_Object *) edje_object_part_object_get(_EDJ(it->edit_item), "elm.item.default.color"); if (color) evas_object_color_get(color, &r, &g, &b, &a); - evas_object_color_set(it->base, r, g, b, a); + evas_object_color_set(it->base_item, r, g, b, a); } } -/** - * Set the default view(Don't use this API) - * - * @param obj The controlbar object - * @param view The default view - * - * @ingroup Controlbar - */ EAPI void elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view) { @@ -3073,7 +3140,9 @@ elm_controlbar_view_set(Evas_Object * obj, Evas_Object * view) EAPI void elm_controlbar_item_view_set(Elm_Controlbar_Item *it, Evas_Object * view) { - it->view = view; + if(!it) return; + + it->view = view; } /** @@ -3184,11 +3253,15 @@ elm_controlbar_item_auto_align_set(Evas_Object *obj, Eina_Bool auto_align) if(wd->more_item->view) evas_object_del(wd->more_item->view); wd->items = eina_list_remove(wd->items, wd->more_item); - eina_stringshare_del(wd->more_item->label); + eina_stringshare_del(wd->more_item->text); if (wd->more_item->icon) evas_object_del(wd->more_item->icon); if (wd->more_item->base) evas_object_del(wd->more_item->base); + if (wd->more_item->base_item) + evas_object_del(wd->more_item->base_item); + if (wd->more_item->edit) + evas_object_del(wd->more_item->edit); if (wd->more_item->edit_item) evas_object_del(wd->more_item->edit_item); free(wd->more_item); @@ -3230,16 +3303,6 @@ init_animation(void *data) return ECORE_CALLBACK_CANCEL; } - -/** - * Set the animation of the controlbar(Don't use this API) - * - * @param obj The object of the controlbar - * @param func The function for start animation - * @param data The data for function - * - * @ingroup Controlbar - */ EAPI void elm_controlbar_animation_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data) { @@ -3275,15 +3338,6 @@ elm_controlbar_animation_set(Evas_Object *obj, void (*func) (void *data, Evas_Ob // } } -/** - * Set the animation of the controlbar(Don't use this API) - * - * @param obj The object of the controlbar - * @param auto_animation The dicision that items move automatically - * @param selected_animation The dicision that the selected item move automatically - * - * @ingroup Controlbar - */ EAPI void elm_controlbar_item_animation_set(Evas_Object *obj, Eina_Bool auto_animation, Eina_Bool selected_animation) { @@ -3310,7 +3364,7 @@ elm_controlbar_item_animation_set(Evas_Object *obj, Eina_Bool auto_animation, Ei if(auto_animation && !wd->effect_timer) { - wd->effect_timer = ecore_timer_add(1, item_animation_effect, wd); + wd->effect_timer = ecore_timer_add(1.5, item_animation_effect, wd); } else { diff --git a/src/lib/elm_tickernoti.c b/src/lib/elm_tickernoti.c index 7e485b1..350cdb4 100644 --- a/src/lib/elm_tickernoti.c +++ b/src/lib/elm_tickernoti.c @@ -345,7 +345,7 @@ elm_tickernoti_label_get (const Evas_Object *obj) } /** - * Set the label on the tickernoti object + * Set the detail label on the tickernoti object * * @param obj The tickernoti object * @param label The label will be used on the tickernoti object @@ -365,7 +365,7 @@ elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label) } /** - * Get the label used on the tickernoti object + * Get the detail label used on the tickernoti object * * @param obj The tickernotil object * @return The string inside the label @@ -415,7 +415,7 @@ elm_tickernoti_detailview_button_get (const Evas_Object *obj) } /** - * Set the icon object used on the tickernoti object + * Set the detail icon object used on the tickernoti object * * @param obj The tickernotil object * @param icon The icon object will be used on the tickernoti object @@ -433,7 +433,7 @@ elm_tickernoti_detailview_icon_set (const Evas_Object *obj, Evas_Object *icon) } /** - * Get the icon object used on the tickernoti object + * Get the detail icon object used on the tickernoti object * * @param obj The tickernotil object * @return The icon object inside the tickernoti diff --git a/src/lib/elm_xml_animator.c b/src/lib/elm_xml_animator.c new file mode 100644 index 0000000..920b714 --- /dev/null +++ b/src/lib/elm_xml_animator.c @@ -0,0 +1,1125 @@ +#include + + + +#include +#include +#include +#include + +#define ELM_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2)) + + +struct _Elm_Xml_Animator +{ + Evas_Object *parent; + Eina_List *object_list; + Eina_List *animation_list; +}; + +typedef struct _Animation_List Animation_List; + +struct _Animation_List +{ + char *animation_title; + Eina_List *scene_list; +}; + +typedef struct _Object_List Object_List; + +struct _Object_List +{ + Evas_Object *object; + Animation_List *animation_list; + Eina_Bool remove_me; + void (*end_func) (void *data, Evas_Object *obj); + void *data; +}; + +typedef enum _Standard_Type +{ + STANDARD_TYPE_OBJECT, + STANDARD_TYPE_SCREEN, + STANDARD_TYPE_CURRENT +}Standard_Type; + +typedef enum _Change_Type +{ + CHANGE_TYPE_LINEAR, + CHANGE_TYPE_ACCELERATE, + CHANGE_TYPE_DECELERATE, + CHANGE_TYPE_RETURN +}Change_Type; + +typedef enum _Attribute_Type +{ + ATTRIBUTE_TYPE_RELATIVE, + ATTRIBUTE_TYPE_ABSOLUTE, +}Attribute_Type; + +typedef struct _Location_Data Location_Data; + +struct _Location_Data +{ + Standard_Type standard; + Standard_Type standard_from; + Standard_Type standard_to; + Evas_Coord from; + Evas_Coord to; + Evas_Coord current; + Change_Type type; +}; + +typedef struct _Rotation_Data Rotation_Data; + +struct _Rotation_Data +{ + double from; + double to; + Change_Type type; +}; + +typedef struct _Color_Data Color_Data; + +struct _Color_Data +{ + int from; + int to; + Change_Type type; +}; + +typedef struct _Animation_Data Animation_Data; + +struct _Animation_Data +{ + Evas_Object * obj; + char * scene_title; + + Location_Data *CoordX; + Location_Data *CoordY; + Location_Data *CoordW; + Location_Data *CoordH; + + Rotation_Data *AngleX; + Rotation_Data *AngleY; + Rotation_Data *AngleZ; + double Center_x; + double Center_y; + double Center_z; + Attribute_Type Center_type; + + Color_Data *Red; + Color_Data *Green; + Color_Data *Blue; + Color_Data *Alpha; + + double start; + double end; + double duration; + + unsigned int start_time; + Eina_Bool (*mv_func) (void *data); + void (*end_func) (void *data, Evas_Object * obj); + void *data; + Ecore_Animator * timer; +}; + + +static void move_continue(void *data, Evas_Object *obj); + +static unsigned int +current_time_get() +{ + struct timeval timev; + + gettimeofday(&timev, NULL); + return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000)); +} + +static void +set_evas_map_3d(Evas_Object * obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, + Evas_Coord h, double dx, double dy, double dz, Evas_Coord cx, Evas_Coord cy, Evas_Coord cz) +{ + if (obj == NULL) + { + return; + } + Evas_Map * map = evas_map_new(4); + if (map == NULL) + return; +// printf("map >> x : %d y : %d w : %d h : %d\n", x, y, w, h); + evas_map_smooth_set(map, EINA_TRUE); + evas_map_util_points_populate_from_object_full(map, obj, 0); + evas_object_map_enable_set(obj, EINA_TRUE); + evas_map_util_3d_perspective(map, x + w / 2, y + h / 2, 0, w * 10); + evas_map_util_points_populate_from_geometry(map, x, y, w, h, 0); + evas_map_util_3d_rotate(map, dx, dy, dz, cx, cy, cz); + evas_object_map_set(obj, map); + evas_map_free(map); +} + +static int +get_value_by_type(Change_Type type, double amount, int dx) +{ + switch(type) + { + case CHANGE_TYPE_LINEAR: + return amount * dx; + case CHANGE_TYPE_ACCELERATE: + return pow(amount, 2) * dx; + case CHANGE_TYPE_DECELERATE: + return (1 * sin(pow(amount, 1) * (M_PI / 2)) * dx); + case CHANGE_TYPE_RETURN: + return (1 * sin(2 * pow(amount, 1) * (M_PI / 2)) * dx); + default: + return amount * dx; + } +} + +static int +get_value_by_standard(Standard_Type type, int object_value, int current, int degree) +{ +// printf("%d %d %d %d\n", type, object_value, current, degree); + switch(type) + { + case STANDARD_TYPE_SCREEN: + return degree; + case STANDARD_TYPE_OBJECT: + return object_value + degree; + case STANDARD_TYPE_CURRENT: + return current + degree; + default: + return degree; + } +} + + +static void +get_value_by_attribute(Attribute_Type type, Evas_Object *obj, double x, double y, double z, int *cx, int *cy, int *cz) +{ + Evas_Coord w, h; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + + switch(type) + { + case ATTRIBUTE_TYPE_RELATIVE: + *cx = (int)((double)w * x); + *cy = (int)((double)h * y); + *cz = (int)z; + return; + case ATTRIBUTE_TYPE_ABSOLUTE: + *cx = (int)x; + *cy = (int)y; + *cz = (int)z; + return; + default: + *cx = (int)((double)w * x); + *cy = (int)((double)h * y); + *cz = (int)z; + return; + } +} + +static Eina_Bool +set_evas_map_disable(void *data) +{ + Evas_Object *obj = (Evas_Object *)data; + evas_object_map_enable_set(obj, EINA_FALSE); + evas_render_updates(obj); + + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +move_evas_map(void *data) +{ + Animation_Data *next_ad; + Evas_Coord tx, ty, tw, th; + double t; + double amount; + + int dx, dy, dw, dh; + int sfx, sfy, sfw, sfh; + int stx, sty, stw, sth; + double dax, day, daz; + + int px, py, pw, ph; + double pax, pay, paz; + + int x, y, w, h; + double ax, ay, az; + + int cx, cy, cz; + + Animation_Data * ad = (Animation_Data *) data; + t = ELM_MAX(0.0, current_time_get() - ad->start_time) / 1000; + + evas_object_geometry_get(ad->obj, &tx, &ty, &tw, &th); + + // sfx = ad->CoordX->from; + // sfy = ad->CoordY->from; + // sfw = ad->CoordW->from; + // sfh = ad->CoordH->from; + + sfx = get_value_by_standard(ad->CoordX->standard_from != NULL ? ad->CoordX->standard_from : ad->CoordX->standard, tx, ad->CoordX->current, ad->CoordX->from); + sfy = get_value_by_standard(ad->CoordY->standard_from != NULL ? ad->CoordY->standard_from : ad->CoordY->standard, ty, ad->CoordY->current, ad->CoordY->from); + sfw = get_value_by_standard(ad->CoordW->standard_from != NULL ? ad->CoordW->standard_from : ad->CoordW->standard, tw, ad->CoordW->current, ad->CoordW->from); + sfh = get_value_by_standard(ad->CoordH->standard_from != NULL ? ad->CoordH->standard_from : ad->CoordH->standard, th, ad->CoordH->current, ad->CoordH->from); + + stx = get_value_by_standard(ad->CoordX->standard_to != NULL ? ad->CoordX->standard_to : ad->CoordX->standard, tx, ad->CoordX->current, ad->CoordX->to); + sty = get_value_by_standard(ad->CoordY->standard_to != NULL ? ad->CoordY->standard_to : ad->CoordY->standard, ty, ad->CoordY->current, ad->CoordY->to); + stw = get_value_by_standard(ad->CoordW->standard_to != NULL ? ad->CoordW->standard_to : ad->CoordW->standard, tw, ad->CoordW->current, ad->CoordW->to); + sth = get_value_by_standard(ad->CoordH->standard_to != NULL ? ad->CoordH->standard_to : ad->CoordH->standard, th, ad->CoordH->current, ad->CoordH->to); + +// printf("%d %d %d %d :: %d %d %d %d\n", sfx, sfy, sfw, sfh, stx, sty, stw, sth); + if(t < ad->start) { + set_evas_map_3d(ad->obj, sfx, sfy, sfw, sfh, ad->AngleX->from, ad->AngleY->from, ad->AngleZ->from, ad->CoordX->from + ad->Center_x, ad->CoordY->from + ad->Center_y, ad->Center_z); + return ECORE_CALLBACK_RENEW; + } + else t -= ad->start; + + dx = stx - sfx;//ad->CoordX->to - sfx; + dy = sty - sfy;//ad->CoordY->to - sfy; + dw = stw - sfw;//ad->CoordW->to - sfw; + dh = sth - sfh;//ad->CoordH->to - sfh; + dax = ad->AngleX->to - ad->AngleX->from; + day = ad->AngleY->to - ad->AngleY->from; + daz = ad->AngleZ->to - ad->AngleZ->from; + + if (t <= ad->duration) + { + amount = t / ad->duration; + x = get_value_by_type(ad->CoordX->type, amount, dx); + y = get_value_by_type(ad->CoordY->type, amount, dy); + w = get_value_by_type(ad->CoordW->type, amount, dw); + h = get_value_by_type(ad->CoordH->type, amount, dh); + ax = get_value_by_type(ad->AngleX->type, amount, dax); + ay = get_value_by_type(ad->AngleY->type, amount, day); + az = get_value_by_type(ad->AngleZ->type, amount, daz); + } + else + { + x = dx; + y = dy; + w = dw; + h = dh; + ax = dax; + ay = day; + az = daz; + } + + // standard chek + px = sfx + x; + py = sfy + y; + pw = sfw + w; + ph = sfh + h; + pax = ad->AngleX->from + ax; + pay = ad->AngleY->from + ay; + paz = ad->AngleZ->from + az; + + get_value_by_attribute(ad->Center_type, ad->obj, ad->Center_x, ad->Center_y, ad->Center_z, &cx, &cy, &cz); + + if (x == dx && y == dy && w == dw && h == dh && ax == dax && ay == day && az == daz) + { + if(ad->timer) + { + ecore_animator_del(ad->timer); + ad->timer = NULL; + } +// printf("px : %d py : %d pw : %d ph : %d\n", px, py, pw, ph); + set_evas_map_3d(ad->obj, px, py, pw, ph, pax, pay, paz, px + cx, py + cy, cz); + + if(ad->end_func == move_continue){ + next_ad = (Animation_Data *)ad->data; + + if(next_ad != NULL){ + next_ad->CoordX->current = px; + next_ad->CoordY->current = py; + next_ad->CoordW->current = pw; + next_ad->CoordH->current = ph; + } + } + if (ad->end_func != NULL) + ad->end_func(ad->data, ad->obj); + ecore_idler_add(set_evas_map_disable, ad->obj); + + return ECORE_CALLBACK_CANCEL; + } + else + { +// Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(ad->obj)); +// evas_object_color_set(rect, 255, 255, 255, 255); +// evas_object_resize(rect, 1, 1); +// evas_object_move(rect, px, py); +// evas_object_show(rect); +// printf(" >>>> px : %d py : %d pw : %d ph : %d\n", px, py, pw, ph); + set_evas_map_3d(ad->obj, px, py, pw, ph, pax, pay, paz, px + cx, py + cy, cz); + } + return ECORE_CALLBACK_RENEW; +} + +static void +move_continue(void *data, Evas_Object *obj) +{ + Animation_Data *ad = (Animation_Data *)data; + ad->start_time = current_time_get(); + ad->timer = ecore_animator_add(ad->mv_func, ad); +} + +static void +move_object_with_animation(Eina_List *list, Evas_Object * obj, Eina_Bool (*mv_func) (void *data), + void (*func) (void *data, Evas_Object * obj), void *data) +{ + Animation_Data *ad, *prev_ad = NULL; + Eina_List *l; + ad = (Animation_Data *)eina_list_data_get(list); + + EINA_LIST_FOREACH(list, l, ad){ + ad->obj = obj; + ad->mv_func = mv_func; + if(ad->end < ad->start) return; + ad->duration = ad->end - ad->start; + if(ad == (Animation_Data *)eina_list_data_get(eina_list_last(list))){ + ad->end_func = func; + ad->data = data; + if(prev_ad != NULL) prev_ad->data = ad; + }else{ + ad->end_func = move_continue; + if(prev_ad != NULL) prev_ad->data = ad; + } + prev_ad = ad; + if(ad == (Animation_Data *)eina_list_data_get(list)){ + ad->start_time = current_time_get(); + ad->timer = ecore_animator_add(ad->mv_func, ad); + } + } +} + +static Standard_Type +get_standard_type(char *str) +{ + if(!strcmp(str, "OBJECT")) + return STANDARD_TYPE_OBJECT; + else if(!strcmp(str, "SCREEN")) + return STANDARD_TYPE_SCREEN; + else if(!strcmp(str, "CURRENT")) + return STANDARD_TYPE_CURRENT; + + return STANDARD_TYPE_SCREEN; +} + +static Change_Type +get_change_type(char *str) +{ + if(!strcmp(str, "LINEAR")) + return CHANGE_TYPE_LINEAR; + else if(!strcmp(str, "ACCELERATE")) + return CHANGE_TYPE_ACCELERATE; + else if(!strcmp(str, "DECELERATE")) + return CHANGE_TYPE_DECELERATE; + else if(!strcmp(str, "RETURN")) + return CHANGE_TYPE_RETURN; + + return CHANGE_TYPE_LINEAR; +} + +static Attribute_Type +get_attribute_type(char *str) +{ + if(!strcmp(str, "RELATIVE")) + return ATTRIBUTE_TYPE_RELATIVE; + else if(!strcmp(str, "ABSOLUTE")) + return ATTRIBUTE_TYPE_ABSOLUTE; + + return ATTRIBUTE_TYPE_RELATIVE; +} + +static Eina_List * +save_animation_data(Eina_List *list, xmlDocPtr doc, xmlNodePtr cur) +{ + Animation_List *al = NULL; + Animation_Data *ad = NULL; + xmlAttrPtr pAttr; + char *tmp; + + while(cur != NULL){ + if (cur->type == XML_ELEMENT_NODE) { + + if(!strcmp((char *)cur->name, "AML")){ + list = save_animation_data(list, doc, cur->xmlChildrenNode); + }else{ + + if(!strcmp((char *)cur->name, "Animation")){ + + al = (Animation_List *) calloc(1, sizeof(Animation_List)); + + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "title")){ + al->animation_title = strdup((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", pAttr->name, ad->scene_title); + } + pAttr=pAttr->next; + } + } + + list = eina_list_append(list, al); + } + else{ + if(list != NULL) + al = (Animation_List *)eina_list_data_get(eina_list_last(list)); + } + + if(!strcmp((char *)cur->name, "Scene")){ + + ad = (Animation_Data *) calloc(1, sizeof(Animation_Data)); + ad->CoordX = (Location_Data *) calloc(1, sizeof(Location_Data)); + ad->CoordY = (Location_Data *) calloc(1, sizeof(Location_Data)); + ad->CoordW = (Location_Data *) calloc(1, sizeof(Location_Data)); + ad->CoordH = (Location_Data *) calloc(1, sizeof(Location_Data)); + ad->AngleX = (Rotation_Data *) calloc(1, sizeof(Rotation_Data)); + ad->AngleY = (Rotation_Data *) calloc(1, sizeof(Rotation_Data)); + ad->AngleZ = (Rotation_Data *) calloc(1, sizeof(Rotation_Data)); + ad->Red = (Color_Data *) calloc(1, sizeof(Color_Data)); + ad->Green = (Color_Data *) calloc(1, sizeof(Color_Data)); + ad->Blue = (Color_Data *) calloc(1, sizeof(Color_Data)); + ad->Alpha = (Color_Data *) calloc(1, sizeof(Color_Data)); + + al->scene_list = eina_list_append(al->scene_list, ad); + + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "title")){ + ad->scene_title = strdup((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", pAttr->name, ad->scene_title); + } + pAttr=pAttr->next; + } + } + } + else{ + ad = (Animation_Data *)eina_list_data_get(eina_list_last(al->scene_list)); + } + + if(!strcmp((char *)cur->name, "Time")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "start")){ + tmp = strdup((char *)pAttr->children->content); + ad->start = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", pAttr->name, ad->start); + } + if(!strcmp((char *)pAttr->name, "end")){ + tmp = strdup((char *)pAttr->children->content); + ad->end = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", pAttr->name, ad->end); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "CoordX")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "standard")){ + ad->CoordX->standard = get_standard_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", pAttr->name, ad->CoordX->standard); + } + if(!strcmp((char *)pAttr->name, "standard_from")){ + ad->CoordX->standard_from = get_standard_type((char *)pAttr->children->content); + } + if(!strcmp((char *)pAttr->name, "standard_to")){ + ad->CoordX->standard_to = get_standard_type((char *)pAttr->children->content); + } + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordX->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", pAttr->name, ad->CoordX->from); + } + if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordX->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", pAttr->name, ad->CoordX->to); + } + if(!strcmp((char *)pAttr->name, "type")){ + ad->CoordX->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", pAttr->name, (char *)pAttr->children->content); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "CoordY")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "standard")){ + ad->CoordY->standard = get_standard_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", pAttr->name, ad->CoordY->standard); + } + if(!strcmp((char *)pAttr->name, "standard_from")){ + ad->CoordY->standard_from = get_standard_type((char *)pAttr->children->content); + } + if(!strcmp((char *)pAttr->name, "standard_to")){ + ad->CoordY->standard_to = get_standard_type((char *)pAttr->children->content); + } + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordY->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", pAttr->name, ad->CoordY->from); + } + if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordY->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", pAttr->name, ad->CoordY->to); + } + if(!strcmp((char *)pAttr->name, "type")){ + ad->CoordY->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", pAttr->name, ad->CoordY->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "CoordW")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "standard")){ + ad->CoordW->standard = get_standard_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->CoordW->standard); + } + if(!strcmp((char *)pAttr->name, "standard_from")){ + ad->CoordW->standard_from = get_standard_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->CoordW->standard); + } + if(!strcmp((char *)pAttr->name, "standard_to")){ + ad->CoordW->standard_to = get_standard_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->CoordW->standard); + } + else if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordW->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->CoordW->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordW->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->CoordW->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->CoordW->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->CoordW->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "CoordH")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "standard")){ + ad->CoordH->standard = get_standard_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->CoordH->standard); + } + if(!strcmp((char *)pAttr->name, "standard_from")){ + ad->CoordH->standard_from = get_standard_type((char *)pAttr->children->content); + } + if(!strcmp((char *)pAttr->name, "standard_to")){ + ad->CoordH->standard_to = get_standard_type((char *)pAttr->children->content); + } + else if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordH->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->CoordH->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->CoordH->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->CoordH->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->CoordH->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->CoordH->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "AngleX")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->AngleX->from = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", (char *)pAttr->name, ad->AngleX->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->AngleX->to = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", (char *)pAttr->name, ad->AngleX->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->AngleX->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->AngleX->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "AngleY")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->AngleY->from = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", (char *)pAttr->name, ad->AngleY->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->AngleY->to = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", (char *)pAttr->name, ad->AngleY->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->AngleY->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->AngleY->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "AngleZ")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->AngleZ->from = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", (char *)pAttr->name, ad->AngleZ->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->AngleZ->to = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.1f\"\n", (char *)pAttr->name, ad->AngleZ->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->AngleZ->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->AngleZ->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "Center")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "x")){ + tmp = strdup((char *)pAttr->children->content); + ad->Center_x = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.2f\"\n", (char *)pAttr->name, ad->Center_x); + } + else if(!strcmp((char *)pAttr->name, "y")){ + tmp = strdup((char *)pAttr->children->content); + ad->Center_y = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.2f\"\n", (char *)pAttr->name, ad->Center_y); + } + else if(!strcmp((char *)pAttr->name, "z")){ + tmp = strdup((char *)pAttr->children->content); + ad->Center_z = atof(tmp); + free(tmp); + //printf("--------- %s=\"%2.2f\"\n", (char *)pAttr->name, ad->Center_z); + } + else if(!strcmp((char *)pAttr->name, "attribute")){ + ad->Center_type = get_attribute_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->Red->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "Red")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->Red->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Red->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->Red->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Red->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->Red->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->Red->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "Green")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->Green->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Green->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->Green->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Green->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->Green->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->Green->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "Blue")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->Blue->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Blue->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->Blue->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Blue->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->Blue->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->Blue->type); + } + pAttr=pAttr->next; + } + } + } + else if(!strcmp((char *)cur->name, "Alpha")){ + if ( cur->properties != NULL) { + pAttr = (xmlAttrPtr)cur->properties; + while (pAttr != NULL) { + if(!strcmp((char *)pAttr->name, "from")){ + tmp = strdup((char *)pAttr->children->content); + ad->Alpha->from = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Alpha->from); + } + else if(!strcmp((char *)pAttr->name, "to")){ + tmp = strdup((char *)pAttr->children->content); + ad->Alpha->to = atoi(tmp); + free(tmp); + //printf("--------- %s=\"%d\"\n", (char *)pAttr->name, ad->Alpha->to); + } + else if(!strcmp((char *)pAttr->name, "type")){ + ad->Alpha->type = get_change_type((char *)pAttr->children->content); + //printf("--------- %s=\"%s\"\n", (char *)pAttr->name, ad->Alpha->type); + } + pAttr=pAttr->next; + } + } + } + list = save_animation_data(list, doc, cur->xmlChildrenNode); + } + } + cur = cur->next; + } + + return list; +} + +static Eina_List * +read_data_from_xml(Eina_List *list, const char *xmlFile) +{ + xmlDocPtr doc = NULL; + xmlNodePtr root = NULL; + + doc = xmlReadFile(xmlFile, NULL, 0); + + if (doc == NULL) { + printf("error: could not parse file %s\n", xmlFile); + return NULL; + } + + /*Get the root element node */ + root = xmlDocGetRootElement(doc); + + list = save_animation_data(list, doc, root); + + /*free the document */ + xmlFreeDoc(doc); + + xmlCleanupParser(); + + return list; +} + + +/** + * Add new xml_animator. + * + * @param parent Parent object + * @return xml_animator + * + * @ingroup Xml_Animator + */ +EAPI Elm_Xml_Animator * +elm_xml_animator_add(Evas_Object *parent) +{ + Elm_Xml_Animator *xa; + xa = (Elm_Xml_Animator *)calloc(1, sizeof(Elm_Xml_Animator)); + + xa->parent = parent; + +// Animation_Data *ad_; + // ad_ = (Animation_Data *)eina_list_data_get(list); + + //move_object_with_animation(list, icon, move_evas_map, NULL, NULL); + + return xa; +} + +/** + * Read xml file. + * + * @param xa xml_animator data + * @param file xml file name + * @return true or false + * + * @ingroup Xml_Animator + */ +EAPI Eina_Bool +elm_xml_animator_file_set(Elm_Xml_Animator *xa, const char *file) +{ + xa->animation_list = read_data_from_xml(xa->animation_list, file); + if(xa->animation_list == NULL) + return EINA_FALSE; + + return EINA_TRUE; +} + +/** + * Link object with animation. + * + * @param xa xml_animator data + * @param obj The object for animation + * @param title the name of animation + * @return true or false + * + * @ingroup Xml_Animator + */ +EAPI Eina_Bool +elm_xml_animator_object_add(Elm_Xml_Animator *xa, Evas_Object *obj, const char *title, void (*end_func)(void *data, Evas_Object *obj), void *data) +{ + Animation_List *al; + const Eina_List *l; + Eina_Bool check = EINA_FALSE; + + if (!xa) return EINA_FALSE; + + Object_List *ol = (Object_List *)calloc(1, sizeof(Object_List)); + + ol->object = obj; + ol->end_func = end_func; + ol->data = data; + ol->remove_me = EINA_FALSE; + + EINA_LIST_FOREACH(xa->animation_list, l, al){ + if(!strcmp(al->animation_title, title)){ + ol->animation_list = al; + check = EINA_TRUE; + } + } + + if(check) + { + xa->object_list = eina_list_append(xa->object_list, ol); + } + else + { + free(ol); + ol = NULL; + } + return check; +} + +static Eina_Bool +object_delete(void *data) +{ + const Eina_List *l; + Object_List *ol; + Elm_Xml_Animator *xa = (Elm_Xml_Animator *)data; + + EINA_LIST_FOREACH(xa->object_list, l, ol){ + if(ol->remove_me){ + xa->object_list = eina_list_remove(xa->object_list, ol); + free(ol); + } + } + + return ECORE_CALLBACK_CANCEL; +} + +/** + * Delete the link of the object. + * + * @param xa xml_animator data + * @param obj The object for animation + * + * @ingroup Xml_Animator + */ +EAPI void +elm_xml_animator_object_del(Elm_Xml_Animator *xa, Evas_Object *obj) +{ + const Eina_List *l; + Object_List *ol; + + EINA_LIST_FOREACH(xa->object_list, l, ol){ + if(ol->object == obj){ + ol->remove_me = EINA_TRUE; + } + } + ecore_idler_add(object_delete, xa); +} + +/** + * Delete animation. + * + * @param xa xml_animator data + * + * @ingroup Xml_Animator + */ +EAPI void +elm_xml_animator_del(Elm_Xml_Animator *xa) +{ + Object_List *ol; + Animation_List *al; + Animation_Data *ad; + const Eina_List *l, *ll; + + EINA_LIST_FOREACH(xa->object_list, l, ol){ + xa->object_list = eina_list_remove(xa->object_list, ol); + free(ol); + ol = NULL; + } + + EINA_LIST_FOREACH(xa->animation_list, l, al){ + EINA_LIST_FOREACH(al->scene_list, ll, ad){ + if(ad->CoordX){ + free(ad->CoordX); + ad->CoordX = NULL; + } + if(ad->CoordY){ + free(ad->CoordY); + ad->CoordY = NULL; + } + if(ad->CoordW){ + free(ad->CoordW); + ad->CoordW = NULL; + } + if(ad->CoordH){ + free(ad->CoordH); + ad->CoordH = NULL; + } + if(ad->AngleX){ + free(ad->AngleX); + ad->AngleX = NULL; + } + if(ad->AngleY){ + free(ad->AngleY); + ad->AngleY = NULL; + } + if(ad->AngleZ){ + free(ad->AngleZ); + ad->AngleZ = NULL; + } + if(ad->Red){ + free(ad->Red); + ad->Red = NULL; + } + if(ad->Green){ + free(ad->Green); + ad->Green = NULL; + } + if(ad->Blue){ + free(ad->Blue); + ad->Blue = NULL; + } + if(ad->Alpha){ + free(ad->Alpha); + ad->Alpha = NULL; + } + if(ad->timer){ + ecore_animator_del(ad->timer); + ad->timer = NULL; + } + al->scene_list = eina_list_remove(al->scene_list, ad); + free(ad); + ad = NULL; + } + xa->animation_list = eina_list_remove(xa->animation_list, al); + free(al); + al = NULL; + } + + free(xa); + xa = NULL; +} + +/** + * Run animation. + * + * @param xa xml_animator data + * + * @ingroup Xml_Animator + */ +EAPI void +elm_xml_animator_run(Elm_Xml_Animator *xa) +{ + Object_List *ol; + const Eina_List *l; + + EINA_LIST_FOREACH(xa->object_list, l, ol){ + move_object_with_animation(ol->animation_list->scene_list, ol->object, move_evas_map, ol->end_func, ol->data); + } +} -- 2.7.4