Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_embed.c ewl_notebook.c ewl_object.h 


Log Message:
Fix for bad max size on x86, slight re-organization of the test program, and
some progress on the notebook widget.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_embed.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_embed.c 18 Oct 2003 17:00:36 -0000      1.9
+++ ewl_embed.c 20 Oct 2003 05:05:48 -0000      1.10
@@ -271,7 +271,7 @@
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       printf("EWL Embedded Object configured at (%d, %d) and %u x %u\n",
+       printf("EWL Embedded Object configured at (%d, %d) and %d x %d\n",
                        ewl_object_get_current_x(EWL_OBJECT(w)),
                        ewl_object_get_current_y(EWL_OBJECT(w)),
                        ewl_object_get_current_w(EWL_OBJECT(w)),
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_notebook.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- ewl_notebook.c      18 Oct 2003 17:00:36 -0000      1.31
+++ ewl_notebook.c      20 Oct 2003 05:05:48 -0000      1.32
@@ -2,8 +2,14 @@
 
 
 void            __ewl_notebook_init(Ewl_Notebook * n);
-void            __ewl_notebook_configure(Ewl_Widget * w, void *ev_data,
-                                        void *user_data);
+void            __ewl_notebook_configure_top(Ewl_Widget * w, void *ev_data,
+                                            void *user_data);
+void            __ewl_notebook_configure_bottom(Ewl_Widget * w, void *ev_data,
+                                               void *user_data);
+void            __ewl_notebook_configure_left(Ewl_Widget * w, void *ev_data,
+                                             void *user_data);
+void            __ewl_notebook_configure_right(Ewl_Widget * w, void *ev_data,
+                                              void *user_data);
 void            __ewl_notebook_add(Ewl_Container *c, Ewl_Widget *w);
 void            __ewl_notebook_resize(Ewl_Container *c, Ewl_Widget *w, int size,
                                        Ewl_Orientation o);
@@ -64,8 +70,7 @@
         * notebook.
         */
        n->tab_box = ewl_hbox_new();
-       ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box),
-                                  EWL_FLAG_FILL_HFILL);
+       ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box), EWL_FLAG_FILL_NONE);
        ewl_object_set_alignment(EWL_OBJECT(n->tab_box), EWL_FLAG_ALIGN_LEFT |
                        EWL_FLAG_ALIGN_TOP);
        ewl_container_append_child(EWL_CONTAINER(n), n->tab_box);
@@ -74,8 +79,8 @@
        /*
         * Attach the necessary callbacks for the notebook
         */
-       ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, __ewl_notebook_configure,
-                           NULL);
+       ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+                           __ewl_notebook_configure_top, NULL);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -413,41 +418,69 @@
 
        w = EWL_WIDGET(n);
 
+       if (n->flags & p)
+               DRETURN(DLEVEL_STABLE);
+
+       switch (n->flags & EWL_POSITION_MASK) {
+               case EWL_POSITION_LEFT:
+                       ewl_callback_del(w, EWL_CALLBACK_CONFIGURE,
+                                        __ewl_notebook_configure_left);
+                       break;
+               case EWL_POSITION_RIGHT:
+                       ewl_callback_del(w, EWL_CALLBACK_CONFIGURE,
+                                        __ewl_notebook_configure_right);
+                       break;
+               case EWL_POSITION_BOTTOM:
+                       ewl_callback_del(w, EWL_CALLBACK_CONFIGURE,
+                                        __ewl_notebook_configure_bottom);
+                       break;
+               case EWL_POSITION_TOP:
+               default:
+                       ewl_callback_del(w, EWL_CALLBACK_CONFIGURE,
+                                        __ewl_notebook_configure_bottom);
+                       break;
+       }
+
        n->flags = (n->flags & ~EWL_POSITION_MASK) | p;
 
-       switch (n->flags) {
+       switch (n->flags & EWL_POSITION_MASK) {
                case EWL_POSITION_LEFT:
                        snprintf(file, PATH_MAX, "lnotebook");
                        ewl_box_set_orientation(EWL_BOX(n->tab_box),
                                        EWL_ORIENTATION_VERTICAL);
-                       ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box),
-                                       EWL_FLAG_FILL_VFILL);
+                       ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+                                           __ewl_notebook_configure_left,
+                                           NULL);
                        break;
                case EWL_POSITION_RIGHT:
                        snprintf(file, PATH_MAX, "rnotebook");
                        ewl_box_set_orientation(EWL_BOX(n->tab_box),
                                        EWL_ORIENTATION_VERTICAL);
-                       ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box),
-                                       EWL_FLAG_FILL_VFILL);
+                       ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+                                           __ewl_notebook_configure_right,
+                                           NULL);
                        break;
                case EWL_POSITION_BOTTOM:
                        snprintf(file, PATH_MAX, "bnotebook");
                        ewl_box_set_orientation(EWL_BOX(n->tab_box),
                                        EWL_ORIENTATION_HORIZONTAL);
-                       ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box),
-                                       EWL_FLAG_FILL_HFILL);
+                       ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+                                           __ewl_notebook_configure_bottom,
+                                           NULL);
                        break;
                case EWL_POSITION_TOP:
                default:
                        snprintf(file, PATH_MAX, "tnotebook");
                        ewl_box_set_orientation(EWL_BOX(n->tab_box),
                                        EWL_ORIENTATION_HORIZONTAL);
-                       ewl_object_set_fill_policy(EWL_OBJECT(n->tab_box),
-                                       EWL_FLAG_FILL_HFILL);
+                       ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
+                                           __ewl_notebook_configure_top,
+                                           NULL);
                        break;
        }
 
-       ewl_widget_set_appearance(EWL_WIDGET(w), file);
+       ewl_widget_set_appearance(w, file);
+       ewl_widget_configure(w);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -498,7 +531,8 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void __ewl_notebook_configure(Ewl_Widget * w, void *ev_data, void *user_data)
+void
+__ewl_notebook_configure_top(Ewl_Widget * w, void *ev_data, void *user_data)
 {
        Ewl_Notebook   *n;
        int x, y;
@@ -509,53 +543,17 @@
 
        n = EWL_NOTEBOOK(w);
 
-       /*
-        * Just try to give the tabs half the available space in the
-        * placement direction, and the full space in the alignment
-        * direction.
-        */
-       if (n->flags & EWL_POSITION_LEFT || n->flags & EWL_POSITION_RIGHT) {
-               width = CURRENT_W(n) / 2;
-               height = CURRENT_H(n);
-       }
-       else {
-               width = CURRENT_W(n);
-               height = CURRENT_H(n) / 2;
-       }
+       width = CURRENT_W(n);
+       height = CURRENT_H(n) / 2;
 
        ewl_object_request_size(EWL_OBJECT(n->tab_box), width, height);
        ewl_object_get_current_size(EWL_OBJECT(n->tab_box), &width, &height);
 
-       if (!(n->flags & EWL_POSITION_MASK) || n->flags & EWL_POSITION_TOP) {
-               ewl_object_request_position(EWL_OBJECT(n->tab_box),
-                               CURRENT_X(w), CURRENT_Y(w));
-               x = CURRENT_X(w);
-               y = CURRENT_Y(w) + height;
-               height = CURRENT_H(w) - height;
-       }
-       else if (n->flags & EWL_POSITION_BOTTOM) {
-               ewl_object_request_position(EWL_OBJECT(n->tab_box),
-                               CURRENT_X(w),
-                               CURRENT_Y(w) + CURRENT_H(w) - height);
-               x = CURRENT_X(w);
-               y = CURRENT_Y(w);
-               height = CURRENT_H(w) - height;
-       }
-       else if (n->flags & EWL_POSITION_LEFT) {
-               ewl_object_request_position(EWL_OBJECT(n->tab_box),
-                               CURRENT_X(w), CURRENT_Y(w));
-               x = CURRENT_X(w) + width;
-               y = CURRENT_Y(w);
-               width = CURRENT_W(w) - width;
-       }
-       else {
-               ewl_object_request_position(EWL_OBJECT(n->tab_box),
-                               CURRENT_X(w) + CURRENT_W(w) - width,
-                               CURRENT_Y(w));
-               x = CURRENT_X(w);
-               y = CURRENT_Y(w);
-               width = CURRENT_W(w) - width;
-       }
+       ewl_object_request_position(EWL_OBJECT(n->tab_box), CURRENT_X(w),
+                                   CURRENT_Y(w));
+       x = CURRENT_X(w);
+       y = CURRENT_Y(w) + height;
+       height = CURRENT_H(w) - height;
 
        if (n->visible_page)
                ewl_object_request_geometry(EWL_OBJECT(n->visible_page),
@@ -580,6 +578,102 @@
                ewl_widget_hide(nb->visible_page);
        nb->visible_page = page;
        ewl_widget_show(nb->visible_page);
+}
+
+void
+__ewl_notebook_configure_bottom(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       Ewl_Notebook   *n;
+       int x, y;
+       int width, height;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+
+       n = EWL_NOTEBOOK(w);
+
+       width = CURRENT_W(n);
+       height = CURRENT_H(n) / 2;
+
+       ewl_object_request_size(EWL_OBJECT(n->tab_box), width, height);
+       ewl_object_get_current_size(EWL_OBJECT(n->tab_box), &width, &height);
+
+       ewl_object_request_position(EWL_OBJECT(n->tab_box), CURRENT_X(w),
+                                   CURRENT_Y(w));
+       x = CURRENT_X(w);
+       y = CURRENT_Y(w) + height;
+       height = CURRENT_H(w) - height;
+
+       ewl_object_request_position(EWL_OBJECT(n->tab_box), CURRENT_X(w),
+                                   CURRENT_Y(w) + CURRENT_H(w) - height);
+       x = CURRENT_X(w);
+       y = CURRENT_Y(w);
+       height = CURRENT_H(w) - height;
+
+       if (n->visible_page)
+               ewl_object_request_geometry(EWL_OBJECT(n->visible_page),
+                               x, y, width, height);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void
+__ewl_notebook_configure_left(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       Ewl_Notebook   *n;
+       int x, y;
+       int width, height;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+
+       n = EWL_NOTEBOOK(w);
+
+       ewl_object_request_size(EWL_OBJECT(n->tab_box), width, height);
+       ewl_object_get_current_size(EWL_OBJECT(n->tab_box), &width, &height);
+
+       width = CURRENT_W(n) / 2;
+       height = CURRENT_H(n);
+
+       ewl_object_request_position(EWL_OBJECT(n->tab_box), CURRENT_X(w),
+                                   CURRENT_Y(w));
+       x = CURRENT_X(w) + width;
+       y = CURRENT_Y(w);
+       width = CURRENT_W(w) - width;
+
+       if (n->visible_page)
+               ewl_object_request_geometry(EWL_OBJECT(n->visible_page),
+                               x, y, width, height);
+}
+
+void
+__ewl_notebook_configure_right(Ewl_Widget * w, void *ev_data, void *user_data)
+{
+       Ewl_Notebook   *n;
+       int x, y;
+       int width, height;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+
+       n = EWL_NOTEBOOK(w);
+
+       ewl_object_request_size(EWL_OBJECT(n->tab_box), width, height);
+       ewl_object_get_current_size(EWL_OBJECT(n->tab_box), &width, &height);
+
+       width = CURRENT_W(n) / 2;
+       height = CURRENT_H(n);
+
+       ewl_object_request_position(EWL_OBJECT(n->tab_box),
+                                   CURRENT_X(w) + CURRENT_W(w) - width,
+                                   CURRENT_Y(w));
+       x = CURRENT_X(w);
+       y = CURRENT_Y(w);
+       width = CURRENT_W(w) - width;
+
+       if (n->visible_page)
+               ewl_object_request_geometry(EWL_OBJECT(n->visible_page),
+                               x, y, width, height);
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_object.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ewl_object.h        18 Oct 2003 17:00:36 -0000      1.36
+++ ewl_object.h        20 Oct 2003 05:05:48 -0000      1.37
@@ -12,11 +12,11 @@
 /**
  * @def EWL_OBJECT_MIN_SIZE The minimum possible size any object can receive.
  */
-#define EWL_OBJECT_MIN_SIZE 1
+#define EWL_OBJECT_MIN_SIZE (1)
 /**
  * @def EWL_OBJECT_MIN_SIZE The maximum possible size any object can receive.
  */
-#define EWL_OBJECT_MAX_SIZE (int)((unsigned int)(1 << 30) - 1)
+#define EWL_OBJECT_MAX_SIZE (2147483647)
 
 /**
  * The base class inherited by all widgets. Provides methods for size and




-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to