author | Don Pellegrino <don@coffee.donpellegrino.com> | 2009-08-17 20:55:56 (GMT) |
---|---|---|
committer | Don Pellegrino <don@coffee.donpellegrino.com> | 2009-08-17 20:55:56 (GMT) |
commit | 5c300e702d7f1944417004ddcb0a6b15f107b5e5 (patch) (unidiff) | |
tree | 043d3debe868108199e0bf58a572f6bb68cefae3 | |
parent | 468e3205a35410f05943ccb01643576ab8036f94 (diff) | |
download | exp005-5c300e702d7f1944417004ddcb0a6b15f107b5e5.zip exp005-5c300e702d7f1944417004ddcb0a6b15f107b5e5.tar.gz exp005-5c300e702d7f1944417004ddcb0a6b15f107b5e5.tar.bz2 |
Refactored the model package.
-rw-r--r-- | src/model/data/base.h | 9 | ||||
-rw-r--r-- | src/model/data/coordinates.h | 11 | ||||
-rw-r--r-- | src/model/state/pan_info.h | 24 | ||||
-rw-r--r-- | src/model/state/pan_info_init.c | 13 | ||||
-rw-r--r-- | src/model/state/selection_info.h | 37 | ||||
-rw-r--r-- | src/model/state/selection_info_init.c | 14 | ||||
-rw-r--r-- | src/model/state/selection_info_init.h | 8 | ||||
-rw-r--r-- | src/model/state/selection_purposes.h | 17 |
8 files changed, 133 insertions, 0 deletions
diff --git a/src/model/data/base.h b/src/model/data/base.h new file mode 100644 index 0000000..5b7bd0b --- a/dev/null +++ b/src/model/data/base.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef BASE_H | ||
2 | #define BASE_H | ||
3 | |||
4 | /* | ||
5 | * Build the base layer of the map. | ||
6 | */ | ||
7 | void base (void); | ||
8 | |||
9 | #endif // BASE_H | ||
diff --git a/src/model/data/coordinates.h b/src/model/data/coordinates.h new file mode 100644 index 0000000..7620904 --- a/dev/null +++ b/src/model/data/coordinates.h | |||
@@ -0,0 +1,11 @@ | |||
1 | struct | ||
2 | { | ||
3 | sqlint32 coord_id; | ||
4 | struct | ||
5 | { | ||
6 | short length; | ||
7 | char data[50]; | ||
8 | } gi; | ||
9 | double x; | ||
10 | double y; | ||
11 | } coordinates; | ||
diff --git a/src/model/state/pan_info.h b/src/model/state/pan_info.h new file mode 100644 index 0000000..9813ac9 --- a/dev/null +++ b/src/model/state/pan_info.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef PAN_INFO_H | ||
2 | #define PAN_INFO_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | |||
6 | typedef struct | ||
7 | { | ||
8 | /* | ||
9 | * A panning operation has begun. | ||
10 | */ | ||
11 | bool active; | ||
12 | |||
13 | /* | ||
14 | * Coordinates of mouse when the pan operation is begun. | ||
15 | */ | ||
16 | int begin[2]; | ||
17 | |||
18 | /* | ||
19 | * Translation | ||
20 | */ | ||
21 | float trans[2]; | ||
22 | } PAN_INFO; | ||
23 | |||
24 | #endif // PAN_INFO_H | ||
diff --git a/src/model/state/pan_info_init.c b/src/model/state/pan_info_init.c new file mode 100644 index 0000000..aa2c869 --- a/dev/null +++ b/src/model/state/pan_info_init.c | |||
@@ -0,0 +1,13 @@ | |||
1 | #include "pan_info_init.h" | ||
2 | |||
3 | void | ||
4 | pan_info_init (PAN_INFO * p) | ||
5 | { | ||
6 | p->active = false; | ||
7 | p->begin[0] = 0; | ||
8 | p->begin[1] = 0; | ||
9 | p->trans[0] = 0.0; | ||
10 | p->trans[1] = 0.0; | ||
11 | |||
12 | return; | ||
13 | } | ||
diff --git a/src/model/state/selection_info.h b/src/model/state/selection_info.h new file mode 100644 index 0000000..73a1c34 --- a/dev/null +++ b/src/model/state/selection_info.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef SELECTION_INFO_H | ||
2 | #define SELECTION_INFO_H | ||
3 | |||
4 | #include "selection_purposes.h" | ||
5 | #include <stdbool.h> | ||
6 | |||
7 | typedef struct | ||
8 | { | ||
9 | |||
10 | /* | ||
11 | * Selection list. | ||
12 | */ | ||
13 | bool *set; | ||
14 | |||
15 | /* | ||
16 | * A selection is being performed. | ||
17 | */ | ||
18 | bool active; | ||
19 | |||
20 | /* | ||
21 | * Indicate if the user is currently defining a selection. | ||
22 | */ | ||
23 | SELECTION_PURPOSES purpose; | ||
24 | |||
25 | /* | ||
26 | * X coordinate of mouse when selection mode initiated. | ||
27 | */ | ||
28 | int x; | ||
29 | |||
30 | /* | ||
31 | * Y coordinate of mouse when selection mode initiated. | ||
32 | */ | ||
33 | int y; | ||
34 | |||
35 | } SELECTION_INFO; | ||
36 | |||
37 | #endif // SELECTION_INFO_H | ||
diff --git a/src/model/state/selection_info_init.c b/src/model/state/selection_info_init.c new file mode 100644 index 0000000..40d00aa --- a/dev/null +++ b/src/model/state/selection_info_init.c | |||
@@ -0,0 +1,14 @@ | |||
1 | #include "selection_info_init.h" | ||
2 | #include <string.h> | ||
3 | |||
4 | void | ||
5 | selection_info_init (SELECTION_INFO * s) | ||
6 | { | ||
7 | s->set = NULL; | ||
8 | s->active = false; | ||
9 | s->purpose = SET; | ||
10 | s->x = 0; | ||
11 | s->y = 0; | ||
12 | |||
13 | return; | ||
14 | } | ||
diff --git a/src/model/state/selection_info_init.h b/src/model/state/selection_info_init.h new file mode 100644 index 0000000..d38b851 --- a/dev/null +++ b/src/model/state/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/state/selection_purposes.h b/src/model/state/selection_purposes.h new file mode 100644 index 0000000..6c2e651 --- a/dev/null +++ b/src/model/state/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 | ||