Enlightenment CVS committal

Author  : moom
Project : e17
Module  : libs/etk

Dir     : e17/libs/etk/src/lib


Modified Files:
        etk_box.c 


Log Message:
* [Bin] Use "float" instead of "int" to do the calculations, so widget 
placement is more accurate when the box is scaled


===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_box.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- etk_box.c   22 Feb 2007 22:24:25 -0000      1.19
+++ etk_box.c   22 Feb 2007 23:04:12 -0000      1.20
@@ -648,6 +648,7 @@
    int num_children_to_expand = 0;
    int i, j;
    float start_offset, end_offset;
+   float width;
 
    if (!(hbox = ETK_HBOX(widget)))
       return;
@@ -680,19 +681,20 @@
             
             if (etk_widget_is_visible(child))
             {
+               width = box->request_sizes[i][j] * ratio;
                child_geometry.y = geometry.y + container->border_width;
-               child_geometry.w = box->request_sizes[i][j] * ratio;
+               child_geometry.w = width;
                child_geometry.h = allocated_size.h;
 
                if (cell->group == ETK_BOX_START)
                {
                   child_geometry.x = geometry.x + start_offset;
-                  start_offset += child_geometry.w + box->spacing;
+                  start_offset += width + box->spacing;
                }
                else
                {
                   child_geometry.x = geometry.x + geometry.w - end_offset - 
child_geometry.w;
-                  end_offset += child_geometry.w + box->spacing;
+                  end_offset += width + box->spacing;
                }
                
                child_geometry.x += cell->padding;
@@ -743,21 +745,22 @@
             
             if (etk_widget_is_visible(child))
             {
+               width = box->request_sizes[i][j];
+               if (cell->fill_policy & ETK_BOX_EXPAND)
+                  width += free_space;
                child_geometry.y = geometry.y + container->border_width;
-               child_geometry.w = box->request_sizes[i][j];
+               child_geometry.w = width;
                child_geometry.h = allocated_size.h;
-               if (cell->fill_policy & ETK_BOX_EXPAND)
-                  child_geometry.w += free_space;
 
                if (cell->group == ETK_BOX_START)
                {
                   child_geometry.x = geometry.x + start_offset;
-                  start_offset += child_geometry.w + box->spacing;
+                  start_offset += width + box->spacing;
                }
                else
                {
                   child_geometry.x = geometry.x + geometry.w - end_offset - 
child_geometry.w;
-                  end_offset += child_geometry.w + box->spacing;
+                  end_offset += width + box->spacing;
                }
 
                child_geometry.x += cell->padding;
@@ -875,6 +878,7 @@
    int num_children_to_expand = 0;
    int i, j;
    float start_offset, end_offset;
+   float height;
 
    if (!(vbox = ETK_VBOX(widget)))
       return;
@@ -907,19 +911,20 @@
             
             if (etk_widget_is_visible(child))
             {
+               height = box->request_sizes[i][j] * ratio;
                child_geometry.x = geometry.x + container->border_width;
                child_geometry.w = allocated_size.w;
-               child_geometry.h = box->request_sizes[i][j] * ratio;
+               child_geometry.h = height;
 
                if (cell->group == ETK_BOX_START)
                {
                   child_geometry.y = geometry.y + start_offset;
-                  start_offset += child_geometry.h + box->spacing;
+                  start_offset += height + box->spacing;
                }
                else
                {
                   child_geometry.y = geometry.y + geometry.h - end_offset - 
child_geometry.h;
-                  end_offset += child_geometry.h + box->spacing;
+                  end_offset += height + box->spacing;
                }
                
                child_geometry.y += cell->padding;
@@ -970,21 +975,22 @@
             
             if (etk_widget_is_visible(child))
             {
+               height = box->request_sizes[i][j];
+               if (cell->fill_policy & ETK_BOX_EXPAND)
+                  height += free_space;
                child_geometry.x = geometry.x + container->border_width;
                child_geometry.w = allocated_size.w;
-               child_geometry.h = box->request_sizes[i][j];
-               if (cell->fill_policy & ETK_BOX_EXPAND)
-                  child_geometry.h += free_space;
+               child_geometry.h = height;
 
                if (cell->group == ETK_BOX_START)
                {
                   child_geometry.y = geometry.y + start_offset;
-                  start_offset += child_geometry.h + box->spacing;
+                  start_offset += height + box->spacing;
                }
                else
                {
                   child_geometry.y = geometry.y + geometry.h - end_offset - 
child_geometry.h;
-                  end_offset += child_geometry.h + box->spacing;
+                  end_offset += height + box->spacing;
                }
 
                child_geometry.y += cell->padding;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to