From 13bac758b5409065c3a485f02d4e77f62b0b9ac8 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sun, 22 Jun 2003 07:58:54 +0000 Subject: [PATCH] fixed bug where instant changes didnt happen if no animation was happening. forgot a call to recalc. also added "Ckiecked" signals... working thru the todo list. SVN revision: 7062 --- legacy/edje/data/src/e_logo.edc | 2 +- legacy/edje/src/bin/edje_main.c | 8 +++--- legacy/edje/src/lib/edje_main.c | 39 ++++++++++++++++++++++++------ legacy/edje/src/lib/edje_private.h | 2 ++ 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/legacy/edje/data/src/e_logo.edc b/legacy/edje/data/src/e_logo.edc index edf749f03c..21cb4706f6 100644 --- a/legacy/edje/data/src/e_logo.edc +++ b/legacy/edje/data/src/e_logo.edc @@ -329,7 +329,7 @@ collections { signal, "mouse,down,1"; source, "logo"; action, STATE_SET "clicked" 0.0; - transition, DECELERATE, 0.25; + transition, LINEAR, 0.0; target, "logo"; } program { diff --git a/legacy/edje/src/bin/edje_main.c b/legacy/edje/src/bin/edje_main.c index 939b9a0487..db78ad3ca5 100644 --- a/legacy/edje/src/bin/edje_main.c +++ b/legacy/edje/src/bin/edje_main.c @@ -1,9 +1,5 @@ #include "edje.h" -/* FIXME: need filename title and part name title */ -/* FIXME: need to look a bit prettier! */ -/* FIXME: edje test needs to load multiple edjes */ - static int main_start(int argc, char **argv); static void main_stop(void); static void main_resize(Ecore_Evas *ee); @@ -106,6 +102,7 @@ bg_setup(void) evas_object_color_set(o, 255, 255, 255, 255); evas_object_image_file_set(o, DAT"data/test/images/bg.png", NULL); evas_object_image_fill_set(o, 0, 0, 128, 128); + evas_object_pass_events_set(o, 1); evas_object_show(o); o_bg = o; @@ -116,6 +113,7 @@ bg_setup(void) evas_object_color_set(o, 255, 255, 255, 255); evas_object_image_file_set(o, DAT"data/test/images/shadow.png", NULL); evas_object_image_fill_set(o, 0, 0, 240, 320); + evas_object_pass_events_set(o, 1); evas_object_show(o); o_shadow = o; } @@ -329,7 +327,7 @@ bottom_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) static void cb (void *data, Evas_Object *o, const char *sig, const char *src) { - printf("CALLBACK for %p %p \"%s\" \"%s\"\n", data, o, sig, src); +// printf("CALLBACK for %p %p \"%s\" \"%s\"\n", data, o, sig, src); } void diff --git a/legacy/edje/src/lib/edje_main.c b/legacy/edje/src/lib/edje_main.c index e2f67ec479..436d685113 100644 --- a/legacy/edje/src/lib/edje_main.c +++ b/legacy/edje/src/lib/edje_main.c @@ -1,8 +1,6 @@ #include "Edje.h" #include "edje_private.h" -/* FIXME: sub objects need to be added to smart object */ -/* FIXME: add clicked signal for a mouse up thats a real clicked */ /* FIXME: free stuff - no more leaks */ /* FIXME: dragables have to work */ /* FIXME: drag start/top signals etc. */ @@ -10,6 +8,8 @@ /* FIXME: need to be able to calculate min & max size of a whole edje */ /* FIXME: on load don't segv on errors */ /* FIXME: add code to list collections in an eet */ +/* FIXME: part replacement with objec t+callbacks */ +/* FIXME: part queries for geometry etc. */ /* FIXME: ? somehow handle double click? */ /* FIXME: ? add numeric params to conditions for progs (ranges etc.) */ @@ -169,6 +169,7 @@ edje_file_set(Evas_Object *obj, const char *file, const char *part) rp->object = evas_object_image_add(ed->evas); else if (ep->type == EDJE_PART_TYPE_TEXT) rp->object = evas_object_text_add(ed->evas); + evas_object_smart_member_add(rp->object, ed->obj); if (ep->mouse_events) { evas_object_event_callback_add(rp->object, @@ -483,6 +484,11 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) rp = evas_object_data_get(obj, "real_part"); if (!rp) return; snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button); + if (rp->clicked_button == 0) + { + rp->clicked_button = ev->button; + rp->still_in = 1; + } _edje_emit(ed, buf, rp->part->name); } @@ -500,6 +506,13 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) if (!rp) return; snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); _edje_emit(ed, buf, rp->part->name); + if ((rp->still_in) && (rp->clicked_button == ev->button)) + { + rp->clicked_button = 0; + rp->still_in = 0; + snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button); + _edje_emit(ed, buf, rp->part->name); + } } static void @@ -514,6 +527,15 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) rp = evas_object_data_get(obj, "real_part"); if (!rp) return; _edje_emit(ed, "mouse,move", rp->part->name); + if (rp->still_in) + { + double x, y, w, h; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) || + (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h))) + rp->still_in = 0; + } } static void @@ -545,12 +567,12 @@ _edje_timer_cb(void *data) while (animl) { Edje *ed; - Evas_List *ll, *newl = NULL; + Evas_List *newl = NULL; ed = animl->data; animl = evas_list_remove(animl, animl->data); - for (ll = ed->actions; ll; ll = ll->next) - newl = evas_list_append(newl, ll->data); + for (l = ed->actions; l; l = l->next) + newl = evas_list_append(newl, l->data); while (newl) { Edje_Running_Program *runp; @@ -715,14 +737,17 @@ _edje_program_run(Edje *ed, Edje_Program *pr) rp = evas_list_nth(ed->parts, pt->id); if (rp) { + if (rp->program) + _edje_program_end(ed, rp->program); _edje_part_description_apply(ed, rp, pr->state, pr->value, NULL, - 0.0); + 0.0); _edje_part_pos_set(ed, rp, pr->tween.mode, 0.0); } } + _edje_recalc(ed); } } else if (pr->action == EDJE_ACTION_TYPE_ACTION_STOP) @@ -774,7 +799,6 @@ _edje_emit(Edje *ed, char *sig, char *src) while (emissions) { ee = emissions->data; - printf(" emission \"%s\" \"%s\"\n", ee->signal, ee->source); emissions = evas_list_remove(emissions, ee); for (l = ed->collection->programs; l; l = l->next) { @@ -1627,6 +1651,7 @@ _edje_smart_add(Evas_Object * obj) if (!ed) return; evas_object_smart_data_set(obj, ed); ed->obj = obj; + evas_object_smart_member_add(ed->clipper, ed->obj); } static void diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index a0951d81df..cdc927a639 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -321,6 +321,8 @@ struct _Edje_Real_Part Evas_Object *object; unsigned char calculated : 1; unsigned char dirty : 1; + unsigned char still_in : 1; + int clicked_button; Edje_Part *part; struct { int x, y;