forked from enlightenment/efl
dragables are about complete now.. with new actions, page and step values....
all happy & smelly. SVN revision: 7395
This commit is contained in:
parent
b3c6f96f24
commit
df683295dd
|
@ -398,7 +398,7 @@ collections {
|
||||||
mouse_events, 1;
|
mouse_events, 1;
|
||||||
dragable {
|
dragable {
|
||||||
// drag in: DIR, ON/OFF STEPPING COUNT;
|
// drag in: DIR, ON/OFF STEPPING COUNT;
|
||||||
x, 1 1 0;
|
x, -1 1 0;
|
||||||
y, 1 1 0;
|
y, 1 1 0;
|
||||||
confine, "background";
|
confine, "background";
|
||||||
}
|
}
|
||||||
|
@ -476,6 +476,20 @@ collections {
|
||||||
in, 1.0 5.0;
|
in, 1.0 5.0;
|
||||||
action, SIGNAL_EMIT "do_random" "the_source";
|
action, SIGNAL_EMIT "do_random" "the_source";
|
||||||
}
|
}
|
||||||
|
program {
|
||||||
|
name, "logo_click_d1";
|
||||||
|
signal, "mouse,down,1";
|
||||||
|
source, "logo";
|
||||||
|
action, DRAG_VAL_STEP 1.0 1.0;
|
||||||
|
target, "dragable";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name, "logo_click_d2";
|
||||||
|
signal, "mouse,down,3";
|
||||||
|
source, "logo";
|
||||||
|
action, DRAG_VAL_STEP -1.0 -1.0;
|
||||||
|
target, "dragable";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ collections
|
||||||
name, "logo_click";
|
name, "logo_click";
|
||||||
signal, "mouse-down-1";
|
signal, "mouse-down-1";
|
||||||
source, "logo";
|
source, "logo";
|
||||||
// STATE_SET ot ACTION_STOP here
|
// STATE_SET, ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, DRAG_VAL_STEP, DRAG_VAL_PAGE
|
||||||
action, STATE_SET "clicked" 0.0;
|
action, STATE_SET "clicked" 0.0;
|
||||||
// LINEAR, SINUSOIDAL, ACCELERATE, DECELERATE, + seconds to transition over
|
// LINEAR, SINUSOIDAL, ACCELERATE, DECELERATE, + seconds to transition over
|
||||||
// transition, LINEAR 0.0;
|
// transition, LINEAR 0.0;
|
||||||
|
|
|
@ -241,6 +241,7 @@ statement_handler_num(void)
|
||||||
static void
|
static void
|
||||||
ob_images(void)
|
ob_images(void)
|
||||||
{
|
{
|
||||||
|
if (!edje_file->image_dir)
|
||||||
edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
|
edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +307,7 @@ st_data_item(void)
|
||||||
static void
|
static void
|
||||||
ob_collections(void)
|
ob_collections(void)
|
||||||
{
|
{
|
||||||
|
if (!edje_file->collection_dir)
|
||||||
edje_file->collection_dir = mem_alloc(SZ(Edje_Part_Collection_Directory));
|
edje_file->collection_dir = mem_alloc(SZ(Edje_Part_Collection_Directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +481,7 @@ st_collections_group_parts_part_dragable_x(void)
|
||||||
|
|
||||||
pc = evas_list_data(evas_list_last(edje_collections));
|
pc = evas_list_data(evas_list_last(edje_collections));
|
||||||
ep = evas_list_data(evas_list_last(pc->parts));
|
ep = evas_list_data(evas_list_last(pc->parts));
|
||||||
ep->dragable.x = parse_int_range(0, 0, 1);
|
ep->dragable.x = parse_int_range(0, -1, 1);
|
||||||
ep->dragable.step_x = parse_int_range(1, 0, 0x7fffffff);
|
ep->dragable.step_x = parse_int_range(1, 0, 0x7fffffff);
|
||||||
ep->dragable.count_x = parse_int_range(2, 0, 0x7fffffff);
|
ep->dragable.count_x = parse_int_range(2, 0, 0x7fffffff);
|
||||||
}
|
}
|
||||||
|
@ -492,7 +494,7 @@ st_collections_group_parts_part_dragable_y(void)
|
||||||
|
|
||||||
pc = evas_list_data(evas_list_last(edje_collections));
|
pc = evas_list_data(evas_list_last(edje_collections));
|
||||||
ep = evas_list_data(evas_list_last(pc->parts));
|
ep = evas_list_data(evas_list_last(pc->parts));
|
||||||
ep->dragable.y = parse_int_range(0, 0, 1);
|
ep->dragable.y = parse_int_range(0, -1, 1);
|
||||||
ep->dragable.step_y = parse_int_range(1, 0, 0x7fffffff);
|
ep->dragable.step_y = parse_int_range(1, 0, 0x7fffffff);
|
||||||
ep->dragable.count_y = parse_int_range(2, 0, 0x7fffffff);
|
ep->dragable.count_y = parse_int_range(2, 0, 0x7fffffff);
|
||||||
}
|
}
|
||||||
|
@ -1229,6 +1231,9 @@ st_collections_group_programs_program_action(void)
|
||||||
"STATE_SET", EDJE_ACTION_TYPE_STATE_SET,
|
"STATE_SET", EDJE_ACTION_TYPE_STATE_SET,
|
||||||
"ACTION_STOP", EDJE_ACTION_TYPE_ACTION_STOP,
|
"ACTION_STOP", EDJE_ACTION_TYPE_ACTION_STOP,
|
||||||
"SIGNAL_EMIT", EDJE_ACTION_TYPE_SIGNAL_EMIT,
|
"SIGNAL_EMIT", EDJE_ACTION_TYPE_SIGNAL_EMIT,
|
||||||
|
"DRAG_VAL_SET", EDJE_ACTION_TYPE_DRAG_VAL_SET,
|
||||||
|
"DRAG_VAL_STEP", EDJE_ACTION_TYPE_DRAG_VAL_STEP,
|
||||||
|
"DRAG_VAL_PAGE", EDJE_ACTION_TYPE_DRAG_VAL_PAGE,
|
||||||
NULL);
|
NULL);
|
||||||
if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
|
if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
|
||||||
{
|
{
|
||||||
|
@ -1240,6 +1245,21 @@ st_collections_group_programs_program_action(void)
|
||||||
ep->state = parse_str(1);
|
ep->state = parse_str(1);
|
||||||
ep->state2 = parse_str(2);
|
ep->state2 = parse_str(2);
|
||||||
}
|
}
|
||||||
|
else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
|
||||||
|
{
|
||||||
|
ep->value = parse_float(1);
|
||||||
|
ep->value2 = parse_float(2);
|
||||||
|
}
|
||||||
|
else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
|
||||||
|
{
|
||||||
|
ep->value = parse_float(1);
|
||||||
|
ep->value2 = parse_float(2);
|
||||||
|
}
|
||||||
|
else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
|
||||||
|
{
|
||||||
|
ep->value = parse_float(1);
|
||||||
|
ep->value2 = parse_float(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1279,6 +1299,12 @@ st_collections_group_programs_program_target(void)
|
||||||
data_queue_part_lookup(pc, name, &(et->id));
|
data_queue_part_lookup(pc, name, &(et->id));
|
||||||
else if (ep->action == EDJE_ACTION_TYPE_ACTION_STOP)
|
else if (ep->action == EDJE_ACTION_TYPE_ACTION_STOP)
|
||||||
data_queue_program_lookup(pc, name, &(et->id));
|
data_queue_program_lookup(pc, name, &(et->id));
|
||||||
|
else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
|
||||||
|
data_queue_part_lookup(pc, name, &(et->id));
|
||||||
|
else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
|
||||||
|
data_queue_part_lookup(pc, name, &(et->id));
|
||||||
|
else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
|
||||||
|
data_queue_part_lookup(pc, name, &(et->id));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME: not type specified. guess */
|
/* FIXME: not type specified. guess */
|
||||||
|
|
|
@ -447,7 +447,7 @@ list_head_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
static void
|
static void
|
||||||
cb (void *data, Evas_Object *o, const char *sig, const char *src)
|
cb (void *data, Evas_Object *o, const char *sig, const char *src)
|
||||||
{
|
{
|
||||||
// printf("CALLBACK for %p %p \"%s\" \"%s\"\n", data, o, sig, src);
|
printf("CALLBACK for %p %p \"%s\" \"%s\"\n", data, o, sig, src);
|
||||||
if (!strcmp(sig, "drag"))
|
if (!strcmp(sig, "drag"))
|
||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
|
@ -687,9 +687,11 @@ test_setup(char *file, char *name)
|
||||||
edje_object_file_set(o, file, name);
|
edje_object_file_set(o, file, name);
|
||||||
// edje_object_signal_callback_add(o, "do_it", "the_source", cb, NULL);
|
// edje_object_signal_callback_add(o, "do_it", "the_source", cb, NULL);
|
||||||
// edje_object_signal_callback_add(o, "mouse,*", "logo", cb, NULL);
|
// edje_object_signal_callback_add(o, "mouse,*", "logo", cb, NULL);
|
||||||
// edje_object_signal_callback_add(o, "*", "*", cb, NULL);
|
edje_object_signal_callback_add(o, "*", "*", cb, NULL);
|
||||||
// edje_object_part_drag_size_set(o, "dragable", 0.01, 0.5);
|
edje_object_part_drag_size_set(o, "dragable", 0.01, 0.5);
|
||||||
// edje_object_part_drag_value_set(o, "dragable", 0.5, 0.5);
|
// edje_object_part_drag_value_set(o, "dragable", 0.5, 0.5);
|
||||||
|
edje_object_part_drag_step_set(o, "dragable", 0.1, 0.1);
|
||||||
|
edje_object_part_drag_page_set(o, "dragable", 0.2, 0.2);
|
||||||
evas_object_move(o, 10 + 10, 10 + 20);
|
evas_object_move(o, 10 + 10, 10 + 20);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
edje_object_size_min_get(o, &(de->minw), &(de->minh));
|
edje_object_size_min_get(o, &(de->minw), &(de->minh));
|
||||||
|
|
|
@ -56,6 +56,12 @@ extern "C" {
|
||||||
void edje_object_part_drag_value_get (Evas_Object *o, const char *part, double *dx, double *dy);
|
void edje_object_part_drag_value_get (Evas_Object *o, const char *part, double *dx, double *dy);
|
||||||
void edje_object_part_drag_size_set (Evas_Object *o, const char *part, double dw, double dh);
|
void edje_object_part_drag_size_set (Evas_Object *o, const char *part, double dw, double dh);
|
||||||
void edje_object_part_drag_size_get (Evas_Object *o, const char *part, double *dw, double *dh);
|
void edje_object_part_drag_size_get (Evas_Object *o, const char *part, double *dw, double *dh);
|
||||||
|
void edje_object_part_drag_step_set (Evas_Object *o, const char *part, double dx, double dy);
|
||||||
|
void edje_object_part_drag_step_get (Evas_Object *o, const char *part, double *dx, double *dy);
|
||||||
|
void edje_object_part_drag_page_set (Evas_Object *o, const char *part, double dx, double dy);
|
||||||
|
void edje_object_part_drag_page_get (Evas_Object *o, const char *part, double *dx, double *dy);
|
||||||
|
void edje_object_part_drag_step (Evas_Object *o, const char *part, double dx, double dy);
|
||||||
|
void edje_object_part_drag_page (Evas_Object *o, const char *part, double dx, double dy);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ _edje_recalc(Edje *ed)
|
||||||
int
|
int
|
||||||
_edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y)
|
_edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y)
|
||||||
{
|
{
|
||||||
if ((ep->part->dragable.x) || (ep->part->dragable.y))
|
if ((ep->part->dragable.x != 0) || (ep->part->dragable.y != 0))
|
||||||
{
|
{
|
||||||
if (ep->confine_to)
|
if (ep->confine_to)
|
||||||
{
|
{
|
||||||
|
@ -221,9 +221,10 @@ _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if ((ep->part->dragable.x) && (ep->part->dragable.y)) ret = 3;
|
if ((ep->part->dragable.x != 0) &&
|
||||||
else if (ep->part->dragable.x) ret = 1;
|
(ep->part->dragable.y != 0 )) ret = 3;
|
||||||
else if (ep->part->dragable.y) ret = 2;
|
else if (ep->part->dragable.x != 0) ret = 1;
|
||||||
|
else if (ep->part->dragable.y != 0) ret = 2;
|
||||||
|
|
||||||
dx = ep->x - ep->confine_to->x;
|
dx = ep->x - ep->confine_to->x;
|
||||||
dw = ep->confine_to->w - ep->w;
|
dw = ep->confine_to->w - ep->w;
|
||||||
|
@ -725,7 +726,6 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
|
||||||
dx = 0;
|
dx = 0;
|
||||||
dy = 0;
|
dy = 0;
|
||||||
_edje_part_dragable_calc(ed, ep, &dx, &dy);
|
_edje_part_dragable_calc(ed, ep, &dx, &dy);
|
||||||
printf("%3.3f %3.3f\n", dx, dy);
|
|
||||||
ep->drag.x = dx;
|
ep->drag.x = dx;
|
||||||
ep->drag.y = dy;
|
ep->drag.y = dy;
|
||||||
ep->drag.tmp.x = 0;
|
ep->drag.tmp.x = 0;
|
||||||
|
|
|
@ -87,6 +87,7 @@ _edje_edd_setup(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state", state, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value2", value2, EET_T_DOUBLE);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.time", tween.time, EET_T_DOUBLE);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.time", tween.time, EET_T_DOUBLE);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "targets", targets, _edje_edd_edje_program_target);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "targets", targets, _edje_edd_edje_program_target);
|
||||||
|
|
|
@ -173,6 +173,9 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
||||||
rp = l->data;
|
rp = l->data;
|
||||||
evas_object_show(rp->object);
|
evas_object_show(rp->object);
|
||||||
if (_edje_block_break(ed)) break;
|
if (_edje_block_break(ed)) break;
|
||||||
|
if (rp->part->dragable.x < 0) rp->drag.val.x = 1.0;
|
||||||
|
if (rp->part->dragable.y < 0) rp->drag.val.x = 1.0;
|
||||||
|
_edje_dragable_pos_set(ed, rp, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
ed->dirty = 1;
|
ed->dirty = 1;
|
||||||
if ((ed->parts) && (evas_object_visible_get(obj)))
|
if ((ed->parts) && (evas_object_visible_get(obj)))
|
||||||
|
|
|
@ -16,14 +16,6 @@
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
*
|
|
||||||
* recursions, unsafe callbacks outside edje etc. with freeze, ref/unref and blobk/unblock and break_programs needs to be redesigned & fixed
|
|
||||||
* all unsafe calls that may result in callbacks must be marked and dealt with
|
|
||||||
*
|
|
||||||
* dragable needs to be able to reverse value affect for "other direction" drag
|
|
||||||
* dragable relative value needs to be able to be set or ++/-- by actions
|
|
||||||
* dragable needs to be able to affect rel/abs values of other parts
|
|
||||||
* dragable relative value needs to be able to be applied to other part vals.
|
|
||||||
*
|
*
|
||||||
* more example edje files
|
* more example edje files
|
||||||
*
|
*
|
||||||
|
@ -63,6 +55,9 @@
|
||||||
* ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
|
* ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
|
||||||
* ? text entry widget (single line only)
|
* ? text entry widget (single line only)
|
||||||
* ? reduce linked list walking and list_nth calls
|
* ? reduce linked list walking and list_nth calls
|
||||||
|
*
|
||||||
|
* ? recursions, unsafe callbacks outside edje etc. with freeze, ref/unref and blobk/unblock and break_programs needs to be redesigned & fixed
|
||||||
|
* ? all unsafe calls that may result in callbacks must be marked and dealt with
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _Edje_File Edje_File;
|
typedef struct _Edje_File Edje_File;
|
||||||
|
@ -106,7 +101,10 @@ typedef struct _Edje_Part_Description Edje_Part_Description;
|
||||||
#define EDJE_ACTION_TYPE_STATE_SET 1
|
#define EDJE_ACTION_TYPE_STATE_SET 1
|
||||||
#define EDJE_ACTION_TYPE_ACTION_STOP 2
|
#define EDJE_ACTION_TYPE_ACTION_STOP 2
|
||||||
#define EDJE_ACTION_TYPE_SIGNAL_EMIT 3
|
#define EDJE_ACTION_TYPE_SIGNAL_EMIT 3
|
||||||
#define EDJE_ACTION_TYPE_LAST 4
|
#define EDJE_ACTION_TYPE_DRAG_VAL_SET 4
|
||||||
|
#define EDJE_ACTION_TYPE_DRAG_VAL_STEP 5
|
||||||
|
#define EDJE_ACTION_TYPE_DRAG_VAL_PAGE 6
|
||||||
|
#define EDJE_ACTION_TYPE_LAST 7
|
||||||
|
|
||||||
#define EDJE_TWEEN_MODE_NONE 0
|
#define EDJE_TWEEN_MODE_NONE 0
|
||||||
#define EDJE_TWEEN_MODE_LINEAR 1
|
#define EDJE_TWEEN_MODE_LINEAR 1
|
||||||
|
@ -171,6 +169,7 @@ struct _Edje_Program /* a conditional program to be run */
|
||||||
char *state; /* what state of alternates to apply, NULL = default */
|
char *state; /* what state of alternates to apply, NULL = default */
|
||||||
char *state2; /* what other state to use - for signal emit action */
|
char *state2; /* what other state to use - for signal emit action */
|
||||||
double value; /* value of state to apply (if multiple names match) */
|
double value; /* value of state to apply (if multiple names match) */
|
||||||
|
double value2; /* other value for drag actions */
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int mode; /* how to tween - linear, sinusoidal etc. */
|
int mode; /* how to tween - linear, sinusoidal etc. */
|
||||||
|
@ -429,7 +428,7 @@ struct _Edje_Real_Part
|
||||||
char need_reset : 1;
|
char need_reset : 1;
|
||||||
struct {
|
struct {
|
||||||
double x, y;
|
double x, y;
|
||||||
} val, size;
|
} val, size, step, page;
|
||||||
} drag;
|
} drag;
|
||||||
struct {
|
struct {
|
||||||
char *text;
|
char *text;
|
||||||
|
|
|
@ -496,7 +496,89 @@ _edje_program_run(Edje *ed, Edje_Program *pr, int force)
|
||||||
_edje_emit(ed, "program,stop", pr->name);
|
_edje_emit(ed, "program,stop", pr->name);
|
||||||
if (_edje_block_break(ed)) goto break_prog;
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
}
|
}
|
||||||
if (pr->action != EDJE_ACTION_TYPE_STATE_SET)
|
else if (pr->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
|
||||||
|
{
|
||||||
|
_edje_emit(ed, "program,start", pr->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
for (l = pr->targets; l; l = l->next)
|
||||||
|
{
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
Edje_Program_Target *pt;
|
||||||
|
|
||||||
|
pt = l->data;
|
||||||
|
rp = evas_list_nth(ed->parts, pt->id);
|
||||||
|
if ((rp) && (rp->drag.down.count == 0))
|
||||||
|
{
|
||||||
|
rp->drag.val.x = pr->value;
|
||||||
|
rp->drag.val.y = pr->value2;
|
||||||
|
if (rp->drag.val.x < 0.0) rp->drag.val.x = 0.0;
|
||||||
|
else if (rp->drag.val.x > 1.0) rp->drag.val.x = 1.0;
|
||||||
|
if (rp->drag.val.y < 0.0) rp->drag.val.y = 0.0;
|
||||||
|
else if (rp->drag.val.y > 1.0) rp->drag.val.y = 1.0;
|
||||||
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
||||||
|
_edje_emit(ed, "drag,set", rp->part->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_edje_emit(ed, "program,stop", pr->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
}
|
||||||
|
else if (pr->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
|
||||||
|
{
|
||||||
|
_edje_emit(ed, "program,start", pr->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
for (l = pr->targets; l; l = l->next)
|
||||||
|
{
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
Edje_Program_Target *pt;
|
||||||
|
|
||||||
|
pt = l->data;
|
||||||
|
rp = evas_list_nth(ed->parts, pt->id);
|
||||||
|
if ((rp) && (rp->drag.down.count == 0))
|
||||||
|
{
|
||||||
|
rp->drag.val.x += pr->value * rp->drag.step.x * rp->part->dragable.x;
|
||||||
|
rp->drag.val.y += pr->value2 * rp->drag.step.y * rp->part->dragable.y;
|
||||||
|
if (rp->drag.val.x < 0.0) rp->drag.val.x = 0.0;
|
||||||
|
else if (rp->drag.val.x > 1.0) rp->drag.val.x = 1.0;
|
||||||
|
if (rp->drag.val.y < 0.0) rp->drag.val.y = 0.0;
|
||||||
|
else if (rp->drag.val.y > 1.0) rp->drag.val.y = 1.0;
|
||||||
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
||||||
|
_edje_emit(ed, "drag,step", rp->part->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_edje_emit(ed, "program,stop", pr->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
}
|
||||||
|
else if (pr->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
|
||||||
|
{
|
||||||
|
_edje_emit(ed, "program,start", pr->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
for (l = pr->targets; l; l = l->next)
|
||||||
|
{
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
Edje_Program_Target *pt;
|
||||||
|
|
||||||
|
pt = l->data;
|
||||||
|
rp = evas_list_nth(ed->parts, pt->id);
|
||||||
|
if ((rp) && (rp->drag.down.count == 0))
|
||||||
|
{
|
||||||
|
rp->drag.val.x += pr->value * rp->drag.page.x * rp->part->dragable.x;
|
||||||
|
rp->drag.val.y += pr->value2 * rp->drag.step.y * rp->part->dragable.y;
|
||||||
|
if (rp->drag.val.x < 0.0) rp->drag.val.x = 0.0;
|
||||||
|
else if (rp->drag.val.x > 1.0) rp->drag.val.x = 1.0;
|
||||||
|
if (rp->drag.val.y < 0.0) rp->drag.val.y = 0.0;
|
||||||
|
else if (rp->drag.val.y > 1.0) rp->drag.val.y = 1.0;
|
||||||
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
||||||
|
_edje_emit(ed, "drag,page", rp->part->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_edje_emit(ed, "program,stop", pr->name);
|
||||||
|
if (_edje_block_break(ed)) goto break_prog;
|
||||||
|
}
|
||||||
|
if (!((pr->action == EDJE_ACTION_TYPE_STATE_SET) &&
|
||||||
|
(pr->tween.time > 0.0) && (!ed->no_anim)))
|
||||||
{
|
{
|
||||||
if (pr->after >= 0)
|
if (pr->after >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -606,9 +606,13 @@ edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, d
|
||||||
else if (dx > 1.0) dx = 1.0;
|
else if (dx > 1.0) dx = 1.0;
|
||||||
if (dy < 0.0) dy = 0.0;
|
if (dy < 0.0) dy = 0.0;
|
||||||
else if (dy > 1.0) dy = 1.0;
|
else if (dy > 1.0) dy = 1.0;
|
||||||
|
if (rp->part->dragable.x < 0) dx = 1.0 - dx;
|
||||||
|
if (rp->part->dragable.y < 0) dy = 1.0 - dy;
|
||||||
|
if ((rp->drag.val.x == dx) && (rp->drag.val.y == dy)) return;
|
||||||
rp->drag.val.x = dx;
|
rp->drag.val.x = dx;
|
||||||
rp->drag.val.y = dy;
|
rp->drag.val.y = dy;
|
||||||
_edje_dragable_pos_set(ed, rp, dx, dy);
|
_edje_dragable_pos_set(ed, rp, dx, dy);
|
||||||
|
_edje_emit(ed, "drag,set", rp->part->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -616,6 +620,7 @@ edje_object_part_drag_value_get(Evas_Object *obj, const char *part, double *dx,
|
||||||
{
|
{
|
||||||
Edje *ed;
|
Edje *ed;
|
||||||
Edje_Real_Part *rp;
|
Edje_Real_Part *rp;
|
||||||
|
double ddx, ddy;
|
||||||
|
|
||||||
ed = _edje_fetch(obj);
|
ed = _edje_fetch(obj);
|
||||||
if ((!ed) || (!part))
|
if ((!ed) || (!part))
|
||||||
|
@ -631,8 +636,12 @@ edje_object_part_drag_value_get(Evas_Object *obj, const char *part, double *dx,
|
||||||
if (dy) *dy = 0;
|
if (dy) *dy = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dx) *dx = rp->drag.val.x;
|
ddx = rp->drag.val.x;
|
||||||
if (dy) *dy = rp->drag.val.y;
|
ddy = rp->drag.val.y;
|
||||||
|
if (rp->part->dragable.x < 0) ddx = 1.0 - ddx;
|
||||||
|
if (rp->part->dragable.y < 0) ddy = 1.0 - ddy;
|
||||||
|
if (dx) *dx = ddx;
|
||||||
|
if (dy) *dy = ddy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -655,6 +664,7 @@ edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, do
|
||||||
else if (dw > 1.0) dw = 1.0;
|
else if (dw > 1.0) dw = 1.0;
|
||||||
if (dh < 0.0) dh = 0.0;
|
if (dh < 0.0) dh = 0.0;
|
||||||
else if (dh > 1.0) dh = 1.0;
|
else if (dh > 1.0) dh = 1.0;
|
||||||
|
if ((rp->drag.size.x == dw) && (rp->drag.size.y == dh)) return;
|
||||||
rp->drag.size.x = dw;
|
rp->drag.size.x = dw;
|
||||||
rp->drag.size.y = dh;
|
rp->drag.size.y = dh;
|
||||||
ed->dirty = 1;
|
ed->dirty = 1;
|
||||||
|
@ -685,6 +695,166 @@ edje_object_part_drag_size_get(Evas_Object *obj, const char *part, double *dw, d
|
||||||
if (dh) *dh = rp->drag.size.y;
|
if (dh) *dh = rp->drag.size.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edje_object_part_drag_step_set(Evas_Object *obj, const char *part, double dx, double dy)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rp = _edje_real_part_get(ed, (char *)part);
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (rp->drag.down.count > 0) return;
|
||||||
|
if (dx < 0.0) dx = 0.0;
|
||||||
|
else if (dx > 1.0) dx = 1.0;
|
||||||
|
if (dy < 0.0) dy = 0.0;
|
||||||
|
else if (dy > 1.0) dy = 1.0;
|
||||||
|
rp->drag.step.x = dx;
|
||||||
|
rp->drag.step.y = dy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edje_object_part_drag_step_get(Evas_Object *obj, const char *part, double *dx, double *dy)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part))
|
||||||
|
{
|
||||||
|
if (dx) *dx = 0;
|
||||||
|
if (dy) *dy = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rp = _edje_real_part_get(ed, (char *)part);
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
if (dx) *dx = 0;
|
||||||
|
if (dy) *dy = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dx) *dx = rp->drag.step.x;
|
||||||
|
if (dy) *dy = rp->drag.step.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edje_object_part_drag_page_set(Evas_Object *obj, const char *part, double dx, double dy)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rp = _edje_real_part_get(ed, (char *)part);
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (rp->drag.down.count > 0) return;
|
||||||
|
if (dx < 0.0) dx = 0.0;
|
||||||
|
else if (dx > 1.0) dx = 1.0;
|
||||||
|
if (dy < 0.0) dy = 0.0;
|
||||||
|
else if (dy > 1.0) dy = 1.0;
|
||||||
|
rp->drag.page.x = dx;
|
||||||
|
rp->drag.page.y = dy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edje_object_part_drag_page_get(Evas_Object *obj, const char *part, double *dx, double *dy)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part))
|
||||||
|
{
|
||||||
|
if (dx) *dx = 0;
|
||||||
|
if (dy) *dy = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rp = _edje_real_part_get(ed, (char *)part);
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
if (dx) *dx = 0;
|
||||||
|
if (dy) *dy = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dx) *dx = rp->drag.page.x;
|
||||||
|
if (dy) *dy = rp->drag.page.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edje_object_part_drag_step(Evas_Object *obj, const char *part, double dx, double dy)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
double px, py;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rp = _edje_real_part_get(ed, (char *)part);
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (rp->drag.down.count > 0) return;
|
||||||
|
px = rp->drag.val.x;
|
||||||
|
py = rp->drag.val.y;
|
||||||
|
rp->drag.val.x += dx * rp->drag.step.x * rp->part->dragable.x;
|
||||||
|
rp->drag.val.y += dy * rp->drag.step.y * rp->part->dragable.y;
|
||||||
|
if (rp->drag.val.x < 0.0) rp->drag.val.x = 0.0;
|
||||||
|
else if (rp->drag.val.x > 1.0) rp->drag.val.x = 1.0;
|
||||||
|
if (rp->drag.val.y < 0.0) rp->drag.val.y = 0.0;
|
||||||
|
else if (rp->drag.val.y > 1.0) rp->drag.val.y = 1.0;
|
||||||
|
if ((px == rp->drag.val.x) && (py == rp->drag.val.y)) return;
|
||||||
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
||||||
|
_edje_emit(ed, "drag,step", rp->part->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edje_object_part_drag_page(Evas_Object *obj, const char *part, double dx, double dy)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
double px, py;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rp = _edje_real_part_get(ed, (char *)part);
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (rp->drag.down.count > 0) return;
|
||||||
|
px = rp->drag.val.x;
|
||||||
|
py = rp->drag.val.y;
|
||||||
|
rp->drag.val.x += dx * rp->drag.page.x * rp->part->dragable.x;
|
||||||
|
rp->drag.val.y += dy * rp->drag.page.y * rp->part->dragable.y;
|
||||||
|
if (rp->drag.val.x < 0.0) rp->drag.val.x = 0.0;
|
||||||
|
else if (rp->drag.val.x > 1.0) rp->drag.val.x = 1.0;
|
||||||
|
if (rp->drag.val.y < 0.0) rp->drag.val.y = 0.0;
|
||||||
|
else if (rp->drag.val.y > 1.0) rp->drag.val.y = 1.0;
|
||||||
|
if ((px == rp->drag.val.x) && (py == rp->drag.val.y)) return;
|
||||||
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
||||||
|
_edje_emit(ed, "drag,page", rp->part->name);
|
||||||
|
}
|
||||||
|
|
||||||
Edje_Real_Part *
|
Edje_Real_Part *
|
||||||
_edje_real_part_get(Edje *ed, char *part)
|
_edje_real_part_get(Edje *ed, char *part)
|
||||||
{
|
{
|
||||||
|
@ -809,4 +979,3 @@ _edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void *e
|
||||||
edje_obj = data;
|
edje_obj = data;
|
||||||
edje_object_part_unswallow(edje_obj, obj);
|
edje_object_part_unswallow(edje_obj, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue