Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_box.c ewl_object.h ewl_widget.c
Log Message:
Fixed a sizing bug in the box code.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_box.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ewl_box.c 14 Jan 2003 21:44:58 -0000 1.41
+++ ewl_box.c 29 Jan 2003 16:56:53 -0000 1.42
@@ -46,20 +46,20 @@
*/
static Ewd_List *spread = NULL;
-void __ewl_box_setup();
-void __ewl_box_add(Ewl_Container * c, Ewl_Widget * w);
-void __ewl_box_child_resize(Ewl_Container * c, Ewl_Widget * w,
+static void __ewl_box_setup();
+static void __ewl_box_add(Ewl_Container * c, Ewl_Widget * w);
+static void __ewl_box_child_resize(Ewl_Container * c, Ewl_Widget * w,
int size, Ewl_Orientation o);
-void __ewl_box_configure(Ewl_Widget * w, void *ev_data,
+static void __ewl_box_configure(Ewl_Widget * w, void *ev_data,
void *user_data);
-void __ewl_box_configure_calc(Ewl_Box * b, int *fill_size,
+static void __ewl_box_configure_calc(Ewl_Box * b, int *fill_size,
int *align_size);
-void __ewl_box_configure_fill(Ewl_Box * b, int *fill_size,
+static void __ewl_box_configure_fill(Ewl_Box * b, int *fill_size,
int *align_size);
-void __ewl_box_configure_layout(Ewl_Box * b, int *x, int *y,
+static void __ewl_box_configure_layout(Ewl_Box * b, int *x, int *y,
int *fill, int *align,
int *align_size);
-void __ewl_box_configure_child(Ewl_Box * b, Ewl_Object * c, int *x,
+static void __ewl_box_configure_child(Ewl_Box * b, Ewl_Object * c, int *x,
int *y, int *align, int *align_size);
/**
@@ -185,16 +185,19 @@
w = EWL_WIDGET(b);
- nodes = ewd_list_nodes(EWL_CONTAINER(b)->children) - 1;
+ nodes = ewd_list_nodes(EWL_CONTAINER(b)->children);
- if (b->orientation == EWL_ORIENTATION_HORIZONTAL)
- ewl_object_set_preferred_w(EWL_OBJECT(w),
- PREFERRED_W(w) - (nodes * b->spacing) +
- (nodes * s));
- else
- ewl_object_set_preferred_h(EWL_OBJECT(w),
- PREFERRED_H(w) - (nodes * b->spacing) +
- (nodes * s));
+ if (nodes) {
+ nodes--;
+ if (b->orientation == EWL_ORIENTATION_HORIZONTAL)
+ ewl_object_set_preferred_w(EWL_OBJECT(w),
+ PREFERRED_W(w) - (nodes * b->spacing) +
+ (nodes * s));
+ else
+ ewl_object_set_preferred_h(EWL_OBJECT(w),
+ PREFERRED_H(w) - (nodes * b->spacing) +
+ (nodes * s));
+ }
b->spacing = s;
@@ -203,7 +206,8 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-void __ewl_box_configure(Ewl_Widget * w, void *ev_data, void *user_data)
+static void
+__ewl_box_configure(Ewl_Widget * w, void *ev_data, void *user_data)
{
Ewl_Box *b;
@@ -226,7 +230,7 @@
* Get the starting values for the dimensions of the box.
*/
x = CURRENT_X(w);
- y = CURRENT_Y(EWL_OBJECT(w));
+ y = CURRENT_Y(w);
width = CURRENT_W(w);
height = CURRENT_H(w);
@@ -264,11 +268,6 @@
__ewl_box_configure_fill(b, fill_size, align_size);
/*
- * Center items to be laid out as best as possible.
- */
- /* *fill += *fill_size / 2; */
-
- /*
* Layout the children in their appropriate positions.
*/
__ewl_box_configure_layout(b, &x, &y, fill, align, align_size);
@@ -279,7 +278,8 @@
/*
* Split the children into three lists for layout.
*/
-void __ewl_box_configure_calc(Ewl_Box * b, int *fill_size, int *align_size)
+static void
+__ewl_box_configure_calc(Ewl_Box * b, int *fill_size, int *align_size)
{
Ewl_Object *child;
@@ -333,7 +333,8 @@
* Spread space to any widgets that have fill policy set to fill. This should
* not be called if @num_fill or *@fill_size are equal to zero.
*/
-void __ewl_box_configure_fill(Ewl_Box * b, int *fill_size, int *align_size)
+static void
+__ewl_box_configure_fill(Ewl_Box * b, int *fill_size, int *align_size)
{
int space;
int temp, remainder;
@@ -442,7 +443,7 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-void
+static void
__ewl_box_configure_layout(Ewl_Box * b, int *x, int *y, int *fill,
int *align, int *align_size)
{
@@ -476,7 +477,7 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
-void
+static void
__ewl_box_configure_child(Ewl_Box * b, Ewl_Object * c, int *x, int *y,
int *align, int *align_size)
{
@@ -516,11 +517,11 @@
/*
* When a child gets added to the box update it's size.
*/
-void __ewl_box_add(Ewl_Container * c, Ewl_Widget * w)
+static void
+__ewl_box_add(Ewl_Container * c, Ewl_Widget * w)
{
- int osize;
int max_size = 0;
- int temp;
+ int osize, temp;
Box_Orientation *info;
DCHECK_PARAM_PTR("c", c);
@@ -559,6 +560,8 @@
info->pref_align_set(EWL_OBJECT(c), temp);
}
+ temp = info->pref_fill_ask(EWL_OBJECT(w));
+
/*
* Add the size of the new child, and add in the spacing if there's
* any other widgets in the box.
@@ -572,7 +575,7 @@
* Determine the preferred size of the box when a child changes it's preferred
* size.
*/
-void
+static void
__ewl_box_child_resize(Ewl_Container * c, Ewl_Widget * w, int size,
Ewl_Orientation o)
{
@@ -643,24 +646,19 @@
info->pref_align_set(EWL_OBJECT(c), max_size);
}
- /*
- printf("Box %p resized to %d x %d\n", c,
- ewl_object_get_preferred_w(EWL_OBJECT(c)),
- ewl_object_get_preferred_h(EWL_OBJECT(c)));
- */
-
max_size = 0;
ewd_list_goto_first(c->children);
while ((child = ewd_list_next(c->children)))
- max_size += ewl_object_get_preferred_h(child);
- printf("\tChildren heights add to %d\n", max_size);
+ max_size += ewl_object_get_preferred_h(child) + EWL_BOX(c)->spacing;
+ max_size -= EWL_BOX(c)->spacing;
}
/*
* Setup some internal variables for effectively laying out the children based
* on orientation.
*/
-void __ewl_box_setup()
+static void
+__ewl_box_setup()
{
if (!vertical) {
vertical = NEW(Box_Orientation, 1);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_object.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_object.h 14 Jan 2003 21:45:03 -0000 1.26
+++ ewl_object.h 29 Jan 2003 16:56:54 -0000 1.27
@@ -11,11 +11,11 @@
struct _ewl_object {
struct {
int x, y;
- int w, h;
+ unsigned int w, h;
} current;
struct {
- int w, h;
+ unsigned int w, h;
} preferred, maximum, minimum;
/*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ewl_widget.c 14 Jan 2003 21:45:06 -0000 1.43
+++ ewl_widget.c 29 Jan 2003 16:56:54 -0000 1.44
@@ -551,8 +551,6 @@
*/
void __ewl_widget_show(Ewl_Widget * w, void *ev_data, void *user_data)
{
- Ewl_Window *win;
-
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
@@ -567,8 +565,6 @@
*/
void __ewl_widget_hide(Ewl_Widget * w, void *ev_data, void *user_data)
{
- Ewl_Window *win;
-
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs