Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        Edje.h edje_calc.c edje_data.c edje_load.c edje_private.h 
        edje_smart.c edje_util.c 


Log Message:


more features... working on fixme list.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Edje.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- Edje.h      20 Jul 2003 12:37:49 -0000      1.15
+++ Edje.h      27 Jul 2003 13:16:51 -0000      1.16
@@ -13,6 +13,9 @@
    void         edje_freeze                     (void);
    void         edje_thaw                       (void);
    
+   Evas_List    *edje_file_collection_list      (const char *file);
+   void         edje_file_collection_list_free  (Evas_List *lst);
+   
    void         edje_extern_object_min_size_set (Evas_Object *obj, double minw, 
double minh);
    void         edje_extern_object_max_size_set (Evas_Object *obj, double maxw, 
double maxh);
    
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- edje_calc.c 20 Jul 2003 12:37:49 -0000      1.8
+++ edje_calc.c 27 Jul 2003 13:16:51 -0000      1.9
@@ -420,26 +420,26 @@
        
        /* complex dragable params */
        offset = params->x + ep->drag.x - confine_to->x;
-       if (desc->dragable.step_x > 0)
+       if (ep->part->dragable.step_x > 0)
          {
             params->x = confine_to->x + 
-              ((offset / desc->dragable.step_x) * desc->dragable.step_x);
+              ((offset / ep->part->dragable.step_x) * ep->part->dragable.step_x);
          }
-       else if (desc->dragable.count_x > 0)
+       else if (ep->part->dragable.count_x > 0)
          {
-            step = (confine_to->w - params->w) / desc->dragable.count_x;
+            step = (confine_to->w - params->w) / ep->part->dragable.count_x;
             params->x = confine_to->x +
               ((offset / step) * step);               
          }
        offset = params->y + ep->drag.y - confine_to->y;
-       if (desc->dragable.step_y > 0)
+       if (ep->part->dragable.step_y > 0)
          {
             params->y = confine_to->y + 
-              ((offset / desc->dragable.step_y) * desc->dragable.step_y);
+              ((offset / ep->part->dragable.step_y) * ep->part->dragable.step_y);
          }
-       else if (desc->dragable.count_y > 0)
+       else if (ep->part->dragable.count_y > 0)
          {
-            step = (confine_to->h - params->h) / desc->dragable.count_y;
+            step = (confine_to->h - params->h) / ep->part->dragable.count_y;
             params->y = confine_to->y +
               ((offset / step) * step);               
          }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_data.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- edje_data.c 20 Jul 2003 12:37:49 -0000      1.7
+++ edje_data.c 27 Jul 2003 13:16:51 -0000      1.8
@@ -94,13 +94,6 @@
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "state.name", state.name, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "state.value", state.value, EET_T_DOUBLE);
    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, "dragable.x", dragable.x, EET_T_CHAR);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "dragable.step_x", dragable.step_x, EET_T_INT);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "dragable.count_x", dragable.count_x, EET_T_INT);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "dragable.y", dragable.y, EET_T_CHAR);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "dragable.step_y", dragable.step_y, EET_T_INT);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "dragable.count_y", dragable.count_y, EET_T_INT);
-   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, 
Edje_Part_Description, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
    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, "min.w", min.w, EET_T_INT);
@@ -171,6 +164,13 @@
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "text_class", 
text_class, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_part, Edje_Part, "default_desc", 
default_desc, _edje_edd_edje_part_description);
    EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part, Edje_Part, "other_desc", 
other_desc, _edje_edd_edje_part_description);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", 
dragable.x, EET_T_CHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_x", 
dragable.step_x, EET_T_INT);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_x", 
dragable.count_x, EET_T_INT);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.y", 
dragable.y, EET_T_CHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", 
dragable.step_y, EET_T_INT);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", 
dragable.count_y, EET_T_INT);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, 
"dragable.counfine_id", dragable.confine_id, EET_T_INT);
    
    _edje_edd_edje_part_collection  = 
      NEWD("Edje_Part_Collection", 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- edje_load.c 20 Jul 2003 12:37:49 -0000      1.13
+++ edje_load.c 27 Jul 2003 13:16:51 -0000      1.14
@@ -28,7 +28,47 @@
    if (ed->collection)
      {
        Evas_List *l;
+       int errors = 0;
        
+       /* check for invalid loops */
+       for (l = ed->collection->parts; (l && ! errors); l = l->next)
+         {
+            Edje_Part *ep;
+            Evas_List *hist = NULL;
+            
+            ep = l->data;
+            hist = evas_list_append(hist, ep);
+            while (ep->dragable.confine_id >= 0)
+              {
+                 ep = evas_list_nth(ed->collection->parts,
+                                    ep->dragable.confine_id);
+                 if (evas_list_find(hist, ep))
+                   {
+                      printf("EDJE FIXME: ERROR! confine_to loops. invalidating 
loop.\n");
+                      ep->dragable.confine_id = -1;
+                      break;
+                   }
+                 hist = evas_list_append(hist, ep);
+              }
+            evas_list_free(hist);
+            hist = NULL;
+            hist = evas_list_append(hist, ep);
+            while (ep->clip_to_id >= 0)
+              {
+                 ep = evas_list_nth(ed->collection->parts,
+                                    ep->clip_to_id);
+                 if (evas_list_find(hist, ep))
+                   {
+                      printf("EDJE FIXME: ERROR! clip_to loops. invalidating 
loop.\n");
+                      ep->clip_to_id = -1;
+                      break;
+                   }
+                 hist = evas_list_append(hist, ep);
+              }
+            evas_list_free(hist);
+            hist = NULL;
+         }
+       /* build real parts */
        for (l = ed->collection->parts; l; l = l->next)
          {
             Edje_Part *ep;
@@ -41,6 +81,10 @@
             rp->part = ep;
             ed->parts = evas_list_append(ed->parts, rp);
             rp->param1.description =  ep->default_desc;
+            if (!rp->param1.description)
+              {
+                 printf("EDJE FIXME: ERROR! no default part description!\n");
+              }
             _edje_text_part_on_add(ed, rp);
             if (ep->type == EDJE_PART_TYPE_RECTANGLE)
               rp->object = evas_object_rectangle_add(ed->evas);
@@ -50,7 +94,7 @@
               rp->object = evas_object_text_add(ed->evas);
             else
               {
-                 printf("FIXME: ERROR! wrong part type!\n");
+                 printf("EDJE FIXME: ERROR! wrong part type %i!\n", ep->type);
               }
             evas_object_smart_member_add(rp->object, ed->obj);
             if (ep->mouse_events)
@@ -80,6 +124,8 @@
                                                 _edje_mouse_wheel_cb,
                                                 ed);
                  evas_object_data_set(rp->object, "real_part", rp);
+                 if (ep->repeat_events)
+                   evas_object_repeat_events_set(rp->object, 1);
               }
             else
               evas_object_pass_events_set(rp->object, 1);
@@ -132,6 +178,55 @@
    if (part) *part = ed->part;
 }
 
+Evas_List *
+edje_file_collection_list(const char *file)
+{
+   Eet_File *ef = NULL;
+   Evas_List *lst = NULL;
+   Edje_File *ed_file;
+   
+   ed_file = evas_hash_find(_edje_file_hash, file);
+   if (!ed_file)
+     {
+       ef = eet_open((char *)file, EET_FILE_MODE_READ);
+       if (!ef) return NULL;
+       ed_file = eet_data_read(ef, _edje_edd_edje_file, "edje_file");
+       if (!ed_file)
+         {
+            eet_close(ef);
+            return NULL;
+         }
+       eet_close(ef);
+     }
+   else
+     ed_file->references++;
+   if (ed_file->collection_dir)
+     {
+       Evas_List *l;
+       
+       for (l = ed_file->collection_dir->entries; l; l = l->next)
+         {
+            Edje_Part_Collection_Directory_Entry *ce;
+            
+            ce = l->data;
+            lst = evas_list_append(lst, strdup(ce->entry));
+         }
+     }
+   ed_file->references--;   
+   if (ed_file->references <= 0) _edje_file_free(ed_file);
+   return lst;
+}
+
+void
+edje_file_collection_list_free(Evas_List *lst)
+{
+   while (lst)
+     {
+       if (lst->data) free(lst->data);
+       lst = evas_list_remove(lst, lst->data);
+     }
+}
+
 void
 _edje_file_add(Edje *ed)
 {
@@ -161,14 +256,11 @@
             ed->file = NULL;
             goto out;
          }
+       if (!ed->file->collection_dir)
          {
-            for (l = ed->file->collection_dir->entries; l; l = l->next)
-              {
-                 Edje_Part_Collection_Directory_Entry *ce;
-                 
-                 ce = l->data;           
-                 printf("Collection: %s\n", ce->entry);
-              }
+            _edje_file_free(ed->file);
+            ed->file = NULL;
+            goto out;       
          }
        _edje_file_hash = evas_hash_add(_edje_file_hash, ed->path, ed->file);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- edje_private.h      23 Jul 2003 05:19:50 -0000      1.35
+++ edje_private.h      27 Jul 2003 13:16:51 -0000      1.36
@@ -17,24 +17,19 @@
 
 /* FIXME:
  * 
- * dont segv if given the wrong collection name
- * 
  * dragables have to work
+ * dragable need a way of their sizing being set relative to confine
  * drag start/top signals etc.
  * drag needs to have signals with relative pos as arg.
  * drag vals should be 0.0 -> 1.0 if drag is confined. "rest" pos = 0.0.
  * query dragable for its relative pos value
  * dragable needs to be able to affext rel/abs values of other parts
  * 
- * need to be able to list collections in an eet file
- * 
- * externally sourced images need to be supported in edje_cc and edje
+ * more example edje files
  * 
- * need to detect rel1_to part loops
- * need to detect rel2_to part loops
- * need to detect clip_to part loops
- * need to detect confine_to part loops
+ * edje test program needs to test all api calls and list edje collections
  * 
+ * ? programs need to be able to cycle part states given a list of states
  * ? programs need to be able to set/get/add/sub and compare variables
  *   ie: 
  *     action, INT "active_state" = INT 1;
@@ -58,18 +53,19 @@
  *     if,  MOUSE_X     "" > 1;
  *     or,  MOUSE_X     "this_part" > 50;
  *     or,  MOUSE_X_REL "this_part" <= 0.5;
+ *     and, STATE       "this_part" == "clicked";
+ *     and, STATE_VAL   "this_part" == 0.0;
  *     ...
+ * 
  *     if,  INT "active_state" != 0;
  *     and, INT "hidden" < 10;
  *     or,  STR "my_string" == "smelly";
  *     ...
  * 
- * ? programs need to be able to "toggle" part states given a list of states
- * ? reduce linked list walking and list_nth calls
+ * ? key/value pair config values per colelction and per edje file
  * ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
  * ? text entry widget (single line only)
- * ? add numeric params to conditions for progs (ranges etc.)
- * ? key/value pair config values per colelction and per edje file
+ * ? reduce linked list walking and list_nth calls
  */
 
 typedef struct _Edje_File                            Edje_File;
@@ -229,11 +225,24 @@
    unsigned char          type; /* what type (image, rect, text) */
    unsigned char          effect; /* 0 = plain... */
    unsigned char          mouse_events; /* it will affect/respond to mouse events */
+   unsigned char          repeat_events; /* it will repeat events to objects below */
    int                    clip_to_id; /* the part id to clip this one to */   
    char                  *color_class; /* how to modify the color */
    char                  *text_class; /* how to apply/modify the font */
    Edje_Part_Description *default_desc; /* the part descriptor for default */
    Evas_List             *other_desc; /* other possible descriptors */
+   struct {
+      char                x; /* can u click & drag this bit in x dir */
+      int                 step_x; /* drag jumps n pixels (0 = no limit) */
+      int                 count_x; /* drag area divided by n (0 = no limit) */
+      
+      char                y; /* can u click & drag this bit in y dir */
+      int                 step_y; /* drag jumps n pixels (0 = no limit) */
+      int                 count_y; /* drag area divided by n (0 = no limit) */
+      
+      int                 confine_id; /* dragging within this bit, -1 = no */
+   } dragable;
+   int                    load_error;
 };
 
 struct _Edje_Part_Image_Id
@@ -250,18 +259,6 @@
    
    unsigned char     visible; /* is it shown */
 
-   struct {
-      char           x; /* can u click & draqg this bit & which dir */
-      int            step_x; /* drag jumps n pixels (0 = no limit) */
-      int            count_x; /* drag area divided by n (0 = no limit) */
-      
-      char           y; /* can u click & drag this bit & which dir */
-      int            step_y; /* drag jumps n pixels (0 = no limit) */
-      int            count_y; /* drag area divided by n (0 = no limit) */
-      
-      int            confine_id; /* dragging within this bit, -1 = no */
-   } dragable;
-   
    struct {
       double         x, y; /* 0 <-> 1.0 alignment within allocated space */
    } align;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_smart.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- edje_smart.c        24 Jul 2003 00:49:13 -0000      1.7
+++ edje_smart.c        27 Jul 2003 13:16:51 -0000      1.8
@@ -78,7 +78,6 @@
 {
    Edje *ed;
    Evas_List *l;
-   char buf[256];
    
    ed = evas_object_smart_data_get(obj);
    if (!ed) return;
@@ -105,8 +104,7 @@
        if (ep->swallowed_object)
          evas_object_layer_set(ep->swallowed_object, ed->layer);
      }
-   snprintf(buf, sizeof(buf), "layer,set,%i", layer);
-   _edje_emit(ed, buf, "");
+   _edje_emit(ed, "layer,set", "");
 }
 
 static void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- edje_util.c 23 Jul 2003 05:19:50 -0000      1.14
+++ edje_util.c 27 Jul 2003 13:16:51 -0000      1.15
@@ -258,6 +258,8 @@
    if (!obj_swallow) return;
    rp->swallowed_object = obj_swallow;
    evas_object_clip_set(rp->swallowed_object, ed->clipper);
+   if (evas_object_layer_get(rp->swallowed_object) != ed->layer)
+     evas_object_layer_set(rp->swallowed_object, ed->layer);
    evas_object_stack_above(rp->swallowed_object, rp->object);
    evas_object_event_callback_add(rp->swallowed_object,
                                  EVAS_CALLBACK_FREE, 
@@ -387,7 +389,7 @@
    Edje *ed;
    
    ed = _edje_fetch(obj);
-   if (!ed)
+   if ((!ed) || (!ed->collection))
      {
        if (minw) *minw = 0;
        if (minh) *minh = 0;
@@ -403,7 +405,7 @@
    Edje *ed;
    
    ed = _edje_fetch(obj);
-   if (!ed)
+   if ((!ed) || (!ed->collection))
      {
        if (maxw) *maxw = 0;
        if (maxh) *maxh = 0;
@@ -436,7 +438,7 @@
    int ok;
    
    ed = _edje_fetch(obj);
-   if (!ed)
+   if ((!ed) || (!ed->collection))
      {
        if (minw) *minw = 0;
        if (minh) *minh = 0;




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to