Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        Edje_Edit.h Makefile.am edje_calc.c edje_load.c edje_private.h 
        edje_program.c edje_text.c 
Added Files:
        edje_embryo.c 


Log Message:


embryo support... started. :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Edje_Edit.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Edje_Edit.h 16 Mar 2004 08:38:51 -0000      1.3
+++ Edje_Edit.h 26 Mar 2004 09:10:05 -0000      1.4
@@ -9,6 +9,12 @@
 #include <Ecore_Fb.h>
 #endif
 #include <Eet.h>
+#include <Embryo.h>
+
+/* Cache result of program glob matches - this uses up extra ram withthe gain
+ * of faster program matching if a part has LOTS of programs.
+#define EDJE_PROGRAM_CACHE
+*/
 
 typedef struct _Edje_File                            Edje_File;
 typedef struct _Edje_Data                            Edje_Data;
@@ -227,11 +233,14 @@
    } prop;
    
    int        references;
-   
+#ifdef EDJE_PROGRAM_CACHE   
    struct {
       Evas_Hash                   *no_matches;
       Evas_Hash                   *matches;
    } prog_cache;
+#endif   
+   
+   Embryo_Program   *script; /* all the embryo script code for this group */
 };
 
 struct _Edje_Part
@@ -506,6 +515,11 @@
    struct {   
       int           l, r, t, b;
    } border;
+   struct {
+      struct {
+         double      x, y; /* text alignment within bounds */
+      } align;
+   } text;
 };
 
 struct _Edje_Emission
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- Makefile.am 28 Feb 2004 04:42:27 -0000      1.11
+++ Makefile.am 26 Mar 2004 09:10:05 -0000      1.12
@@ -11,6 +11,7 @@
 -I$(top_builddir) \
 -I$(includedir) \
 @eet_cflags@ \
[EMAIL PROTECTED]@ \
 @evas_cflags@ \
 @ecore_cflags@
 
@@ -26,6 +27,7 @@
 edje_calc.c \
 edje_callbacks.c \
 edje_data.c \
+edje_embryo.c \
 edje_load.c \
 edje_main.c \
 edje_program.c \
@@ -34,7 +36,7 @@
 edje_util.c \
 edje_private.h
 
-libedje_la_LIBADD       = $(LDFLAGS) -lm @evas_libs@ @ecore_libs@ @eet_libs@
+libedje_la_LIBADD       = $(LDFLAGS) -lm @evas_libs@ @ecore_libs@ @eet_libs@ 
@embryo_libs@
 libedje_la_CPPFLAGS     = @edje_def@
 libedje_la_DEPENDENCIES = $(top_builddir)/config.h
 libedje_la_LDFLAGS      = -version-info 0:1:0
@@ -42,6 +44,6 @@
 libedje_edit_la_SOURCES  = \
 edje_edit.c
 
-libedje_edit_la_LIBADD       = $(LDFLAGS) -lm @evas_libs@ @ecore_libs@ @eet_libs@ 
$(top_builddir)/src/lib/libedje.la
+libedje_edit_la_LIBADD       = $(LDFLAGS) -lm @evas_libs@ @ecore_libs@ @eet_libs@ 
@embryo_libs@ $(top_builddir)/src/lib/libedje.la
 libedje_edit_la_DEPENDENCIES = $(top_builddir)/config.h libedje.la
 libedje_edit_la_LDFLAGS      = -version-info 0:1:0
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- edje_calc.c 4 Feb 2004 11:10:10 -0000       1.25
+++ edje_calc.c 26 Mar 2004 09:10:05 -0000      1.26
@@ -591,6 +591,9 @@
    params->border.r = desc->border.r;
    params->border.t = desc->border.t;
    params->border.b = desc->border.b;
+   /* text.align */
+   params->text.align.x = desc->text.align.x;
+   params->text.align.y = desc->text.align.y;
 }
 
 static void
@@ -702,6 +705,9 @@
        p3.border.r = (p1.border.r * (1.0 - pos)) + (p2.border.r * (pos));
        p3.border.t = (p1.border.t * (1.0 - pos)) + (p2.border.t * (pos));
        p3.border.b = (p1.border.b * (1.0 - pos)) + (p2.border.b * (pos));
+
+       p3.text.align.x = (p1.text.align.x * (1.0 - pos)) + (p2.text.align.x * (pos));
+       p3.text.align.y = (p1.text.align.y * (1.0 - pos)) + (p2.text.align.y * (pos));
      }
    else
      p3 = p1;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- edje_load.c 16 Mar 2004 08:38:51 -0000      1.37
+++ edje_load.c 26 Mar 2004 09:10:05 -0000      1.38
@@ -4,7 +4,9 @@
 static Evas_Hash   *_edje_file_hash = NULL;
 
 static void _edje_collection_free_part_description_free(Edje_Part_Description *desc);
+#ifdef EDJE_PROGRAM_CACHE
 static int  _edje_collection_free_prog_cache_matches_free_cb(Evas_Hash *hash, const 
char *key, void *data, void *fdata);
+#endif
 
 /* API Routines */
 int
@@ -184,6 +186,7 @@
        _edje_ref(ed);
        _edje_block(ed);
        _edje_freeze(ed);
+       if (ed->collection->script) _edje_embryo_script_init(ed);
        _edje_emit(ed, "load", "");
        for (l = ed->parts; l; l = l->next)
          {
@@ -403,6 +406,8 @@
        if (id >= 0)
          {
             char buf[256];
+            int  size;
+            void *data;
             
             snprintf(buf, sizeof(buf), "collections/%i", id);
             if (!ef) ef = eet_open(ed->path, EET_FILE_MODE_READ);
@@ -421,6 +426,13 @@
               }
             ed->collection->references = 1;
             ed->file->collection_hash = evas_hash_add(ed->file->collection_hash, 
ed->part, ed->collection);
+            snprintf(buf, sizeof(buf), "scripts/%i", id);
+            data = eet_read(ef, buf, &size);
+            if (data)
+              {
+                 ed->collection->script = embryo_program_new(data, size);
+                 free(data);
+              }
          }
        else
          {
@@ -444,6 +456,7 @@
        ed->collection->references--;
        if (ed->collection->references <= 0)
          {
+            _edje_embryo_script_shutdown(ed);
             ed->file->collection_hash = evas_hash_del(ed->file->collection_hash, 
ed->part, ed->collection);
             _edje_collection_free(ed, ed->collection);
          }
@@ -621,6 +634,7 @@
          }
        free(ep);
      }
+#ifdef EDJE_PROGRAM_CACHE
    if (ec->prog_cache.no_matches) evas_hash_free(ec->prog_cache.no_matches);
    if (ec->prog_cache.matches)
      {
@@ -629,6 +643,7 @@
                          NULL);
        evas_hash_free(ec->prog_cache.matches);
      }
+#endif   
    free(ec);
 }
 
@@ -651,6 +666,7 @@
    free(desc);
 }
 
+#ifdef EDJE_PROGRAM_CACHE
 static int
 _edje_collection_free_prog_cache_matches_free_cb(Evas_Hash *hash, const char *key, 
void *data, void *fdata)
 {
@@ -659,3 +675,4 @@
    hash = NULL;
    fdata = NULL;
 }
+#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- edje_private.h      8 Mar 2004 02:43:48 -0000       1.59
+++ edje_private.h      26 Mar 2004 09:10:05 -0000      1.60
@@ -11,6 +11,7 @@
 #include <Ecore_Fb.h>
 #endif
 #include <Eet.h>
+#include <Embryo.h>
 
 #include <math.h>
 #include <fnmatch.h>
@@ -26,40 +27,7 @@
  * 
  * more example edje files
  * 
- * ? programs need to be able to cycle part states given a list of states
  * ? programs can do multiple actions from one signal
- * ? programs need to be able to set/get/add/sub and compare variables
- *   ie: 
- *     action, INT "active_state" = INT 1;
- *     ...
- *     action, INT "hidden" = INT 10;
- *     ...
- *     action, STR "my_string" = STR "some content here";
- *     ...
- *     action, INT "count" += INT 10;
- *     ...
- *     action, INT "count" -= INT 10;
- *     action, INT "count" += MOUSE_X "this_part";
- *     ...
- *     action, INT "count" *= INT "another_variable";
- *     action, INT "count" -= INT 10;
- *     action, INT "count" /= INT 2;
- *     ...
- * 
- *     if,  INT "active_state" == 1;
- *     ...
- *     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";
- *     ...
- * 
  * ? add containering (hbox, vbox, table, wrapping multi-line hbox & vbox)
  * ? text entry widget (single line only)
  * ? reduce linked list walking and list_nth calls
@@ -88,4 +56,8 @@
 extern Edje_Text_Style  _edje_text_styles[EDJE_TEXT_EFFECT_LAST];
 extern Evas_List       *_edje_edjes;
 
+void _edje_embryo_script_init     (Edje *ed);
+void _edje_embryo_script_shutdown (Edje *ed);
+void _edje_embryo_script_reset    (Edje *ed);
+    
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_program.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- edje_program.c      16 Mar 2004 08:38:51 -0000      1.29
+++ edje_program.c      26 Mar 2004 09:10:05 -0000      1.30
@@ -697,11 +697,14 @@
        if (ed->collection)
          {
             Edje_Part_Collection *ec;
+#ifdef EDJE_PROGRAM_CACHE
             char *tmps;
+#endif      
             int l1, l2;
             int done;
             
             ec = ed->collection;
+#ifdef EDJE_PROGRAM_CACHE
             l1 = strlen(ee->signal);
             l2 = strlen(ee->source);
             tmps = malloc(l1 + l2 + 2);
@@ -712,8 +715,10 @@
                  tmps[l1] = '\377';
                  strcpy(&(tmps[l1 + 1]), ee->source);
               }
+#endif      
             done = 0;
             
+#ifdef EDJE_PROGRAM_CACHE
             if (tmps)
               {
                  Evas_List *matches;
@@ -741,10 +746,13 @@
                       done = 1;
                    }
               }
+#endif
             if (!done)
               {
+#ifdef EDJE_PROGRAM_CACHE
                  int matched = 0;
                  Evas_List *matches = NULL;
+#endif
                  
                  for (l = ed->collection->programs; l; l = l->next)
                    {
@@ -756,19 +764,26 @@
                           (_edje_glob_match(ee->signal, pr->signal)) &&
                           (_edje_glob_match(ee->source, pr->source)))
                         {
+#ifdef EDJE_PROGRAM_CACHE
                            matched++;
+#endif                     
                            _edje_program_run(ed, pr, 0);
                            if (_edje_block_break(ed))
                              {
+#ifdef EDJE_PROGRAM_CACHE
                                 if (tmps) free(tmps);
                                 evas_list_free(matches);
+#endif                          
                                 if (!ed->dont_clear_signals)
                                   _edje_emit(ed, NULL, NULL);
                                 goto break_prog;
                              }
+#ifdef EDJE_PROGRAM_CACHE
                            matches = evas_list_append(matches, pr);
+#endif                     
                         }
                    }
+#ifdef EDJE_PROGRAM_CACHE
                  if (tmps)
                    {
                       if (matched == 0)
@@ -778,17 +793,22 @@
                         ec->prog_cache.matches =
                         evas_hash_add(ec->prog_cache.matches, tmps, matches);
                    }
+#endif             
               }
             _edje_emit_cb(ed, ee->signal, ee->source);
             if (_edje_block_break(ed))
               {
+#ifdef EDJE_PROGRAM_CACHE
                  if (tmps) free(tmps);
+#endif           
                  if (!ed->dont_clear_signals)              
                    _edje_emit(ed, NULL, NULL);
                  goto break_prog;
               }
+#ifdef EDJE_PROGRAM_CACHE
             if (tmps) free(tmps);
             tmps = NULL;
+#endif      
          }
 
        _edje_emission_free(ee);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_text.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- edje_text.c 23 Jan 2004 02:13:42 -0000      1.13
+++ edje_text.c 26 Mar 2004 09:10:05 -0000      1.14
@@ -322,7 +322,9 @@
        (ep->text.cache.in_h == sh) &&
        (ep->text.cache.in_str) &&
        (text) &&
-       (!strcmp(ep->text.cache.in_str, text)))
+       (!strcmp(ep->text.cache.in_str, text)) &&
+       (chosen_desc->text.align.x == params->text.align.x) &&
+       (chosen_desc->text.align.y == params->text.align.y))
      {
        text = ep->text.cache.out_str;
        size = ep->text.cache.out_size;
@@ -415,17 +417,17 @@
        evas_object_text_font_set(ep->object, font, size);
        evas_object_text_text_set(ep->object, text);
        evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th);
-       p = ((sw - tw) * chosen_desc->text.align.x);
+       p = ((sw - tw) * params->text.align.x);
        c1 = -1;
        c2 = -1;
        /* chop chop */
        if (tw > sw)
          {
-            if (chosen_desc->text.align.x != 0.0)
+            if (params->text.align.x != 0.0)
               c1 = evas_object_text_char_coords_get(ep->object,
                                                     -p, th / 2,
                                                     NULL, NULL, NULL, NULL);
-            if (chosen_desc->text.align.x != 1.0)
+            if (params->text.align.x != 1.0)
               c2 = evas_object_text_char_coords_get(ep->object,
                                                     -p + sw, th / 2,
                                                     NULL, NULL, NULL, NULL);
@@ -539,8 +541,8 @@
    evas_object_text_font_set(ep->object, font, size);
    evas_object_text_text_set(ep->object, text);
    evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th);
-   ep->offset.x = ox + ((sw - tw) * chosen_desc->text.align.x);
-   ep->offset.y = oy + ((sh - th) * chosen_desc->text.align.y);
+   ep->offset.x = ox + ((sw - tw) * params->text.align.x);
+   ep->offset.y = oy + ((sh - th) * params->text.align.y);
    evas_object_move(ep->object,
                    ed->x + params->x + ep->offset.x,
                    ed->y + params->y + ep->offset.y);




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to