Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        Makefile.am ewl_config.c ewl_container.c ewl_embed.c 
        ewl_image.h ewl_menu_base.c ewl_misc.c ewl_theme.c ewl_theme.h 
        ewl_widget.c ewl_window.c 


Log Message:
New theme format that allows the themer to package everything into a single
eet, w/o the need for the theme.db. A few other minor changes related to some
testing. Also removed the profiling flag from the Makefile.am.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/Makefile.am,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- Makefile.am 4 Jan 2004 20:30:58 -0000       1.40
+++ Makefile.am 27 Jan 2004 06:08:35 -0000      1.41
@@ -103,4 +103,4 @@
        ewl_window.c
 
 libewl_la_LIBADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ @ewd_libs@ 
@etox_libs@ -lm
-libewl_la_LDFLAGS = -version-info 0:0:0 -pg
+libewl_la_LDFLAGS = -version-info 0:0:0
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_config.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- ewl_config.c        19 Nov 2003 20:18:34 -0000      1.31
+++ ewl_config.c        27 Jan 2004 06:08:35 -0000      1.32
@@ -333,8 +333,10 @@
 
                        if (nc.evas.font_cache) {
                                evas_font_cache_flush(e->evas);
-                               evas_font_cache_set(e->evas,
+                               evas_font_cache_set(e->evas, 0);
+                                               /*
                                                    nc.evas.font_cache);
+                                                   */
                        }
 
                        if (nc.evas.image_cache) {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- ewl_container.c     14 Jan 2004 20:42:54 -0000      1.58
+++ ewl_container.c     27 Jan 2004 06:08:35 -0000      1.59
@@ -138,7 +138,7 @@
        while (pc->redirect)
                pc = pc->redirect;
 
-       if (ewd_list_is_empty(pc->children) && pc->clip_box)
+       if (!ewd_list_is_empty(pc->children) && pc->clip_box)
                evas_object_show(pc->clip_box);
 
        ewd_list_append(pc->children, child);
@@ -170,7 +170,7 @@
        while (pc->redirect)
                pc = pc->redirect;
 
-       if (ewd_list_is_empty(pc->children) && pc->clip_box)
+       if (!ewd_list_is_empty(pc->children) && pc->clip_box)
                evas_object_show(pc->clip_box);
 
        ewd_list_prepend(pc->children, child);
@@ -205,7 +205,7 @@
        while (pc->redirect)
                pc = pc->redirect;
 
-       if (ewd_list_is_empty(pc->children) && pc->clip_box)
+       if (!ewd_list_is_empty(pc->children) && pc->clip_box)
                evas_object_show(pc->clip_box);
 
        ewd_list_goto_index(pc->children, index);
@@ -257,11 +257,6 @@
         * If the child isn't found, then this isn't it's parent.
         */
        if (!temp) {
-               /* FIXME: Test to see if this is correct. It doesn't seem that
-                * it should be.
-               if (pc->clip_box)
-                       evas_object_hide(pc->clip_box);
-                       */
                DRETURN(DLEVEL_STABLE);
        }
 
@@ -767,9 +762,11 @@
         * to the wanted area.
         */
        c->clip_box = evas_object_rectangle_add(emb->evas);
+       if (c->clip_box) {
+               evas_object_move(c->clip_box, CURRENT_X(w), CURRENT_Y(w));
+               evas_object_resize(c->clip_box, CURRENT_W(w), CURRENT_H(w));
+       }
 
-       evas_object_move(c->clip_box, CURRENT_X(w), CURRENT_Y(w));
-       evas_object_resize(c->clip_box, CURRENT_W(w), CURRENT_H(w));
        if (w->fx_clip_box) {
                evas_object_clip_set(c->clip_box, w->fx_clip_box);
                evas_object_layer_set(c->clip_box,
@@ -809,9 +806,6 @@
        DCHECK_PARAM_PTR("w", w);
 
        if (EWL_CONTAINER(w)->clip_box) {
-               Ewl_Embed      *emb;
-
-               emb = ewl_embed_find_by_widget(w);
 
                /*
                 * Move the clip box into the new position and size of the
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_embed.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_embed.c 3 Jan 2004 21:23:11 -0000       1.19
+++ ewl_embed.c 27 Jan 2004 06:08:35 -0000      1.20
@@ -202,8 +202,9 @@
 
        paths = ewl_theme_font_path_get();
        ewd_list_goto_first(paths);
-       while ((font_path = ewd_list_next(paths)))
+       while ((font_path = ewd_list_next(paths))) {
                evas_font_path_append(evas, font_path);
+       }
 
        DRETURN_PTR(emb->smart, DLEVEL_STABLE);
 }
@@ -229,6 +230,8 @@
                if (REALIZED(e))
                        evas_font_path_append(e->evas, path);
 
+       ewd_list_append(ewl_theme_font_path_get(), strdup(path));
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -620,12 +623,13 @@
 static void ewl_embed_smart_clip_set_cb(Evas_Object *obj, Evas_Object *clip)
 {
        Ewl_Embed *emb;
+       Ewl_Widget *w;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        emb = evas_object_smart_data_get(obj);
-       if (emb && EWL_WIDGET(emb)->fx_clip_box
-                       && clip != EWL_WIDGET(emb)->fx_clip_box)
+       w = EWL_WIDGET(emb);
+       if (emb && w->fx_clip_box && clip != w->fx_clip_box)
                evas_object_clip_set(EWL_WIDGET(emb)->fx_clip_box, clip);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -634,11 +638,13 @@
 static void ewl_embed_smart_clip_unset_cb(Evas_Object *obj)
 {
        Ewl_Embed *emb;
+       Ewl_Widget *w;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        emb = evas_object_smart_data_get(obj);
-       if (emb && EWL_WIDGET(emb)->fx_clip_box)
+       w = EWL_WIDGET(emb);
+       if (emb && w->fx_clip_box)
                evas_object_clip_unset(EWL_WIDGET(emb)->fx_clip_box);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_image.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_image.h 19 Nov 2003 20:18:34 -0000      1.18
+++ ewl_image.h 27 Jan 2004 06:08:35 -0000      1.19
@@ -33,7 +33,7 @@
 {
        Ewl_Widget      widget;
        Ewl_Image_Type  type;
-       void           *image;
+       Evas_Object    *image;
        char           *path;
        char            proportional;
        int             ow, oh;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_menu_base.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_menu_base.c     14 Jan 2004 20:42:54 -0000      1.23
+++ ewl_menu_base.c     27 Jan 2004 06:08:35 -0000      1.24
@@ -263,7 +263,9 @@
        if (!menu->popup)
                DRETURN(DLEVEL_STABLE);
 
-       ewl_container_append_child(EWL_CONTAINER(menu->popup), menu->popbox);
+       if (!REALIZED(menu->popup))
+               ewl_container_append_child(EWL_CONTAINER(menu->popup),
+                                          menu->popbox);
        ewl_widget_show(menu->popup);
 
        if (EWL_MENU_ITEM(w)->submenu)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_misc.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- ewl_misc.c  25 Nov 2003 07:47:29 -0000      1.55
+++ ewl_misc.c  27 Jan 2004 06:08:35 -0000      1.56
@@ -345,7 +345,7 @@
                                        EWL_FLAG_VISIBLE_OBSCURED);
                        if (w->fx_clip_box)
                                evas_object_hide(w->fx_clip_box);
-                       else if (w->theme_object)
+                       if (w->theme_object)
                                evas_object_hide(w->theme_object);
                        /* FIXME: This might be a good idea.
                        if (w->theme_object)
@@ -357,7 +357,7 @@
                                        EWL_FLAG_VISIBLE_OBSCURED);
                        if (w->fx_clip_box)
                                evas_object_show(w->fx_clip_box);
-                       else if (w->theme_object)
+                       if (w->theme_object)
                                evas_object_show(w->theme_object);
                        /* FIXME: This might be a good idea.
                        if (w->theme_object)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- ewl_theme.c 14 Jan 2004 20:42:54 -0000      1.51
+++ ewl_theme.c 27 Jan 2004 06:08:35 -0000      1.52
@@ -4,7 +4,7 @@
 #include "ewl-config.h"
 #endif
 
-static char     theme_path[PATH_MAX];
+static char     *theme_path = NULL;
 
 static E_DB_File *theme_db = NULL;
 
@@ -56,34 +56,55 @@
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
 
-       snprintf(theme_path, PATH_MAX, "%s/.e/ewl/themes/%s", home, theme_name);
-
-       if (((stat(theme_path, &st)) == 0) && S_ISDIR(st.st_mode)) {
-               snprintf(theme_db_path, PATH_MAX, "%s/theme.db", theme_path);
+       snprintf(theme_db_path, PATH_MAX, "%s/.e/ewl/themes/%s", home,
+                       theme_name);
 
+       if (((stat(theme_db_path, &st)) == 0) && S_ISDIR(st.st_mode)) {
+               snprintf(theme_db_path, PATH_MAX,
+                               "%s/.e/ewl/themes/%s/theme.db", home,
+                               theme_name);
                theme_db = e_db_open_read(theme_db_path);
+               if (theme_db)
+                       theme_path = strdup(theme_db_path);
+       }
+       else {
+               snprintf(theme_db_path, PATH_MAX, "%s/.e/ewl/themes/%s.eet",
+                               home, theme_name);
+               if (((stat(theme_db_path, &st)) == 0) && S_ISREG(st.st_mode)) {
+                       theme_path = strdup(theme_db_path);
+               }
        }
 
-       if (!theme_db) {
+       if (!theme_path) {
 
                /*
                 * Theme dir is ok, now get the specified theme's path 
                 */
-               snprintf(theme_path, PATH_MAX, PACKAGE_DATA_DIR
+               snprintf(theme_db_path, PATH_MAX, PACKAGE_DATA_DIR
                         "/themes/%s", theme_name);
-               stat(theme_path, &st);
 
-               if (S_ISDIR(st.st_mode)) {
-                       snprintf(theme_db_path, PATH_MAX, "%s/theme.db",
-                                theme_path);
+               if (((stat(theme_db_path, &st)) == 0) && S_ISDIR(st.st_mode)) {
+                       snprintf(theme_db_path, PATH_MAX, PACKAGE_DATA_DIR
+                                       "/theme/%s/theme.db", theme_name);
 
                        theme_db = e_db_open_read(theme_db_path);
+                       if (theme_db)
+                               theme_path = strdup(theme_db_path);
                }
-
-               if (!theme_db) {
-                       DERROR("No theme db =( ....");
-                       DRETURN_INT(FALSE, DLEVEL_STABLE);
+               else {
+                       snprintf(theme_db_path, PATH_MAX, PACKAGE_DATA_DIR
+                                       "/themes/%s.eet", theme_name);
+                       if (((stat(theme_db_path, &st)) == 0) &&
+                                       S_ISREG(st.st_mode)) {
+                               theme_path = strdup(theme_db_path);
+                       }
                }
+
+       }
+
+       if (!theme_path) {
+               DERROR("No usable theme found, exiting EWL");
+               DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
 
        ewl_theme_init_font_path();
@@ -166,7 +187,7 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-/*
+/**
  * @brief Return the path of the current theme
  * @return Returns a copy of the current theme path on success, NULL on failure
  */
@@ -176,6 +197,15 @@
 }
 
 /**
+ * @brief Returns the open theme db file handle.
+ * @return Returns the open theme database on success, NULL for an eet theme.
+ */
+E_DB_File *ewl_theme_get_db()
+{
+       DRETURN_PTR(theme_db, DLEVEL_STABLE);
+}
+
+/**
  * @return Returns the font path of widget @a w on success, NULL on failure.
  * @brief retrieve the path of a widgets theme's fonts
  */
@@ -217,7 +247,6 @@
  */
 char           *ewl_theme_image_get(Ewl_Widget * w, char *k)
 {
-       char           *path;
        char           *data;
        struct stat     st;
 
@@ -225,28 +254,30 @@
        DCHECK_PARAM_PTR_RET("w", w, NULL);
        DCHECK_PARAM_PTR_RET("k", k, NULL);
 
-       data = ewl_theme_data_get_str(w, k);
+       if (theme_db)
+               data = ewl_theme_data_get_str(w, k);
+       else
+               data = strdup(theme_path);
 
        if (!data)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
+       /*
+        * Convert a relative path to an absolute path
+        */
        if (*data != '/') {
-               path = NEW(char, PATH_MAX);
-               if (!path) {
-                       FREE(data);
-                       DRETURN_PTR(NULL, DLEVEL_STABLE);
-               }
+               char path[PATH_MAX];
 
                snprintf(path, PATH_MAX, "%s/%s", theme_path, data);
 
                FREE(data);
-       } else                  /* Absolute path given, so return it */
-               path = strdup(data);
+               data = strdup(path);
+       }
 
-       if (((stat(path, &st)) == -1) || !S_ISREG(st.st_mode))
+       if (((stat(data, &st)) == -1) || !S_ISREG(st.st_mode))
                DWARNING("Couldn't stat image\n");
 
-       DRETURN_PTR(path, DLEVEL_STABLE);
+       DRETURN_PTR(data, DLEVEL_STABLE);
 }
 
 
@@ -274,8 +305,18 @@
                if (!ret && ewl_config.theme.cache && cached_theme_data)
                        ret = ewd_hash_get(cached_theme_data, temp);
 
-               if (!ret && theme_db) {
-                       ret = e_db_str_get(theme_db, temp);
+               if (!ret) {
+                       if (theme_db) {
+                               /*
+                                * strdup here to stay consistent with edje
+                                */
+                               ret = e_db_str_get(theme_db, temp);
+                               if (ret)
+                                       ret = strdup(ret);
+                       }
+                       else {
+                               ret = edje_file_data_get(theme_path, temp);
+                       }
 
                        if (ret && ewl_config.theme.cache) {
                                if (!cached_theme_data)
@@ -289,9 +330,6 @@
                temp++;
        }
 
-       if (ret)
-               ret = strdup(ret);
-
        DRETURN_PTR(ret, DLEVEL_STABLE);
 }
 
@@ -315,8 +353,19 @@
                else
                        ret = (int) (ewd_hash_get(def_theme_data, temp));
 
-               if (!ret)
-                       e_db_int_get(theme_db, temp, &ret);
+               if (!ret) {
+                       if (theme_db)
+                               e_db_int_get(theme_db, temp, &ret);
+                       else {
+                               char *val;
+
+                               val = edje_file_data_get(theme_path, temp);
+                               if (val) {
+                                       ret = atoi(val);
+                                       FREE(val);
+                               }
+                       }
+               }
                temp++;
        }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_theme.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_theme.h 3 Jan 2004 21:23:11 -0000       1.19
+++ ewl_theme.h 27 Jan 2004 06:08:35 -0000      1.20
@@ -14,6 +14,7 @@
 int             ewl_theme_init_widget(Ewl_Widget * w);
 void            ewl_theme_deinit_widget(Ewl_Widget * w);
 char           *ewl_theme_path(void);
+E_DB_File      *ewl_theme_get_db();
 Ewd_List       *ewl_theme_font_path_get(void);
 void            ewl_theme_font_path_add(char *path);
 char           *ewl_theme_image_get(Ewl_Widget * w, char *k);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -3 -r1.96 -r1.97
--- ewl_widget.c        14 Jan 2004 20:42:54 -0000      1.96
+++ ewl_widget.c        27 Jan 2004 06:08:35 -0000      1.97
@@ -83,7 +83,6 @@
  * @return Returns no value.
  * @brief Realize the specified widget.
  *
- *
  * The specified widget is realized, ie. actually displayed to the screen.
  */
 void ewl_widget_realize(Ewl_Widget * w)
@@ -908,6 +907,8 @@
 
        if (w->fx_clip_box)
                evas_object_show(w->fx_clip_box);
+       if (w->theme_object)
+               evas_object_show(w->theme_object);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -922,6 +923,8 @@
 
        if (w->fx_clip_box)
                evas_object_hide(w->fx_clip_box);
+       if (w->theme_object)
+               evas_object_hide(w->theme_object);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -1011,7 +1014,7 @@
 
        FREE(key);
 
-       if (i) {
+       if (group) {
                emb = ewl_embed_find_by_widget(w);
                if (!emb)
                        DRETURN(DLEVEL_STABLE);
@@ -1022,10 +1025,11 @@
                w->theme_object = edje_object_add(emb->evas);
                
                edje_object_file_set(w->theme_object, i, group);
-               FREE(i);
-               IF_FREE(group);
+               FREE(group);
        }
 
+       IF_FREE(i);
+
        /*
         * Set up the theme object on the widgets evas
         */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -3 -r1.67 -r1.68
--- ewl_window.c        30 Dec 2003 18:05:22 -0000      1.67
+++ ewl_window.c        27 Jan 2004 06:08:36 -0000      1.68
@@ -312,8 +312,6 @@
        LAYER(w) = -1000;
        ewd_list_append(ewl_window_list, w);
 
-       ewd_list_append(ewl_window_list, w);
-
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to