summaryrefslogtreecommitdiffstats
Unidiff
-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 @@
1#include "pick_convert.h"
2
3/*
4 * Width and height of a selection box about a single-click selection.
5 */
6#define N 3.0
7
8void pick_convert (int select_x, int select_y, int x, int y,
9 double *c_x, double *c_y, double *w, double *h)
10{
11 /*
12 * Calculate X and the width.
13 */
14 if (x > select_x)
15 {
16 *c_x = (x - select_x) / 2.0 + select_x;
17 *w = x - select_x;
18 }
19 else if (x < select_x)
20 {
21 *c_x = (select_x - x) / 2.0 + x;
22 *w = select_x - x;
23 }
24 else
25 {
26 *c_x = x;
27 *w = N;
28 }
29
30 /*
31 * Calculate Y and the width.
32 */
33 if (y > select_y)
34 {
35 *c_y = (y - select_y) / 2.0 + select_y;
36 *h = y - select_y;
37 }
38 else if (y < select_y)
39 {
40 *c_y = (select_y - y) / 2.0 + y;
41 *h = select_y - y;
42 }
43 else
44 {
45 *c_y = y;
46 *h = N;
47 }
48
49 return;
50}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.