summaryrefslogtreecommitdiff
path: root/meme
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2015-03-13 05:18:59 (GMT)
committerWerner Almesberger <werner@almesberger.net>2015-03-13 05:18:59 (GMT)
commit54dbe1c4b48b545e937a31fe0a775491ea55cd01 (patch)
tree6ac1e06ff389a0fc31498818e0468107f4d3546a /meme
parent6106c0520946131f654b0a2e863a28f1c8c2a458 (diff)
downloadmisc-54dbe1c4b48b545e937a31fe0a775491ea55cd01.zip
misc-54dbe1c4b48b545e937a31fe0a775491ea55cd01.tar.gz
misc-54dbe1c4b48b545e937a31fe0a775491ea55cd01.tar.bz2
meme/gui.c (set_marker): move text output to new function print_marker
Diffstat (limited to 'meme')
-rw-r--r--meme/gui.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/meme/gui.c b/meme/gui.c
index c40e94e..9bcb13d 100644
--- a/meme/gui.c
+++ b/meme/gui.c
@@ -1,7 +1,7 @@
/* * gui.c - User interface
*
- * Written 2014 by Werner Almesberger
- * Copyright 2014 by Werner Almesberger
+ * Written 2014-2015 by Werner Almesberger
+ * Copyright 2014-2015 by Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -818,19 +818,11 @@ static bool select_marker(const struct vertex *v)
}
-static void set_marker(const struct vertex *v)
+static void print_marker(FILE *file)
{
double dx, dy, dz;
- if (select_marker(v))
- return;
-
- if (curr_mark)
- mark_b = cursor;
- else
- mark_a = cursor;
-
- fprintf(stderr, "%c:\tX %.3f\tY %.3f\tZ %.3f\n",
+ fprintf(file, "%c:\tX %.3f\tY %.3f\tZ %.3f\n",
curr_mark ? 'B' : 'A',
cursor->x/1000.0, cursor->y/1000.0, cursor->z/1000.0);
if (!mark_a || !mark_b)
@@ -840,10 +832,24 @@ static void set_marker(const struct vertex *v)
dy = abs(mark_a->y - mark_b->y) / 1000.0;
dz = abs(mark_a->z - mark_b->z) / 1000.0;
- fprintf(stderr, "D:\tX %.3f\tY %.3f\tZ %.3f\n", dx, dy, dz);
- fprintf(stderr, " \tXY %.3f\tXZ %.3f\tYZ %.3f\n",
+ fprintf(file, "D:\tX %.3f\tY %.3f\tZ %.3f\n", dx, dy, dz);
+ fprintf(file, " \tXY %.3f\tXZ %.3f\tYZ %.3f\n",
hypot(dx, dy), hypot(dx, dz), hypot(dy, dz));
- fprintf(stderr, " \tXYZ %.3f\n", hypot(hypot(dx, dy), dz));
+ fprintf(file, " \tXYZ %.3f\n", hypot(hypot(dx, dy), dz));
+}
+
+
+static void set_marker(const struct vertex *v)
+{
+ if (select_marker(v))
+ return;
+
+ if (curr_mark)
+ mark_b = cursor;
+ else
+ mark_a = cursor;
+
+ print_marker(stderr);
}