Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_data.c edje_private.h edje_util.c 


Log Message:


hmm - make min size calculation mroe accurate and handle corner cases...

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_data.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- edje_data.c 12 Sep 2005 09:43:49 -0000      1.24
+++ edje_data.c 19 Sep 2005 06:51:49 -0000      1.25
@@ -173,6 +173,8 @@
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "visible", visible, EET_T_CHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "align.x", align.x, EET_T_DOUBLE);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "align.y", align.y, EET_T_DOUBLE);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "fixed.w", fixed.w, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "fixed.h", fixed.h, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "min.w", min.w, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "min.h", min.h, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "max.w", max.w, EET_T_INT);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- edje_private.h      19 Sep 2005 03:13:23 -0000      1.90
+++ edje_private.h      19 Sep 2005 06:51:49 -0000      1.91
@@ -355,6 +355,10 @@
    } align;
    
    struct {
+      unsigned char  w, h; /* width or height si fixed in side (cannot expand 
with edje object size) */
+   } fixed;
+   
+   struct {
       int            w, h; /* min & max size, 0 = none */
    } min, max;
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- edje_util.c 12 Sep 2005 09:43:49 -0000      1.58
+++ edje_util.c 19 Sep 2005 06:51:49 -0000      1.59
@@ -820,6 +820,8 @@
    Evas_Coord pw, ph;   
    int maxw, maxh;
    int ok;
+   int reset_maxwh;
+   Edje_Real_Part *pep = NULL;
    
    ed = _edje_fetch(obj);
    if ((!ed) || (!ed->collection))
@@ -828,9 +830,12 @@
        if (minh) *minh = 0;
        return;
      }
+   reset_maxwh = 1;
    ed->calc_only = 1;
    pw = ed->w;
    ph = ed->h;
+   
+   again:
    ed->w = 0;
    ed->h = 0;
    
@@ -844,7 +849,14 @@
        
        ok = 0;
        ed->dirty = 1;
+//     printf("...CALC %s\n", ed->part);
        _edje_recalc(ed);
+       if (reset_maxwh)
+         {
+            maxw = 0;
+            maxh = 0;
+         }
+       pep = NULL;
        for (l = ed->parts; l; l = l->next)
          {
             Edje_Real_Part *ep;
@@ -853,15 +865,31 @@
             ep = l->data;
             w = ep->w - ep->req.w;
             h = ep->h - ep->req.h;
-            if (w > maxw)
+//          printf("EP: %s size %ix%i, req %ix%i, dif %ix%i, max %ix%i\n",
+//                 ep->part->name,
+//                 ep->w, ep->h,
+//                 ep->req.w, ep->req.h,
+//                 w, h,
+//                 maxw, maxh);
+            if (!((ep->chosen_description) &&
+                  (ep->chosen_description->fixed.w)))
               {
-                 maxw = w;
-                 ok = 1;
+                 if (w > maxw)
+                   {
+                      maxw = w;
+                      ok = 1;
+                      pep = ep;
+                   }
               }
-            if (h > maxh)
+            if (!((ep->chosen_description) &&
+                  (ep->chosen_description->fixed.h)))
               {
-                 maxh = h;
-                 ok = 1;
+                 if (h > maxh)
+                   {
+                      maxh = h;
+                      ok = 1;
+                      pep = ep;
+                   }
               }
          }
        if (ok)
@@ -869,6 +897,25 @@
             ed->w += maxw;
             ed->h += maxh;
          }
+       if ((ed->w > 8000) || (ed->h > 8000))
+         {
+            printf("EDJE ERROR: An element in file %s, group %s has a non 
expandable\n"
+                   "part not marked as fixed size in one dimension. This 
needs\n"
+                   "to be fixed in the source .edc by adding:\n"
+                   "  fixed: 1 1;\n"
+                   "to the part that cannot expand in size if the edje object 
does.\n",
+                   ed->path, ed->part);
+            if (pep)
+              printf("The part suspected causing this problem is:\n"
+                     "  part: \"%s\"\n",
+                     pep->part->name);
+            printf("Will recalc min size not allowing broken parts to affect 
the result.\n");
+            if (reset_maxwh)
+              {
+                 reset_maxwh = 0;
+                 goto again;
+              }
+         }
      }
    ed->min.w = ed->w;
    ed->min.h = ed->h;




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to