On 8/19/08, Stuart Brorson <[EMAIL PROTECTED]> wrote:
> A lot of activity has taken place on gerbv over the last few weeks.
> Now, the gerbv developers are getting ready to release the next
> version of gerbv, revision 2.1.0!
>
> Before the official release, I would like to ask folks on the geda-dev
> list to help us with beta testing. If you could, please get the
> latest gerbv out of CVS, build it, and try using it on some of your
> favorite Gerber files. Then please report (either here, or on the
> gerbv-devel list) any bugs you find.
Very impressive. I just can't recognize the program.
I think it would be nice if the measure tool worked
with mouse zooms and if the measure line were persistent.
Also gerbv.h seems to lack
#ifndef RENDER_USING_GDK
#include <cairo.h>
#endif
clause (surprisingly, on one of my machines it builds
without that include, on another it does not).
Best regards and a patch against current CVS are attached.
Index: src/callbacks.c
===================================================================
RCS file: /cvsroot/gerbv/gerbv/src/callbacks.c,v
retrieving revision 1.157
diff -U2 -r1.157 callbacks.c
--- src/callbacks.c 26 Aug 2008 03:23:27 -0000 1.157
+++ src/callbacks.c 26 Aug 2008 05:17:01 -0000
@@ -19,5 +19,5 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -2364,4 +2364,7 @@
render_draw_measure_distance();
}
+ if (screen.tool == MEASURE && screen.state != IN_MEASURE) {
+ render_toggle_measure_line();
+ }
return FALSE;
@@ -2404,22 +2407,31 @@
#endif
+ if (screen.tool == MEASURE) {
+ render_toggle_measure_line();
+ }
return FALSE;
}
-/* --------------------------------------------------------- */
-void
-callbacks_update_statusbar_coordinates (gint x, gint y) {
- double X, Y;
-
+/* Transforms screen coordinates to board ones */
+static void
+screen2board(gdouble *X, gdouble *Y, gint x, gint y) {
/* make sure we don't divide by zero (which is possible if the gui
isn't displayed yet */
if ((screenRenderInfo.scaleFactorX > 0.001)||(screenRenderInfo.scaleFactorY > 0.001)) {
- X = screenRenderInfo.lowerLeftX + (x / screenRenderInfo.scaleFactorX);
- Y = screenRenderInfo.lowerLeftY + ((screenRenderInfo.displayHeight - y)
+ *X = screenRenderInfo.lowerLeftX + (x / screenRenderInfo.scaleFactorX);
+ *Y = screenRenderInfo.lowerLeftY + ((screenRenderInfo.displayHeight - y)
/ screenRenderInfo.scaleFactorY);
}
else {
- X = Y = 0.0;
+ *X = *Y = 0.0;
}
+}
+
+/* --------------------------------------------------------- */
+void
+callbacks_update_statusbar_coordinates (gint x, gint y) {
+ gdouble X, Y;
+
+ screen2board(&X, &Y, x, y);
if (screen.unit == GERBV_MILS) {
snprintf(screen.statusbar.coordstr, MAX_COORDLEN,
@@ -2464,5 +2476,5 @@
callbacks_update_statusbar();
}
-
+
/* --------------------------------------------------------- */
gboolean
@@ -2507,4 +2519,6 @@
if (screen.last_x || screen.last_y)
render_draw_measure_distance();
+ screen2board(&(screen.measure_last_x), &(screen.measure_last_y),
+ x, y);
screen.last_x = x;
screen.last_y = y;
@@ -2566,4 +2580,8 @@
else if (screen.tool == MEASURE) {
screen.state = IN_MEASURE;
+ screen2board(&(screen.measure_start_x), &(screen.measure_start_y),
+ event->x, event->y);
+ screen.measure_last_x = screen.measure_start_x;
+ screen.measure_last_y = screen.measure_start_y;
screen.start_x = event->x;
screen.start_y = event->y;
Index: src/gerbv.h
===================================================================
RCS file: /cvsroot/gerbv/gerbv/src/gerbv.h,v
retrieving revision 1.34
diff -U2 -r1.34 gerbv.h
--- src/gerbv.h 24 Aug 2008 14:30:38 -0000 1.34
+++ src/gerbv.h 26 Aug 2008 05:17:02 -0000
@@ -19,5 +19,5 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -68,4 +68,8 @@
#include <gdk/gdkkeysyms.h>
+#ifndef RENDER_USING_GDK
+#include <cairo.h>
+#endif
+
#define APERTURE_MIN 10
#define APERTURE_MAX 9999
Index: src/main.h
===================================================================
RCS file: /cvsroot/gerbv/gerbv/src/main.h,v
retrieving revision 1.7
diff -U2 -r1.7 main.h
--- src/main.h 23 May 2008 15:32:16 -0000 1.7
+++ src/main.h 26 Aug 2008 05:17:04 -0000
@@ -19,5 +19,5 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -100,5 +100,5 @@
gint last_x;
gint last_y;
- gint start_x; /* Zoom box/measure start coordinates */
+ gint start_x; /* Zoom box/measure start screen coordinates */
gint start_y;
@@ -106,4 +106,9 @@
gint off_y;
+ gdouble measure_start_x;/* Measure start board coordinates */
+ gdouble measure_start_y;
+ gdouble measure_last_x; /* Measure end board coordinates */
+ gdouble measure_last_y;
+
int dump_parsed_image;
} gerbv_screen_t;
Index: src/render.c
===================================================================
RCS file: /cvsroot/gerbv/gerbv/src/render.c,v
retrieving revision 1.63
diff -U2 -r1.63 render.c
--- src/render.c 25 Aug 2008 15:04:56 -0000 1.63
+++ src/render.c 26 Aug 2008 05:17:04 -0000
@@ -20,5 +20,5 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -303,11 +303,19 @@
}
+/* ------------------------------------------------------ */
+/* Transforms board coordinates to screen ones */
+static void
+board2screen(gint *X, gint *Y, gdouble x, gdouble y) {
+ *X = (x - screenRenderInfo.lowerLeftX) * screenRenderInfo.scaleFactorX;
+ *Y = screenRenderInfo.displayHeight - (y - screenRenderInfo.lowerLeftY)
+ * screenRenderInfo.scaleFactorY;
+}
/* ------------------------------------------------------ */
-/** Displays a measured distance graphically on screen and in statusbar.
- activated when using SHIFT and mouse dragged to measure distances\n
- under win32 graphical annotations are currently disabled (GTK 2.47)*/
+/** Draws/erases measure line
+ * No implementation for windows yet (GTK 2.47)
+ */
void
-render_draw_measure_distance(void)
+render_toggle_measure_line(void)
{
#if !defined (__MINGW32__)
@@ -316,9 +324,4 @@
GdkGCValues values;
GdkGCValuesMask values_mask;
-#endif
- gint x1, y1, x2, y2;
- double dx, dy;
-
-#if !defined (__MINGW32__) /*taken out because of different drawing behaviour under win32 resulting in a smear */
memset(&values, 0, sizeof(values));
values.function = GDK_XOR;
@@ -329,22 +332,36 @@
gc = gdk_gc_new_with_values(screen.drawing_area->window, &values,
values_mask);
-#endif
+ board2screen(&(screen.start_x), &(screen.start_y),
+ screen.measure_start_x, screen.measure_start_y);
+ board2screen(&(screen.last_x), &(screen.last_y),
+ screen.measure_last_x, screen.measure_last_y);
+
+ gdk_draw_line(screen.drawing_area->window, gc, screen.start_x,
+ screen.start_y, screen.last_x, screen.last_y);
+ gdk_gc_unref(gc);
+#endif
+} /* toggle_measure_line */
+
+/* ------------------------------------------------------ */
+/** Displays a measured distance graphically on screen and in statusbar.
+ activated when using SHIFT and mouse dragged to measure distances\n
+ under win32 graphical annotations are currently disabled (GTK 2.47)*/
+void
+render_draw_measure_distance(void)
+{
+ gint x1, y1, x2, y2;
+ double dx, dy;
+
x1 = MIN(screen.start_x, screen.last_x);
y1 = MIN(screen.start_y, screen.last_y);
x2 = MAX(screen.start_x, screen.last_x);
y2 = MAX(screen.start_y, screen.last_y);
- dx = (x2 - x1)/ screenRenderInfo.scaleFactorX;
- dy = (y2 - y1)/ screenRenderInfo.scaleFactorY;
+ dx = (x2 - x1);
+ dy = (y2 - y1);
-#if !defined (__MINGW32__)
- gdk_draw_line(screen.drawing_area->window, gc, screen.start_x,
- screen.start_y, screen.last_x, screen.last_y);
-#endif
screen.win.lastMeasuredX = dx;
screen.win.lastMeasuredY = dy;
callbacks_update_statusbar_measured_distance (dx, dy);
-#if !defined (__MINGW32__)
- gdk_gc_unref(gc);
-#endif
+ render_toggle_measure_line();
} /* draw_measure_distance */
Index: src/render.h
===================================================================
RCS file: /cvsroot/gerbv/gerbv/src/render.h,v
retrieving revision 1.29
diff -U2 -r1.29 render.h
--- src/render.h 25 Aug 2008 15:04:56 -0000 1.29
+++ src/render.h 26 Aug 2008 05:17:04 -0000
@@ -20,5 +20,5 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -53,4 +53,7 @@
void
+render_toggle_measure_line(void);
+
+void
render_draw_measure_distance(void);
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev