forked from enlightenment/efl
edje: add threshold to draggable part.
This commit is contained in:
parent
e7862929e4
commit
cf9b0180d6
|
@ -1,3 +1,7 @@
|
||||||
|
2013-07-19 Cedric Bail
|
||||||
|
|
||||||
|
* Edje: add threshold to draggable part.
|
||||||
|
|
||||||
2013-07-18 Mike Blumenkrantz
|
2013-07-18 Mike Blumenkrantz
|
||||||
|
|
||||||
* Ecore-X: add ECORE_X_SYNC env variable for xlib backend
|
* Ecore-X: add ECORE_X_SYNC env variable for xlib backend
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -120,6 +120,7 @@ Additions:
|
||||||
- Add EDJE_INPUT_PANEL_LAYOUT_DATETIME layout
|
- Add EDJE_INPUT_PANEL_LAYOUT_DATETIME layout
|
||||||
- support edc proxy.source_visible, proxy.source_clip
|
- support edc proxy.source_visible, proxy.source_clip
|
||||||
- support edc map color set
|
- support edc map color set
|
||||||
|
- Add threshold support to Edje draggable part.
|
||||||
* Eeze:
|
* Eeze:
|
||||||
- Add a dummy libmount replacement for when libmount is not there.
|
- Add a dummy libmount replacement for when libmount is not there.
|
||||||
* Ecore_Con:
|
* Ecore_Con:
|
||||||
|
|
|
@ -234,6 +234,7 @@ static void st_collections_group_parts_part_access(void);
|
||||||
static void st_collections_group_parts_part_dragable_x(void);
|
static void st_collections_group_parts_part_dragable_x(void);
|
||||||
static void st_collections_group_parts_part_dragable_y(void);
|
static void st_collections_group_parts_part_dragable_y(void);
|
||||||
static void st_collections_group_parts_part_dragable_confine(void);
|
static void st_collections_group_parts_part_dragable_confine(void);
|
||||||
|
static void st_collections_group_parts_part_dragable_threshold(void);
|
||||||
static void st_collections_group_parts_part_dragable_events(void);
|
static void st_collections_group_parts_part_dragable_events(void);
|
||||||
|
|
||||||
/* box and table items share these */
|
/* box and table items share these */
|
||||||
|
@ -512,6 +513,7 @@ New_Statement_Handler statement_handlers[] =
|
||||||
{"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
|
{"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
|
||||||
{"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
|
{"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
|
||||||
{"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
|
{"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
|
||||||
|
{"collections.group.parts.part.dragable.threshold", st_collections_group_parts_part_dragable_threshold},
|
||||||
{"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
|
{"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
|
||||||
{"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode},
|
{"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode},
|
||||||
{"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode},
|
{"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode},
|
||||||
|
@ -2719,6 +2721,7 @@ st_collections_group_inherit(void)
|
||||||
ep->nested_children_count = ep2->nested_children_count;
|
ep->nested_children_count = ep2->nested_children_count;
|
||||||
|
|
||||||
data_queue_copied_part_lookup(pc, &(ep2->dragable.confine_id), &(ep->dragable.confine_id));
|
data_queue_copied_part_lookup(pc, &(ep2->dragable.confine_id), &(ep->dragable.confine_id));
|
||||||
|
data_queue_copied_part_lookup(pc, &(ep2->dragable.threshold_id), &(ep->dragable.threshold_id));
|
||||||
data_queue_copied_part_lookup(pc, &(ep2->dragable.event_id), &(ep->dragable.event_id));
|
data_queue_copied_part_lookup(pc, &(ep2->dragable.event_id), &(ep->dragable.event_id));
|
||||||
|
|
||||||
epp = (Edje_Part_Parser *)ep;
|
epp = (Edje_Part_Parser *)ep;
|
||||||
|
@ -3353,6 +3356,7 @@ edje_cc_handlers_part_make(void)
|
||||||
ep->access = 0;
|
ep->access = 0;
|
||||||
ep->clip_to_id = -1;
|
ep->clip_to_id = -1;
|
||||||
ep->dragable.confine_id = -1;
|
ep->dragable.confine_id = -1;
|
||||||
|
ep->dragable.threshold_id = -1;
|
||||||
ep->dragable.event_id = -1;
|
ep->dragable.event_id = -1;
|
||||||
ep->items = NULL;
|
ep->items = NULL;
|
||||||
ep->nested_children_count = 0;
|
ep->nested_children_count = 0;
|
||||||
|
@ -4227,6 +4231,7 @@ st_collections_group_parts_part_access(void)
|
||||||
..
|
..
|
||||||
dragable {
|
dragable {
|
||||||
confine: "another part";
|
confine: "another part";
|
||||||
|
threshold: "another part";
|
||||||
events: "another dragable part";
|
events: "another dragable part";
|
||||||
x: 0 0 0;
|
x: 0 0 0;
|
||||||
y: 0 0 0;
|
y: 0 0 0;
|
||||||
|
@ -4319,6 +4324,34 @@ st_collections_group_parts_part_dragable_confine(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@page edcref
|
||||||
|
@property
|
||||||
|
threshold
|
||||||
|
@parameters
|
||||||
|
[another part's name]
|
||||||
|
@effect
|
||||||
|
When set, the movement of the dragged part can only start when it get
|
||||||
|
moved enough to be outside of the threshold part.
|
||||||
|
@endproperty
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
st_collections_group_parts_part_dragable_threshold(void)
|
||||||
|
{
|
||||||
|
Edje_Part_Collection *pc;
|
||||||
|
|
||||||
|
check_arg_count(1);
|
||||||
|
|
||||||
|
pc = eina_list_data_get(eina_list_last(edje_collections));
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
name = parse_str(0);
|
||||||
|
data_queue_part_lookup(pc, name, &(current_part->dragable.threshold_id));
|
||||||
|
free(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@page edcref
|
@page edcref
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -11,6 +11,7 @@ endif
|
||||||
|
|
||||||
#put here all EDCs one needs to the examples
|
#put here all EDCs one needs to the examples
|
||||||
EDCS = \
|
EDCS = \
|
||||||
|
edje-threshold.edc \
|
||||||
animations2.edc \
|
animations2.edc \
|
||||||
animations.edc \
|
animations.edc \
|
||||||
basic2.edc \
|
basic2.edc \
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
collections {
|
||||||
|
group {
|
||||||
|
name: "main";
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
type: RECT;
|
||||||
|
name: background;
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
color: 0 0 0 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
type: RECT;
|
||||||
|
name: "area/vertical";
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
color: 255 0 0 255;
|
||||||
|
align: 0.5 0;
|
||||||
|
min: 20 30;
|
||||||
|
max: 20 -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
type: RECT;
|
||||||
|
name: "area/horizontal";
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
color: 255 0 0 255;
|
||||||
|
align: 0 0.5;
|
||||||
|
min: 30 20;
|
||||||
|
max: -1 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
type: RECT;
|
||||||
|
name: "threshold/horizontal";
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
color: 0 0 255 255;
|
||||||
|
rel1 {
|
||||||
|
to: "drag/horizontal";
|
||||||
|
offset: -13 -13;
|
||||||
|
}
|
||||||
|
rel2 {
|
||||||
|
to: "drag/horizontal";
|
||||||
|
offset: +12 +12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
type: RECT;
|
||||||
|
name: "drag/horizontal";
|
||||||
|
mouse_events: 1;
|
||||||
|
dragable {
|
||||||
|
confine: "area/horizontal";
|
||||||
|
threshold: "threshold/horizontal";
|
||||||
|
x: 1 1 0;
|
||||||
|
y: 0 0 0;
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
aspect: 1 1;
|
||||||
|
color: 0 255 0 255;
|
||||||
|
min: 20 20;
|
||||||
|
max: 20 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
type: RECT;
|
||||||
|
name: "drag/vertical";
|
||||||
|
mouse_events: 1;
|
||||||
|
dragable {
|
||||||
|
confine: "area/vertical";
|
||||||
|
threshold: "threshold/horizontal";
|
||||||
|
x: 0 0 0;
|
||||||
|
y: 1 1 0;
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
aspect: 1 1;
|
||||||
|
color: 0 255 255 255;
|
||||||
|
min: 20 20;
|
||||||
|
max: 20 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
|
||||||
Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp,
|
Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp,
|
||||||
Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
|
Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
|
||||||
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
|
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
|
||||||
Edje_Real_Part *confine_to, Edje_Calc_Params *params,
|
Edje_Real_Part *confine_to, Edje_Real_Part *threshold,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
Evas_Coord mmw, Evas_Coord mmh,
|
Evas_Coord mmw, Evas_Coord mmh,
|
||||||
FLOAT_T pos);
|
FLOAT_T pos);
|
||||||
|
|
||||||
|
@ -775,6 +776,15 @@ _edje_part_dragable_calc(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, FLOAT_T *x, F
|
||||||
{
|
{
|
||||||
if (ep->drag)
|
if (ep->drag)
|
||||||
{
|
{
|
||||||
|
Eina_Bool tx = EINA_FALSE;
|
||||||
|
Eina_Bool ty = EINA_FALSE;
|
||||||
|
|
||||||
|
if (ep->drag->threshold)
|
||||||
|
{
|
||||||
|
// Check if we are in the threshold or not and cancel the movement.
|
||||||
|
tx = ep->drag->threshold_x && ep->drag->threshold_started_x;
|
||||||
|
ty = ep->drag->threshold_y && ep->drag->threshold_started_y;
|
||||||
|
}
|
||||||
if (ep->drag->confine_to)
|
if (ep->drag->confine_to)
|
||||||
{
|
{
|
||||||
FLOAT_T dx, dy, dw, dh;
|
FLOAT_T dx, dy, dw, dh;
|
||||||
|
@ -795,15 +805,15 @@ _edje_part_dragable_calc(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, FLOAT_T *x, F
|
||||||
if (dh != ZERO) dy = DIV(dy, dh);
|
if (dh != ZERO) dy = DIV(dy, dh);
|
||||||
else dy = ZERO;
|
else dy = ZERO;
|
||||||
|
|
||||||
if (x) *x = dx;
|
if (x) *x = tx ? ep->drag->x : dx;
|
||||||
if (y) *y = dy;
|
if (y) *y = ty ? ep->drag->y : dy;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x) *x = ADD(FROM_INT(ep->drag->tmp.x), ep->drag->x);
|
if (x) *x = tx ? ep->drag->x : ADD(FROM_INT(ep->drag->tmp.x), ep->drag->x);
|
||||||
if (y) *y = ADD(FROM_INT(ep->drag->tmp.y), ep->drag->y);
|
if (y) *y = ty ? ep->drag->y : ADD(FROM_INT(ep->drag->tmp.y), ep->drag->y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1798,9 +1808,57 @@ _edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
|
||||||
_edje_part_recalc_single_max_length(desc->align.y, ¶ms->eval.y, ¶ms->eval.h, maxh);
|
_edje_part_recalc_single_max_length(desc->align.y, ¶ms->eval.y, ¶ms->eval.h, maxh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_drag_threshold(Edje_Real_Part *ep,
|
||||||
|
Edje_Real_Part *threshold,
|
||||||
|
Edje_Calc_Params *params)
|
||||||
|
{
|
||||||
|
if (threshold)
|
||||||
|
{
|
||||||
|
if (ep->drag->threshold_started_x &&
|
||||||
|
threshold->x < TO_INT(params->eval.x) &&
|
||||||
|
TO_INT(params->eval.x) + TO_INT(params->eval.w) < threshold->x + threshold->w)
|
||||||
|
{
|
||||||
|
// Cancel movement to previous position due to our presence inside the threshold
|
||||||
|
params->eval.x = FROM_INT(params->req_drag.x);
|
||||||
|
params->eval.w = FROM_INT(params->req_drag.w);
|
||||||
|
ep->drag->threshold_x = EINA_TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params->req_drag.x = TO_INT(params->eval.x);
|
||||||
|
params->req_drag.w = TO_INT(params->eval.w);
|
||||||
|
ep->drag->threshold_started_x = EINA_FALSE;
|
||||||
|
}
|
||||||
|
if (ep->drag->threshold_started_y &&
|
||||||
|
threshold->y < TO_INT(params->eval.y) &&
|
||||||
|
TO_INT(params->eval.y) + TO_INT(params->eval.h) < threshold->y + threshold->h)
|
||||||
|
{
|
||||||
|
// Cancel movement to previous position due to our presence inside the threshold
|
||||||
|
params->eval.y = FROM_INT(params->req_drag.y);
|
||||||
|
params->eval.h = FROM_INT(params->req_drag.h);
|
||||||
|
ep->drag->threshold_y = EINA_TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params->req_drag.y = TO_INT(params->eval.y);
|
||||||
|
params->req_drag.h = TO_INT(params->eval.h);
|
||||||
|
ep->drag->threshold_started_y = EINA_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params->req_drag.x = TO_INT(params->eval.x);
|
||||||
|
params->req_drag.w = TO_INT(params->eval.w);
|
||||||
|
params->req_drag.y = TO_INT(params->eval.y);
|
||||||
|
params->req_drag.h = TO_INT(params->eval.h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
_edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
||||||
Edje_Real_Part *confine_to,
|
Edje_Real_Part *confine_to,
|
||||||
|
Edje_Real_Part *threshold,
|
||||||
Edje_Calc_Params *params,
|
Edje_Calc_Params *params,
|
||||||
int minw, int minh,
|
int minw, int minh,
|
||||||
int maxw, int maxh)
|
int maxw, int maxh)
|
||||||
|
@ -1833,8 +1891,6 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
||||||
params->eval.x = FROM_INT(confine_to->x +
|
params->eval.x = FROM_INT(confine_to->x +
|
||||||
((offset / step) * step));
|
((offset / step) * step));
|
||||||
}
|
}
|
||||||
params->req_drag.x = TO_INT(params->eval.x);
|
|
||||||
params->req_drag.w = TO_INT(params->eval.w);
|
|
||||||
|
|
||||||
v = SCALE(ep->drag->size.y, confine_to->h);
|
v = SCALE(ep->drag->size.y, confine_to->h);
|
||||||
|
|
||||||
|
@ -1856,8 +1912,8 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
||||||
params->eval.y = FROM_INT(confine_to->y +
|
params->eval.y = FROM_INT(confine_to->y +
|
||||||
((offset / step) * step));
|
((offset / step) * step));
|
||||||
}
|
}
|
||||||
params->req_drag.y = TO_INT(params->eval.y);
|
|
||||||
params->req_drag.h = TO_INT(params->eval.h);
|
_edje_part_recalc_single_drag_threshold(ep, threshold, params);
|
||||||
|
|
||||||
/* limit to confine */
|
/* limit to confine */
|
||||||
if (params->eval.x < FROM_INT(confine_to->x))
|
if (params->eval.x < FROM_INT(confine_to->x))
|
||||||
|
@ -1881,12 +1937,9 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
||||||
{
|
{
|
||||||
/* simple dragable params */
|
/* simple dragable params */
|
||||||
params->eval.x = ADD(ADD(params->eval.x, ep->drag->x), FROM_INT(ep->drag->tmp.x));
|
params->eval.x = ADD(ADD(params->eval.x, ep->drag->x), FROM_INT(ep->drag->tmp.x));
|
||||||
params->req_drag.x = FROM_INT(params->eval.x);
|
|
||||||
params->req_drag.w = FROM_INT(params->eval.w);
|
|
||||||
|
|
||||||
params->eval.y = ADD(ADD(params->eval.y, ep->drag->y), FROM_INT(ep->drag->tmp.y));
|
params->eval.y = ADD(ADD(params->eval.y, ep->drag->y), FROM_INT(ep->drag->tmp.y));
|
||||||
params->req_drag.y = FROM_INT(params->eval.y);
|
|
||||||
params->req_drag.h = FROM_INT(params->eval.h);
|
_edje_part_recalc_single_drag_threshold(ep, threshold, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2183,6 +2236,7 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
Edje_Real_Part *rel2_to_x,
|
Edje_Real_Part *rel2_to_x,
|
||||||
Edje_Real_Part *rel2_to_y,
|
Edje_Real_Part *rel2_to_y,
|
||||||
Edje_Real_Part *confine_to,
|
Edje_Real_Part *confine_to,
|
||||||
|
Edje_Real_Part *threshold,
|
||||||
Edje_Calc_Params *params,
|
Edje_Calc_Params *params,
|
||||||
Evas_Coord mmw, Evas_Coord mmh,
|
Evas_Coord mmw, Evas_Coord mmh,
|
||||||
FLOAT_T pos)
|
FLOAT_T pos)
|
||||||
|
@ -2289,7 +2343,7 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
|
|
||||||
/* take care of dragable part */
|
/* take care of dragable part */
|
||||||
if (ep->drag)
|
if (ep->drag)
|
||||||
_edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh);
|
_edje_part_recalc_single_drag(ep, confine_to, threshold, params, minw, minh, maxw, maxh);
|
||||||
|
|
||||||
/* fill */
|
/* fill */
|
||||||
if (ep->part->type == EDJE_PART_TYPE_IMAGE)
|
if (ep->part->type == EDJE_PART_TYPE_IMAGE)
|
||||||
|
@ -2962,6 +3016,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
int state1 = -1;
|
int state1 = -1;
|
||||||
int state2 = -1;
|
int state2 = -1;
|
||||||
int statec = -1;
|
int statec = -1;
|
||||||
|
int statet = -1;
|
||||||
#else
|
#else
|
||||||
Edje_Calc_Params lp1, lp2;
|
Edje_Calc_Params lp1, lp2;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2979,6 +3034,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
Edje_Calc_Params *p1, *pf;
|
Edje_Calc_Params *p1, *pf;
|
||||||
Edje_Part_Description_Common *chosen_desc;
|
Edje_Part_Description_Common *chosen_desc;
|
||||||
Edje_Real_Part *confine_to = NULL;
|
Edje_Real_Part *confine_to = NULL;
|
||||||
|
Edje_Real_Part *threshold = NULL;
|
||||||
FLOAT_T pos = ZERO, pos2;
|
FLOAT_T pos = ZERO, pos2;
|
||||||
Edje_Calc_Params lp3;
|
Edje_Calc_Params lp3;
|
||||||
Evas_Coord mmw = 0, mmh = 0;
|
Evas_Coord mmw = 0, mmh = 0;
|
||||||
|
@ -3160,7 +3216,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ep->drag && ep->drag->confine_to)
|
if (ep->drag)
|
||||||
|
{
|
||||||
|
if (ep->drag->confine_to)
|
||||||
{
|
{
|
||||||
confine_to = ep->drag->confine_to;
|
confine_to = ep->drag->confine_to;
|
||||||
_edje_part_recalc(ed, confine_to, flags, NULL);
|
_edje_part_recalc(ed, confine_to, flags, NULL);
|
||||||
|
@ -3168,6 +3226,17 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
statec = confine_to->state;
|
statec = confine_to->state;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (ep->drag->threshold)
|
||||||
|
{
|
||||||
|
threshold = ep->drag->threshold;
|
||||||
|
// We shall not recalculate the threshold position as
|
||||||
|
// we use it's previous position to assert the threshold
|
||||||
|
// the one before moving take action.
|
||||||
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
statet = threshold->state;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
// if (ep->text.source) _edje_part_recalc(ed, ep->text.source, flags);
|
// if (ep->text.source) _edje_part_recalc(ed, ep->text.source, flags);
|
||||||
// if (ep->text.text_source) _edje_part_recalc(ed, ep->text.text_source, flags);
|
// if (ep->text.text_source) _edje_part_recalc(ed, ep->text.text_source, flags);
|
||||||
|
|
||||||
|
@ -3240,6 +3309,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
ep->invalidate ||
|
ep->invalidate ||
|
||||||
state1 >= ep->param1.state ||
|
state1 >= ep->param1.state ||
|
||||||
statec >= ep->param1.state ||
|
statec >= ep->param1.state ||
|
||||||
|
statet >= ep->param1.state ||
|
||||||
statec1 >= ep->param1.state ||
|
statec1 >= ep->param1.state ||
|
||||||
statel1 >= ep->param1.state ||
|
statel1 >= ep->param1.state ||
|
||||||
statep1 >= ep->param1.state ||
|
statep1 >= ep->param1.state ||
|
||||||
|
@ -3250,7 +3320,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
{
|
{
|
||||||
_edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, center[0], light[0], persp[0],
|
_edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, center[0], light[0], persp[0],
|
||||||
rp1[Rel1X], rp1[Rel1Y], rp1[Rel2X], rp1[Rel2Y],
|
rp1[Rel1X], rp1[Rel1Y], rp1[Rel2X], rp1[Rel2Y],
|
||||||
confine_to,
|
confine_to, threshold,
|
||||||
p1, mmw, mmh, pos);
|
p1, mmw, mmh, pos);
|
||||||
#ifdef EDJE_CALC_CACHE
|
#ifdef EDJE_CALC_CACHE
|
||||||
if (flags == FLAG_XY)
|
if (flags == FLAG_XY)
|
||||||
|
@ -3304,6 +3374,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
ep->invalidate ||
|
ep->invalidate ||
|
||||||
state2 >= ep->param2->state ||
|
state2 >= ep->param2->state ||
|
||||||
statec >= ep->param2->state ||
|
statec >= ep->param2->state ||
|
||||||
|
statet >= ep->param2->state ||
|
||||||
statec2 >= ep->param2->state ||
|
statec2 >= ep->param2->state ||
|
||||||
statel2 >= ep->param2->state ||
|
statel2 >= ep->param2->state ||
|
||||||
statep2 >= ep->param2->state ||
|
statep2 >= ep->param2->state ||
|
||||||
|
@ -3319,7 +3390,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
|
||||||
rp2[Rel1Y],
|
rp2[Rel1Y],
|
||||||
rp2[Rel2X],
|
rp2[Rel2X],
|
||||||
rp2[Rel2Y],
|
rp2[Rel2Y],
|
||||||
confine_to,
|
confine_to, threshold,
|
||||||
p2, mmw, mmh, pos);
|
p2, mmw, mmh, pos);
|
||||||
#ifdef EDJE_CALC_CACHE
|
#ifdef EDJE_CALC_CACHE
|
||||||
if (flags == FLAG_XY)
|
if (flags == FLAG_XY)
|
||||||
|
|
|
@ -139,8 +139,10 @@ _edje_mouse_down_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc
|
||||||
rp->drag->down.x = ev->canvas.x;
|
rp->drag->down.x = ev->canvas.x;
|
||||||
if (rp->part->dragable.y)
|
if (rp->part->dragable.y)
|
||||||
rp->drag->down.y = ev->canvas.y;
|
rp->drag->down.y = ev->canvas.y;
|
||||||
if (!ignored)
|
rp->drag->threshold_x = EINA_FALSE;
|
||||||
_edje_emit(ed, "drag,start", rp->part->name);
|
rp->drag->threshold_y = EINA_FALSE;
|
||||||
|
rp->drag->threshold_started_x = EINA_TRUE;
|
||||||
|
rp->drag->threshold_started_y = EINA_TRUE;
|
||||||
}
|
}
|
||||||
rp->drag->down.count++;
|
rp->drag->down.count++;
|
||||||
}
|
}
|
||||||
|
@ -201,14 +203,18 @@ _edje_mouse_up_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc E
|
||||||
rp->drag->down.count--;
|
rp->drag->down.count--;
|
||||||
if (rp->drag->down.count == 0)
|
if (rp->drag->down.count == 0)
|
||||||
{
|
{
|
||||||
|
rp->drag->threshold_started_x = EINA_FALSE;
|
||||||
|
rp->drag->threshold_started_y = EINA_FALSE;
|
||||||
rp->drag->need_reset = 1;
|
rp->drag->need_reset = 1;
|
||||||
ed->recalc_call = EINA_TRUE;
|
ed->recalc_call = EINA_TRUE;
|
||||||
ed->dirty = EINA_TRUE;
|
ed->dirty = EINA_TRUE;
|
||||||
#ifdef EDJE_CALC_CACHE
|
#ifdef EDJE_CALC_CACHE
|
||||||
rp->invalidate = 1;
|
rp->invalidate = 1;
|
||||||
#endif
|
#endif
|
||||||
if (!ignored)
|
if (!ignored && rp->drag->started)
|
||||||
_edje_emit(ed, "drag,stop", rp->part->name);
|
_edje_emit(ed, "drag,stop", rp->part->name);
|
||||||
|
rp->drag->started = EINA_FALSE;
|
||||||
|
_edje_recalc_do(ed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +312,12 @@ _edje_mouse_move_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc
|
||||||
rp->drag->val.x = dx;
|
rp->drag->val.x = dx;
|
||||||
rp->drag->val.y = dy;
|
rp->drag->val.y = dy;
|
||||||
if (!ignored)
|
if (!ignored)
|
||||||
|
{
|
||||||
|
if (!rp->drag->started)
|
||||||
|
_edje_emit(ed, "drag,start", rp->part->name);
|
||||||
_edje_emit(ed, "drag", rp->part->name);
|
_edje_emit(ed, "drag", rp->part->name);
|
||||||
|
rp->drag->started = EINA_TRUE;
|
||||||
|
}
|
||||||
ed->recalc_call = EINA_TRUE;
|
ed->recalc_call = EINA_TRUE;
|
||||||
ed->dirty = EINA_TRUE;
|
ed->dirty = EINA_TRUE;
|
||||||
#ifdef EDJE_CALC_CACHE
|
#ifdef EDJE_CALC_CACHE
|
||||||
|
|
|
@ -90,7 +90,27 @@ EMP(BOX, box);
|
||||||
EMP(TABLE, table);
|
EMP(TABLE, table);
|
||||||
EMP(EXTERNAL, external);
|
EMP(EXTERNAL, external);
|
||||||
EMP(SPACER, spacer);
|
EMP(SPACER, spacer);
|
||||||
EMP(part, part);
|
|
||||||
|
EAPI Eina_Mempool *_emp_part = NULL;
|
||||||
|
|
||||||
|
static void *
|
||||||
|
mem_alloc_part(size_t size)
|
||||||
|
{
|
||||||
|
Edje_Part *ep;
|
||||||
|
|
||||||
|
ep = eina_mempool_malloc(_emp_part, size);
|
||||||
|
memset(ep, 0, size);
|
||||||
|
// This value need to be defined for older file that didn't provide it
|
||||||
|
// as it should -1 by default instead of 0.
|
||||||
|
ep->dragable.threshold_id = -1;
|
||||||
|
return ep;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mem_free_part(void *data)
|
||||||
|
{
|
||||||
|
eina_mempool_free(_emp_part, data);
|
||||||
|
}
|
||||||
|
|
||||||
#define FREED(eed) \
|
#define FREED(eed) \
|
||||||
if (eed) \
|
if (eed) \
|
||||||
|
@ -956,6 +976,7 @@ _edje_edd_init(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.threshold_id", dragable.threshold_id, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element_pointer);
|
EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element_pointer);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR);
|
||||||
|
|
|
@ -688,6 +688,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
||||||
{
|
{
|
||||||
if (rp->part->dragable.confine_id >= 0)
|
if (rp->part->dragable.confine_id >= 0)
|
||||||
rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
|
rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
|
||||||
|
if (rp->part->dragable.threshold_id >= 0)
|
||||||
|
rp->drag->threshold = ed->table_parts[rp->part->dragable.threshold_id % ed->table_parts_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
|
if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
|
||||||
|
|
|
@ -942,6 +942,7 @@ struct _Edje_Part_Dragable
|
||||||
int count_y; /* drag area divided by n (0 = no limit) */
|
int count_y; /* drag area divided by n (0 = no limit) */
|
||||||
|
|
||||||
int confine_id; /* dragging within this bit, -1 = no */
|
int confine_id; /* dragging within this bit, -1 = no */
|
||||||
|
int threshold_id; /* dragging outside this bit, -1 = no */
|
||||||
|
|
||||||
/* davinchi */
|
/* davinchi */
|
||||||
int event_id; /* If it is used as scrollbar */
|
int event_id; /* If it is used as scrollbar */
|
||||||
|
@ -1487,8 +1488,14 @@ struct _Edje_Real_Part_Drag
|
||||||
struct {
|
struct {
|
||||||
int x, y; // 8
|
int x, y; // 8
|
||||||
} tmp;
|
} tmp;
|
||||||
unsigned char need_reset : 1; // 4
|
|
||||||
Edje_Real_Part *confine_to; // 4
|
Edje_Real_Part *confine_to; // 4
|
||||||
|
Edje_Real_Part *threshold; // 4
|
||||||
|
Eina_Bool need_reset : 1; // 4
|
||||||
|
Eina_Bool threshold_started_x : 1;
|
||||||
|
Eina_Bool threshold_started_y : 1;
|
||||||
|
Eina_Bool threshold_x : 1;
|
||||||
|
Eina_Bool threshold_y : 1;
|
||||||
|
Eina_Bool started : 1;
|
||||||
}; // 104
|
}; // 104
|
||||||
|
|
||||||
#define EDJE_RP_TYPE_NONE 0
|
#define EDJE_RP_TYPE_NONE 0
|
||||||
|
|
Loading…
Reference in New Issue