Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        entice.c image.c image.h prefs.c signals_image.c 
        signals_image.h 


Log Message:

* Image rotation routines implemented, flipping should be done in a similar
  manner, rm ~/.entice.db, it'll recreated it Left/Right keys rotate by default 

* Code to handle EnticeImageModified

* Added a tiny bit of code to recognize http image loading, would be really
  nice to have, but needs to be thought about more

This commit was brought to you in part by Fall Break :)


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- entice.c    12 Oct 2003 01:56:46 -0000      1.3
+++ entice.c    14 Oct 2003 14:12:06 -0000      1.4
@@ -48,7 +48,7 @@
       "EnticeThumbsScrollStop",
       "EnticeImageScrollEastStart", "EnticeImageScrollWestStart",
       "EnticeImageScrollNorthStart", "EnticeImageScrollSouthStart",
-      "EnticeImageScrollStop",
+      "EnticeImageScrollStop", "EnticeImageModified",
       "EnticeQuit"
    };
    edje_callbacks funcs[] = { _entice_delete_current, _entice_remove_current,
@@ -63,7 +63,7 @@
       _entice_thumbs_scroll_stop,
       _entice_image_scroll_east_start, _entice_image_scroll_west_start,
       _entice_image_scroll_north_start, _entice_image_scroll_south_start,
-      _entice_image_scroll_stop,
+      _entice_image_scroll_stop, _entice_image_modified,
       _entice_quit, NULL
    };
    count = sizeof(signals) / sizeof(char *);
@@ -326,16 +326,23 @@
    {
       file = (char *) data;
 
-      if (file && file[0] == '/')
-         snprintf(buf, PATH_MAX, "%s", file);
-      else
+      if (file)
       {
-         char mycwd[PATH_MAX];
-
-         memset(mycwd, 0, sizeof(mycwd));
-         if (getcwd(mycwd, PATH_MAX))
+         if (file[0] == '/')
+            snprintf(buf, PATH_MAX, "%s", file);
+         else if ((strlen(file) > 7) && strncmp(file, "http://";, 7))
+         {
+            fprintf(stderr, "http file request\n");
+         }
+         else
          {
-            snprintf(buf, PATH_MAX, "%s/%s", mycwd, file);
+            char mycwd[PATH_MAX];
+
+            memset(mycwd, 0, sizeof(mycwd));
+            if (getcwd(mycwd, PATH_MAX))
+            {
+               snprintf(buf, PATH_MAX, "%s/%s", mycwd, file);
+            }
          }
       }
       if ((o = e_thumb_new(ecore_evas_get(entice->ee), buf)))
@@ -614,5 +621,24 @@
       {
          fprintf(stderr, "Unable to allocate a new preview\n");
       }
+   }
+}
+
+void
+entice_rotate_image_right(void)
+{
+   if (entice && entice->current)
+   {
+      entice_image_rotate(entice->current, 1);
+      edje_object_signal_emit(entice->edje, "EnticeImageModified", "");
+   }
+}
+void
+entice_rotate_image_left(void)
+{
+   if (entice && entice->current)
+   {
+      entice_image_rotate(entice->current, 3);
+      edje_object_signal_emit(entice->edje, "EnticeImageModified", "");
    }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- image.c     11 Oct 2003 22:54:12 -0000      1.22
+++ image.c     14 Oct 2003 14:12:07 -0000      1.23
@@ -17,6 +17,42 @@
 static int _entice_image_scroll_timer(void *data);
 
 void
+entice_image_rotate(Evas_Object * o, int orientation)
+{
+   int iw, ih;
+   double w, h;
+   Entice_Image *im = NULL;
+   Imlib_Image imlib_im = NULL;
+
+   if ((im = evas_object_smart_data_get(o)))
+   {
+      evas_object_image_size_get(im->obj, &iw, &ih);
+      evas_object_geometry_get(o, NULL, NULL, &w, &h);
+
+      if (imlib_im =
+          imlib_create_image_using_copied_data(iw, ih,
+                                               evas_object_image_data_get(im->
+                                                                          obj,
+                                                                          1)))
+      {
+         imlib_context_set_image(imlib_im);
+         imlib_image_orientate(orientation);
+         im->iw = imlib_image_get_width();
+         im->ih = imlib_image_get_height();
+         evas_object_image_size_set(im->obj, im->iw, im->ih);
+         evas_object_image_data_copy_set(im->obj,
+                                         imlib_image_get_data_for_reading_only
+                                         ());
+         evas_object_resize(o, w, h);
+         /* if we're fitting, it'll need to be recalculated */
+         if (entice_image_zoom_fit_get(o))
+            entice_image_zoom_fit(o);
+         imlib_free_image();
+      }
+   }
+}
+
+void
 entice_image_file_set(Evas_Object * o, char *filename)
 {
    char buf[PATH_MAX];
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- image.h     11 Oct 2003 22:54:12 -0000      1.13
+++ image.h     14 Oct 2003 14:12:07 -0000      1.14
@@ -8,6 +8,9 @@
  */
 #include <Evas.h>
 #include <Ecore.h>
+#define X_DISPLAY_MISSING
+#include <Imlib2.h>
+#undef X_DISPLAY_MISSING
 
 typedef struct _Entice_Image Entice_Image;
 typedef enum _Entice_Image_Scroll_Direction Entice_Scroll_Direction;
@@ -60,5 +63,6 @@
 void entice_image_scroll_start(Evas_Object * o, Entice_Scroll_Direction d);
 void entice_image_scroll(Evas_Object * o, Entice_Scroll_Direction d, int val);
 const char *entice_image_file_get(Evas_Object * o);
+void entice_image_rotate(Evas_Object * o, int orientation);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/prefs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- prefs.c     12 Oct 2003 01:56:47 -0000      1.2
+++ prefs.c     14 Oct 2003 14:12:07 -0000      1.3
@@ -178,10 +178,12 @@
    char *signals[] = { "EnticeZoomIn", "EnticeZoomOut", "EnticeFullScreen",
       "EnticeImageNext", "EnticeImagePrev",
       "EnticeZoomDefault", "EnticeZoomFit",
-      "EnticeQuit"
+      "EnticeQuit", "EnticeRotateLeft", "EnticeRotateRight"
    };
    char *keys[] =
-      { "equal", "minus", "f", "space", "BackSpace", "n", "w", "q" };
+      { "equal", "minus", "f", "space", "BackSpace", "n", "w", "q", "Left",
+      "Right"
+   };
    count = sizeof(signals) / sizeof(char *);
 
    if (filename)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_image.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- signals_image.c     11 Oct 2003 23:45:58 -0000      1.2
+++ signals_image.c     14 Oct 2003 14:12:07 -0000      1.3
@@ -153,6 +153,7 @@
 _entice_rotate_left(void *data, Evas_Object * o, const char *emission,
                     const char *source)
 {
+   entice_rotate_image_left();
    return;
    data = NULL;
    o = NULL;
@@ -165,6 +166,7 @@
 _entice_rotate_right(void *data, Evas_Object * o, const char *emission,
                      const char *source)
 {
+   entice_rotate_image_right();
    return;
    data = NULL;
    o = NULL;
@@ -331,6 +333,21 @@
              const char *source)
 {
    ecore_main_loop_quit();
+   return;
+   data = NULL;
+   o = NULL;
+   emission = NULL;
+   source = NULL;
+}
+
+/* EnticeImageModified */
+void
+_entice_image_modified(void *data, Evas_Object * o, const char *emission,
+                       const char *source)
+{
+#if DEBUG
+   fprintf(stderr, "Image has been modified !!! :)\n");
+#endif
    return;
    data = NULL;
    o = NULL;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_image.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- signals_image.h     11 Oct 2003 22:54:12 -0000      1.1
+++ signals_image.h     14 Oct 2003 14:12:07 -0000      1.2
@@ -68,4 +68,6 @@
                                const char *emission, const char *source);
 void _entice_quit(void *data, Evas_Object * o, const char *emission,
                   const char *source);
+void _entice_image_modified(void *data, Evas_Object * o, const char *emission,
+                            const char *source);
 #endif




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to