From 5c300e702d7f1944417004ddcb0a6b15f107b5e5 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Mon, 17 Aug 2009 20:55:56 +0000 Subject: Refactored the model package. --- 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 + +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 + +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 + +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 -- cgit v0.8.3.1-22-g547a