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) (side-by-side diff) | |
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 @@ +#ifndef BASE_H +#define BASE_H + +/* + * Build the base layer of the map. + */ +void base (void); + +#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 @@ +struct +{ + sqlint32 coord_id; + struct + { + short length; + char data[50]; + } gi; + double x; + double y; +} 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 @@ +#ifndef PAN_INFO_H +#define PAN_INFO_H + +#include <stdbool.h> + +typedef struct +{ + /* + * A panning operation has begun. + */ + bool active; + + /* + * Coordinates of mouse when the pan operation is begun. + */ + int begin[2]; + + /* + * Translation + */ + float trans[2]; +} PAN_INFO; + +#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 @@ +#include "pan_info_init.h" + +void +pan_info_init (PAN_INFO * p) +{ + p->active = false; + p->begin[0] = 0; + p->begin[1] = 0; + p->trans[0] = 0.0; + p->trans[1] = 0.0; + + return; +} 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 @@ +#ifndef SELECTION_INFO_H +#define SELECTION_INFO_H + +#include "selection_purposes.h" +#include <stdbool.h> + +typedef struct +{ + + /* + * Selection list. + */ + bool *set; + + /* + * A selection is being performed. + */ + bool active; + + /* + * Indicate if the user is currently defining a selection. + */ + SELECTION_PURPOSES purpose; + + /* + * X coordinate of mouse when selection mode initiated. + */ + int x; + + /* + * Y coordinate of mouse when selection mode initiated. + */ + int y; + +} SELECTION_INFO; + +#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 @@ +#include "selection_info_init.h" +#include <string.h> + +void +selection_info_init (SELECTION_INFO * s) +{ + s->set = NULL; + s->active = false; + s->purpose = SET; + s->x = 0; + s->y = 0; + + return; +} 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 @@ +#ifndef SELECTION_INFO_INIT_H +#define SELECTION_INFO_INIT_H + +#include "selection_info.h" + +void selection_info_init (SELECTION_INFO * s); + +#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 @@ +#ifndef SELECTION_PURPOSES_H +#define SELECTION_PURPOSES_H + +typedef enum +{ + /* + * The selection will define a new set. + */ + SET, + + /* + * The selection will define a zoom region. + */ + ZOOM +} SELECTION_PURPOSES; + +#endif // SELECTION_PURPOSES_H |