Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


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


Log Message:
migrating away from old sloppy dragging in favor of other dragables, for now all you 
can use is the vertical/horizontal scrollbars.  minor fixups that should make things 
nicer for tokyo, nuke unused panning timer code
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- entice.c    7 Apr 2004 01:50:20 -0000       1.45
+++ entice.c    7 Apr 2004 21:16:03 -0000       1.46
@@ -59,11 +59,8 @@
       "entice,image,current,rotate,right",
       "entice,image,current,flip,horizontal",
       "entice,image,current,flip,vertical",
-      "entice,image,current,scroll,start,east",
-      "entice,image,current,scroll,start,west",
-      "entice,image,current,scroll,start,north",
-      "entice,image,current,scroll,start,south",
-      "entice,image,current,scroll,stop",
+      "entice,image,current,align,seek,*",
+      "entice,image,current,align,drag,*",
       "entice,image,current,modified",
       "entice,image,current,save",
       "entice,thumbnail,scroll,start,next",
@@ -81,21 +78,21 @@
          _entice_zoom_in_focused, _entice_zoom_out_focused,
          _entice_zoom_default, _entice_zoom_fit, _entice_rotate_left,
          _entice_rotate_right, _entice_flip_horizontal,
-         _entice_flip_vertical, _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_modified, _entice_image_save,
-         _entice_thumbs_scroll_next_start,
+         _entice_flip_vertical, _entice_image_align_seek,
+         _entice_image_align_drag, _entice_image_modified,
+         _entice_image_save, _entice_thumbs_scroll_next_start,
          _entice_thumbs_scroll_prev_start, _entice_thumbs_scroll_stop,
          _entice_fit_window, _entice_fullscreen, _entice_quit, NULL};
    count = sizeof(signals) / sizeof(char *);
    for (i = 0; i < count; i++)
-      edje_object_signal_callback_add(o, signals[i], "", funcs[i], NULL);
+      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
    return;
 }
 
@@ -354,6 +351,10 @@
          {
             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));
             if (entice_image_zoom_fit_get(entice->current))
                should_fit = 1;
             entice_current_free();
@@ -853,41 +854,6 @@
 }
 
 void
-entice_main_image_scroll_east_start(void)
-{
-   if (entice && entice->edje && entice->current)
-      entice_image_scroll_start(entice->current, ENTICE_SCROLL_EAST);
-}
-
-void
-entice_main_image_scroll_west_start(void)
-{
-   if (entice && entice->edje && entice->current)
-      entice_image_scroll_start(entice->current, ENTICE_SCROLL_WEST);
-}
-
-void
-entice_main_image_scroll_north_start(void)
-{
-   if (entice && entice->edje && entice->current)
-      entice_image_scroll_start(entice->current, ENTICE_SCROLL_NORTH);
-}
-
-void
-entice_main_image_scroll_south_start(void)
-{
-   if (entice && entice->edje && entice->current)
-      entice_image_scroll_start(entice->current, ENTICE_SCROLL_SOUTH);
-}
-
-void
-entice_main_image_scroll_stop(void)
-{
-   if (entice && entice->edje && entice->current)
-      entice_image_scroll_stop(entice->current);
-}
-
-void
 entice_preview_thumb(Evas_Object * o)
 {
    Evas_Object *swallowed = NULL;
@@ -1025,8 +991,9 @@
                                        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);
+        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);
@@ -1062,3 +1029,19 @@
       _entice_thumb_load(o, NULL, NULL, NULL);
    }
 }
+void
+entice_image_horizontal_align_set(double align)
+{
+   if (entice && entice->edje && entice->current)
+   {
+      entice_image_x_align_set(entice->current, align);
+   }
+}
+void
+entice_image_vertical_align_set(double align)
+{
+   if (entice && entice->edje && entice->current)
+   {
+      entice_image_y_align_set(entice->current, align);
+   }
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/entice.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- entice.h    26 Jan 2004 04:10:23 -0000      1.15
+++ entice.h    7 Apr 2004 21:16:03 -0000       1.16
@@ -74,5 +74,7 @@
 void entice_thumb_load_ethumb(Evas_Object * o);
 void entice_dragable_image_set(int state);
 
+void entice_image_horizontal_align_set(double align);
+void entice_image_vertical_align_set(double align);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- image.c     1 Mar 2004 05:52:22 -0000       1.39
+++ image.c     7 Apr 2004 21:16:04 -0000       1.40
@@ -16,8 +16,29 @@
 static void entice_image_resize(Evas_Object * o, Evas_Coord w, Evas_Coord h);
 static int _entice_image_scroll_timer(void *data);
 
+double
+entice_image_x_align_get(Evas_Object * o)
+{
+   Entice_Image *im = NULL;
+
+   if ((im = evas_object_smart_data_get(o)))
+   {
+      return(im->align.x);
+   }
+   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(0.5);
+}
 void
-entice_image_x_scroll_offset_add(Evas_Object * o, Evas_Coord offset)
+entice_image_x_align_set(Evas_Object * o, double align)
 {
    Entice_Image *im = NULL;
 
@@ -26,12 +47,12 @@
 #if DEBUG
       fprintf(stderr, "Adding X OFfset: %0.2f\n", offset);
 #endif
-      im->scroll.x += offset;
+      im->align.x = align;
    }
 
 }
 void
-entice_image_y_scroll_offset_add(Evas_Object * o, Evas_Coord offset)
+entice_image_y_align_set(Evas_Object * o, double align)
 {
    Entice_Image *im = NULL;
 
@@ -40,7 +61,7 @@
 #if DEBUG
       fprintf(stderr, "Adding Y OFfset: %0.2f\n", offset);
 #endif
-      im->scroll.y += offset;
+      im->align.y = align;
    }
 
 }
@@ -272,93 +293,6 @@
 }
 
 /**
- * entice_image_scroll_stop - stop scrolling in any direction
- * @o - the Entice_Image object
- */
-void
-entice_image_scroll_stop(Evas_Object * o)
-{
-   Entice_Image *im = NULL;
-
-   if ((im = evas_object_smart_data_get(o)))
-   {
-      if (im->scroll.timer)
-         ecore_timer_del(im->scroll.timer);
-      im->scroll.timer = NULL;
-   }
-}
-
-/**
- * entice_image_scroll_start - start scrolling in a given direction
- * @o - the Entice_Image object
- * @d - the Entice_Image_Scroll_Direction
- */
-void
-entice_image_scroll_start(Evas_Object * o, Entice_Scroll_Direction d)
-{
-   Entice_Image *im = NULL;
-
-   if ((im = evas_object_smart_data_get(o)))
-   {
-      if (im->scroll.timer)
-         return;
-      im->scroll.direction = d;
-      im->scroll.velocity = 1.0 * im->zoom;
-      im->scroll.start_time = ecore_time_get();
-      im->scroll.timer = ecore_timer_add(0.03, _entice_image_scroll_timer, o);
-   }
-}
-
-/**
- * entice_image_scroll - scrolling in a given direction, a given value
- * @o - the Entice_Image object
- * @d - the Entice_Image_Scroll_Direction
- * @val - the number of pixels to scroll
- */
-void
-entice_image_scroll(Evas_Object * o, Entice_Scroll_Direction d, int val)
-{
-   Entice_Image *im = NULL;
-
-   if ((im = evas_object_smart_data_get(o)))
-   {
-      switch (d)
-      {
-        case ENTICE_SCROLL_NORTH:
-           if (im->scroll.y > 0)
-              im->scroll.y -= val;
-           if (im->scroll.y < 0)
-              im->scroll.y = 0;
-           break;
-        case ENTICE_SCROLL_EAST:
-           if (im->scroll.x > 0)
-              im->scroll.x += val;
-           if (im->scroll.x < 0)
-              im->scroll.x = 0;
-           break;
-        case ENTICE_SCROLL_SOUTH:
-           if (im->scroll.y > 0)
-              im->scroll.y += val;
-           if (im->scroll.y < 0)
-              im->scroll.y = 0;
-           break;
-        case ENTICE_SCROLL_WEST:
-           if (im->scroll.x > 0)
-              im->scroll.x -= val;
-           if (im->scroll.x < 0)
-              im->scroll.x = 0;
-           break;
-        default:
-#if DEBUG
-           fprintf(stderr, "Scrolling WTF\n");
-#endif
-           break;
-      }
-      entice_image_resize(o, im->w, im->h);
-   }
-}
-
-/**
  * entice_image_zoom_get - get the current zoom value for the image
  * @o - The Entice_Image we're curious about
  */
@@ -478,6 +412,7 @@
    }
 }
 
+#if 0
 /**
  * _entice_image_scroll_timer - our ecore timer to do continuous
  * scrolling
@@ -572,6 +507,7 @@
    }
    return (ok);
 }
+#endif
 
 /*=========================================================================
  * Entice_Image smart object definitions
@@ -690,6 +626,7 @@
       im->w = w;
       im->h = h;
 
+      evas_object_move(im->clip, im->x, im->y);
       evas_object_resize(im->clip, w, h);
       if (w < 5 || h < 5)
          return;
@@ -730,8 +667,8 @@
 #endif
       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));
+      evas_object_move(im->obj, im->x - ((ww - im->w) * im->align.x),
+                       im->y - ((hh - im->h) * im->align.y));
    }
 }
 static void
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- image.h     22 Jan 2004 19:39:13 -0000      1.20
+++ image.h     7 Apr 2004 21:16:04 -0000       1.21
@@ -38,11 +38,8 @@
    double zoom;                 /* the current zoom percentage */
    struct
    {
-      Ecore_Timer *timer;
-      double velocity, start_time, x, y, dx, dy;
-      Entice_Scroll_Direction direction;
-   }
-   scroll;
+      double x, y;
+   } align;
    char *filename;              /* we need to keep track of this */
    char *format;                /* we need to keep track of this too */
    Entice_Image_Moving_State state;
@@ -73,9 +70,6 @@
 void entice_image_zoom_set(Evas_Object * o, double zoom);
 void entice_image_zoom_focused_set(Evas_Object * o, double zoom, double x,
                                    double y);
-void entice_image_scroll_stop(Evas_Object * o);
-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);
 const char *entice_image_format_get(Evas_Object * o);
 int entice_image_rotate(Evas_Object * o, int direction);
@@ -87,8 +81,10 @@
 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);
+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);
 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.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- main.c      2 Apr 2004 22:53:49 -0000       1.22
+++ main.c      7 Apr 2004 21:16:04 -0000       1.23
@@ -52,7 +52,8 @@
    if (ee)
    {
       ecore_evas_geometry_get(ee, &x, &y, &w, &h);
-      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.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- signals_image.c     3 Apr 2004 02:23:23 -0000       1.10
+++ signals_image.c     7 Apr 2004 21:16:04 -0000       1.11
@@ -425,83 +425,6 @@
    source = NULL;
 }
 
-/* entice,imageScrollEastStart */
-void
-_entice_image_scroll_east_start(void *data, Evas_Object * o,
-                                const char *emission, const char *source)
-{
-#if DEBUG
-   fprintf(stderr, "SCROLL EAST!!!\n");
-#endif
-   entice_main_image_scroll_east_start();
-   return;
-   data = NULL;
-   o = NULL;
-   emission = NULL;
-   source = NULL;
-}
-
-/* entice,imageScrollWestStart */
-void
-_entice_image_scroll_west_start(void *data, Evas_Object * o,
-                                const char *emission, const char *source)
-{
-#if DEBUG
-   fprintf(stderr, "SCROLL WEST!!!\n");
-#endif
-   entice_main_image_scroll_west_start();
-   return;
-   data = NULL;
-   o = NULL;
-   emission = NULL;
-   source = NULL;
-}
-
-/* entice,imageScrollNorthStart */
-void
-_entice_image_scroll_north_start(void *data, Evas_Object * o,
-                                 const char *emission, const char *source)
-{
-#if DEBUG
-   fprintf(stderr, "SCROLL NORTH!!!\n");
-#endif
-   entice_main_image_scroll_north_start();
-   return;
-   data = NULL;
-   o = NULL;
-   emission = NULL;
-   source = NULL;
-}
-
-/* entice,imageScrollSouthStart */
-void
-_entice_image_scroll_south_start(void *data, Evas_Object * o,
-                                 const char *emission, const char *source)
-{
-#if DEBUG
-   fprintf(stderr, "SCROLL SOUTH!!!\n");
-#endif
-   entice_main_image_scroll_south_start();
-   return;
-   data = NULL;
-   o = NULL;
-   emission = NULL;
-   source = NULL;
-}
-
-/* entice,imageScrollStop */
-void
-_entice_image_scroll_stop(void *data, Evas_Object * o, const char *emission,
-                          const char *source)
-{
-   entice_main_image_scroll_stop();
-   return;
-   data = NULL;
-   o = NULL;
-   emission = NULL;
-   source = NULL;
-}
-
 /* entice,quit */
 void
 _entice_quit(void *data, Evas_Object * o, const char *emission,
@@ -548,23 +471,44 @@
 
 /* drag,* */
 void
-_entice_image_drag_stop(void *data, Evas_Object * o, const char *emission,
-                        const char *source)
+_entice_image_align_seek(void *data, Evas_Object * o, const char *emission,
+                         const char *source)
 {
+   Evas_Coord x, y, w, h;
+
 #if DEBUG
-   fprintf(stderr, "Drag stopped\n");
+   fprintf(stderr, "Seek Request\n");
 #endif
-   if ((source) && !strcmp(source, "entice.image"))
-      entice_dragable_image_set(0);
+   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);
+   }
+
 }
 
 void
-_entice_image_drag_start(void *data, Evas_Object * o, const char *emission,
+_entice_image_align_drag(void *data, Evas_Object * o, const char *emission,
                          const char *source)
 {
+   double dx = 0.0, dy = 0.0;
+
 #if DEBUG
-   fprintf(stderr, "Drag started\n");
+   fprintf(stderr, "Dragging %s\n", source);
 #endif
-   if ((source) && !strcmp(source, "entice.image"))
-      entice_dragable_image_set(1);
+   if (!strcmp(source, "entice.image.scroll.horizontal.scrollbar"))
+   {
+      edje_object_part_drag_value_get(o,
+                                      "entice.image.scroll.horizontal.scrollbar",
+                                      &dx, NULL);
+      entice_image_horizontal_align_set(dx);
+   }
+   else if (!strcmp(source, "entice.image.scroll.vertical.scrollbar"))
+   {
+      edje_object_part_drag_value_get(o,
+                                      "entice.image.scroll.vertical.scrollbar",
+                                      NULL, &dy);
+      entice_image_vertical_align_set(dy);
+   }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/signals_image.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- signals_image.h     5 Nov 2003 10:30:26 -0000       1.5
+++ signals_image.h     7 Apr 2004 21:16:04 -0000       1.6
@@ -62,8 +62,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,
+void _entice_image_align_drag(void *data, Evas_Object * o,
+                              const char *emission, const char *source);
+void _entice_image_align_seek(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




-------------------------------------------------------
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

Reply via email to