[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (352d0fcf4ba5d5d72b9899eceb4d3ff41df3b257)
The branch, master has been updated
via 352d0fcf4ba5d5d72b9899eceb4d3ff41df3b257 (commit)
from cc9904cb4abee08306127dc85f1a8e523db5651f (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
=========
src/hid/gtk/gui-pinout-preview.c | 23 +++++++++--------------
src/hid/gtk/gui-pinout-preview.h | 2 --
2 files changed, 9 insertions(+), 16 deletions(-)
=================
Commit Messages
=================
commit 352d0fcf4ba5d5d72b9899eceb4d3ff41df3b257
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Fix pinout preview default zoom after unit conversion
Apparently the scale factor equation was dependant on the old PCB units
of 100th mils to produce a sensible zoom level.
Since this code is monumentally obtuse, just re-write something completley
new. The old code probably bit-rot when we split out the rendering widget.
Lets just suggest a fixed size of 100 pixels natural size for each 150 mil
of element bounding box. That seems to work nicely.
:100644 100644 46806da... 88576a1... M src/hid/gtk/gui-pinout-preview.c
:100644 100644 978bb25... 77fdd1b... M src/hid/gtk/gui-pinout-preview.h
=========
Changes
=========
commit 352d0fcf4ba5d5d72b9899eceb4d3ff41df3b257
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Fix pinout preview default zoom after unit conversion
Apparently the scale factor equation was dependant on the old PCB units
of 100th mils to produce a sensible zoom level.
Since this code is monumentally obtuse, just re-write something completley
new. The old code probably bit-rot when we split out the rendering widget.
Lets just suggest a fixed size of 100 pixels natural size for each 150 mil
of element bounding box. That seems to work nicely.
diff --git a/src/hid/gtk/gui-pinout-preview.c b/src/hid/gtk/gui-pinout-preview.c
index 46806da..88576a1 100644
--- a/src/hid/gtk/gui-pinout-preview.c
+++ b/src/hid/gtk/gui-pinout-preview.c
@@ -51,24 +51,19 @@
RCSID ("$Id$");
-
+/* Just define a sensible scale, lets say (for example), 100 pixel per 150 mil */
+#define SENSIBLE_VIEW_SCALE (100. / MIL_TO_COORD (150.))
static void
-pinout_zoom_fit (GhidPinoutPreview * pinout, gint zoom)
+pinout_set_view (GhidPinoutPreview * pinout)
{
- pinout->zoom = zoom;
-
- /* Should be a function I can call for this:
- */
- pinout->scale = 1.0 / (100.0 * exp (pinout->zoom * LN_2_OVER_2));
+ float scale = SENSIBLE_VIEW_SCALE;
pinout->x_max = pinout->element.BoundingBox.X2 + Settings.PinoutOffsetX;
pinout->y_max = pinout->element.BoundingBox.Y2 + Settings.PinoutOffsetY;
- pinout->w_pixels = (gint) (pinout->scale *
- (pinout->element.BoundingBox.X2 -
- pinout->element.BoundingBox.X1));
- pinout->h_pixels = (gint) (pinout->scale *
- (pinout->element.BoundingBox.Y2 -
- pinout->element.BoundingBox.Y1));
+ pinout->w_pixels = scale * (pinout->element.BoundingBox.X2 -
+ pinout->element.BoundingBox.X1);
+ pinout->h_pixels = scale * (pinout->element.BoundingBox.Y2 -
+ pinout->element.BoundingBox.Y1);
}
@@ -109,7 +104,7 @@ pinout_set_data (GhidPinoutPreview * pinout, ElementType * element)
Settings.PinoutOffsetY -
pinout->element.BoundingBox.Y1);
- pinout_zoom_fit (pinout, 3);
+ pinout_set_view (pinout);
ELEMENTLINE_LOOP (&pinout->element);
{
diff --git a/src/hid/gtk/gui-pinout-preview.h b/src/hid/gtk/gui-pinout-preview.h
index 978bb25..77fdd1b 100644
--- a/src/hid/gtk/gui-pinout-preview.h
+++ b/src/hid/gtk/gui-pinout-preview.h
@@ -52,8 +52,6 @@ struct _GhidPinoutPreview
GtkDrawingArea parent_instance;
ElementType element; /* element data to display */
- gfloat zoom; /* zoom factor of window */
- gfloat scale; /* scale factor of zoom */
gint x_max, y_max;
gint w_pixels, h_pixels; /* natural size of element preview */
};
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs