Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : apps/entice
Dir : e17/apps/entice/src/bin
Modified Files:
entice.c image.c image.h main.c signals_image.c
Log Message:
no more saving geometry if you quit in fullscreen mode, nuke the test code in image.c,
sync image dragability with the new edje dragables, allow for image alignment with
DRAG_VAL_SET, still no trough seeking yet, dragging isn't perfect, but we can easily
work the precision into the code
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- entice.c 7 Apr 2004 21:16:03 -0000 1.46
+++ entice.c 8 Apr 2004 00:07:30 -0000 1.47
@@ -87,12 +87,9 @@
for (i = 0; i < count; i++)
edje_object_signal_callback_add(o, signals[i], "*", funcs[i], NULL);
-#if 0
- edje_object_signal_callback_add(o, "drag,stop", "entice.image",
- _entice_image_drag_stop, NULL);
- edje_object_signal_callback_add(o, "drag,start", "entice.image",
- _entice_image_drag_start, NULL);
-#endif
+
+ edje_object_signal_callback_add(o, "drag,set", "*",
+ _entice_image_align_drag, NULL);
return;
}
@@ -351,10 +348,12 @@
{
entice_image_zoom_set(new_current,
entice_image_zoom_get(entice->current));
- entice_image_x_align_set(new_current,
- entice_image_x_align_get(entice->current));
- entice_image_y_align_set(new_current,
- entice_image_y_align_get(entice->current));
+ entice_image_x_align_set(new_current,
+ entice_image_x_align_get(entice->
+ current));
+ entice_image_y_align_set(new_current,
+ entice_image_y_align_get(entice->
+ current));
if (entice_image_zoom_fit_get(entice->current))
should_fit = 1;
entice_current_free();
@@ -975,53 +974,6 @@
}
}
void
-entice_dragable_image_fix(Evas_Coord x, Evas_Coord y)
-{
- Evas_Coord xx, yy;
- Evas_Coord dx, dy;
- Evas_Coord w, h;
- Evas_Object *swallowed = NULL;
-
- if (entice && entice->current)
- {
- if ((swallowed =
- edje_object_part_swallow_get(entice->edje, "entice.image")))
- {
- edje_object_part_geometry_get(entice->edje, "entice.image", &xx, &yy,
- NULL, NULL);
- dx = x - xx;
- dy = y - yy;
- fprintf(stderr, "Align changed\n");
- entice_image_x_align_set(entice->current, -dx);
- entice_image_y_align_set(entice->current, -dy);
- edje_object_part_drag_value_set(entice->edje, "entice.image", 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);
- }
- }
-}
-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, "entice.image", &x, &y,
- NULL, NULL);
- }
- }
-}
-void
entice_thumb_load_ethumb(Evas_Object * o)
{
if (entice && entice->edje && o)
@@ -1032,16 +984,30 @@
void
entice_image_horizontal_align_set(double align)
{
+ Evas_Coord w, h;
+
if (entice && entice->edje && entice->current)
{
+ evas_object_geometry_get(entice->current, NULL, NULL, &w, &h);
entice_image_x_align_set(entice->current, align);
+ edje_object_part_drag_value_set(entice->edje,
+ "entice.image.scroll.horizontal.scrollbar",
+ align, 0.0);
+ evas_object_resize(entice->current, w, h);
}
}
void
entice_image_vertical_align_set(double align)
{
+ Evas_Coord w, h;
+
if (entice && entice->edje && entice->current)
{
+ evas_object_geometry_get(entice->current, NULL, NULL, &w, &h);
entice_image_y_align_set(entice->current, align);
+ edje_object_part_drag_value_set(entice->edje,
+ "entice.image.scroll.vertical.scrollbar",
+ 0.0, align);
+ evas_object_resize(entice->current, w, h);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- image.c 7 Apr 2004 21:16:04 -0000 1.40
+++ image.c 8 Apr 2004 00:07:37 -0000 1.41
@@ -10,12 +10,77 @@
#include <limits.h>
#include <Ecore.h>
#include "image.h"
+#include "entice.h"
#define DEBUG 0
static void entice_image_resize(Evas_Object * o, Evas_Coord w, Evas_Coord h);
static int _entice_image_scroll_timer(void *data);
+static void
+_im_down_cb(void *data, Evas * evas, Evas_Object * obj, void *ev)
+{
+ Entice_Image *im = NULL;
+
+ if ((im = evas_object_smart_data_get((Evas_Object *) data)))
+ {
+ im->dragging = 1;
+ }
+}
+static void
+_im_up_cb(void *data, Evas * evas, Evas_Object * obj, void *ev)
+{
+ Entice_Image *im = NULL;
+
+ if ((im = evas_object_smart_data_get((Evas_Object *) data)))
+ {
+ im->dragging = 0;
+ }
+}
+static void
+_im_move_cb(void *data, Evas * evas, Evas_Object * obj, void *ev)
+{
+ Entice_Image *im = NULL;
+ Evas_Coord dx = 0.0, dy = 0.0;
+ Evas_Coord ww = 0.0, hh = 0.0;
+ Evas_Event_Mouse_Move *e = NULL;
+
+ if ((im = evas_object_smart_data_get((Evas_Object *) data)))
+ {
+ if (im->dragging)
+ {
+ if ((e = (Evas_Event_Mouse_Move *) ev))
+ {
+ dx = e->cur.canvas.x - e->prev.canvas.x;
+ dy = e->cur.canvas.y - e->prev.canvas.y;
+ ww = im->iw / im->zoom;
+ hh = im->ih / im->zoom;
+ /* get the offset alignment */
+ if (ww > im->w)
+ im->align.x -= (double) dx / (double) ww;
+ else
+ im->align.x += (double) dx / (double) ww;
+ if (hh > im->h)
+ im->align.y -= (double) dy / (double) hh;
+ else
+ im->align.y += (double) dy / (double) hh;
+
+ /* keep it bounded */
+ if (im->align.x < 0.0)
+ im->align.x = 0.0;
+ else if (im->align.x > 1.0)
+ im->align.x = 1.0;
+ if (im->align.y < 0.0)
+ im->align.y = 0.0;
+ else if (im->align.y > 1.0)
+ im->align.y = 1.0;
+
+ entice_image_vertical_align_set(im->align.y);
+ entice_image_horizontal_align_set(im->align.x);
+ }
+ }
+ }
+}
double
entice_image_x_align_get(Evas_Object * o)
{
@@ -23,20 +88,23 @@
if ((im = evas_object_smart_data_get(o)))
{
- return(im->align.x);
+ return (im->align.x);
}
- return(0.5);
+ return (0.5);
}
+
double
entice_image_y_align_get(Evas_Object * o)
{
Entice_Image *im = NULL;
+
if ((im = evas_object_smart_data_get(o)))
{
- return(im->align.y);
+ return (im->align.y);
}
- return(0.5);
+ return (0.5);
}
+
void
entice_image_x_align_set(Evas_Object * o, double align)
{
@@ -759,7 +827,13 @@
evas_object_clip_set(im->obj, im->clip);
evas_object_show(im->obj);
evas_object_pass_events_set(im->clip, 1);
- evas_object_pass_events_set(im->obj, 1);
+ evas_object_repeat_events_set(im->obj, 1);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_DOWN,
+ _im_down_cb, o);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_UP,
+ _im_up_cb, o);
+ evas_object_event_callback_add(im->obj, EVAS_CALLBACK_MOUSE_MOVE,
+ _im_move_cb, o);
evas_object_move(im->obj, 0, 0);
im->iw = w;
@@ -790,97 +864,3 @@
im->quality = quality;
}
}
-
-/*==========================================================================
- * Test app for entice_image by itself
- * #define TESTING to 1 at the top of the file
- *========================================================================*/
-#if TESTING
-#include<Ecore.h>
-#include<Ecore_Evas.h>
-
-static Evas_Object *bg = NULL;
-
-/**
- * exit_cb - called when the app exits(window is killed)
- * @ev_type -
- * @ev -
- * @data -
- */
-static int
-exit_cb(int ev_type, void *ev, void *data)
-{
- ecore_main_loop_quit();
- return (0);
-}
-
-/**
- * window_resize_cb - when the ecore_evas is resized by the user
- * @ee - the Ecore_Evas that was resized
- */
-static void
-window_resize_cb(Ecore_Evas * ee)
-{
- int w, h;
-
- ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
- evas_object_resize(bg, (Evas_Coord) w, (Evas_Coord) h);
-}
-
-/**
- * window_del_cb - callback for when the ecore_evas is deleted
- * @ee - the Ecore_Evas that was deleted
- */
-static void
-window_del_cb(Ecore_Evas * ee)
-{
- ecore_main_loop_quit();
-}
-
-/**
- * main - your C apps start here, duh.
- * @argc - unused
- * @argv - unused
- */
-int
-main(int argc, const char *argv[])
-{
- Evas *evas = NULL;
- Ecore_Evas *e = NULL;
- Evas_Object *o = NULL, *oo = NULL;
-
- if (argc < 2)
- return (1);
- ecore_init();
- ecore_app_args_set(argc, argv);
-
- ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_cb, NULL);
-
- if (ecore_evas_init())
- {
- e = ecore_evas_software_x11_new(NULL, 0, 0, 0, 300, 120);
- ecore_evas_title_set(e, "Entice Image Test");
- ecore_evas_callback_delete_request_set(e, window_del_cb);
- ecore_evas_callback_resize_set(e, window_resize_cb);
-
- evas = ecore_evas_get(e);
- bg = evas_object_rectangle_add(evas);
- evas_object_move(bg, 0, 0);
- evas_object_resize(bg, 300, 120);
- evas_object_color_set(bg, 89, 94, 97, 255);
- evas_object_layer_set(bg, 0);
- evas_object_show(bg);
-
- o = evas_object_image_add(evas);
- evas_object_image_file_set(o, argv[1], NULL);
-
- oo = entice_image_new(o);
- evas_object_move(oo, 0, 0);
- evas_object_resize(oo, 300, 120);
- evas_object_show(oo);
- ecore_evas_show(e);
- }
- ecore_main_loop_begin();
- return (0);
-}
-#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- image.h 7 Apr 2004 21:16:04 -0000 1.21
+++ image.h 8 Apr 2004 00:07:37 -0000 1.22
@@ -36,6 +36,8 @@
int fit;
int quality; /* int value for saving quality */
double zoom; /* the current zoom percentage */
+ int button; /* the drag button */
+ int dragging; /* whether we're currently dragging */
struct
{
double x, y;
@@ -83,8 +85,8 @@
Evas_Coord * h);
void entice_image_x_align_set(Evas_Object * o, double align);
void entice_image_y_align_set(Evas_Object * o, double align);
-double entice_image_x_align_get(Evas_Object *o);
-double entice_image_y_align_get(Evas_Object *o);
+double entice_image_x_align_get(Evas_Object * o);
+double entice_image_y_align_get(Evas_Object * o);
void entice_image_save_quality_set(Evas_Object * o, int quality);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/main.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- main.c 7 Apr 2004 21:16:04 -0000 1.23
+++ main.c 8 Apr 2004 00:07:37 -0000 1.24
@@ -52,8 +52,8 @@
if (ee)
{
ecore_evas_geometry_get(ee, &x, &y, &w, &h);
- if(!ecore_evas_fullscreen_get(ee))
- entice_config_geometry_set(x, y, w, h);
+ if (!ecore_evas_fullscreen_get(ee))
+ entice_config_geometry_set(x, y, w, h);
entice_resize(w, h);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_image.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- signals_image.c 7 Apr 2004 21:16:04 -0000 1.11
+++ signals_image.c 8 Apr 2004 00:07:37 -0000 1.12
@@ -479,11 +479,11 @@
#if DEBUG
fprintf(stderr, "Seek Request\n");
#endif
- if(edje_object_part_exists(o, source))
+ if (edje_object_part_exists(o, source))
{
edje_object_part_geometry_get(o, source, &x, &y, &w, &h);
- fprintf(stderr, "Seek on %s(%0.2f,%0.2f,%0.2f, %0.2f)\n",
- source,x,y,w,h);
+ fprintf(stderr, "Seek on %s(%0.2f,%0.2f,%0.2f, %0.2f)\n", source, x, y,
+ w, h);
}
}
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs