Enlightenment CVS committal

Author  : zuluone
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        buttons.c event.c globals.h handler.c image.c main.c 


Log Message:
Changed zoom behaviour so that zooming in/out twice doubles/halves the scale factor, 
and increased the maximum zoom factor to 32x, then fixed a bug with scrolling and the 
mini-image selector that the change revealed/caused (I'm still not sure which).
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/buttons.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- buttons.c   11 Aug 2003 13:02:18 -0000      1.7
+++ buttons.c   19 Aug 2003 23:11:23 -0000      1.8
@@ -141,9 +141,9 @@
 bt_zoom_in_up(void *data, Evas * e, Evas_Object * obj, void *event_info)
 {
    evas_object_image_file_set(obj, IM "bt_zoom_in_1.png", NULL);
-   scale -= 0.5;
-   if (scale < 0.5)
-      scale = 0.5;
+   scale /= 1.414;
+   if (scale > 0.03125)
+     scale = 0.03125;
    e_handle_resize();
 }
 
@@ -171,7 +171,7 @@
 bt_zoom_out_up(void *data, Evas * e, Evas_Object * obj, void *event_info)
 {
    evas_object_image_file_set(obj, IM "bt_zoom_out_1.png", NULL);
-   scale += 0.5;
+   scale *= 1.414;
    e_handle_resize();
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/event.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- event.c     15 Aug 2003 18:01:43 -0000      1.17
+++ event.c     19 Aug 2003 23:11:23 -0000      1.18
@@ -95,16 +95,16 @@
    else if ((!strcmp(e->keyname, "minus")) ||
            (!strcmp(e->keyname, "o")))
      {
-       scale += 0.5;
+       scale *= 1.414;
        e_handle_resize();
      }
    else if ((!strcmp(e->keyname, "plus")) ||
            (!strcmp(e->keyname, "equal")) ||
            (!strcmp(e->keyname, "i")))
      {
-       scale -= 0.5;
-       if (scale < 0.5)
-          scale = 0.5;
+       scale /= 1.414;
+       if (scale < 0.03125)
+         scale = 0.03125;
        e_handle_resize();
      }
    else if (!strcmp(e->keyname, "w"))
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/globals.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- globals.h   11 Aug 2003 13:02:18 -0000      1.8
+++ globals.h   19 Aug 2003 23:11:23 -0000      1.9
@@ -57,8 +57,6 @@
 extern enum active_state buttons_active;
 extern int          scroll_x;
 extern int          scroll_y;
-extern int          scroll_sx;
-extern int          scroll_sy;
 extern int          arrow_l;
 extern int          arrow_r;
 extern int          arrow_t;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/handler.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- handler.c   15 Aug 2003 18:01:43 -0000      1.8
+++ handler.c   19 Aug 2003 23:11:23 -0000      1.9
@@ -91,10 +91,8 @@
 
    if (o_image)
      {
-       int                 sx, sy, mx, my, pw, ph;
+       int                 mx, my, pw, ph;
 
-       sx = scroll_x;
-       sy = scroll_y;
        evas_object_image_size_get(o_image, &w, &h);
        pw = w;
        ph = h;
@@ -102,32 +100,28 @@
        h = (int)((double)h / scale);
        if (w > win_w)
          {
-            if (sx > ((w - win_w) / 2))
-               sx = ((w - win_w) / 2);
-            if (sx < -((w - win_w + 1) / 2))
-               sx = -((w - win_w + 1) / 2);
+            if (scroll_x > ((w - win_w) / 2))
+               scroll_x = ((w - win_w) / 2);
+            if (scroll_x < -((w - win_w + 1) / 2))
+               scroll_x = -((w - win_w + 1) / 2);
          }
        else
-          sx = 0;
+          scroll_x = 0;
        if (h > win_h)
          {
-            if (sy > ((h - win_h) / 2))
-               sy = ((h - win_h) / 2);
-            if (sy < -((h - win_h + 1) / 2))
-               sy = -((h - win_h + 1) / 2);
+            if (scroll_y > ((h - win_h) / 2))
+               scroll_y = ((h - win_h) / 2);
+            if (scroll_y < -((h - win_h + 1) / 2))
+               scroll_y = -((h - win_h + 1) / 2);
          }
        else
-          sy = 0;
-
+          scroll_y = 0;
        evas_object_move(o_image,
-                        sx + ((win_w - w) / 2), sy + ((win_h - h) / 2));
+                        scroll_x + ((win_w - w) / 2), scroll_y + ((win_h - h) / 2));
        evas_object_image_fill_set(o_image, 0, 0, w, h);
        evas_object_resize(o_image, w, h);
        evas_object_layer_set(o_image, 100);
 
-       scroll_sx = sx;
-       scroll_sy = sy;
-
        if ((win_w <= w) && (win_h <= h) &&
            (!evas_object_image_alpha_get(o_image)))
           evas_object_hide(o_bg);
@@ -164,13 +158,13 @@
          {
             int                 ww, hh, sw, sh;
 
-            ww = 48;
-            hh = (48 * ph) / pw;
-            if (h > w)
-              {
-                 hh = 48;
-                 ww = (48 * pw) / ph;
-              }
+            if (h > w) {
+              hh = 48;
+              ww = (48 * w) / h;
+            } else {
+              ww = 48;
+              hh = (48 * h) / w;
+            }
             evas_object_resize(o_mini_image, ww, hh);
             evas_object_image_fill_set(o_mini_image, 0, 0, ww, hh);
             evas_object_move(o_mini_image, win_w - ww - 3, win_h - hh - 3);
@@ -181,8 +175,8 @@
                sw = (win_w * ww) / w;
             if (win_h < h)
                sh = (win_h * hh) / h;
-            mx = (-sx * ww) / pw;
-            my = (-sy * hh) / ph;
+            mx = (-scroll_x * ww) / w;
+            my = (-scroll_y * hh) / h;
             evas_object_resize(o_mini_select, sw + 6, sh + 6);
             evas_object_image_fill_set(o_mini_select, 0, 0, sw + 6, sh + 6);
             evas_object_move(o_mini_select,
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- image.c     18 Aug 2003 10:01:31 -0000      1.18
+++ image.c     19 Aug 2003 23:11:23 -0000      1.19
@@ -671,8 +671,6 @@
 {
    scroll_x = 0;
    scroll_y = 0;
-   scroll_sx = 0;
-   scroll_sy = 0;
    Imlib_Image im;
    DATA32 *data;
    int mustUseImlib = 0;
@@ -806,8 +804,6 @@
    if (((ev->output.x - down_x) * (ev->output.x - down_x)) +
        ((ev->output.y - down_y) * (ev->output.y - down_y)) > 9)
      {
-       scroll_x = scroll_sx;
-       scroll_y = scroll_sy;
        e_fade_scroller_out(NULL);
        return;
      }
@@ -833,10 +829,43 @@
    Evas_Event_Mouse_Move *ev;
 
    ev = event_info;
-   if (ev->buttons != 0)
+   if (ev->buttons != 0 && o_image)
      {
+        int w,h;
+        evas_object_image_size_get(o_image, &w, &h);
+       w = (int)((double)w / scale);
+       h = (int)((double)h / scale);
        scroll_x = ev->cur.output.x - down_x + down_sx;
        scroll_y = ev->cur.output.y - down_y + down_sy;
+       if (w > win_w)
+         {
+            if (scroll_x > ((w - win_w) / 2))
+               scroll_x = ((w - win_w) / 2);
+            if (scroll_x < -((w - win_w + 1) / 2))
+               scroll_x = -((w - win_w + 1) / 2);
+         }
+       else
+          scroll_x = 0;
+       if (h > win_h)
+         {
+            if (scroll_y > ((h - win_h) / 2))
+               scroll_y = ((h - win_h) / 2);
+            if (scroll_y < -((h - win_h + 1) / 2))
+               scroll_y = -((h - win_h + 1) / 2);
+         }
+       else
+          scroll_y = 0;
+
+       /*
+       if (scroll_x > w / 2)
+         scroll_x = w / 2;
+       else if (scroll_x < -w / 2)
+         scroll_x = -w / 2;
+       if (scroll_y > h / 2)
+         scroll_y = h / 2;
+       else if (scroll_y < -h / 2)
+         scroll_y = -h / 2;
+       */
 
        e_handle_resize();
      }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- main.c      15 Aug 2003 18:01:43 -0000      1.9
+++ main.c      19 Aug 2003 23:11:23 -0000      1.10
@@ -53,7 +53,6 @@
 enum active_state   panel_active = active_out;
 enum active_state   buttons_active = active_out;
 int                 scroll_x = 0, scroll_y = 0;
-int                 scroll_sx = 0, scroll_sy = 0;
 int                 arrow_l = 0, arrow_r = 0, arrow_t = 0, arrow_b = 0;
 int                 down_x = 0, down_y = 0;
 int                 down_sx = 0, down_sy = 0;




-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code=104
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to