nuke some FIXME's. smooth parameter now added for fills. program infinite

loops are now detected and limited to a recursion limit of 64 levels.


SVN revision: 7103
This commit is contained in:
Carsten Haitzler 2003-06-28 03:08:25 +00:00
parent 626d2b9981
commit 62d66a7d63
7 changed files with 68 additions and 3 deletions

View File

@ -184,6 +184,11 @@ collections {
image {
normal, "e.png";
}
/*
fill {
smooth, 0;
}
*/
}
description {
state, "clicked" 0.0;
@ -348,6 +353,9 @@ collections {
name, "logo_click";
signal, "mouse,down,1";
source, "logo";
// test to see if program loops can be avoided
// signal, "*";
// source, "*";
action, STATE_SET "clicked" 0.0;
transition, LINEAR, 0.0;
target, "logo";

View File

@ -65,6 +65,7 @@ collections
border, 12 12 12 12;
// fill
// {
// smooth, 1;
// origin
// {
// relative, 0.0 0.0;

View File

@ -40,6 +40,7 @@ static void st_collections_group_parts_part_description_rel2_to(void);
static void st_collections_group_parts_part_description_image_normal(void);
static void st_collections_group_parts_part_description_image_tween(void);
static void st_collections_group_parts_part_description_border(void);
static void st_collections_group_parts_part_description_fill_smooth(void);
static void st_collections_group_parts_part_description_fill_origin_relative(void);
static void st_collections_group_parts_part_description_fill_origin_offset(void);
static void st_collections_group_parts_part_description_fill_size_relative(void);
@ -97,6 +98,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.description.image.normal", st_collections_group_parts_part_description_image_normal},
{"collections.group.parts.part.description.image.tween", st_collections_group_parts_part_description_image_tween},
{"collections.group.parts.part.description.border", st_collections_group_parts_part_description_border},
{"collections.group.parts.part.description.fill.smooth", st_collections_group_parts_part_description_fill_smooth},
{"collections.group.parts.part.description.fill.origin.relative", st_collections_group_parts_part_description_fill_origin_relative},
{"collections.group.parts.part.description.fill.origin.offset", st_collections_group_parts_part_description_fill_origin_offset},
{"collections.group.parts.part.description.fill.size.relative", st_collections_group_parts_part_description_fill_size_relative},
@ -160,6 +162,7 @@ New_Object_Handler object_handlers[] =
{"collections.group.parts.part.description.image.tween", NULL},
{"collections.group.parts.part.description.border", NULL},
{"collections.group.parts.part.description.fill", NULL},
{"collections.group.parts.part.description.fill.smooth", NULL},
{"collections.group.parts.part.description.fill.origin", NULL},
{"collections.group.parts.part.description.fill.origin.relative", NULL},
{"collections.group.parts.part.description.fill.origin.offset", NULL},
@ -418,6 +421,7 @@ ob_collections_group_parts_part_description(void)
ed->rel2.offset_x = -1;
ed->rel2.id = -1;
ed->image.id = -1;
ed->fill.smooth = 1;
ed->fill.pos_rel_x = 0.0;
ed->fill.pos_abs_x = 0;
ed->fill.rel_x = 1.0;
@ -756,6 +760,20 @@ st_collections_group_parts_part_description_border(void)
ed->border.b = parse_int_range(3, 0, 0x7fffffff);
}
static void
st_collections_group_parts_part_description_fill_smooth(void)
{
Edje_Part_Collection *pc;
Edje_Part *ep;
Edje_Part_Description *ed;
pc = evas_list_data(evas_list_last(edje_collections));
ep = evas_list_data(evas_list_last(pc->parts));
ed = ep->default_desc;
if (ep->other_desc) ed = evas_list_data(evas_list_last(ep->other_desc));
ed->fill.smooth = parse_int_range(0, 0, 1);
}
static void
st_collections_group_parts_part_description_fill_origin_relative(void)
{

View File

@ -453,6 +453,7 @@ _edje_part_recalc_single(Edje *ed,
params->y += ep->drag.y;
}
/* fill */
params->smooth = desc->fill.smooth;
params->fill.x = desc->fill.pos_abs_x + (params->w * desc->fill.pos_rel_x);
params->fill.w = desc->fill.abs_x + (params->w * desc->fill.rel_x);
params->fill.y = desc->fill.pos_abs_y + (params->h * desc->fill.pos_rel_y);
@ -526,6 +527,11 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
}
else
p3.visible = p1.visible;
if (pos < 0.5)
p3.smooth = p1.smooth;
else
p3.smooth = p2.smooth;
p3.x = (p1.x * (1.0 - pos)) + (p2.x * (pos));
p3.y = (p1.y * (1.0 - pos)) + (p2.y * (pos));
@ -579,6 +585,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
evas_object_move(ep->object, ed->x + p3.x, ed->y + p3.y);
evas_object_resize(ep->object, p3.w, p3.h);
evas_object_image_fill_set(ep->object, p3.fill.x, p3.fill.y, p3.fill.w, p3.fill.h);
evas_object_image_smooth_scale_set(ep->object, p3.smooth);
// printf("fill %3.3f %3.3f %3.3fx%3.3f\n", p3.fill.x, p3.fill.y, p3.fill.w, p3.fill.h);
evas_object_image_border_set(ep->object, p3.border.l, p3.border.r, p3.border.t, p3.border.b);

View File

@ -160,6 +160,7 @@ _edje_edd_setup(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.r", border.r, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.t", border.t, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.b", border.b, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.smooth", fill.smooth, EET_T_CHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_rel_x", fill.pos_rel_x, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.pos_abs_x", fill.pos_abs_x, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "fill.rel_x", fill.rel_x, EET_T_DOUBLE);

View File

@ -11,7 +11,6 @@
#include <fnmatch.h>
/* FIXME:
* add a smooth scale option to fill params
* need "random" signals and events for hooking to, and "random" durations
* free stuff - no more leaks
* dragables have to work
@ -33,11 +32,11 @@
* need to be able to force anim times to 0.0 from API to turn off animation
* need to detect relative part loops
* need to detect clip_to part loops
* need to detect anim time 0.0 loops
* edje_cc should be able to force lossy, lossless, min and max quality and compression of encoded images
* edje_cc needs to prune out unused images
* edje_cc might need an option for limiting number of tween images
* audit edje for corrupt/bad input files
* ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
* ? somehow handle double click?
* ? add numeric params to conditions for progs (ranges etc.)
* ? containering for multiple children? (hbox, vbox, table, wrapping list)
@ -283,6 +282,7 @@ struct _Edje_Part_Description
} border;
struct {
char smooth; /* fill with smooth scaling or not */
double pos_rel_x; /* fill offset x relative to area */
int pos_abs_x; /* fill offset x added to fill offset */
double rel_x; /* relative size compared to area */
@ -406,6 +406,7 @@ struct _Edje_Calc_Params
{
double x, y, w, h;
char visible : 1;
char smooth : 1;
struct {
double x, y, w, h;
} fill;

View File

@ -209,7 +209,16 @@ void
_edje_program_run(Edje *ed, Edje_Program *pr)
{
Evas_List *l;
/* limit self-feeding loops in programs to 64 levels */
static int recursions = 0;
static int recursion_limit = 0;
if ((recursions >= 64) || (recursion_limit))
{
recursion_limit = 1;
return;
}
recursions++;
_edje_freeze(ed);
_edje_ref(ed);
_edje_emit(ed, "program,start", pr->name);
@ -302,6 +311,8 @@ _edje_program_run(Edje *ed, Edje_Program *pr)
}
_edje_unref(ed);
_edje_thaw(ed);
recursions--;
if (recursions == 0) recursion_limit = 0;
}
void
@ -310,12 +321,26 @@ _edje_emit(Edje *ed, char *sig, char *src)
Evas_List *l;
static Evas_List *emissions = NULL;
Edje_Emission *ee;
/* limit self-feeding loops in callbacks to 64 levels */
static int recursions = 0;
static int recursion_limit = 0;
if ((recursions >= 64) || (recursion_limit))
{
recursion_limit = 1;
return;
}
recursions++;
_edje_ref(ed);
_edje_freeze(ed);
printf("EMIT \"%s\" \"%s\"\n", sig, src);
ee = calloc(1, sizeof(Edje_Emission));
if (!ee) return;
if (!ee)
{
recursions--;
if (recursions == 0) recursion_limit = 0;
return;
}
ee->signal = strdup(sig);
ee->source = strdup(src);
if (emissions)
@ -323,6 +348,8 @@ _edje_emit(Edje *ed, char *sig, char *src)
emissions = evas_list_append(emissions, ee);
_edje_thaw(ed);
_edje_unref(ed);
recursions--;
if (recursions == 0) recursion_limit = 0;
return;
}
else
@ -385,4 +412,6 @@ _edje_emit(Edje *ed, char *sig, char *src)
}
_edje_thaw(ed);
_edje_unref(ed);
recursions--;
if (recursions == 0) recursion_limit = 0;
}