Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : apps/entice
Dir : e17/apps/entice/src/bin
Modified Files:
entice.c image.c image.h
Log Message:
* Have entice load the first image it receives
* Translate mouse events from our image object back to edje
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- entice.c 16 Oct 2003 06:17:46 -0000 1.6
+++ entice.c 17 Oct 2003 21:36:08 -0000 1.7
@@ -262,6 +262,7 @@
edje_object_part_swallow(entice->edje, "EnticeImage", new_current);
edje_object_part_swallow(entice->edje, "EnticeImageScroller",
new_scroller);
+ entice_image_edje_set(new_current, entice->edje);
if (should_fit)
entice_image_zoom_fit(new_current);
@@ -307,6 +308,8 @@
evas_object_show(edje);
e_container_element_append(entice->container, edje);
+ if (evas_list_count(entice->thumb.list) == 1)
+ _entice_thumb_load(o, NULL, NULL, NULL);
}
else
result = 1;
@@ -684,8 +687,8 @@
if (entice && entice->current)
{
edje_freeze();
- if(entice_image_save(entice->current))
- fprintf(stderr, "Saving was successul\n");
+ if (entice_image_save(entice->current))
+ fprintf(stderr, "Saving was successul\n");
/* FIXME: Emit a EnticeSaveOk or something signal */
edje_thaw();
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- image.c 14 Oct 2003 22:08:53 -0000 1.25
+++ image.c 17 Oct 2003 21:36:08 -0000 1.26
@@ -11,10 +11,25 @@
#include <Ecore.h>
#include "image.h"
-#define DEBUG 0
+#define DEBUG 1
static void entice_image_resize(Evas_Object * o, double w, double h);
static int _entice_image_scroll_timer(void *data);
+static void _entice_image_mouse_down_translate(void *data, Evas * e,
+ Evas_Object * obj,
+ void *event_info);
+static void _entice_image_mouse_in_translate(void *data, Evas * e,
+ Evas_Object * obj,
+ void *event_info);
+static void _entice_image_mouse_out_translate(void *data, Evas * e,
+ Evas_Object * obj,
+ void *event_info);
+static void _entice_image_mouse_up_translate(void *data, Evas * e,
+ Evas_Object * obj,
+ void *event_info);
+static void _entice_image_mouse_wheel_translate(void *data, Evas * e,
+ Evas_Object * obj,
+ void *event_info);
const char *
entice_image_format_get(Evas_Object * o)
@@ -404,6 +419,27 @@
entice_image_resize(o, im->w, im->h);
}
}
+void
+entice_image_edje_set(Evas_Object * o, Evas_Object * edje)
+{
+ Entice_Image *im = NULL;
+
+ if ((edje) && (im = evas_object_smart_data_get(o)))
+ {
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_IN,
+ _entice_image_mouse_in_translate, edje);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_OUT,
+ _entice_image_mouse_out_translate, edje);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_UP,
+ _entice_image_mouse_up_translate, edje);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _entice_image_mouse_down_translate,
+ edje);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_WHEEL,
+ _entice_image_mouse_wheel_translate,
+ edje);
+ }
+}
/**
* _entice_image_scroll_timer - our ecore timer to do continuous
@@ -515,6 +551,7 @@
im->clip = evas_object_rectangle_add(evas_object_evas_get(o));
evas_object_color_set(im->clip, 255, 255, 255, 255);
evas_object_layer_set(im->clip, 0);
+
im->zoom = 1.0;
im->fit = 1;
evas_object_smart_data_set(o, im);
@@ -718,6 +755,7 @@
im = evas_object_smart_data_get(o);
im->obj = image;
+
evas_object_image_size_get(im->obj, &w, &h);
evas_object_clip_set(im->obj, im->clip);
evas_object_show(im->obj);
@@ -820,3 +858,99 @@
return (0);
}
#endif
+/**
+ * The following five functions translate evas mouse events into edje
+ * mouse event signal emissions
+ */
+static void
+_entice_image_mouse_wheel_translate(void *data, Evas * e, Evas_Object * obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_Wheel *ev = NULL;
+ Evas_Object *o = NULL;
+
+ if ((ev = (Evas_Event_Mouse_Wheel *) event_info))
+ {
+ if ((o = (Evas_Object *) data))
+ {
+ evas_event_feed_mouse_wheel_data(e, ev->direction, ev->z, o);
+ }
+ }
+#if DEBUG
+ fprintf(stderr, "MouseWheel\n");
+#endif
+}
+
+static void
+_entice_image_mouse_in_translate(void *data, Evas * e, Evas_Object * obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_In *ev = NULL;
+ Evas_Object *o = NULL;
+
+ if ((ev = (Evas_Event_Mouse_In *) event_info))
+ if ((o = (Evas_Object *) data))
+ edje_object_signal_emit(o, "mouse,in", "EnticeImage");
+#if DEBUG
+ fprintf(stderr, "MouseIn\n");
+#endif
+}
+
+static void
+_entice_image_mouse_out_translate(void *data, Evas * e, Evas_Object * obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_Out *ev = NULL;
+ Evas_Object *o = NULL;
+
+ if ((ev = (Evas_Event_Mouse_Out *) event_info))
+ if ((o = (Evas_Object *) data))
+ edje_object_signal_emit(o, "mouse,out", "EnticeImage");
+#if DEBUG
+ fprintf(stderr, "MouseOut\n");
+#endif
+}
+
+static void
+_entice_image_mouse_up_translate(void *data, Evas * e, Evas_Object * obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_Up *ev = NULL;
+ Evas_Object *o = NULL;
+
+ if ((ev = (Evas_Event_Mouse_Up *) event_info))
+ {
+ if ((o = (Evas_Object *) data))
+ {
+ char buf[PATH_MAX];
+
+ snprintf(buf, PATH_MAX, "mouse,up,%i", (int) ev->button);
+ edje_object_signal_emit(o, buf, "EnticeImage");
+ }
+ }
+#if DEBUG
+ fprintf(stderr, "MouseUp");
+#endif
+}
+
+static void
+_entice_image_mouse_down_translate(void *data, Evas * e, Evas_Object * obj,
+ void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = NULL;
+ Evas_Object *o = NULL;
+
+ if ((ev = (Evas_Event_Mouse_Down *) event_info))
+ {
+ if ((o = (Evas_Object *) data))
+ {
+ char buf[PATH_MAX];
+
+ snprintf(buf, PATH_MAX, "mouse,down,%i", (int) ev->button);
+ edje_object_signal_emit(o, buf, "EnticeImage");
+ }
+ }
+#if DEBUG
+ fprintf(stderr, "MouseDown\n");
+#endif
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- image.h 14 Oct 2003 18:33:29 -0000 1.15
+++ image.h 17 Oct 2003 21:36:08 -0000 1.16
@@ -70,5 +70,6 @@
int entice_image_save(Evas_Object * o);
void entice_image_file_set(Evas_Object * o, const char *filename);
void entice_image_format_set(Evas_Object * o, const char *format);
+void entice_image_edje_set(Evas_Object * o, Evas_Object * edje);
#endif
-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise
Linux in the Boardroom; in the Front Office; & in the Server Room
http://www.enterpriselinuxforum.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs