Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        Edje.h Edje_Edit.h edje_embryo.c edje_message_queue.c 
        edje_misc.c edje_private.h edje_program.c 


Log Message:


fully supported message queues now. that was a chunk of work!

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Edje.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- Edje.h      2 Jul 2004 03:24:56 -0000       1.32
+++ Edje.h      2 Jul 2004 10:17:25 -0000       1.33
@@ -4,18 +4,11 @@
 #include <Evas.h>
 
 /* FIXDOC: Define these? */
-
-typedef enum _Edje_Queue
-{
-   EDJE_QUEUE_APP,
-     EDJE_QUEUE_SCRIPT
-} Edje_Queue;
-
 typedef enum _Edje_Message_Type
 {
    EDJE_MESSAGE_NONE = 0,
      
-     EDJE_MESSAGE_SIGNAL = 1,
+     EDJE_MESSAGE_SIGNAL = 1, /* DONT USE THIS */
      
      EDJE_MESSAGE_STRING = 2,
      EDJE_MESSAGE_INT = 3,
@@ -32,7 +25,6 @@
      EDJE_MESSAGE_STRING_FLOAT_SET = 11
 } Edje_Message_Type;
 
-typedef struct _Edje_Message_Signal           Edje_Message_Signal;
 typedef struct _Edje_Message_String           Edje_Message_String;
 typedef struct _Edje_Message_Int              Edje_Message_Int;
 typedef struct _Edje_Message_Float            Edje_Message_Float;
@@ -44,12 +36,6 @@
 typedef struct _Edje_Message_String_Int_Set   Edje_Message_String_Int_Set;
 typedef struct _Edje_Message_String_Float_Set Edje_Message_String_Float_Set;
 
-struct _Edje_Message_Signal
-{
-   char *sig;
-   char *src;
-};
-
 struct _Edje_Message_String
 {
    char *str;
@@ -133,9 +119,6 @@
 extern "C" {
 #endif
    
-  /* Documentation is within .c files */
-  /* Doc issues marked with FIXDOC: */
-  
   /* edje_main.c */
    int          edje_init                       (void);
    int          edje_shutdown                   (void);
@@ -189,8 +172,8 @@
   void         edje_object_size_min_calc       (Evas_Object *obj, Evas_Coord *minw, 
Evas_Coord *minh);
   int          edje_object_part_exists         (Evas_Object *obj, const char *part);
   void         edje_object_part_geometry_get   (Evas_Object *obj, const char *part, 
Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
-  void         edje_object_text_change_cb_set(Evas_Object *obj, void (*func) (void 
*data, Evas_Object *obj, const char *part), void *data);
-   void         edje_object_part_text_set       (Evas_Object *obj, const char *part, 
const char *text);
+  void         edje_object_text_change_cb_set  (Evas_Object *obj, void (*func) (void 
*data, Evas_Object *obj, const char *part), void *data);
+  void         edje_object_part_text_set       (Evas_Object *obj, const char *part, 
const char *text);
   const char  *edje_object_part_text_get       (Evas_Object *obj, const char *part);
   void         edje_object_part_swallow        (Evas_Object *obj, const char *part, 
Evas_Object *obj_swallow);
   void         edje_object_part_unswallow      (Evas_Object *obj, Evas_Object 
*obj_swallow);
@@ -208,15 +191,10 @@
   void         edje_object_part_drag_step      (Evas_Object *obj, const char *part, 
double dx, double dy);
   void         edje_object_part_drag_page      (Evas_Object *obj, const char *part, 
double dx, double dy);
 
-  /* edje_misc.c */
-  int          edje_object_variable_id_get     (Evas_Object *obj, char *name);
-  int          edje_object_variable_int_get    (Evas_Object *obj, int id);
-  void         edje_object_variable_int_set    (Evas_Object *obj, int id, int val);
-  double       edje_object_variable_float_get  (Evas_Object *obj, int id);
-  void         edje_object_variable_float_set  (Evas_Object *obj, int id, double val);
-  char        *edje_object_variable_str_get    (Evas_Object *obj, int id);
-  void         edje_object_variable_str_set    (Evas_Object *obj, int id, char *str);
-       
+  /* edje_message_queue.c */
+  void         edje_object_message_send        (Evas_Object *obj, Edje_Message_Type 
type, int id, void *msg);
+  void         edje_object_message_handler_set (Evas_Object *obj, void (*func) (void 
*data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data);
+     
 #ifdef __cplusplus
 }
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Edje_Edit.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- Edje_Edit.h 1 Jul 2004 03:46:05 -0000       1.12
+++ Edje_Edit.h 2 Jul 2004 10:17:25 -0000       1.13
@@ -445,7 +445,11 @@
       void *data;
    } text_change;
    
-   int                   message_num;
+   struct {
+      int                   num;
+      void                (*func) (void *data, Evas_Object *obj, Edje_Message_Type 
type, int id, void *msg);
+      void                 *data;
+   } message;
 };
 
 struct _Edje_Real_Part
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_embryo.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- edje_embryo.c       1 Jul 2004 03:46:05 -0000       1.17
+++ edje_embryo.c       2 Jul 2004 10:17:25 -0000       1.18
@@ -78,28 +78,6 @@
  * get_strlen(id)
  * get_str(id, dst[], maxlen)
  * set_str(id, str[])
- * ######## lists/arrays for stored variables (to be implemented)
- * # count(id)
- * # remove(id, n)
- * #
- * # append_int(id, v)
- * # prepend_int(id, v)
- * # insert_int(id, v, n)
- * # replace_int(id, v, n)
- * # fetch_int(id, n)
- * #
- * # append_float(id, Float:v)
- * # prepend_float(id, Float:v)
- * # insert_float(id, Float:v, n)
- * # replace_float(id, Float:v, n)
- * # Float:fetch_float(id, n)
- * #
- * # append_str(id, str[])
- * # prepend_str(id, str[])
- * # insert_str(id, str[], n)
- * # replace_str(id, str[], n)
- * # fetch_str(id, n, dst[], maxlen)
- * #
  * timer(Float:in, fname[], val)
  * cancel_timer(id)
  * anim(Float:len, fname[], val)
@@ -132,10 +110,32 @@
  * still need to implement this:
  *
  * ##### post messages to the app via _edje_message_send();
- * # message(id, type, ...);
+ * # send_message(id, type, ...);
  * #
  * ##### what about posting messages to OTHER edje objects (swallowed?)
  * # ????
+ * ######## lists/arrays for stored variables (to be implemented)
+ * # count(id)
+ * # remove(id, n)
+ * #
+ * # append_int(id, v)
+ * # prepend_int(id, v)
+ * # insert_int(id, v, n)
+ * # replace_int(id, v, n)
+ * # fetch_int(id, n)
+ * #
+ * # append_float(id, Float:v)
+ * # prepend_float(id, Float:v)
+ * # insert_float(id, Float:v, n)
+ * # replace_float(id, Float:v, n)
+ * # Float:fetch_float(id, n)
+ * #
+ * # append_str(id, str[])
+ * # prepend_str(id, str[])
+ * # insert_str(id, str[], n)
+ * # replace_str(id, str[], n)
+ * # fetch_str(id, n, dst[], maxlen)
+ * #
  * 
  * ** part_id and program_id need to be able to be "found" from strings
  * 
@@ -687,7 +687,7 @@
    part_id = params[1];
    if (part_id < 0) return 0;
    rp = ed->table_parts[part_id % ed->table_parts_size];
-   s = edje_object_part_text_get(ed->obj, rp->part->name);
+   s = (char *)edje_object_part_text_get(ed->obj, rp->part->name);
    if (s)
      {
        if (strlen(s) < params[3])
@@ -900,6 +900,223 @@
    return(0);
 }
 
+/* send_message(id, Msg_Type:type, ...); */
+static Embryo_Cell
+_edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params)
+{
+   Edje *ed;
+   Edje_Message_Type type;
+   int id, i, n;
+   
+   if (params[0] < (sizeof(Embryo_Cell) * (2))) return 0;
+   ed = embryo_program_data_get(ep);
+   type = params[1];
+   id = params[2];
+   switch (type)
+     {
+      case EDJE_MESSAGE_NONE:
+       _edje_message_send(ed, EDJE_QUEUE_APP, type, id, NULL);
+       break;
+      case EDJE_MESSAGE_SIGNAL:
+       break;
+      case EDJE_MESSAGE_STRING:
+         {
+            Embryo_Cell *cptr;
+            
+            cptr = embryo_data_address_get(ep, params[3]);
+            if (cptr)
+              {
+                 Edje_Message_String *emsg;
+                 int l;
+                 char *s;
+                 
+                 l = embryo_data_string_length_get(ep, cptr);
+                 s = alloca(l + 1);
+                 embryo_data_string_get(ep, cptr, s);
+                 emsg = alloca(sizeof(Edje_Message_String));
+                 emsg->str = s;
+                 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+              }
+         }
+       break;
+      case EDJE_MESSAGE_INT:
+         {
+            Edje_Message_Int *emsg;
+            
+            emsg = alloca(sizeof(Edje_Message_Int));
+            emsg->val = (int)params[3];
+            _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+         }
+       break;
+      case EDJE_MESSAGE_FLOAT:
+         {
+            Edje_Message_Int *emsg;
+            float f;
+            
+            emsg = alloca(sizeof(Edje_Message_Int));
+            f = EMBRYO_CELL_TO_FLOAT(params[3]);
+            emsg->val = (double)f;
+            _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+         }
+       break;
+      case EDJE_MESSAGE_STRING_SET:
+         {
+            Edje_Message_String_Set *emsg;
+            
+            n = (params[0] / sizeof(Embryo_Cell));
+            emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 3 - 1) * 
sizeof(char *)));
+            emsg->count = n - 3;
+            for (i = 3; i < n; i++)
+              {
+                 Embryo_Cell *cptr;
+                 
+                 cptr = embryo_data_address_get(ep, params[i]);
+                 if (cptr)
+                   {
+                      int l;
+                      char *s;
+                      
+                      l = embryo_data_string_length_get(ep, cptr);
+                      s = alloca(l + 1);
+                      embryo_data_string_get(ep, cptr, s);
+                      emsg->str[i - 3] = s;
+                   }
+              }
+            _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+         }
+       break;
+      case EDJE_MESSAGE_INT_SET:
+         {
+            Edje_Message_Int_Set *emsg;
+            
+            n = (params[0] / sizeof(Embryo_Cell));
+            emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 3 - 1) * sizeof(int)));
+            emsg->count = n - 3;
+            for (i = 3; i < n; i++)
+              emsg->val[i - 3] = (int)params[i];
+            _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+         }
+       break;
+      case EDJE_MESSAGE_FLOAT_SET:
+         {
+            Edje_Message_Float_Set *emsg;
+            
+            n = (params[0] / sizeof(Embryo_Cell));
+            emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 3 - 1) * 
sizeof(double)));
+            emsg->count = n - 3;
+            for (i = 3; i < n; i++)
+              {
+                 float f;
+                 
+                 f = EMBRYO_CELL_TO_FLOAT(params[i]);
+                 emsg->val[i - 3] = (double)f;
+              }
+            _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+         }
+       break;
+      case EDJE_MESSAGE_STRING_INT:
+         {
+            Edje_Message_String_Int *emsg;
+            Embryo_Cell *cptr;
+            
+            cptr = embryo_data_address_get(ep, params[3]);
+            if (cptr)
+              {
+                 int l;
+                 char *s;
+                 
+                 l = embryo_data_string_length_get(ep, cptr);
+                 s = alloca(l + 1);
+                 embryo_data_string_get(ep, cptr, s);
+                 emsg = alloca(sizeof(Edje_Message_String_Int));
+                 emsg->str = s;
+                 emsg->val = (int)params[4];
+                 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+              }
+         }
+       break;
+      case EDJE_MESSAGE_STRING_FLOAT:
+         {
+            Edje_Message_String_Float *emsg;
+            Embryo_Cell *cptr;
+            
+            cptr = embryo_data_address_get(ep, params[3]);
+            if (cptr)
+              {
+                 int l;
+                 char *s;
+                 float f;
+                 
+                 l = embryo_data_string_length_get(ep, cptr);
+                 s = alloca(l + 1);
+                 embryo_data_string_get(ep, cptr, s);
+                 emsg = alloca(sizeof(Edje_Message_String_Float));
+                 emsg->str = s;
+                 f = EMBRYO_CELL_TO_FLOAT(params[4]);
+                 emsg->val = (double)f;
+                 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+              }
+         }
+       break;
+      case EDJE_MESSAGE_STRING_INT_SET:
+         {
+            Edje_Message_String_Int_Set *emsg;
+            Embryo_Cell *cptr;
+            
+            cptr = embryo_data_address_get(ep, params[3]);
+            if (cptr)
+              {
+                 int l;
+                 char *s;
+                 
+                 l = embryo_data_string_length_get(ep, cptr);
+                 s = alloca(l + 1);
+                 embryo_data_string_get(ep, cptr, s);
+                 n = (params[0] / sizeof(Embryo_Cell));
+                 emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 4 - 1) * 
sizeof(int)));
+                 emsg->str = s;
+                 emsg->count = n - 4;
+                 for (i = 4; i < n; i++)
+                   emsg->val[i - 4] = (int)params[i];
+                 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+              }
+         }
+       break;
+      case EDJE_MESSAGE_STRING_FLOAT_SET:
+         {
+            Edje_Message_String_Float_Set *emsg;
+            Embryo_Cell *cptr;
+            
+            cptr = embryo_data_address_get(ep, params[3]);
+            if (cptr)
+              {
+                 int l;
+                 char *s;
+                 
+                 l = embryo_data_string_length_get(ep, cptr);
+                 s = alloca(l + 1);
+                 embryo_data_string_get(ep, cptr, s);
+                 n = (params[0] / sizeof(Embryo_Cell));
+                 emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 4 - 1) * 
sizeof(double)));
+                 emsg->str = s;
+                 emsg->count = n - 4;
+                 for (i = 4; i < n; i++)
+                   {
+                      float f;
+                      
+                      f = EMBRYO_CELL_TO_FLOAT(params[i]);
+                      emsg->val[i - 4] = (double)f;
+                   }
+                 _edje_message_send(ed, EDJE_QUEUE_APP, type, id, emsg);
+              }
+         }
+       break;
+      default:
+       break;
+     }
+   return(0);
+}
+
 void
 _edje_embryo_script_init(Edje *ed)
 {
@@ -950,6 +1167,8 @@
    embryo_program_native_call_add(ep, "set_min_size", _edje_embryo_fn_set_min_size);
    embryo_program_native_call_add(ep, "set_max_size", _edje_embryo_fn_set_max_size);
    
+   embryo_program_native_call_add(ep, "send_message", _edje_embryo_fn_send_message);
+   
    embryo_program_vm_push(ep); /* neew a new vm to run in */
    _edje_embryo_globals_init(ed);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_message_queue.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- edje_message_queue.c        2 Jul 2004 03:24:56 -0000       1.4
+++ edje_message_queue.c        2 Jul 2004 10:17:25 -0000       1.5
@@ -1,18 +1,25 @@
 #include "Edje.h"
 #include "edje_private.h"
 
-/* NB: global message que to be processed on idle enterer */
-
-/* NB: on deletion of an edje, remvoe all pending msg que items for it */
-
-/* NB: each edje needs a messagequeue cointer to knwo how many messages on the
- * queue for that edje */
+void
+edje_object_message_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
+{
+   Edje *ed;
+   
+   ed = _edje_fetch(obj);
+   if (!ed) return;
+   _edje_message_send(ed, EDJE_QUEUE_SCRIPT, type, id, msg);
+}
 
-/* NB: need to temporarly remove queue so messages added while processing the
- * the queue so messages added as a result of processing dont loop. if the
- * queue is not empty after processing scheduly 0.0 timeout to induce a
- * new processing of the queue
- */
+void
+edje_object_message_handler_set(Evas_Object *obj, void (*func) (void *data, 
Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data)
+{
+   Edje *ed;
+   
+   ed = _edje_fetch(obj);
+   if (!ed) return;
+   _edje_message_cb_set(ed, func, data);
+}
 
 static Evas_List *msgq = NULL;
 static Evas_List *tmp_msgq = NULL;
@@ -21,7 +28,6 @@
 static int
 _edje_dummy_timer(void *data)
 {
-   printf("DUMMY\n");
    return 0;
 }
 
@@ -46,6 +52,13 @@
    idler = NULL;
 }
 
+void
+_edje_message_cb_set(Edje *ed, void (*func) (void *data, Evas_Object *obj, 
Edje_Message_Type type, int id, void *msg), void *data)
+{
+   ed->message.func = func;
+   ed->message.data = data;
+}
+
 Edje_Message *
 _edje_message_new(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id)
 {
@@ -57,7 +70,7 @@
    em->queue = queue;
    em->type = type;
    em->id = id;
-   em->edje->message_num++;
+   em->edje->message.num++;
    return em;
 }
 
@@ -79,6 +92,7 @@
                  free(emsg->str);
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_INT:
               {
                  Edje_Message_Int *emsg;
@@ -86,6 +100,7 @@
                  emsg = (Edje_Message_Int *)em->msg;
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_FLOAT:
               {
                  Edje_Message_Float *emsg;
@@ -93,6 +108,7 @@
                  emsg = (Edje_Message_Float *)em->msg;
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_INT_SET:
               {
                  Edje_Message_Int_Set *emsg;
@@ -117,6 +133,7 @@
                  free(emsg->str);
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_STRING_INT:
               {
                  Edje_Message_String_Int *emsg;
@@ -125,6 +142,7 @@
                  free(emsg->str);
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_STRING_FLOAT_SET:
               {
                  Edje_Message_String_Float_Set *emsg;
@@ -133,6 +151,7 @@
                  free(emsg->str);
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_STRING_INT_SET:
               {
                  Edje_Message_String_Int_Set *emsg;
@@ -141,6 +160,7 @@
                  free(emsg->str);
                  free(emsg);
               }
+            break;
           case EDJE_MESSAGE_SIGNAL:
               {
                  Edje_Message_Signal *emsg;
@@ -166,7 +186,7 @@
             break;
          }
      }
-   em->edje->message_num--;
+   em->edje->message.num--;
    free(em);
 }
 
@@ -320,111 +340,124 @@
 void
 _edje_message_process(Edje_Message *em)
 {
+   Embryo_Function fn;
+   void *pdata;
+   int i;
+   
+   /* signals are only handled one way */
+   if (em->type == EDJE_MESSAGE_SIGNAL)
+     {
+       _edje_emit_handle(em->edje, 
+                         ((Edje_Message_Signal *)em->msg)->sig, 
+                         ((Edje_Message_Signal *)em->msg)->src);
+       return;
+     }
+   /* if this has been queued up for the app then just call the callback */
+   if (em->queue == EDJE_QUEUE_APP)
+     {
+       if (em->edje->message.func)
+         em->edje->message.func(em->edje->message.data, em->edje->obj,
+                                em->type, em->id, em->msg);
+       return;
+     }
+   /* now this message is destined for the script message handler fn */
+   if (!((em->edje->collection) && (em->edje->collection->script))) return;
+   fn = embryo_program_function_find(em->edje->collection->script, "message");
+   if (fn == EMBRYO_FUNCTION_NONE) return;
+   /* reset the engine */
+   _edje_embryo_script_reset(em->edje);
+   /* these params ALWAYS go on */
+   /* first param is the message type - always */
+   embryo_parameter_cell_push(em->edje->collection->script,
+                             (Embryo_Cell)em->type);
+   /* 2nd param is the integer of the event id - always there */
+   embryo_parameter_cell_push(em->edje->collection->script, 
+                             (Embryo_Cell)em->id);
+   /* the rest is varags of whatever is in the msg */
    switch (em->type)
      {
       case EDJE_MESSAGE_NONE:
-       switch (em->queue)
-         {
-          case EDJE_QUEUE_APP:
-            /* simply call app callback */
-            break;
-          case EDJE_QUEUE_SCRIPT:
-            if ((em->edje->collection) && (em->edje->collection->script))
-              {
-                 Embryo_Function fn;
-                 
-                 _edje_embryo_script_reset(em->edje);
-                 fn = embryo_program_function_find(em->edje->collection->script, 
"message");
-                 if (fn != EMBRYO_FUNCTION_NONE)
-                   {
-                      void *pdata;
-                      Embryo_Cell cell;
-                      
-                      /* first param is the message type - always */
-                      cell = em->type;
-                      embryo_parameter_cell_push(em->edje->collection->script, cell);
-                      /* 2nd param is the integer of the event id - always there */
-                      cell = em->id;
-                      embryo_parameter_cell_push(em->edje->collection->script, cell);
-                      pdata = embryo_program_data_get(em->edje->collection->script);
-                      embryo_program_data_set(em->edje->collection->script, em->edje);
-                      embryo_program_run(em->edje->collection->script, fn);
-                      embryo_program_data_set(em->edje->collection->script, pdata);
-                   }
-              }
-            break;
-          default:
-            break;
-         }
-       break;
-      case EDJE_MESSAGE_SIGNAL:
-         {
-            char *str1;
-            char *str2;
-            
-            memcpy(&str1, em->msg, sizeof(char *));
-            memcpy(&str2, em->msg + sizeof(char *), sizeof(char *));
-            _edje_emit_handle(em->edje, str1, str2);
-         }
        break;
       case EDJE_MESSAGE_STRING:
-       switch (em->queue)
-         {
-          case EDJE_QUEUE_APP:
-            /* simply call app callback */
-            break;
-          case EDJE_QUEUE_SCRIPT:
-            if ((em->edje->collection) && (em->edje->collection->script))
-              {
-                 Embryo_Function fn;
-                 
-                 _edje_embryo_script_reset(em->edje);
-                 fn = embryo_program_function_find(em->edje->collection->script, 
"message");
-                 if (fn != EMBRYO_FUNCTION_NONE)
-                   {
-                      void *pdata;
-                      Embryo_Cell cell;
-                      
-                      /* first param is the message type - always */
-                      cell = em->type;
-                      embryo_parameter_cell_push(em->edje->collection->script, cell);
-                      /* 2nd param is the integer of the event id - always there */
-                      cell = em->id;
-                      embryo_parameter_cell_push(em->edje->collection->script, cell);
-                      /* 3rd param is the string */
-                      embryo_parameter_string_push(em->edje->collection->script, 
em->msg);
-                      pdata = embryo_program_data_get(em->edje->collection->script);
-                      embryo_program_data_set(em->edje->collection->script, em->edje);
-                      embryo_program_run(em->edje->collection->script, fn);
-                      embryo_program_data_set(em->edje->collection->script, pdata);
-                   }
-              }
-            break;
-          default:
-            break;
-         }
+       embryo_parameter_string_push(em->edje->collection->script, 
+                                    ((Edje_Message_String *)em->msg)->str);
        break;
       case EDJE_MESSAGE_INT:
+       embryo_parameter_cell_push(em->edje->collection->script, 
+                                  (Embryo_Cell)((Edje_Message_Int *)em->msg)->val);
        break;
       case EDJE_MESSAGE_FLOAT:
+         {
+            float v;
+            
+            v = (Embryo_Cell)((Edje_Message_Float *)em->msg)->val;
+            embryo_parameter_cell_push(em->edje->collection->script, 
+                                       (Embryo_Cell)EMBRYO_FLOAT_TO_CELL(v));
+         }
        break;
       case EDJE_MESSAGE_STRING_SET:
+       for (i = 0; i < ((Edje_Message_String_Set *)em->msg)->count; i++)
+         embryo_parameter_string_push(em->edje->collection->script, 
+                                      ((Edje_Message_String_Set *)em->msg)->str[i]);
        break;
       case EDJE_MESSAGE_INT_SET:
+       for (i = 0; i < ((Edje_Message_Int_Set *)em->msg)->count; i++)
+         embryo_parameter_cell_push(em->edje->collection->script, 
+                                    (Embryo_Cell)((Edje_Message_Int_Set 
*)em->msg)->val[i]);
        break;
       case EDJE_MESSAGE_FLOAT_SET:
+       for (i = 0; i < ((Edje_Message_Float_Set *)em->msg)->count; i++)
+         {
+            float v;
+            
+            v = ((Edje_Message_Float_Set *)em->msg)->val[i];
+            embryo_parameter_cell_push(em->edje->collection->script, 
+                                       (Embryo_Cell)EMBRYO_FLOAT_TO_CELL(v));
+         }
        break;
       case EDJE_MESSAGE_STRING_INT:
+       embryo_parameter_string_push(em->edje->collection->script, 
+                                    ((Edje_Message_String_Int *)em->msg)->str);
+       embryo_parameter_cell_push(em->edje->collection->script, 
+                                  (Embryo_Cell)((Edje_Message_String_Int 
*)em->msg)->val);
        break;
       case EDJE_MESSAGE_STRING_FLOAT:
+       embryo_parameter_string_push(em->edje->collection->script, 
+                                    ((Edje_Message_String_Float *)em->msg)->str);
+         {
+            float v;
+            
+            v = (Embryo_Cell)((Edje_Message_String_Float *)em->msg)->val;
+            embryo_parameter_cell_push(em->edje->collection->script, 
+                                       (Embryo_Cell)EMBRYO_FLOAT_TO_CELL(v));
+         }
        break;
       case EDJE_MESSAGE_STRING_INT_SET:
+       embryo_parameter_string_push(em->edje->collection->script, 
+                                    ((Edje_Message_String_Int_Set *)em->msg)->str);
+       for (i = 0; i < ((Edje_Message_String_Int_Set *)em->msg)->count; i++)
+         embryo_parameter_cell_push(em->edje->collection->script, 
+                                    (Embryo_Cell)((Edje_Message_String_Int_Set 
*)em->msg)->val[i]);
        break;
       case EDJE_MESSAGE_STRING_FLOAT_SET:
+       embryo_parameter_string_push(em->edje->collection->script, 
+                                    ((Edje_Message_String_Float_Set *)em->msg)->str);
+       for (i = 0; i < ((Edje_Message_String_Float_Set *)em->msg)->count; i++)
+         {
+            float v;
+            
+            v = ((Edje_Message_String_Float_Set *)em->msg)->val[i];
+            embryo_parameter_cell_push(em->edje->collection->script, 
+                                       (Embryo_Cell)EMBRYO_FLOAT_TO_CELL(v));
+         }
        break;
       default:
        break;
      }
+   pdata = embryo_program_data_get(em->edje->collection->script);
+   embryo_program_data_set(em->edje->collection->script, em->edje);
+   embryo_program_run(em->edje->collection->script, fn);
+   embryo_program_data_set(em->edje->collection->script, pdata);
 }
 
 void
@@ -477,7 +510,7 @@
 {
    Evas_List *l;
 
-   if (ed->message_num <= 0) return;
+   if (ed->message.num <= 0) return;
    /* delete any messages on the main queue for this edje object */
    for (l = msgq; ; )
      {
@@ -492,7 +525,7 @@
             msgq = evas_list_remove_list(msgq, lp);
             _edje_message_free(em);
          }
-       if (ed->message_num <= 0) return;
+       if (ed->message.num <= 0) return;
      }
    /* delete any on the processing queue */
    for (l = tmp_msgq; ; )
@@ -508,6 +541,6 @@
             msgq = evas_list_remove_list(msgq, lp);
             _edje_message_free(em);
          }
-       if (ed->message_num <= 0) return;
+       if (ed->message.num <= 0) return;
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_misc.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- edje_misc.c 6 Jun 2004 04:42:17 -0000       1.3
+++ edje_misc.c 2 Jul 2004 10:17:25 -0000       1.4
@@ -1,129 +1,2 @@
 #include "Edje.h"
 #include "edje_private.h"
-
-/************************** API Routines **************************/
-
-/* FIXDOC: Verify/Expand */
-/** Returns the variable ID
- * @param obj A valid Evas_Object handle
- * @param name The variable name
- * 
- * @return Variable ID\n
- * 0 on Error.
- */
-int
-edje_object_variable_id_get(Evas_Object *obj, char *name)
-{
-   Edje *ed;
-   int id;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (!name)) return 0;
-   return _edje_var_string_id_get(ed, name);
-}
-
-/* FIXDOC: Verify/Expand */
-/** Returns the variable int
- * @param obj A valid Evas_Object handle
- * @param id The variable id
- *
- * @return Variable int\n
- * 0 on Error
- */
-int
-edje_object_variable_int_get(Evas_Object *obj, int id)
-{
-   Edje *ed;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (id <= 0)) return 0;
-   return _edje_var_int_get(ed, id);
-}
-
-/* FIXDOC: Verify/Expand */
-/** Sets the variable int
- * @param obj A valid Evas_Object handle
- * @param id The variable id
- * @param val The int value to set
- */
-void
-edje_object_variable_int_set(Evas_Object *obj, int id, int val)
-{
-   Edje *ed;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (id <= 0)) return;
-   _edje_var_int_set(ed, id, val);
-}
-
-/* FIXDOC: Verify/Expand */
-/** Returns the variable float
- * @param obj A valid Evas_Object handle
- * @param id The variable id
- *
- * @return Variable float\n
- * 0 on Error
- */
-double
-edje_object_variable_float_get(Evas_Object *obj, int id)
-{
-   Edje *ed;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (id <= 0)) return 0;
-   return _edje_var_float_get(ed, id);
-}
-
-/* FIXDOC: Verify/Expand */
-/** Sets the variable float
- * @param obj A valid Evas_Object handle
- * @param id The variable id
- * @param val The float value to set
- */
-void
-edje_object_variable_float_set(Evas_Object *obj, int id, double val)
-{
-   Edje *ed;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (id <= 0)) return;
-   _edje_var_float_set(ed, id, val);
-}
-
-/* FIXDOC: Verify/Expand */
-/** Returns the variable string
- * @param obj A valid Evas_Object handle
- * @param id The variable id
- *
- * @return Variable String\n
- * 0 on Error
- */
-char *
-edje_object_variable_str_get(Evas_Object *obj, int id)
-{
-   Edje *ed;
-   char *s;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (id <= 0)) return NULL;
-   s = _edje_var_str_get(ed, id);
-   if (!s) return NULL;
-   return strdup(s);
-}
-
-/* FIXDOC: Verify/Expand */
-/** Sets the variable string
- * @param obj A valid Evas_Object handle
- * @param id The variable id
- * @param str The string value to set
- */   
-void
-edje_object_variable_str_set(Evas_Object *obj, int id, char *str)
-{
-   Edje *ed;
-   
-   ed = _edje_fetch(obj);
-   if ((!ed) || (id <= 0)) return;
-   if (!str) str = "";
-   _edje_var_str_set(ed, id, str);
-}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- edje_private.h      2 Jul 2004 03:24:56 -0000       1.67
+++ edje_private.h      2 Jul 2004 10:17:25 -0000       1.68
@@ -40,7 +40,20 @@
  * ? all unsafe calls that may result in callbacks must be marked and dealt with
  */
 
-typedef struct _Edje_Message Edje_Message;
+typedef enum _Edje_Queue
+{
+   EDJE_QUEUE_APP,
+     EDJE_QUEUE_SCRIPT
+} Edje_Queue;
+
+typedef struct _Edje_Message_Signal Edje_Message_Signal;
+typedef struct _Edje_Message        Edje_Message;
+
+struct _Edje_Message_Signal
+{
+   char *sig;
+   char *src;
+};
 
 struct _Edje_Message
 {
@@ -126,14 +139,15 @@
 void          _edje_var_anim_del            (Edje *ed, int id);
 void          _edje_var_anim_frametime_reset(void);
     
-void _edje_message_init(void);
-void _edje_message_shutdown(void);
-Edje_Message *_edje_message_new(Edje *ed, Edje_Queue queue, Edje_Message_Type type, 
int id);
-void _edje_message_free(Edje_Message *em);
-void _edje_message_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, 
void *emsg);
-void _edje_message_process(Edje_Message *em);
-void _edje_message_queue_process(void);
-void _edje_message_queue_clear(void);
-void _edje_message_del(Edje *ed);
+void          _edje_message_init            (void);
+void          _edje_message_shutdown        (void);
+void          _edje_message_cb_set          (Edje *ed, void (*func) (void *data, 
Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data);
+Edje_Message *_edje_message_new             (Edje *ed, Edje_Queue queue, 
Edje_Message_Type type, int id);
+void          _edje_message_free            (Edje_Message *em);
+void          _edje_message_send            (Edje *ed, Edje_Queue queue, 
Edje_Message_Type type, int id, void *emsg);
+void          _edje_message_process         (Edje_Message *em);
+void          _edje_message_queue_process   (void);
+void          _edje_message_queue_clear     (void);
+void          _edje_message_del             (Edje *ed);
     
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_program.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- edje_program.c      2 Jul 2004 03:24:56 -0000       1.37
+++ edje_program.c      2 Jul 2004 10:17:25 -0000       1.38
@@ -732,7 +732,7 @@
    if (ed->delete_me) return;
    emsg.sig = sig;
    emsg.src = src;
-   _edje_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_SIGNAL, 0, &emsg);
+   _edje_message_send(ed, EDJE_QUEUE_SCRIPT, EDJE_MESSAGE_SIGNAL, 0, &emsg);
 }
 
 /* FIXME: what if we delete the evas object??? */




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to