formatting

SVN revision: 72402
This commit is contained in:
Mike Blumenkrantz 2012-06-18 13:41:45 +00:00
parent a58ddcbb92
commit 8d352bc01e
1 changed files with 421 additions and 416 deletions

View File

@ -1,60 +1,62 @@
#include "e.h"
#define SMART_NAME "e_scrollframe"
#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
#define SMART_NAME "e_scrollframe"
#define API_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
typedef struct _E_Smart_Data E_Smart_Data;
struct _E_Smart_Data
{
Evas_Coord x, y, w, h;
Evas_Coord x, y, w, h;
Evas_Object *smart_obj;
Evas_Object *child_obj;
Evas_Object *pan_obj;
Evas_Object *edje_obj;
Evas_Object *event_obj;
Evas_Object *smart_obj;
Evas_Object *child_obj;
Evas_Object *pan_obj;
Evas_Object *edje_obj;
Evas_Object *event_obj;
E_Scrollframe_Policy hbar_flags, vbar_flags;
struct {
Evas_Coord x, y;
Evas_Coord sx, sy;
Evas_Coord dx, dy;
struct {
Evas_Coord x, y;
double timestamp;
struct
{
Evas_Coord x, y;
Evas_Coord sx, sy;
Evas_Coord dx, dy;
struct
{
Evas_Coord x, y;
double timestamp;
} history[20];
double anim_start;
double anim_start;
Ecore_Animator *momentum_animator;
Evas_Coord locked_x, locked_y;
unsigned char now : 1;
unsigned char dragged : 1;
unsigned char dir_x : 1;
unsigned char dir_y : 1;
unsigned char locked : 1;
Evas_Coord locked_x, locked_y;
unsigned char now : 1;
unsigned char dragged : 1;
unsigned char dir_x : 1;
unsigned char dir_y : 1;
unsigned char locked : 1;
} down;
struct
{
Evas_Coord w, h;
} child;
{
Evas_Coord w, h;
} child;
struct
{
Evas_Coord x, y;
} step, page;
{
Evas_Coord x, y;
} step, page;
struct
{
void (*set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
void (*get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void (*max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
} pan_func;
{
void (*set)(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
void (*get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void (*max_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void (*child_size_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
} pan_func;
struct
{
Eina_Bool forced : 1;
} thumbscroll;
{
Eina_Bool forced : 1;
} thumbscroll;
unsigned char hbar_visible : 1;
unsigned char vbar_visible : 1;
@ -63,34 +65,34 @@ struct _E_Smart_Data
};
/* local subsystem functions */
static void _e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
static void _e_smart_pan_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
static void _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
static void _e_smart_pan_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
static void _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static Eina_Bool _e_smart_momentum_animator(void *data);
static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_smart_scrollbar_read(E_Smart_Data *sd);
static void _e_smart_scrollbar_reset(E_Smart_Data *sd);
static int _e_smart_scrollbar_bar_h_visibility_adjust(E_Smart_Data *sd);
static int _e_smart_scrollbar_bar_v_visibility_adjust(E_Smart_Data *sd);
static void _e_smart_scrollbar_bar_visibility_adjust(E_Smart_Data *sd);
static void _e_smart_scrollbar_size_adjust(E_Smart_Data *sd);
static void _e_smart_reconfigure(E_Smart_Data *sd);
static void _e_smart_add(Evas_Object *obj);
static void _e_smart_del(Evas_Object *obj);
static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_smart_show(Evas_Object *obj);
static void _e_smart_hide(Evas_Object *obj);
static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
static void _e_smart_clip_unset(Evas_Object *obj);
static void _e_smart_init(void);
static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_smart_scrollbar_read(E_Smart_Data *sd);
static void _e_smart_scrollbar_reset(E_Smart_Data *sd);
static int _e_smart_scrollbar_bar_h_visibility_adjust(E_Smart_Data *sd);
static int _e_smart_scrollbar_bar_v_visibility_adjust(E_Smart_Data *sd);
static void _e_smart_scrollbar_bar_visibility_adjust(E_Smart_Data *sd);
static void _e_smart_scrollbar_size_adjust(E_Smart_Data *sd);
static void _e_smart_reconfigure(E_Smart_Data *sd);
static void _e_smart_add(Evas_Object *obj);
static void _e_smart_del(Evas_Object *obj);
static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_smart_show(Evas_Object *obj);
static void _e_smart_hide(Evas_Object *obj);
static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
static void _e_smart_clip_unset(Evas_Object *obj);
static void _e_smart_init(void);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
@ -124,14 +126,14 @@ e_scrollframe_child_set(Evas_Object *obj, Evas_Object *child)
if (!sd->pan_obj)
{
o = e_pan_add(evas_object_evas_get(obj));
sd->pan_obj = o;
evas_object_smart_callback_add(o, "changed",
o = e_pan_add(evas_object_evas_get(obj));
sd->pan_obj = o;
evas_object_smart_callback_add(o, "changed",
_e_smart_pan_changed_hook, sd);
evas_object_smart_callback_add(o, "pan_changed",
evas_object_smart_callback_add(o, "pan_changed",
_e_smart_pan_pan_changed_hook, sd);
evas_object_show(o);
edje_object_part_swallow(sd->edje_obj, "e.swallow.content", o);
evas_object_show(o);
edje_object_part_swallow(sd->edje_obj, "e.swallow.content", o);
}
sd->pan_func.set = e_pan_set;
@ -149,34 +151,34 @@ e_scrollframe_child_set(Evas_Object *obj, Evas_Object *child)
EAPI void
e_scrollframe_extern_pan_set(Evas_Object *obj, Evas_Object *pan,
void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y),
void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y))
void (*pan_set)(Evas_Object *obj, Evas_Coord x, Evas_Coord y),
void (*pan_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
void (*pan_max_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
void (*pan_child_size_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y))
{
API_ENTRY return;
e_scrollframe_child_set(obj, NULL);
if (sd->extern_pan)
{
if (sd->pan_obj)
{
edje_object_part_unswallow(sd->edje_obj, sd->pan_obj);
sd->pan_obj = NULL;
}
if (sd->pan_obj)
{
edje_object_part_unswallow(sd->edje_obj, sd->pan_obj);
sd->pan_obj = NULL;
}
}
else
{
if (sd->pan_obj)
{
evas_object_del(sd->pan_obj);
sd->pan_obj = NULL;
}
if (sd->pan_obj)
{
evas_object_del(sd->pan_obj);
sd->pan_obj = NULL;
}
}
if (!pan)
{
sd->extern_pan = 0;
return;
sd->extern_pan = 0;
return;
}
sd->pan_obj = pan;
@ -234,11 +236,13 @@ e_scrollframe_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
if (mx > 0) vx = (double)x / (double)mx;
else vx = 0.0;
if (vx < 0.0) vx = 0.0;
else if (vx > 1.0) vx = 1.0;
else if (vx > 1.0)
vx = 1.0;
if (my > 0) vy = (double)y / (double)my;
else vy = 0.0;
if (vy < 0.0) vy = 0.0;
else if (vy > 1.0) vy = 1.0;
else if (vy > 1.0)
vy = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.vbar", 0.0, vy);
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.hbar", vx, 0.0);
sd->pan_func.set(sd->pan_obj, x, y);
@ -272,15 +276,15 @@ e_scrollframe_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Ev
if (x < px) nx = x;
else if ((x + w) > (px + (cw - mx)))
{
nx = x + w - (cw - mx);
if (nx > x) nx = x;
nx = x + w - (cw - mx);
if (nx > x) nx = x;
}
ny = py;
if (y < py) ny = y;
else if ((y + h) > (py + (ch - my)))
{
ny = y + h - (ch - my);
if (ny > y) ny = y;
ny = y + h - (ch - my);
if (ny > y) ny = y;
}
if ((nx == px) && (ny == py)) return;
e_scrollframe_child_pos_set(obj, nx, ny);
@ -418,9 +422,9 @@ _e_smart_pan_changed_hook(void *data, Evas_Object *obj __UNUSED__, void *event_i
sd->pan_func.child_size_get(sd->pan_obj, &w, &h);
if ((w != sd->child.w) || (h != sd->child.h))
{
sd->child.w = w;
sd->child.h = h;
_e_smart_scrollbar_size_adjust(sd);
sd->child.w = w;
sd->child.h = h;
_e_smart_scrollbar_size_adjust(sd);
}
}
@ -466,27 +470,27 @@ _e_smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU
ev = event_info;
if ((e_config->thumbscroll_enable) || (sd->thumbscroll.forced))
{
if (sd->down.momentum_animator)
{
ecore_animator_del(sd->down.momentum_animator);
sd->down.momentum_animator = NULL;
}
if (ev->button == 1)
{
sd->down.now = 1;
sd->down.dragged = 0;
sd->down.dir_x = 0;
sd->down.dir_y = 0;
sd->down.x = ev->canvas.x;
sd->down.y = ev->canvas.y;
e_scrollframe_child_pos_get(sd->smart_obj,
if (sd->down.momentum_animator)
{
ecore_animator_del(sd->down.momentum_animator);
sd->down.momentum_animator = NULL;
}
if (ev->button == 1)
{
sd->down.now = 1;
sd->down.dragged = 0;
sd->down.dir_x = 0;
sd->down.dir_y = 0;
sd->down.x = ev->canvas.x;
sd->down.y = ev->canvas.y;
e_scrollframe_child_pos_get(sd->smart_obj,
&sd->down.sx, &sd->down.sy);
sd->down.locked = 0;
memset(&(sd->down.history[0]), 0, sizeof(sd->down.history[0]) * 20);
sd->down.history[0].timestamp = ecore_loop_time_get();
sd->down.history[0].x = ev->canvas.x;
sd->down.history[0].y = ev->canvas.y;
}
sd->down.locked = 0;
memset(&(sd->down.history[0]), 0, sizeof(sd->down.history[0]) * 20);
sd->down.history[0].timestamp = ecore_loop_time_get();
sd->down.history[0].x = ev->canvas.x;
sd->down.history[0].y = ev->canvas.y;
}
}
}
@ -502,19 +506,19 @@ _e_smart_momentum_animator(void *data)
dt = t - sd->down.anim_start;
if (dt >= 0.0)
{
dt = dt / e_config->thumbscroll_friction;
if (dt > 1.0) dt = 1.0;
p = 1.0 - ((1.0 - dt) * (1.0 - dt) * (1.0 - dt));
dx = (sd->down.dx * e_config->thumbscroll_friction * p);
dy = (sd->down.dy * e_config->thumbscroll_friction * p);
x = sd->down.sx - dx;
y = sd->down.sy - dy;
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
if (dt >= 1.0)
{
sd->down.momentum_animator = NULL;
return ECORE_CALLBACK_CANCEL;
}
dt = dt / e_config->thumbscroll_friction;
if (dt > 1.0) dt = 1.0;
p = 1.0 - ((1.0 - dt) * (1.0 - dt) * (1.0 - dt));
dx = (sd->down.dx * e_config->thumbscroll_friction * p);
dy = (sd->down.dy * e_config->thumbscroll_friction * p);
x = sd->down.sx - dx;
y = sd->down.sy - dy;
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
if (dt >= 1.0)
{
sd->down.momentum_animator = NULL;
return ECORE_CALLBACK_CANCEL;
}
}
return ECORE_CALLBACK_RENEW;
}
@ -530,57 +534,57 @@ _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *
ev = event_info;
if ((e_config->thumbscroll_enable) || (sd->thumbscroll.forced))
{
if (ev->button == 1)
{
x = ev->canvas.x - sd->down.x;
y = ev->canvas.y - sd->down.y;
if (sd->down.dragged)
{
double t, at, dt;
int i;
Evas_Coord ax, ay, dx, dy, vel;
if (ev->button == 1)
{
x = ev->canvas.x - sd->down.x;
y = ev->canvas.y - sd->down.y;
if (sd->down.dragged)
{
double t, at, dt;
int i;
Evas_Coord ax, ay, dx, dy, vel;
t = ecore_loop_time_get();
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
ax = ev->canvas.x;
ay = ev->canvas.y;
at = 0.0;
for (i = 0; i < 20; i++)
{
dt = t - sd->down.history[i].timestamp;
if (dt > 0.2) break;
at += dt;
ax += sd->down.history[i].x;
ay += sd->down.history[i].y;
}
ax /= (i + 1);
ay /= (i + 1);
at /= (i + 1);
at *= 4.0;
dx = ev->canvas.x - ax;
dy = ev->canvas.y - ay;
if (at > 0)
{
vel = sqrt((dx * dx) + (dy * dy)) / at;
if ((e_config->thumbscroll_friction > 0.0) &&
(vel > e_config->thumbscroll_momentum_threshhold))
{
if (!sd->down.momentum_animator)
sd->down.momentum_animator =
ecore_animator_add(_e_smart_momentum_animator, sd);
sd->down.dx = ((double)dx / at);
sd->down.dy = ((double)dy / at);
sd->down.anim_start = t;
e_scrollframe_child_pos_get(sd->smart_obj, &x, &y);
sd->down.sx = x;
sd->down.sy = y;
}
}
evas_event_feed_hold(e, 0, ev->timestamp, ev->data);
}
sd->down.dragged = 0;
sd->down.now = 0;
}
t = ecore_loop_time_get();
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
ax = ev->canvas.x;
ay = ev->canvas.y;
at = 0.0;
for (i = 0; i < 20; i++)
{
dt = t - sd->down.history[i].timestamp;
if (dt > 0.2) break;
at += dt;
ax += sd->down.history[i].x;
ay += sd->down.history[i].y;
}
ax /= (i + 1);
ay /= (i + 1);
at /= (i + 1);
at *= 4.0;
dx = ev->canvas.x - ax;
dy = ev->canvas.y - ay;
if (at > 0)
{
vel = sqrt((dx * dx) + (dy * dy)) / at;
if ((e_config->thumbscroll_friction > 0.0) &&
(vel > e_config->thumbscroll_momentum_threshhold))
{
if (!sd->down.momentum_animator)
sd->down.momentum_animator =
ecore_animator_add(_e_smart_momentum_animator, sd);
sd->down.dx = ((double)dx / at);
sd->down.dy = ((double)dy / at);
sd->down.anim_start = t;
e_scrollframe_child_pos_get(sd->smart_obj, &x, &y);
sd->down.sx = x;
sd->down.sy = y;
}
}
evas_event_feed_hold(e, 0, ev->timestamp, ev->data);
}
sd->down.dragged = 0;
sd->down.now = 0;
}
}
}
@ -595,63 +599,63 @@ _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void
ev = event_info;
if ((e_config->thumbscroll_enable) || (sd->thumbscroll.forced))
{
if (sd->down.now)
{
memmove(&(sd->down.history[1]), &(sd->down.history[0]),
sizeof(sd->down.history[0]) * 19);
sd->down.history[0].timestamp = ecore_loop_time_get();
sd->down.history[0].x = ev->cur.canvas.x;
sd->down.history[0].y = ev->cur.canvas.y;
if (sd->down.now)
{
memmove(&(sd->down.history[1]), &(sd->down.history[0]),
sizeof(sd->down.history[0]) * 19);
sd->down.history[0].timestamp = ecore_loop_time_get();
sd->down.history[0].x = ev->cur.canvas.x;
sd->down.history[0].y = ev->cur.canvas.y;
x = ev->cur.canvas.x - sd->down.x;
if (x < 0) x = -x;
y = ev->cur.canvas.y - sd->down.y;
if (y < 0) y = -y;
if ((sd->one_dir_at_a_time) &&
(!sd->down.dir_x) && (!sd->down.dir_y))
{
if (x > y)
{
if (x > e_config->thumbscroll_threshhold)
{
sd->down.dir_x = 1;
sd->down.dir_y = 0;
}
}
else
{
if (y > e_config->thumbscroll_threshhold)
{
sd->down.dir_x = 0;
sd->down.dir_y = 1;
}
}
}
if ((sd->down.dragged) ||
(((x * x) + (y * y)) >
(e_config->thumbscroll_threshhold *
e_config->thumbscroll_threshhold)))
{
if (!sd->down.dragged)
evas_event_feed_hold(e, 1, ev->timestamp, ev->data);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
sd->down.dragged = 1;
x = sd->down.sx - (ev->cur.canvas.x - sd->down.x);
y = sd->down.sy - (ev->cur.canvas.y - sd->down.y);
if ((sd->down.dir_x) || (sd->down.dir_y))
{
if (!sd->down.locked)
{
sd->down.locked_x = x;
sd->down.locked_y = y;
sd->down.locked = 1;
}
if (sd->down.dir_x) y = sd->down.locked_y;
else x = sd->down.locked_x;
}
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
}
}
x = ev->cur.canvas.x - sd->down.x;
if (x < 0) x = -x;
y = ev->cur.canvas.y - sd->down.y;
if (y < 0) y = -y;
if ((sd->one_dir_at_a_time) &&
(!sd->down.dir_x) && (!sd->down.dir_y))
{
if (x > y)
{
if (x > e_config->thumbscroll_threshhold)
{
sd->down.dir_x = 1;
sd->down.dir_y = 0;
}
}
else
{
if (y > e_config->thumbscroll_threshhold)
{
sd->down.dir_x = 0;
sd->down.dir_y = 1;
}
}
}
if ((sd->down.dragged) ||
(((x * x) + (y * y)) >
(e_config->thumbscroll_threshhold *
e_config->thumbscroll_threshhold)))
{
if (!sd->down.dragged)
evas_event_feed_hold(e, 1, ev->timestamp, ev->data);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
sd->down.dragged = 1;
x = sd->down.sx - (ev->cur.canvas.x - sd->down.x);
y = sd->down.sy - (ev->cur.canvas.y - sd->down.y);
if ((sd->down.dir_x) || (sd->down.dir_y))
{
if (!sd->down.locked)
{
sd->down.locked_x = x;
sd->down.locked_y = y;
sd->down.locked = 1;
}
if (sd->down.dir_x) y = sd->down.locked_y;
else x = sd->down.locked_x;
}
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
}
}
}
}
@ -682,17 +686,17 @@ _e_smart_event_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE
y += sd->step.y;
else if (!strcmp(ev->keyname, "Prior"))
{
if (sd->page.y < 0)
y -= -(sd->page.y * vh) / 100;
else
y -= sd->page.y;
if (sd->page.y < 0)
y -= -(sd->page.y * vh) / 100;
else
y -= sd->page.y;
}
else if (!strcmp(ev->keyname, "Next"))
{
if (sd->page.y < 0)
y += -(sd->page.y * vh) / 100;
else
y += sd->page.y;
if (sd->page.y < 0)
y += -(sd->page.y * vh) / 100;
else
y += sd->page.y;
}
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
}
@ -723,8 +727,8 @@ _e_smart_scrollbar_reset(E_Smart_Data *sd)
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.hbar", 0.0, 0.0);
if ((!sd->child_obj) && (!sd->extern_pan))
{
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.vbar", 1.0, 1.0);
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.hbar", 1.0, 1.0);
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.vbar", 1.0, 1.0);
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.hbar", 1.0, 1.0);
}
if (sd->pan_obj)
sd->pan_func.set(sd->pan_obj, 0, 0);
@ -741,55 +745,55 @@ _e_smart_scrollbar_bar_v_visibility_adjust(E_Smart_Data *sd)
NULL, NULL, NULL, &vh);
if (sd->vbar_visible)
{
if (sd->vbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (h <= vh)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else if (sd->vbar_flags == E_SCROLLFRAME_POLICY_OFF)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
if (sd->vbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (h <= vh)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else if (sd->vbar_flags == E_SCROLLFRAME_POLICY_OFF)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else
{
if (sd->vbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (h > vh)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 1;
}
}
}
else if (sd->vbar_flags == E_SCROLLFRAME_POLICY_ON)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 1;
}
if (sd->vbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (h > vh)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 1;
}
}
}
else if (sd->vbar_flags == E_SCROLLFRAME_POLICY_ON)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 1;
}
}
if (scroll_v_vis_change)
{
if (sd->vbar_visible)
edje_object_signal_emit(sd->edje_obj, "e,action,show,vbar", "e");
else
edje_object_signal_emit(sd->edje_obj, "e,action,hide,vbar", "e");
edje_object_message_signal_process(sd->edje_obj);
_e_smart_scrollbar_size_adjust(sd);
if (sd->vbar_visible)
edje_object_signal_emit(sd->edje_obj, "e,action,show,vbar", "e");
else
edje_object_signal_emit(sd->edje_obj, "e,action,hide,vbar", "e");
edje_object_message_signal_process(sd->edje_obj);
_e_smart_scrollbar_size_adjust(sd);
}
return scroll_v_vis_change;
}
@ -805,55 +809,55 @@ _e_smart_scrollbar_bar_h_visibility_adjust(E_Smart_Data *sd)
NULL, NULL, &vw, NULL);
if (sd->hbar_visible)
{
if (sd->hbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (w <= vw)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else if (sd->hbar_flags == E_SCROLLFRAME_POLICY_OFF)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
if (sd->hbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (w <= vw)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else if (sd->hbar_flags == E_SCROLLFRAME_POLICY_OFF)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else
{
if (sd->hbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (w > vw)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 1;
}
}
}
else if (sd->hbar_flags == E_SCROLLFRAME_POLICY_ON)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 1;
}
if (sd->hbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if ((sd->child_obj) || (sd->extern_pan))
{
if (w > vw)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 1;
}
}
}
else if (sd->hbar_flags == E_SCROLLFRAME_POLICY_ON)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 1;
}
}
if (scroll_h_vis_change)
{
if (sd->hbar_visible)
edje_object_signal_emit(sd->edje_obj, "e,action,show,hbar", "e");
else
edje_object_signal_emit(sd->edje_obj, "e,action,hide,hbar", "e");
edje_object_message_signal_process(sd->edje_obj);
_e_smart_scrollbar_size_adjust(sd);
if (sd->hbar_visible)
edje_object_signal_emit(sd->edje_obj, "e,action,show,hbar", "e");
else
edje_object_signal_emit(sd->edje_obj, "e,action,hide,hbar", "e");
edje_object_message_signal_process(sd->edje_obj);
_e_smart_scrollbar_size_adjust(sd);
}
return scroll_h_vis_change;
}
@ -867,13 +871,13 @@ _e_smart_scrollbar_bar_visibility_adjust(E_Smart_Data *sd)
changed |= _e_smart_scrollbar_bar_v_visibility_adjust(sd);
if (changed)
{
changed |= _e_smart_scrollbar_bar_h_visibility_adjust(sd);
changed |= _e_smart_scrollbar_bar_v_visibility_adjust(sd);
changed |= _e_smart_scrollbar_bar_h_visibility_adjust(sd);
changed |= _e_smart_scrollbar_bar_v_visibility_adjust(sd);
}
if (changed)
{
_e_smart_scrollbar_bar_h_visibility_adjust(sd);
_e_smart_scrollbar_bar_v_visibility_adjust(sd);
_e_smart_scrollbar_bar_h_visibility_adjust(sd);
_e_smart_scrollbar_bar_v_visibility_adjust(sd);
}
}
@ -882,39 +886,39 @@ _e_smart_scrollbar_size_adjust(E_Smart_Data *sd)
{
if ((sd->child_obj) || (sd->extern_pan))
{
Evas_Coord x = 0, y = 0, w = 0, h = 0, mx = 0, my = 0, vw = 0, vh = 0;
double vx, vy, size;
Evas_Coord x = 0, y = 0, w = 0, h = 0, mx = 0, my = 0, vw = 0, vh = 0;
double vx, vy, size;
edje_object_calc_force(sd->edje_obj);
edje_object_part_geometry_get(sd->edje_obj, "e.swallow.content",
edje_object_calc_force(sd->edje_obj);
edje_object_part_geometry_get(sd->edje_obj, "e.swallow.content",
NULL, NULL, &vw, &vh);
w = sd->child.w;
if (w < 1) w = 1;
size = (double)vw / (double)w;
if (size > 1.0)
{
size = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.hbar",
w = sd->child.w;
if (w < 1) w = 1;
size = (double)vw / (double)w;
if (size > 1.0)
{
size = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.hbar",
0.0, 0.0);
}
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.hbar",
}
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.hbar",
size, 1.0);
h = sd->child.h;
if (h < 1) h = 1;
size = (double)vh / (double)h;
if (size > 1.0)
{
size = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.vbar",
h = sd->child.h;
if (h < 1) h = 1;
size = (double)vh / (double)h;
if (size > 1.0)
{
size = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.vbar",
0.0, 0.0);
}
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.vbar",
}
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.vbar",
1.0, size);
edje_object_part_drag_value_get(sd->edje_obj, "e.dragable.hbar",
edje_object_part_drag_value_get(sd->edje_obj, "e.dragable.hbar",
&vx, NULL);
edje_object_part_drag_value_get(sd->edje_obj, "e.dragable.vbar",
edje_object_part_drag_value_get(sd->edje_obj, "e.dragable.vbar",
NULL, &vy);
if (sd->pan_obj)
{
@ -923,21 +927,21 @@ _e_smart_scrollbar_size_adjust(E_Smart_Data *sd)
y = vy * my;
}
edje_object_part_drag_step_set(sd->edje_obj, "e.dragable.hbar",
edje_object_part_drag_step_set(sd->edje_obj, "e.dragable.hbar",
(double)sd->step.x / (double)w, 0.0);
edje_object_part_drag_step_set(sd->edje_obj, "e.dragable.vbar",
edje_object_part_drag_step_set(sd->edje_obj, "e.dragable.vbar",
0.0, (double)sd->step.y / (double)h);
if (sd->page.x > 0)
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.hbar",
if (sd->page.x > 0)
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.hbar",
(double)sd->page.x / (double)w, 0.0);
else
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.hbar",
else
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.hbar",
-((double)sd->page.x * ((double)vw / (double)w)) / 100.0, 0.0);
if (sd->page.y > 0)
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.vbar",
if (sd->page.y > 0)
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.vbar",
0.0, (double)sd->page.y / (double)h);
else
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.vbar",
else
edje_object_part_drag_page_set(sd->edje_obj, "e.dragable.vbar",
0.0, -((double)sd->page.y * ((double)vh / (double)h)) / 100.0);
if (sd->pan_obj)
@ -945,9 +949,9 @@ _e_smart_scrollbar_size_adjust(E_Smart_Data *sd)
}
else
{
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.vbar",
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.vbar",
1.0, 1.0);
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.hbar",
edje_object_part_drag_size_set(sd->edje_obj, "e.dragable.hbar",
1.0, 1.0);
if (sd->pan_obj)
sd->pan_func.set(sd->pan_obj, 0, 0);
@ -996,7 +1000,7 @@ _e_smart_add(Evas_Object *obj)
o = edje_object_add(evas_object_evas_get(obj));
sd->edje_obj = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"e/widgets/scrollframe");
"e/widgets/scrollframe");
edje_object_signal_callback_add(o, "drag*", "e.dragable.vbar",
_e_smart_edje_drag_v, sd);
edje_object_signal_callback_add(o, "drag*", "e.dragable.hbar",
@ -1083,7 +1087,7 @@ _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
}
static void
_e_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
_e_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
{
INTERNAL_ENTRY;
evas_object_clip_set(sd->edje_obj, clip);
@ -1104,22 +1108,23 @@ static void
_e_smart_init(void)
{
if (_e_smart) return;
{
static const Evas_Smart_Class sc =
{
SMART_NAME,
EVAS_SMART_CLASS_VERSION,
_e_smart_add,
_e_smart_del,
_e_smart_move,
_e_smart_resize,
_e_smart_show,
_e_smart_hide,
_e_smart_color_set,
_e_smart_clip_set,
_e_smart_clip_unset,
NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
_e_smart = evas_smart_class_new(&sc);
}
{
static const Evas_Smart_Class sc =
{
SMART_NAME,
EVAS_SMART_CLASS_VERSION,
_e_smart_add,
_e_smart_del,
_e_smart_move,
_e_smart_resize,
_e_smart_show,
_e_smart_hide,
_e_smart_color_set,
_e_smart_clip_set,
_e_smart_clip_unset,
NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
_e_smart = evas_smart_class_new(&sc);
}
}