summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHannes Janetzek <hannes.janetzek@gmail.com>2009-03-05 23:49:01 +0000
committerHannes Janetzek <hannes.janetzek@gmail.com>2009-03-05 23:49:01 +0000
commite94484b0d120693bde4cb906e32cacbad243990d (patch)
treebc37692f88580cecf945205392d535af5f6c9e2c /src
parentc3fb24a3ae47b463097ee5d257e350dbb2339ed6 (diff)
downloadenlightenment-e94484b0d120693bde4cb906e32cacbad243990d.tar.gz
refactored shelf autohide animation code
SVN revision: 39384
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_shelf.c235
1 files changed, 69 insertions, 166 deletions
diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c
index b0d398d83b..3f35ed8b1e 100644
--- a/src/bin/e_shelf.c
+++ b/src/bin/e_shelf.c
@@ -199,12 +199,12 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
es->hide_step = 0;
es->locked = 0;
- option = edje_object_data_get(es->o_base, "hidden_state_size");
+ option = edje_object_data_get(es->o_base, "hidden_state_size");
if (option)
es->hidden_state_size = atoi(option);
else
es->hidden_state_size = 4;
- option = edje_object_data_get(es->o_base, "instant_delay");
+ option = edje_object_data_get(es->o_base, "instant_delay");
if (option)
es->instant_delay = atof(option);
else
@@ -1396,192 +1396,95 @@ static int
_e_shelf_cb_hide_animator(void *data)
{
E_Shelf *es;
- int step = 2, move = 0;
-
+ int step, height;
+
es = data;
+ switch (es->gadcon->orient)
+ {
+ case E_GADCON_ORIENT_TOP:
+ case E_GADCON_ORIENT_CORNER_TL:
+ case E_GADCON_ORIENT_CORNER_TR:
+ case E_GADCON_ORIENT_BOTTOM:
+ case E_GADCON_ORIENT_CORNER_BL:
+ case E_GADCON_ORIENT_CORNER_BR:
+ height = es->h;
+ if (es->hide_origin == -1)
+ es->hide_origin = es->y;
+ break;
+ case E_GADCON_ORIENT_LEFT:
+ case E_GADCON_ORIENT_CORNER_LB:
+ case E_GADCON_ORIENT_CORNER_LT:
+ case E_GADCON_ORIENT_RIGHT:
+ case E_GADCON_ORIENT_CORNER_RB:
+ case E_GADCON_ORIENT_CORNER_RT:
+ height = es->w;
+ if (es->hide_origin == -1)
+ es->hide_origin = es->x;
+ break;
+ }
+
+ step = ((height - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
+
+ if (!step) step = 1;
+
+ if (es->hidden)
+ {
+ if (es->hide_step < height - es->hidden_state_size)
+ {
+ if (es->hide_step + step > height - es->hidden_state_size)
+ {
+ es->hide_step = height - es->hidden_state_size;
+ }
+ else
+ {
+ es->hide_step += step;
+ }
+ }
+ else goto end;
+ }
+ else
+ {
+ if (es->hide_step > 0)
+ {
+ if (es->hide_step < step)
+ {
+ es->hide_step = 0;
+ }
+ else
+ {
+ es->hide_step -= step;
+ }
+ }
+ else goto end;
+ }
switch (es->gadcon->orient)
{
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
- step = ((es->h - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
- if (!step) step = 1;
- if (es->hidden)
- {
- if (es->hide_origin == -1) es->hide_origin = es->y;
- if (es->hide_step < es->h - es->hidden_state_size)
- {
- if (es->hide_step + step > es->h - es->hidden_state_size)
- {
- move = es->hide_origin - es->h + es->hidden_state_size;
- es->hide_step = es->h - es->hidden_state_size;
- }
- else
- {
- move = es->y - step;
- es->hide_step += step;
- }
- e_shelf_move(es, es->x, move);
- }
- else goto end;
- }
- else
- {
- if (es->hide_step > 0)
- {
- if (es->hide_step < step)
- {
- move = es->hide_origin;
- es->hide_step = 0;
- }
- else
- {
- move = es->y + step;
- es->hide_step -= step;
- }
- e_shelf_move(es, es->x, move);
- }
- else goto end;
- }
+ e_shelf_move(es, es->x, es->hide_origin - es->hide_step);
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
- step = ((es->h - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
- if (!step) step = 1;
- if (es->hidden)
- {
- if (es->hide_origin == -1) es->hide_origin = es->y;
- if (es->hide_step < es->h - es->hidden_state_size)
- {
- if (es->hide_step + step > es->h - es->hidden_state_size)
- {
- move = es->hide_origin + es->h - es->hidden_state_size;
- es->hide_step = es->h - es->hidden_state_size;
- }
- else
- {
- move = es->y + step;
- es->hide_step += step;
- }
- e_shelf_move(es, es->x, move);
- }
- else goto end;
- }
- else
- {
- if (es->hide_step > 0)
- {
- if (es->hide_step < step)
- {
- move = es->hide_origin;
- es->hide_step = 0;
- }
- else
- {
- move = es->y - step;
- es->hide_step -= step;
- }
- e_shelf_move(es, es->x, move);
- }
- else goto end;
- }
-
+ e_shelf_move(es, es->x, es->hide_origin + es->hide_step);
break;
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_LT:
- step = ((es->w - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
- if (!step) step = 1;
- if (es->hidden)
- {
- if (es->hide_origin == -1) es->hide_origin = es->x;
- if (es->hide_step < es->w - es->hidden_state_size)
- {
- if (es->hide_step + step > es->w - es->hidden_state_size)
- {
- move = es->hide_origin - es->w + es->hidden_state_size;
- es->hide_step = es->w - es->hidden_state_size;
- }
- else
- {
- move = es->x - step;
- es->hide_step += step;
- }
- e_shelf_move(es, move, es->y);
- }
- else goto end;
- }
- else
- {
- if (es->hide_step > 0)
- {
- if (es->hide_step < step)
- {
- move = es->hide_origin;
- es->hide_step = 0;
- }
- else
- {
- move = es->x + step;
- es->hide_step -= step;
- }
- e_shelf_move(es, move, es->y);
- }
- else goto end;
- }
-
- break;
+ e_shelf_move(es, es->hide_origin - es->hide_step, es->y);
+ break;
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RB:
case E_GADCON_ORIENT_CORNER_RT:
- step = ((es->w - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
- if (!step) step = 1;
- if (es->hidden)
- {
- if (es->hide_origin == -1) es->hide_origin = es->x;
- if (es->hide_step < es->w - es->hidden_state_size)
- {
- if (es->hide_step + step > es->w - es->hidden_state_size)
- {
- move = es->hide_origin + es->w - es->hidden_state_size;
- es->hide_step = es->w - es->hidden_state_size;
- }
- else
- {
- move = es->x + step;
- es->hide_step += step;
- }
- e_shelf_move(es, move, es->y);
- }
- else goto end;
- }
- else
- {
- if (es->hide_step > 0)
- {
- if (es->hide_step < step)
- {
- move = es->hide_origin;
- es->hide_step = 0;
- }
- else
- {
- move = es->x - step;
- es->hide_step -= step;
- }
- e_shelf_move(es, move, es->y);
- }
- else goto end;
- }
- break;
- default:
+ e_shelf_move(es, es->hide_origin + es->hide_step, es->y);
break;
}
+
return 1;
-end:
+ end:
es->hide_animator = NULL;
if (es->interrupted > -1)
e_shelf_toggle(es, es->interrupted);