summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/controller/clear_selection.h6
-rw-r--r--src/controller/clear_selection.sqc45
-rw-r--r--src/controller/keyboard.c28
-rw-r--r--src/controller/keyboard.h6
-rw-r--r--src/controller/selection_from_db.h9
-rw-r--r--src/controller/selection_from_db.sqc21
-rw-r--r--src/controller/selection_to_db.h9
-rw-r--r--src/controller/selection_to_db.sqc38
-rw-r--r--src/model/exp004base.sqc144
-rw-r--r--src/util/pick_convert.c50
-rw-r--r--src/util/pick_convert.h29
11 files changed, 385 insertions, 0 deletions
diff --git a/src/util/pick_convert.c b/src/util/pick_convert.c
new file mode 100644
index 0000000..baafcfb
--- a/dev/null
+++ b/src/util/pick_convert.c
@@ -0,0 +1,50 @@
+#include "pick_convert.h"
+
+/*
+ * Width and height of a selection box about a single-click selection.
+ */
+#define N 3.0
+
+void pick_convert (int select_x, int select_y, int x, int y,
+ double *c_x, double *c_y, double *w, double *h)
+{
+ /*
+ * Calculate X and the width.
+ */
+ if (x > select_x)
+ {
+ *c_x = (x - select_x) / 2.0 + select_x;
+ *w = x - select_x;
+ }
+ else if (x < select_x)
+ {
+ *c_x = (select_x - x) / 2.0 + x;
+ *w = select_x - x;
+ }
+ else
+ {
+ *c_x = x;
+ *w = N;
+ }
+
+ /*
+ * Calculate Y and the width.
+ */
+ if (y > select_y)
+ {
+ *c_y = (y - select_y) / 2.0 + select_y;
+ *h = y - select_y;
+ }
+ else if (y < select_y)
+ {
+ *c_y = (select_y - y) / 2.0 + y;
+ *h = select_y - y;
+ }
+ else
+ {
+ *c_y = y;
+ *h = N;
+ }
+
+ return;
+}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.