Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : proto
Dir : e17/proto/esmart/src/container/layout/entice
Modified Files:
entice.c
Log Message:
phormie, i think this atleast in part was wher eyou were heading with this.
It's still not *right* but we can work on it.
Notable question though, should the alpha value for the clipper be being
handled in the plugin ? can we do this at append/remove time checking the
size of the list, and that way not reimplementing it in multiple places?
===================================================================
RCS file:
/cvsroot/enlightenment/e17/proto/esmart/src/container/layout/entice/entice.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- entice.c 13 Jan 2004 01:25:09 -0000 1.1
+++ entice.c 13 Jan 2004 07:35:02 -0000 1.2
@@ -3,27 +3,21 @@
#include <math.h>
#include "../../container.h"
+static int _entice_current = 0;
+static int _entice_scroll_timer(void *data);
+
void
_entice_layout(Container *cont)
{
Evas_List *l;
int i, im_no;
double pos;
- double ey = cont->y + cont->padding.t;
+ double ey = cont->y + cont->padding.t + cont->scroll_offset;
- i = 1;
- im_no = 0;
- printf("*** layout, entice style...\n");
-/*
- for (l = cont->elements; l; l = l->next, i++)
- {
- if (l == current)
- im_no = i;
- }
-*/
- im_no = 3;
+ im_no = _entice_current;
i = 1;
pos = 0.0;
+ evas_object_color_set(cont->clipper, 255, 255, 255, 255);
for (l=cont->elements; l; l = l->next, i++)
{
Container_Element *el;
@@ -65,16 +59,42 @@
void
_entice_scroll_start(Container *cont, double velocity)
{
+ Scroll_Data *data;
+ double length, size;
+
+ length = e_container_elements_length_get(cont->obj);
+ data = calloc(1, sizeof(Scroll_Data));
+ data->velocity = velocity;
+ data->start_time = ecore_time_get();
+ data->cont = cont;
+ data->length = length;
+
+ cont->scroll_timer = ecore_timer_add(.02, _entice_scroll_timer, data);
}
void
_entice_scroll_stop(Container *cont)
{
+ /* FIXME: decelerate on stop? */
+ if (cont->scroll_timer)
+ {
+ ecore_timer_del(cont->scroll_timer);
+ cont->scroll_timer = NULL;
+ }
}
void
_entice_scroll_to(Container *cont, Container_Element *el)
{
+ if(cont && el)
+ {
+ Evas_List *l;
+ _entice_current = 1;
+ for(l = cont->elements; l; l = l->next, _entice_current++)
+ {
+ if(el == l->data) return;
+ }
+ }
}
void
@@ -93,3 +113,29 @@
return 1;
}
+
+int
+_entice_scroll_timer(void *data)
+{
+ Scroll_Data *sd = data;
+ double dt, dx, size, pad, max_scroll;
+
+ dt = ecore_time_get() - sd->start_time;
+ dx = 10 * (1 - exp(-dt));
+
+ sd->cont->scroll_offset += dx * sd->velocity;
+
+ size = sd->cont->direction ? sd->cont->h : sd->cont->w;
+ pad = sd->cont->direction ? sd->cont->padding.t + sd->cont->padding.b :
+ sd->cont->padding.l + sd->cont->padding.r;
+ max_scroll = size - sd->length - pad;
+
+ if (sd->cont->scroll_offset < max_scroll)
+ sd->cont->scroll_offset = max_scroll;
+
+ else if (sd->cont->scroll_offset > 0)
+ sd->cont->scroll_offset = 0;
+
+ _entice_layout(sd->cont);
+ return 1;
+}
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs