[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-147-gd48b0b3)



The branch, master has been updated
       via  d48b0b36c5348abd52413de14afb6ab0958b260d (commit)
      from  d615982103652c0143eca430570bbfcfa0d206fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/src/a_zoom.c |   60 +++++++++++++++++++++++++++-----------------------
 1 files changed, 32 insertions(+), 28 deletions(-)


=================
 Commit Messages
=================

commit d48b0b36c5348abd52413de14afb6ab0958b260d
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Mon Jan 5 11:31:56 2009 +0100

    gschem: fixed the math for warp-cursor "disabled"
    
    This fixes the bug [2212748] and the feature request [2001299].
    
    The fix calculates a new center out of the mouse cursor,the
    current visible area and the zoom factor.
     # Please enter the commit message for your changes. Lines starting

:100644 100644 5f699aa... 2b94af9... M	gschem/src/a_zoom.c

=========
 Changes
=========

commit d48b0b36c5348abd52413de14afb6ab0958b260d
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Mon Jan 5 11:31:56 2009 +0100

    gschem: fixed the math for warp-cursor "disabled"
    
    This fixes the bug [2212748] and the feature request [2001299].
    
    The fix calculates a new center out of the mouse cursor,the
    current visible area and the zoom factor.
     # Please enter the commit message for your changes. Lines starting

diff --git a/gschem/src/a_zoom.c b/gschem/src/a_zoom.c
index 5f699aa..2b94af9 100644
--- a/gschem/src/a_zoom.c
+++ b/gschem/src/a_zoom.c
@@ -58,39 +58,51 @@ void a_zoom(GSCHEM_TOPLEVEL *w_current, int dir, int selected_from, int pan_flag
   TOPLEVEL *toplevel = w_current->toplevel;
   double world_pan_center_x,world_pan_center_y,relativ_zoom_factor = - 1;
   int start_x, start_y;
-
-  /*calc center: either "mouse_to_world" or center=center */
-  if (w_current->zoom_with_pan == TRUE && selected_from == HOTKEY) {
-    if (!x_event_get_pointer_position(w_current, FALSE, 
-				      &start_x, &start_y))
-      return;
-    world_pan_center_x = start_x;
-    world_pan_center_y = start_y;
-  }
-  else {
-    world_pan_center_x = (double) (toplevel->page_current->left +
-                                   toplevel->page_current->right ) / 2;
-    world_pan_center_y = (double) (toplevel->page_current->top +
-                                   toplevel->page_current->bottom ) / 2;
-  }
+  double top, bottom, right, left;
 
   /* NB: w_current->zoom_gain is a percentage increase */
   switch(dir) {
-    case(ZOOM_IN):
+  case(ZOOM_IN):
     relativ_zoom_factor = (100.0 + w_current->zoom_gain) / 100.0;
     break;	
 	
-    case(ZOOM_OUT):
+  case(ZOOM_OUT):
     relativ_zoom_factor = 100.0 / (100.0 + w_current->zoom_gain);
     break;
 
-    case(ZOOM_FULL):
-    /*hope someone have a better idea (hw)*/
+  case(ZOOM_FULL):
+    /* indicate the zoom full with a negative zoomfactor */
     relativ_zoom_factor = -1;
     break;
   }
 
-
+  /* calc center: either "mouse_to_world" or center=center or a 
+     virtual center if warp_cursor is disabled */
+  if (w_current->zoom_with_pan == TRUE && selected_from == HOTKEY) {
+    if (!x_event_get_pointer_position(w_current, FALSE, 
+				      &start_x, &start_y))
+      return;
+    if ( w_current->warp_cursor ) {
+      world_pan_center_x = start_x;
+      world_pan_center_y = start_y;
+    } else {
+      left = ((toplevel->page_current->left - start_x)
+              * (1/relativ_zoom_factor) + start_x);
+      right = ((toplevel->page_current->right - start_x)
+               * (1/relativ_zoom_factor) + start_x);
+      top = ((toplevel->page_current->top - start_y)
+             * (1/relativ_zoom_factor) + start_y);
+      bottom = ((toplevel->page_current->bottom - start_y)
+                * (1/relativ_zoom_factor) + start_y);
+      world_pan_center_x = (right + left) / 2;
+      world_pan_center_y = (top + bottom) / 2;
+    }
+  } else {
+    world_pan_center_x = (double) (toplevel->page_current->left +
+                                   toplevel->page_current->right ) / 2;
+    world_pan_center_y = (double) (toplevel->page_current->top +
+                                   toplevel->page_current->bottom ) / 2;
+  }
 
 #if DEBUG
   printf("relative zoomfactor: %E\n", relativ_zoom_factor);
@@ -127,14 +139,6 @@ void a_zoom(GSCHEM_TOPLEVEL *w_current, int dir, int selected_from, int pan_flag
 		   &start_x, &start_y);
      x_basic_warp_cursor (w_current->drawing_area, start_x, start_y);
   }
-  else {
-    /*! \bug FIXME? trigger a x_event_motion() call without moving the cursor 
-     *  this will redraw rubberband lines 
-     *  Find a way to trigger the x_event_motion() without moving
-     *  the mouse cursor (werner) 
-     */
-    /* x_basic_warp_cursor(w_current->drawing_area, mouse_x, mouse_y); */
-  }
 }
 
 /*! \todo Finish function documentation!!!




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs