Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_paned.c 


Log Message:
- use the preferred size of the widget by default instead of equal widths
  between widgets
- if the preferred size isnt' available then we use the miniumn size and
  distribute the extra space evenly.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_paned.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_paned.c 29 Dec 2005 17:12:09 -0000      1.14
+++ ewl_paned.c 4 Jan 2006 02:53:24 -0000       1.15
@@ -464,12 +464,15 @@
                if ((CURRENT_X(cur) < CURRENT_X(p)))
                {
                        int panes, pane_size, grabbers, grab_size, i;
+                       int pref_size = 0, min_size = 0, use_min = 0, extra = 0;
                        Ewl_Widget *skip;
 
                        /* the previous widget and this grabber */
                        panes = 1;
                        grabbers = 1;
                        grab_size = CURRENT_W(cur);
+                       pref_size = 
ewl_object_preferred_w_get(EWL_OBJECT(prev));
+                       min_size = ewl_object_minimum_w_get(EWL_OBJECT(prev));
                        pane_size = 0; 
                        skip = cur;
 
@@ -479,6 +482,10 @@
                                if (!ewl_widget_internal_is(skip))
                                {
                                        panes ++;
+                                       pref_size += ewl_object_preferred_w_get(
+                                                               
EWL_OBJECT(skip));
+                                       min_size += ewl_object_minimum_w_get(
+                                                               
EWL_OBJECT(skip));
                                        continue;
                                }
                                
@@ -493,13 +500,15 @@
 
                        /* we have a grabber thats been placed,
                         * calculate the size per pane */
-                       if (skip)
-                               pane_size = CURRENT_X(skip) - cur_pos;
-                       else
-                               pane_size = CURRENT_W(p) - cur_pos;
+                       if (skip) pane_size = CURRENT_X(skip) - cur_pos;
+                       else pane_size = CURRENT_W(p) - cur_pos;
 
                        pane_size -= grab_size;
-                       pane_size /= panes;
+                       if (pane_size < pref_size)
+                       {
+                               extra = (pane_size - min_size) / panes;
+                               use_min = 1;
+                       }
 
                        ecore_list_goto(c->children, prev);
                        i = 0;
@@ -516,11 +525,23 @@
                                }
                                else
                                {
+                                       int size = 0;
+
+                                       if (use_min)
+                                       {
+                                               size = ewl_object_minimum_w_get(
+                                                               
EWL_OBJECT(prev));
+                                               size += extra;
+                                       }
+                                       else
+                                               size = 
ewl_object_preferred_w_get(
+                                                               
EWL_OBJECT(prev));
+
                                        ewl_object_place(EWL_OBJECT(prev),
                                                        cur_pos, CURRENT_Y(p), 
-                                                       pane_size, 
CURRENT_H(p));
+                                                       size, CURRENT_H(p));
 
-                                       cur_pos += pane_size;
+                                       cur_pos += size;
                                }
 
                                i++;
@@ -592,12 +613,15 @@
                if ((CURRENT_Y(cur) < CURRENT_Y(p)))
                {
                        int panes, pane_size, grabbers, grab_size, i;
+                       int pref_size = 0, min_size = 0, use_min = 0, extra = 0;
                        Ewl_Widget *skip;
 
                        /* the previous widget and this grabber */
                        panes = 1;
                        grabbers = 1;
                        grab_size = CURRENT_H(cur);
+                       pref_size = 
ewl_object_preferred_h_get(EWL_OBJECT(prev));
+                       min_size = ewl_object_minimum_h_get(EWL_OBJECT(prev));
                        pane_size = 0; 
                        skip = cur;
 
@@ -613,6 +637,10 @@
                                if ((CURRENT_Y(skip) < CURRENT_Y(p)))
                                {
                                        grab_size += CURRENT_H(skip);
+                                       pref_size += ewl_object_preferred_h_get(
+                                                               
EWL_OBJECT(skip));
+                                       min_size += ewl_object_minimum_h_get(
+                                                               
EWL_OBJECT(skip));
                                        grabbers ++;
                                        continue;
                                }
@@ -621,13 +649,15 @@
 
                        /* we have a grabber thats been placed,
                         * calculate the size per pane */
-                       if (skip)
-                               pane_size = CURRENT_Y(skip) - cur_pos;
-                       else
-                               pane_size = CURRENT_H(p) - cur_pos;
+                       if (skip) pane_size = CURRENT_Y(skip) - cur_pos;
+                       else pane_size = CURRENT_H(p) - cur_pos;
 
                        pane_size -= grab_size;
-                       pane_size /= panes;
+                       if (pane_size < pref_size)
+                       {
+                               extra = (pane_size - min_size) / panes;
+                               use_min = 1;
+                       }
 
                        ecore_list_goto(c->children, prev);
                        i = 0;
@@ -644,11 +674,23 @@
                                }
                                else
                                {
+                                       int size = 0;
+
+                                       if (use_min)
+                                       {
+                                               size = ewl_object_minimum_h_get(
+                                                               
EWL_OBJECT(prev));
+                                               size += extra;
+                                       }
+                                       else
+                                               size = 
ewl_object_preferred_h_get(
+                                                               
EWL_OBJECT(prev));
+
                                        ewl_object_place(EWL_OBJECT(prev),
                                                        CURRENT_X(p), cur_pos,
-                                                       CURRENT_W(p), 
pane_size);
+                                                       CURRENT_W(p), size);
 
-                                       cur_pos += pane_size;
+                                       cur_pos += size;
                                }
 
                                i++;




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to