author | Don Pellegrino <don@drexel.edu> | 2009-06-18 21:12:54 (GMT) |
---|---|---|
committer | Don Pellegrino <don@drexel.edu> | 2009-06-18 21:12:54 (GMT) |
commit | 4914750f48517cd076600d7e209a8da391a3be59 (patch) (unidiff) | |
tree | a816e91fcf68971b788d323325be4638913cf2ba | |
parent | 816589d55b274c58425900e7cafd0288fe85c861 (diff) | |
download | exp005-4914750f48517cd076600d7e209a8da391a3be59.zip exp005-4914750f48517cd076600d7e209a8da391a3be59.tar.gz exp005-4914750f48517cd076600d7e209a8da391a3be59.tar.bz2 |
Implemented zooming.
-rw-r--r-- | src/model/selection_info.h | 41 | ||||
-rw-r--r-- | src/model/selection_info_init.c | 12 | ||||
-rw-r--r-- | src/model/selection_info_init.h | 8 | ||||
-rw-r--r-- | src/model/selection_purposes.h | 17 | ||||
-rw-r--r-- | src/model/zoom_info.h | 21 | ||||
-rw-r--r-- | src/model/zoom_info_init.c | 9 | ||||
-rw-r--r-- | src/model/zoom_info_init.h | 8 |
7 files changed, 116 insertions, 0 deletions
diff --git a/src/model/selection_info.h b/src/model/selection_info.h new file mode 100644 index 0000000..970ecec --- a/dev/null +++ b/src/model/selection_info.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef SELECTION_INFO_H | ||
2 | #define SELECTION_INFO_H | ||
3 | |||
4 | #include "selection_purposes.h" | ||
5 | #include <stdbool.h> | ||
6 | |||
7 | /* | ||
8 | * Vertices in the graph. | ||
9 | */ | ||
10 | #define ROWS 83905 | ||
11 | |||
12 | typedef struct { | ||
13 | |||
14 | /* | ||
15 | * Selection list. | ||
16 | */ | ||
17 | bool set[ROWS]; | ||
18 | |||
19 | /* | ||
20 | * A selection is being performed. | ||
21 | */ | ||
22 | bool active; | ||
23 | |||
24 | /* | ||
25 | * Indicate if the user is currently defining a selection. | ||
26 | */ | ||
27 | SELECTION_PURPOSES purpose; | ||
28 | |||
29 | /* | ||
30 | * X coordinate of mouse when selection mode initiated. | ||
31 | */ | ||
32 | int x; | ||
33 | |||
34 | /* | ||
35 | * Y coordinate of mouse when selection mode initiated. | ||
36 | */ | ||
37 | int y; | ||
38 | |||
39 | } SELECTION_INFO; | ||
40 | |||
41 | #endif // SELECTION_INFO_H | ||
diff --git a/src/model/selection_info_init.c b/src/model/selection_info_init.c new file mode 100644 index 0000000..e01b2b8 --- a/dev/null +++ b/src/model/selection_info_init.c | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "selection_info_init.h" | ||
2 | |||
3 | void | ||
4 | selection_info_init (SELECTION_INFO* s) | ||
5 | { | ||
6 | s->active = false; | ||
7 | s->purpose = SET; | ||
8 | s->x = 0; | ||
9 | s->y = 0; | ||
10 | |||
11 | return; | ||
12 | } | ||
diff --git a/src/model/selection_info_init.h b/src/model/selection_info_init.h new file mode 100644 index 0000000..8ce56c5 --- a/dev/null +++ b/src/model/selection_info_init.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef SELECTION_INFO_INIT_H | ||
2 | #define SELECTION_INFO_INIT_H | ||
3 | |||
4 | #include "selection_info.h" | ||
5 | |||
6 | void selection_info_init (SELECTION_INFO* s); | ||
7 | |||
8 | #endif // SELECTION_INFO_INIT_H | ||
diff --git a/src/model/selection_purposes.h b/src/model/selection_purposes.h new file mode 100644 index 0000000..12d6ec7 --- a/dev/null +++ b/src/model/selection_purposes.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef SELECTION_PURPOSES_H | ||
2 | #define SELECTION_PURPOSES_H | ||
3 | |||
4 | typedef enum | ||
5 | { | ||
6 | /* | ||
7 | * The selection will define a new set. | ||
8 | */ | ||
9 | SET, | ||
10 | |||
11 | /* | ||
12 | * The selection will define a zoom region. | ||
13 | */ | ||
14 | ZOOM | ||
15 | } SELECTION_PURPOSES; | ||
16 | |||
17 | #endif // SELECTION_PURPOSES_H | ||
diff --git a/src/model/zoom_info.h b/src/model/zoom_info.h new file mode 100644 index 0000000..0b935c8 --- a/dev/null +++ b/src/model/zoom_info.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef ZOOM_INFO_H | ||
2 | #define ZOOM_INFO_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | |||
6 | /* | ||
7 | * Maintain information for zooming. | ||
8 | */ | ||
9 | typedef struct { | ||
10 | /* | ||
11 | * A zoomed region has been selection. | ||
12 | */ | ||
13 | bool active; | ||
14 | |||
15 | /* | ||
16 | * Left, right, bottom and top of zoom region in world coordinates. | ||
17 | */ | ||
18 | double coords[4]; | ||
19 | } ZOOM_INFO; | ||
20 | |||
21 | #endif // ZOOM_INFO_H | ||
diff --git a/src/model/zoom_info_init.c b/src/model/zoom_info_init.c new file mode 100644 index 0000000..c5a3b1d --- a/dev/null +++ b/src/model/zoom_info_init.c | |||
@@ -0,0 +1,9 @@ | |||
1 | #include "zoom_info_init.h" | ||
2 | |||
3 | void | ||
4 | zoom_info_init (ZOOM_INFO* z) | ||
5 | { | ||
6 | z->active = false; | ||
7 | |||
8 | return; | ||
9 | } | ||
diff --git a/src/model/zoom_info_init.h b/src/model/zoom_info_init.h new file mode 100644 index 0000000..262d408 --- a/dev/null +++ b/src/model/zoom_info_init.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef ZOOM_INFO_INIT_H | ||
2 | #define ZOOM_INFO_INIT_H | ||
3 | |||
4 | #include "zoom_info.h" | ||
5 | |||
6 | void zoom_info_init (ZOOM_INFO* z); | ||
7 | |||
8 | #endif // ZOOM_INFO_INIT_H | ||