Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/lib
Modified Files:
Edje.h edje_calc.c edje_data.c edje_load.c edje_private.h
edje_util.c
Log Message:
min.max size properties now per edje collection can be specified in the edje
.edc file and can be accessed. the min_size_get has become a min_size_calc
since it does actually calculate it.
also swallowed edjes will be queried for their own min/max size and that will
be used to further limit the part that swallows. also you can attach
properties to any old evas object so it will have min/max size properties
(maybe one day this can go into evas itself?). also swallowed objects if
deleted before the parent edje will "unswallow" themselves properly :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Edje.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- Edje.h 16 Jul 2003 13:50:28 -0000 1.14
+++ Edje.h 20 Jul 2003 12:37:49 -0000 1.15
@@ -13,6 +13,9 @@
void edje_freeze (void);
void edje_thaw (void);
+ void edje_extern_object_min_size_set (Evas_Object *obj, double minw,
double minh);
+ void edje_extern_object_max_size_set (Evas_Object *obj, double maxw,
double maxh);
+
Evas_Object *edje_object_add (Evas *evas);
void edje_object_file_set (Evas_Object *o, const char *file,
const char *part);
void edje_object_file_get (Evas_Object *o, const char **file,
const char **part);
@@ -28,6 +31,8 @@
void edje_object_color_class_set (Evas_Object *o, const char
*color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int
g3, int b3, int a3);
void edje_object_text_class_set (Evas_Object *o, const char
*text_class, const char *font, double size);
void edje_object_size_min_get (Evas_Object *o, double *minw, double
*minh);
+ void edje_object_size_max_get (Evas_Object *o, double *maxw, double
*maxh);
+ void edje_object_size_min_calc (Evas_Object *o, double *minw, double
*minh);
int edje_object_part_exists (Evas_Object *o, const char *part);
void edje_object_part_geometry_get (Evas_Object *o, const char *part,
double *x, double *y, double *w, double *h);
void edje_object_part_text_set (Evas_Object *o, const char *part,
const char *text);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- edje_calc.c 16 Jul 2003 13:50:28 -0000 1.7
+++ edje_calc.c 20 Jul 2003 12:37:49 -0000 1.8
@@ -201,7 +201,7 @@
Edje_Real_Part *confine_to,
Edje_Calc_Params *params)
{
- int minw, minh;
+ int minw, minh, maxw, maxh;
/* relative coords of top left & bottom right */
if (rel1_to)
@@ -322,6 +322,8 @@
}
minw = desc->min.w;
minh = desc->min.h;
+ if (ep->swallow_params.min.w > desc->min.w) minw = ep->swallow_params.min.w;
+ if (ep->swallow_params.min.h > desc->min.h) minh = ep->swallow_params.min.h;
/* if we have text that wants to make the min size the text size... */
if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXT))
{
@@ -385,23 +387,29 @@
params->h = minh;
}
}
+ maxw = desc->max.w;
+ maxh = desc->max.h;
+ if ((ep->swallow_params.max.w > 0) &&
+ (ep->swallow_params.max.w < maxw)) maxw = ep->swallow_params.max.w;
+ if ((ep->swallow_params.max.h > 0) &&
+ (ep->swallow_params.max.h < maxh)) maxh = ep->swallow_params.max.h;
/* adjust for max size */
- if (desc->max.w >= 0)
+ if (maxw >= 0)
{
- if (params->w > desc->max.w)
+ if (params->w > maxw)
{
params->x = params->x +
- ((params->w - desc->max.w) * desc->align.x);
- params->w = desc->max.w;
+ ((params->w - maxw) * desc->align.x);
+ params->w = maxw;
}
}
- if (desc->max.h >= 0)
+ if (maxh >= 0)
{
- if (params->h > desc->max.h)
+ if (params->h > maxh)
{
params->y = params->y +
- ((params->h - desc->max.h) * desc->align.y);
- params->h = desc->max.h;
+ ((params->h - maxh) * desc->align.y);
+ params->h = maxh;
}
}
/* confine */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_data.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- edje_data.c 15 Jul 2003 08:26:06 -0000 1.6
+++ edje_data.c 20 Jul 2003 12:37:49 -0000 1.7
@@ -177,5 +177,9 @@
Edje_Part_Collection);
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_collection, Edje_Part_Collection,
"programs", programs, _edje_edd_edje_program);
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_collection, Edje_Part_Collection,
"parts", parts, _edje_edd_edje_part);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection,
Edje_Part_Collection, "prop.min.w", prop.min.w, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection,
Edje_Part_Collection, "prop.min.h", prop.min.h, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection,
Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection,
Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection,
Edje_Part_Collection, "id", id, EET_T_INT);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- edje_load.c 20 Jul 2003 02:08:47 -0000 1.12
+++ edje_load.c 20 Jul 2003 12:37:49 -0000 1.13
@@ -243,7 +243,13 @@
rp = ed->parts->data;
_edje_text_part_on_del(ed, rp);
evas_object_del(rp->object);
- if (rp->swallowed_object) evas_object_del(rp->swallowed_object);
+ if (rp->swallowed_object)
+ {
+ evas_object_event_callback_del(rp->swallowed_object,
+ EVAS_CALLBACK_FREE,
+ _edje_object_part_swallow_free_cb);
+ evas_object_del(rp->swallowed_object);
+ }
if (rp->text.text) free(rp->text.text);
if (rp->text.font) free(rp->text.font);
if (rp->text.cache.in_str) free(rp->text.cache.in_str);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- edje_private.h 20 Jul 2003 02:08:47 -0000 1.33
+++ edje_private.h 20 Jul 2003 12:37:49 -0000 1.34
@@ -17,8 +17,6 @@
/* FIXME:
*
- * free stuff - no more leaks
- *
* dragables have to work
* drag start/top signals etc.
* drag needs to have signals with relative pos as arg.
@@ -26,8 +24,6 @@
* query dragable for its relative pos value
* dragable needs to be able to affext rel/abs values of other parts
*
- * swallowed objects need to be able to advertise min/max size
- *
* need to be able to list collections in an eet file
*
* externally sourced images need to be supported in edje_cc and edje
@@ -182,7 +178,14 @@
int id; /* the collection id */
+ struct {
+ struct {
+ int w, h;
+ } min, max;
+ } prop;
+
int references;
+
struct {
Evas_Hash *no_matches;
Evas_Hash *matches;
@@ -362,6 +365,11 @@
Evas_Object *object;
Evas_List *extra_objects;
Evas_Object *swallowed_object;
+ struct {
+ struct {
+ int w, h;
+ } min, max;
+ } swallow_params;
unsigned char calculated : 1;
unsigned char still_in : 1;
int clicked_button;
@@ -519,6 +527,7 @@
int _edje_glob_match(char *str, char *glob);
int _edje_freeze(Edje *ed);
int _edje_thaw(Edje *ed);
+void _edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object
*obj, void *event_info);
extern Eet_Data_Descriptor *_edje_edd_edje_file;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- edje_util.c 16 Jul 2003 13:50:28 -0000 1.12
+++ edje_util.c 20 Jul 2003 12:37:49 -0000 1.13
@@ -241,6 +241,7 @@
{
Edje *ed;
Edje_Real_Part *rp;
+ char *type;
ed = _edje_fetch(obj);
if ((!ed) || (!part)) return;
@@ -248,6 +249,9 @@
if (!rp) return;
if (rp->swallowed_object)
{
+ evas_object_event_callback_del(rp->swallowed_object,
+ EVAS_CALLBACK_FREE,
+ _edje_object_part_swallow_free_cb);
evas_object_clip_unset(rp->swallowed_object);
rp->swallowed_object = NULL;
}
@@ -255,11 +259,76 @@
rp->swallowed_object = obj_swallow;
evas_object_clip_set(rp->swallowed_object, ed->clipper);
evas_object_stack_above(rp->swallowed_object, rp->object);
+ evas_object_event_callback_add(rp->swallowed_object,
+ EVAS_CALLBACK_FREE,
+ _edje_object_part_swallow_free_cb,
+ obj);
+ type = (char *)evas_object_type_get(obj_swallow);
+ if ((type) && (!strcmp(type, "edje")))
+ {
+ double w, h;
+
+ edje_object_size_min_get(obj_swallow, &w, &h);
+ rp->swallow_params.min.w = w;
+ rp->swallow_params.min.h = h;
+ edje_object_size_max_get(obj_swallow, &w, &h);
+ rp->swallow_params.max.w = w;
+ rp->swallow_params.max.h = h;
+ }
+ else
+ {
+ rp->swallow_params.min.w =
+ (int)evas_object_data_get(obj_swallow, "\377 edje.minw");
+ rp->swallow_params.min.h =
+ (int)evas_object_data_get(obj_swallow, "\377 edje.minh");
+ rp->swallow_params.max.w =
+ (int)evas_object_data_get(obj_swallow, "\377 edje.maxw");
+ rp->swallow_params.max.h =
+ (int)evas_object_data_get(obj_swallow, "\377 edje.maxh");
+ }
ed->dirty = 1;
_edje_recalc(ed);
}
void
+edje_extern_object_min_size_set(Evas_Object *obj, double minw, double minh)
+{
+ int mw, mh;
+
+ mw = minw;
+ if (mw < 0) mw = 0;
+ mh = minh;
+ if (mh < 0) mh = 0;
+ if (mw > 0)
+ evas_object_data_set(obj, "\377 edje.minw", (void *)mw);
+ else
+ evas_object_data_del(obj, "\377 edje.minw");
+ if (mh > 0)
+ evas_object_data_set(obj, "\377 edje.minh", (void *)mh);
+ else
+ evas_object_data_del(obj, "\377 edje.maxw");
+}
+
+void
+edje_extern_object_max_size_set(Evas_Object *obj, double maxw, double maxh)
+{
+ int mw, mh;
+
+ mw = maxw;
+ if (mw < 0) mw = 0;
+ mh = maxh;
+ if (mh < 0) mh = 0;
+ if (mw > 0)
+ evas_object_data_set(obj, "\377 edje.maxw", (void *)mw);
+ else
+ evas_object_data_del(obj, "\377 edje.maxw");
+ if (mh > 0)
+ evas_object_data_set(obj, "\377 edje.maxh", (void *)mh);
+ else
+ evas_object_data_del(obj, "\377 edje.maxh");
+}
+
+void
edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
{
Edje *ed;
@@ -276,6 +345,10 @@
{
evas_object_clip_unset(rp->swallowed_object);
rp->swallowed_object = NULL;
+ rp->swallow_params.min.w = 0;
+ rp->swallow_params.min.h = 0;
+ rp->swallow_params.max.w = 0;
+ rp->swallow_params.max.h = 0;
ed->dirty = 1;
_edje_recalc(ed);
return;
@@ -300,11 +373,63 @@
edje_object_size_min_get(Evas_Object *obj, double *minw, double *minh)
{
Edje *ed;
+
+ ed = _edje_fetch(obj);
+ if (!ed)
+ {
+ if (minw) *minw = 0;
+ if (minh) *minh = 0;
+ return;
+ }
+ if (minw) *minw = ed->collection->prop.min.w;
+ if (minh) *minh = ed->collection->prop.min.h;
+}
+
+void
+edje_object_size_max_get(Evas_Object *obj, double *maxw, double *maxh)
+{
+ Edje *ed;
+
+ ed = _edje_fetch(obj);
+ if (!ed)
+ {
+ if (maxw) *maxw = 0;
+ if (maxh) *maxh = 0;
+ return;
+ }
+ if (ed->collection->prop.max.w == 0)
+ {
+ if (maxw) *maxw = 1e+37;
+ }
+ else
+ {
+ if (maxw) *maxw = ed->collection->prop.max.w;
+ }
+ if (ed->collection->prop.max.h == 0)
+ {
+ if (maxh) *maxh = 1e+37;
+ }
+ else
+ {
+ if (maxh) *maxh = ed->collection->prop.max.h;
+ }
+}
+
+void
+edje_object_size_min_calc(Evas_Object *obj, double *minw, double *minh)
+{
+ Edje *ed;
double pw, ph;
int maxw, maxh;
int ok;
ed = _edje_fetch(obj);
+ if (!ed)
+ {
+ if (minw) *minw = 0;
+ if (minh) *minh = 0;
+ return;
+ }
ed->calc_only = 1;
pw = ed->w;
ph = ed->h;
@@ -485,3 +610,13 @@
_edje_recalc(ed);
return ed->freeze;
}
+
+void
+_edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void
*event_info)
+{
+ Evas_Object *edje_obj;
+
+ edje_obj = data;
+ edje_object_part_unswallow(edje_obj, obj);
+}
+
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs