Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        entice.c image.c 


Log Message:
Allow entice to open directories recursively
Also put the image back "centered" when loaded.


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- entice.c    5 Nov 2003 08:12:17 -0000       1.18
+++ entice.c    9 Nov 2003 23:12:26 -0000       1.19
@@ -11,6 +11,9 @@
 #include <Esmart/container.h>
 #include <Esmart/E_Thumb.h>
 #include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include "entice.h"
 #include "ipc.h"
 #include "image.h"
@@ -317,6 +320,48 @@
    return (result);
 }
 
+void
+entice_file_add_dir_job_cb(void *data)
+{
+   DIR *d = NULL;
+   struct dirent *dent = NULL;
+   char buf[PATH_MAX], *file = NULL;
+
+   if (entice && entice->ee && data)
+   {
+      file = (char *) data;
+
+      if ((d = opendir(data)))
+      {
+         while ((dent = readdir(d)))
+         {
+            if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")
+                || (dent->d_name[0] == '.'))
+               continue;
+            snprintf(buf, PATH_MAX, "%s/%s", file, dent->d_name);
+            entice_file_add_job_cb(buf);
+         }
+         closedir(d);
+      }
+   }
+
+}
+
+int
+entice_file_is_dir(char *file)
+{
+   struct stat st;
+
+   if (file)
+   {
+      if (stat(file, &st) < 0)
+         return (0);
+      if (S_ISDIR(st.st_mode))
+         return (1);
+   }
+   return (0);
+}
+
 /**
  * entice_file_add_job_cb - generate the cached thumb and send an ipc
  * message telling entice to load it
@@ -350,10 +395,14 @@
                snprintf(buf, PATH_MAX, "%s/%s", mycwd, file);
             }
          }
+         if (entice_file_is_dir(buf))
+            entice_file_add_dir_job_cb(buf);
+         else if ((o = e_thumb_new(ecore_evas_get(entice->ee), buf)))
+         {
+            evas_object_del(o);
+            entice_ipc_client_request_image_load(buf);
+         }
       }
-      if ((o = e_thumb_new(ecore_evas_get(entice->ee), buf)))
-         evas_object_del(o);
-      entice_ipc_client_request_image_load(buf);
    }
 }
 
@@ -756,9 +805,8 @@
          entice_image_x_scroll_offset_add(entice->current, -dx);
          entice_image_y_scroll_offset_add(entice->current, -dy);
          edje_object_part_drag_value_set(entice->edje, "EnticeImage", dx, dy);
-        evas_object_geometry_get(entice->current, &x, &y, &w, &h);
-        evas_damage_rectangle_add(ecore_evas_get(entice->ee), x,
-        y,w,h); 
+         evas_object_geometry_get(entice->current, &x, &y, &w, &h);
+         evas_damage_rectangle_add(ecore_evas_get(entice->ee), x, y, w, h);
       }
    }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- image.c     5 Nov 2003 08:12:17 -0000       1.33
+++ image.c     9 Nov 2003 23:12:26 -0000       1.34
@@ -393,7 +393,6 @@
       else
          im->zoom = ((double) (im->ih) / (double) im->h);
       im->fit = 1;
-      im->scroll.x = im->scroll.y = 0;
       entice_image_resize(o, im->w, im->h);
    }
 }
@@ -704,10 +703,10 @@
             im->scroll.y = -((h - hh + 1) / 2);
       }
       */
-      evas_object_move(im->obj, im->scroll.x + im->x, im->scroll.y +
-      im->y);
       evas_object_resize(im->obj, ww, hh);
       evas_object_image_fill_set(im->obj, 0, 0, ww, hh);
+      evas_object_move(im->obj, im->scroll.x + im->x + ((im->w - ww) / 2),
+                       im->scroll.y + im->y + ((im->h - hh) / 2));
    }
 }
 static void




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to