Hello,
Thanks for your advice.
I modified then send patches again.
Please review then apply them.
001 - elm_transit_paused_set / elm_transit_paused_get /
elm_transit_progress_value_get
002 - modified some test sample codes for looking better.
Thanks!
Best Regards.
hermet
-----Original Message-----
From: Carsten Haitzler (The Rasterman) [mailto:[email protected]]
Sent: Tuesday, January 11, 2011 3:05 PM
To: ChunEon Park
Cc: [email protected]
Subject: Re: [E-devel] [PATCH] elm_transit
On Mon, 10 Jan 2011 21:39:32 +0900 ChunEon Park <[email protected]>
said:
oh dear. bad me - i didnt notice the isse. you declared elm_transit_add as:
elm_transit_add() - not elm_transit_add(void). that means the compiler
doesnt
find errors when passing parameters. a function declared with
elm_transit_add()
in C means "this accepts 0 or MORE parameters - which are undefined".
basically
it means it wont complain if you call it with no params, 1, 2, or N - it
doesnt
care. thats really bad. thus the bug lipped through and your fix. first that
goes into svn.
you have some problems though with pause & resume. on run you never reset
delayed to 0. :) so if you want to run multiple times and have paused it at
a
time in the past with an older run... it'll get things wrong. also you have
pause() and resume - why not have a pause_set(transit, EINA_TRUE/FALSE); and
a
pause_get() so you can set and get the paused state. that'd be better. also
i
see another if formatting thing:
+ if(transit->animator)
no space after if :) could you fix the above? :)
> Dear All.
>
> Here is elm_transit patches.
>
> 001_elm_transit.txt
> Added elm_transit_pause, elm_transit_resume,
elm_transit_progress_value_get
>
> 002_elm_transit.txt
> fixed customized transit sample error.
>
>
> Check it then apply it please.
>
> Thanks.
>
> Best Regards
> Hermet
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler) [email protected]
Index: src/lib/elm_transit.c
===================================================================
--- src/lib/elm_transit.c (revision 56055)
+++ src/lib/elm_transit.c (working copy)
@@ -66,6 +66,8 @@
void *arg;
} del_data;
struct {
+ double delayed;
+ double paused;
double duration;
double begin;
double current;
@@ -75,6 +77,7 @@
int current;
Eina_Bool reverse;
} repeat;
+ double progress;
unsigned int effects_pending_del;
int walking;
Eina_Bool auto_reverse : 1;
@@ -155,12 +158,13 @@
{
Eina_List *elist, *elist_next;
Elm_Transit_Effect *effect;
-
+
+ if (transit->animator)
+ ecore_animator_del(transit->animator);
+
if (transit->del_data.func)
transit->del_data.func(transit->del_data.arg, transit);
-
- ecore_animator_del(transit->animator);
-
+
EINA_LIST_FOREACH_SAFE(transit->effect_list, elist, elist_next, effect)
_elm_transit_effect_del(transit, effect, elist);
@@ -196,38 +200,39 @@
_animator_animate_cb(void *data)
{
Elm_Transit *transit = data;
- double elapsed_time, progress;
-
+ double elapsed_time, duration;
+
transit->time.current = ecore_loop_time_get();
elapsed_time = transit->time.current - transit->time.begin;
-
- if (elapsed_time > transit->time.duration)
- elapsed_time = transit->time.duration;
-
- progress = elapsed_time / transit->time.duration;
+ duration = transit->time.duration + transit->time.delayed;
+
+ if (elapsed_time > duration)
+ elapsed_time = duration;
+
+ transit->progress = elapsed_time / duration;
switch (transit->tween_mode)
{
case ELM_TRANSIT_TWEEN_MODE_ACCELERATE:
- progress = 1.0 - sin((ELM_PI / 2.0) + (progress * ELM_PI / 2.0));
+ transit->progress = 1.0 - sin((ELM_PI / 2.0) + (transit->progress *
ELM_PI / 2.0));
break;
case ELM_TRANSIT_TWEEN_MODE_DECELERATE:
- progress = sin(progress * ELM_PI / 2.0);
+ transit->progress = sin(transit->progress * ELM_PI / 2.0);
break;
case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL:
- progress = (1.0 - cos(progress * ELM_PI)) / 2.0;
+ transit->progress = (1.0 - cos(transit->progress * ELM_PI)) / 2.0;
break;
default:
break;
}
/* Reverse? */
- if (transit->repeat.reverse) progress = 1 - progress;
+ if (transit->repeat.reverse) transit->progress = 1 - transit->progress;
- if (transit->time.duration > 0) _transit_animate_op(transit, progress);
+ if (transit->time.duration > 0) _transit_animate_op(transit,
transit->progress);
/* Not end. Keep going. */
- if (elapsed_time < transit->time.duration) return ECORE_CALLBACK_RENEW;
-
+ if (elapsed_time < duration) return ECORE_CALLBACK_RENEW;
+
/* Repeat and reverse and time done! */
if ((transit->repeat.current == transit->repeat.count)
&& (!transit->auto_reverse || transit->repeat.reverse))
@@ -790,10 +795,90 @@
if (transit->animator)
ecore_animator_del(transit->animator);
+ transit->time.paused = 0;
+ transit->time.delayed = 0;
transit->time.begin = ecore_loop_time_get();
transit->animator = ecore_animator_add(_animator_animate_cb, transit);
}
+/**
+ * Pause/Resume the transition.
+ * If you call elm_transit_go again, paused states will affect no anymore.
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ *
+ * @ingroup Transit
+ */
+EAPI void
+elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused)
+{
+ ELM_TRANSIT_CHECK_OR_RETURN(transit);
+
+ if (!transit->animator) return;
+
+ if (paused)
+ {
+ if (transit->time.paused > 0)
+ return;
+ ecore_animator_freeze(transit->animator);
+ transit->time.paused = ecore_loop_time_get();
+ }
+ else
+ {
+ if (transit->time.paused == 0)
+ return;
+ ecore_animator_thaw(transit->animator);
+ transit->time.delayed += (ecore_loop_time_get() -
transit->time.paused);
+ transit->time.paused = 0;
+ }
+}
+
+/**
+ * Get the value of paused status.
+ *
+ * @see elm_transit_paused_set()
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ * @return EINA_TRUE means transition is paused. If @p transit is NULL
+ * EINA_FALSE is returned
+ *
+ * @ingroup Transit
+ */
+EAPI Eina_Bool
+elm_transit_paused_get(const Elm_Transit *transit)
+{
+ ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
+
+ if (transit->time.paused == 0)
+ return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
+/**
+ * Get the time progression of the animation (a double value between 0.0 and
1.0).
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ *
+ * @return The time progression value. If @p transit is NULL
+ * 0 is returned
+ *
+ * @ingroup Transit
+ */
+EAPI double
+elm_transit_progress_value_get(const Elm_Transit *transit)
+{
+ ELM_TRANSIT_CHECK_OR_RETURN(transit, 0);
+
+ return transit->progress;
+}
+
///////////////////////////////////////////////////////////////////////////////
//Resizing FX
///////////////////////////////////////////////////////////////////////////////
Index: src/lib/Elementary.h.in
===================================================================
--- src/lib/Elementary.h.in (revision 56055)
+++ src/lib/Elementary.h.in (working copy)
@@ -2503,6 +2503,9 @@
EAPI void elm_transit_duration_set(Elm_Transit *transit,
double duration) EINA_ARG_NONNULL(1);
EAPI double elm_transit_duration_get(const Elm_Transit
*transit) EINA_ARG_NONNULL(1);
EAPI void elm_transit_go(Elm_Transit *transit)
EINA_ARG_NONNULL(1);
+ EAPI void elm_transit_paused_set(Elm_Transit *transit,
Eina_Bool paused) EINA_ARG_NONNULL(1);
+ EAPI Eina_Bool elm_transit_paused_get(const Elm_Transit
*transit) EINA_ARG_NONNULL(1);
+ EAPI double elm_transit_progress_value_get(const
Elm_Transit *transit) EINA_ARG_NONNULL(1);
EAPI void *elm_transit_effect_resizing_add(Elm_Transit*
transit, Evas_Coord from_w, Evas_Coord from_h, Evas_Coord to_w, Evas_Coord
to_h);
EAPI void *elm_transit_effect_translation_add(Elm_Transit*
transit, Evas_Coord from_dx, Evas_Coord dy, Evas_Coord to_dx, Evas_Coord to_dy);
Index: src/bin/test_transit.c
===================================================================
--- src/bin/test_transit.c (revision 56055)
+++ src/bin/test_transit.c (working copy)
@@ -339,72 +339,65 @@
void
test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void
*event_info __UNUSED__)
{
- Evas_Object *win, *bg, *bx, *bt;
+ Evas_Object *win, *bg, *bt;
win = elm_win_add(NULL, "transit-4", ELM_WIN_BASIC);
elm_win_title_set(win, "Transit 4");
elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_resize(win, 300, 300);
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);
- bx = elm_box_add(win);
- evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, bx);
- evas_object_size_hint_min_set(bx, 318, 318);
- evas_object_show(bx);
-
bt = elm_button_add(win);
- elm_button_label_set(bt, "Button");
- elm_box_pack_end(bx, bt);
- evas_object_show(bt);
-
- bt = elm_button_add(win);
elm_button_label_set(bt, "Zoom Effect");
- elm_box_pack_end(bx, bt);
+ evas_object_resize(bt, 100, 50);
+ evas_object_move(bt, 100, 125);
evas_object_show(bt);
evas_object_smart_callback_add(bt, "clicked", _transit_zoom, NULL);
evas_object_show(win);
-
- bt = elm_button_add(win);
- elm_button_label_set(bt, "Button");
- elm_box_pack_end(bx, bt);
- evas_object_show(bt);
}
/* Blend Effect */
void
test_transit5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void
*event_info __UNUSED__)
{
- Evas_Object *win, *bg, *bx, *bt, *bt2;
+ Evas_Object *win, *bg, *bx, *bt, *bt2, *ic;
win = elm_win_add(NULL, "transit-5", ELM_WIN_BASIC);
elm_win_title_set(win, "Transit 5");
elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_resize(win, 300, 300);
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);
- bx = elm_box_add(win);
- evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, bx);
- evas_object_size_hint_min_set(bx, 318, 318);
- evas_object_show(bx);
+ ic = elm_icon_add(win);
+ elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_01.jpg", NULL);
+ evas_object_size_hint_max_set(ic, 50, 50);
bt = elm_button_add(win);
+ elm_button_icon_set(bt, ic);
elm_button_label_set(bt, "Before Button - Blend Effect");
- elm_box_pack_end(bx, bt);
+ evas_object_move(bt, 25, 125);
+ evas_object_resize(bt, 250, 50);
evas_object_show(bt);
+ ic = elm_icon_add(win);
+ elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_02.jpg", NULL);
+ evas_object_size_hint_max_set(ic, 50, 50);
+
bt2 = elm_button_add(win);
+ elm_button_icon_set(bt2, ic);
elm_button_label_set(bt2, "After Button - Blend Effect");
- elm_box_pack_end(bx, bt2);
+ evas_object_move(bt2, 25, 125);
+ evas_object_resize(bt2, 250, 50);
evas_object_show(win);
@@ -416,7 +409,7 @@
void
test_transit6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void
*event_info __UNUSED__)
{
- Evas_Object *win, *bg, *bt, *bt2;
+ Evas_Object *win, *bg, *bt, *bt2, *ic;
win = elm_win_add(NULL, "transit-6", ELM_WIN_BASIC);
elm_win_title_set(win, "Transit 6");
@@ -428,16 +421,26 @@
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
+ ic = elm_icon_add(win);
+ elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_01.jpg", NULL);
+ evas_object_size_hint_max_set(ic, 50, 50);
+
bt = elm_button_add(win);
+ elm_button_icon_set(bt, ic);
elm_button_label_set(bt, "Before Button - Fade Effect");
+ evas_object_move(bt, 25, 125);
+ evas_object_resize(bt, 250, 50);
evas_object_show(bt);
- evas_object_move(bt, 50, 100);
- evas_object_resize(bt, 200, 50);
+ ic = elm_icon_add(win);
+ elm_icon_file_set(ic, PACKAGE_DATA_DIR"/images/rock_02.jpg", NULL);
+ evas_object_size_hint_max_set(ic, 50, 50);
+
bt2 = elm_button_add(win);
+ elm_button_icon_set(bt2, ic);
elm_button_label_set(bt2, "After Button - Fade Effect");
- evas_object_move(bt2, 50, 100);
- evas_object_resize(bt2, 200, 50);
+ evas_object_move(bt2, 25, 125);
+ evas_object_resize(bt2, 250, 50);
evas_object_show(win);
@@ -465,7 +468,7 @@
elm_button_label_set(bt, "Front Button - Resizable Flip Effect");
evas_object_show(bt);
evas_object_move(bt, 50, 100);
- evas_object_resize(bt, 200, 30);
+ evas_object_resize(bt, 250, 30);
bt2 = elm_button_add(win);
elm_button_label_set(bt2, "Back Button - Resizable Flip Effect");
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel