Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : apps/entice
Dir : e17/apps/entice/src/bin
Modified Files:
Makefile.am entice.c entice.h image.c image.h ipc.c
signals_image.c signals_image.h signals_thumb.c
Log Message:
Fixups for dragables
EnticeImage should work fine for both confined and unconfined dragables.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 11 Oct 2003 22:54:12 -0000 1.4
+++ Makefile.am 5 Nov 2003 07:33:56 -0000 1.5
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
INCLUDES = \
- -I../lib \
+ -Wall -I../lib \
@esmart_cflags@ \
@evas_cflags@ \
@edb_cflags@ \
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- entice.c 25 Oct 2003 09:54:01 -0000 1.16
+++ entice.c 5 Nov 2003 07:33:56 -0000 1.17
@@ -50,7 +50,7 @@
"EnticeImageScrollEastStart", "EnticeImageScrollWestStart",
"EnticeImageScrollNorthStart", "EnticeImageScrollSouthStart",
"EnticeImageScrollStop", "EnticeImageModified",
- "EnticeImageSave", "EnticeQuit"
+ "EnticeImageSave", "EnticeQuit", NULL
};
edje_callbacks funcs[] = { _entice_delete_current, _entice_remove_current,
_entice_image_next, _entice_image_prev,
@@ -70,6 +70,11 @@
count = sizeof(signals) / sizeof(char *);
for (i = 0; i < count; i++)
edje_object_signal_callback_add(o, signals[i], "", funcs[i].func, NULL);
+
+ edje_object_signal_callback_add(o, "drag,stop", "EnticeImage",
+ _entice_image_drag_stop, NULL);
+ edje_object_signal_callback_add(o, "drag,start", "EnticeImage",
+ _entice_image_drag_start, NULL);
return;
}
@@ -222,8 +227,6 @@
if (entice->current)
{
- Evas_Object *swallowed = NULL;
-
entice_image_zoom_set(new_current,
entice_image_zoom_get(entice->current));
if (entice_image_zoom_fit_get(entice->current))
@@ -354,32 +357,6 @@
}
}
-void
-entice_delete_current(void)
-{
- if (entice && entice->current)
- {
- int result = 0;
-
- result = entice_file_delete(entice_image_file_get(entice->current));
-
- if (!result)
- edje_object_signal_emit(entice->edje, "EnticeImageNext", "");
- }
-}
-void
-entice_remove_current(void)
-{
- if (entice && entice->current)
- {
- int result = 0;
-
- result = entice_file_remove(entice_image_file_get(entice->current));
- if (!result)
- edje_object_signal_emit(entice->edje, "EnticeImageNext", "");
- }
-
-}
static void
entice_current_free(void)
{
@@ -461,7 +438,6 @@
entice_file_delete(const char *file)
{
int result = 0;
- Evas_Object *o = NULL;
char buf[PATH_MAX];
if (file)
@@ -477,6 +453,33 @@
}
+void
+entice_delete_current(void)
+{
+ if (entice && entice->current)
+ {
+ int result = 0;
+
+ result = entice_file_delete(entice_image_file_get(entice->current));
+
+ if (!result)
+ edje_object_signal_emit(entice->edje, "EnticeImageNext", "");
+ }
+}
+void
+entice_remove_current(void)
+{
+ if (entice && entice->current)
+ {
+ int result = 0;
+
+ result = entice_file_remove(entice_image_file_get(entice->current));
+ if (!result)
+ edje_object_signal_emit(entice->edje, "EnticeImageNext", "");
+ }
+
+}
+
/**
* entice_load_prev - load the previous image in the list
*/
@@ -731,5 +734,55 @@
fprintf(stderr, "Saving was successul\n");
/* FIXME: Emit a EnticeSaveOk or something signal */
edje_thaw();
+ }
+}
+void
+entice_dragable_image_fix(Evas_Coord x, Evas_Coord y)
+{
+ Evas_Coord xx, yy;
+ Evas_Coord dx, dy;
+ Evas_Object *swallowed = NULL;
+
+ if (entice && entice->current)
+ {
+ if ((swallowed =
+ edje_object_part_swallow_get(entice->edje, "EnticeImage")))
+ {
+ edje_object_part_geometry_get(entice->edje, "EnticeImage", &xx, &yy,
+ NULL, NULL);
+ dx = x - xx;
+ dy = y - yy;
+ 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);
+ }
+ }
+}
+void
+entice_dragable_image_set(int state)
+{
+ static Evas_Coord x = 0.0;
+ static Evas_Coord y = 0.0;
+
+ if (entice && entice->current)
+ {
+ if (state == 0)
+ {
+ entice_dragable_image_fix(x, y);
+ x = y = 0.0;
+ }
+ else
+ {
+ edje_object_part_geometry_get(entice->edje, "EnticeImage", &x, &y,
+ NULL, NULL);
+ }
+ }
+}
+void
+entice_thumb_load_ethumb(Evas_Object * o)
+{
+ if (entice && entice->edje && o)
+ {
+ _entice_thumb_load(o, NULL, NULL, NULL);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- entice.h 18 Oct 2003 20:38:55 -0000 1.11
+++ entice.h 5 Nov 2003 07:33:56 -0000 1.12
@@ -68,5 +68,9 @@
void entice_preview_thumb(Evas_Object * o);
void entice_delete_current(void);
void entice_remove_current(void);
+void entice_save_image(void);
+void entice_thumb_load_ethumb(Evas_Object * o);
+void entice_dragable_image_set(int state);
+
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- image.c 25 Oct 2003 09:54:01 -0000 1.31
+++ image.c 5 Nov 2003 07:33:56 -0000 1.32
@@ -16,6 +16,52 @@
static void entice_image_resize(Evas_Object * o, Evas_Coord w, Evas_Coord h);
static int _entice_image_scroll_timer(void *data);
+void
+entice_image_x_scroll_offset_add(Evas_Object * o, Evas_Coord offset)
+{
+ Entice_Image *im = NULL;
+
+ if ((im = evas_object_smart_data_get(o)))
+ {
+#if DEBUG
+ fprintf(stderr, "Adding X OFfset: %0.2f\n", offset);
+#endif
+ im->scroll.x += offset;
+ }
+
+}
+void
+entice_image_y_scroll_offset_add(Evas_Object * o, Evas_Coord offset)
+{
+ Entice_Image *im = NULL;
+
+ if ((im = evas_object_smart_data_get(o)))
+ {
+#if DEBUG
+ fprintf(stderr, "Adding Y OFfset: %0.2f\n", offset);
+#endif
+ im->scroll.y += offset;
+ }
+
+}
+void
+entice_image_geometry_get(Evas_Object * o, Evas_Coord * x, Evas_Coord * y,
+ Evas_Coord * w, Evas_Coord * h)
+{
+ Entice_Image *im = NULL;
+
+ if ((im = evas_object_smart_data_get(o)))
+ {
+ if (x)
+ *x = im->x;
+ if (y)
+ *y = im->y;
+ if (w)
+ *w = im->w;
+ if (h)
+ *h = im->h;
+ }
+}
const char *
entice_image_format_get(Evas_Object * o)
{
@@ -60,11 +106,10 @@
evas_object_image_size_get(im->obj, &iw, &ih);
evas_object_geometry_get(o, &x, &y, &w, &h);
- if (imlib_im =
- imlib_create_image_using_copied_data(iw, ih,
- evas_object_image_data_get(im->
- obj,
- 1)))
+ 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);
@@ -104,11 +149,10 @@
evas_object_image_size_get(im->obj, &iw, &ih);
evas_object_geometry_get(o, &x, &y, &w, &h);
- if (imlib_im =
- imlib_create_image_using_copied_data(iw, ih,
- evas_object_image_data_get(im->
- obj,
- 1)))
+ 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);
if (orientation)
@@ -151,11 +195,10 @@
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)))
+ 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);
if (im->format && im->filename)
@@ -208,7 +251,9 @@
Entice_Image *im = NULL;
if ((im = evas_object_smart_data_get(o)))
+ {
result = im->fit;
+ }
return (result);
}
@@ -348,6 +393,7 @@
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);
}
}
@@ -594,16 +640,16 @@
entice_image_move(Evas_Object * o, double x, double y)
{
Entice_Image *im = NULL;
- Evas_Coord w, h;
-
+
if ((im = evas_object_smart_data_get(o)))
{
- if(im->dx == x && im->dy == y) return;
- evas_object_geometry_get(im->obj, NULL, NULL, &w, &h);
- im->scroll.x -= (im->dx - x);
- im->scroll.y -= (im->dy - y);
- im->dx = x;
- im->dy = y;
+ if (im->x == x && im->y == y)
+ return;
+ im->dx = im->x - x;
+ im->dy = im->y - y;
+
+ im->x = x;
+ im->y = y;
entice_image_resize(o, im->w, im->h);
}
}
@@ -753,6 +799,17 @@
im->ih = h;
}
return (o);
+}
+
+void
+entice_image_dragable_state_set(Evas_Object * o, int state)
+{
+ Entice_Image *im = NULL;
+
+ if ((im = evas_object_smart_data_get(o)))
+ {
+ im->state = state;
+ }
}
/*==========================================================================
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- image.h 25 Oct 2003 09:54:01 -0000 1.17
+++ image.h 5 Nov 2003 07:33:56 -0000 1.18
@@ -14,6 +14,14 @@
typedef struct _Entice_Image Entice_Image;
typedef enum _Entice_Image_Scroll_Direction Entice_Scroll_Direction;
+typedef enum _Entice_Image_Moving_State Entice_Image_Moving_State;
+
+enum _Entice_Image_Moving_State
+{
+ ENTICE_IMAGE_MOVE_DEFAULT = 0,
+ ENTICE_IMAGE_MOVE_DRAGGING,
+ ENTICE_IMAGE_MOVE_FIXING
+};
enum _Entice_Image_Scroll_Direction
{
@@ -30,11 +38,13 @@
struct
{
Ecore_Timer *timer;
- double velocity, start_time, x, y;
+ double velocity, start_time, x, y, dx, dy;
Entice_Scroll_Direction direction;
} scroll;
char *filename; /* we need to keep track of this */
char *format; /* we need to keep track of this too */
+ Entice_Image_Moving_State state;
+ /* current moving state */
int x, y, w, h, iw, ih; /* geometry */
Evas_Coord dx, dy;
Evas_Object *obj; /* the image object */
@@ -71,5 +81,10 @@
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_dragable_set(Evas_Object * o, int dragging);
+void entice_image_geometry_get(Evas_Object * o, Evas_Coord * x,
+ Evas_Coord * y, Evas_Coord * w,
+ Evas_Coord * h);
+void entice_image_x_scroll_offset_add(Evas_Object * o, Evas_Coord offset);
+void entice_image_y_scroll_offset_add(Evas_Object * o, Evas_Coord offset);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/ipc.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ipc.c 12 Oct 2003 01:56:47 -0000 1.3
+++ ipc.c 5 Nov 2003 07:33:56 -0000 1.4
@@ -33,7 +33,7 @@
Ecore_Ipc_Event_Server_Del *e;
e = (Ecore_Ipc_Event_Server_Del *) event;
- // fprintf(stderr, "Server delete\n");
+ /* fprintf(stderr, "Server delete\n"); */
return (1);
}
@@ -49,8 +49,9 @@
Ecore_Ipc_Event_Server_Data *e;
e = (Ecore_Ipc_Event_Server_Data *) event;
- printf("!! Server sent: [%i] [%i] (%i) \"%s\"\n", e->major, e->minor,
- e->size, e->data);
+ /*
+ printf("!! Server sent: [%i] [%i] (%i) \"%s\"\n", e->major, e->minor,
+ e->size, e->data); */
return (1);
}
@@ -101,7 +102,7 @@
{
char buf[e->size];
- snprintf(buf, e->size, "%s", e->data);
+ snprintf(buf, e->size, "%s", (char *) e->data);
entice_file_add(buf);
/*
printf("!! Client sent: [%i] [%i] (%i) \"%s\"\n", e->major,
@@ -180,7 +181,6 @@
entice_ipc_client_request_image_load(const char *file)
{
Ecore_Ipc_Server *server = NULL;
- char buf[PATH_MAX];
/* we definitely fail if we can't connect to ecore_ipc */
if (ecore_ipc_init() < 1)
@@ -200,13 +200,15 @@
NULL);
snprintf(buf, PATH_MAX, "%s", file);
- ecore_ipc_server_send(server, 5, 6, 0, 0, 0, buf, sizeof(buf));
+ ecore_ipc_server_send(server, 5, 6, 0, 0, 0, buf, strlen(buf) + 1);
memset(buf, 0, sizeof(buf));
ecore_ipc_server_del(server);
}
+#if DEBUG
else
{
fprintf(stderr, "ERROR: Unable to connect to entice IPC Server\n");
}
+#endif
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_image.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- signals_image.c 19 Oct 2003 17:20:49 -0000 1.6
+++ signals_image.c 5 Nov 2003 07:33:56 -0000 1.7
@@ -374,3 +374,26 @@
emission = NULL;
source = NULL;
}
+
+/* drag,* */
+void
+_entice_image_drag_stop(void *data, Evas_Object * o, const char *emission,
+ const char *source)
+{
+#if DEBUG
+ fprintf(stderr, "Drag stopped\n");
+#endif
+ if ((source) && !strcmp(source, "EnticeImage"))
+ entice_dragable_image_set(0);
+}
+
+void
+_entice_image_drag_start(void *data, Evas_Object * o, const char *emission,
+ const char *source)
+{
+#if DEBUG
+ fprintf(stderr, "Drag started\n");
+#endif
+ if ((source) && !strcmp(source, "EnticeImage"))
+ entice_dragable_image_set(1);
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_image.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- signals_image.h 14 Oct 2003 18:33:29 -0000 1.3
+++ signals_image.h 5 Nov 2003 07:33:56 -0000 1.4
@@ -72,4 +72,8 @@
const char *source);
void _entice_image_save(void *data, Evas_Object * o, const char *emission,
const char *source);
+void _entice_image_drag_start(void *data, Evas_Object * o,
+ const char *emission, const char *source);
+void _entice_image_drag_stop(void *data, Evas_Object * o,
+ const char *emission, const char *source);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_thumb.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- signals_thumb.c 12 Oct 2003 01:56:47 -0000 1.2
+++ signals_thumb.c 5 Nov 2003 07:33:56 -0000 1.3
@@ -14,7 +14,7 @@
const char *source)
{
if (data)
- _entice_thumb_load(data, NULL, NULL, NULL);
+ entice_thumb_load_ethumb(data);
else
fprintf(stderr, "load request with null data\n");
}
@@ -131,7 +131,6 @@
void (*func) (void *data, Evas_Object * o, const char *emission,
const char *source);
} edje_callbacks;
-
char *signals[] = { "EnticeThumbPreview", "EnticeThumbLoad" };
edje_callbacks funcs[] = { _entice_thumb_preview_cb,
_entice_thumb_load_cb
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs