]> err.no Git - mapper/blob - src/mapper-types.h
Move some variables and types around
[mapper] / src / mapper-types.h
1 #include "config.h"
2
3 #define _GNU_SOURCE
4
5 #include <math.h>
6 #include <gtk/gtk.h>
7
8 #ifndef _MAPPER_TYPES_H
9 #define _MAPPER_TYPES_H
10
11 /** Generic search item list indexes */
12 typedef enum {
13         ITEM_ID,
14         ITEM_CATID,
15         ITEM_LAT,
16         ITEM_LON,
17         ITEM_DIST,
18         ITEM_LATLON,
19         ITEM_LABEL,
20         ITEM_DESC,
21         ITEM_CATLAB,
22         ITEM_ICON,
23         ITEM_COLOR,
24         ITEM_NUM_COLUMNS
25 } item_list_id;
26
27 /** This enumerated type defines the supported types of repositories. */
28 typedef enum {
29         REPOTYPE_NONE,          /* No URL set. */
30         REPOTYPE_XYZ,           /* x=%d, y=%d, and zoom=%d */
31         REPOTYPE_XYZ_INV,       /* zoom=%0d, x=%d, y=%d */
32         REPOTYPE_QUAD_QRST,     /* t=%s   (%s = {qrst}*) */
33         REPOTYPE_QUAD_ZERO,     /* t=%0s  (%0s = {0123}*) */
34         REPOTYPE_WMS            /* "service=wms" */
35 } RepoType;
36
37 /** Possible center modes.  The "WAS" modes imply no current center mode;
38  * they only hint at what the last center mode was, so that it can be
39  * recalled. */
40 typedef enum {
41         CENTER_WAS_LATLON = -2,
42         CENTER_WAS_LEAD = -1,
43         CENTER_MANUAL =0,
44         CENTER_LEAD = 1,
45         CENTER_LATLON = 2
46 } CenterMode;
47
48 /* Route list */
49 typedef enum {
50         ROUTE_LATLON,
51         ROUTE_DISTANCE,
52         ROUTE_WAYPOINT,
53         ROUTE_NUM_COLUMNS
54 } RouteList;
55
56 /** Category list **/
57 typedef enum {
58         CAT_ID,
59         CAT_ENABLED,
60         CAT_LABEL,
61         CAT_DESC,
62         CAT_POI_CNT,
63         CAT_NUM_COLUMNS
64 } CategoryList;
65
66 /** This enum defines the possible units we can use. */
67 typedef enum {
68         UNITS_KM,
69         UNITS_MI,
70         UNITS_NM,
71         UNITS_ENUM_COUNT
72 } UnitType;
73 gchar *UNITS_TEXT[UNITS_ENUM_COUNT];
74
75 /* UNITS_CONVERTS, when multiplied, converts from NM. */
76 #define EARTH_RADIUS (3440.06479f)
77 gfloat UNITS_CONVERT[UNITS_ENUM_COUNT];
78
79 /** This enum defines the possible font sizes. */
80 typedef enum {
81         INFO_FONT_XXSMALL,
82         INFO_FONT_XSMALL,
83         INFO_FONT_SMALL,
84         INFO_FONT_MEDIUM,
85         INFO_FONT_LARGE,
86         INFO_FONT_XLARGE,
87         INFO_FONT_XXLARGE,
88         INFO_FONT_ENUM_COUNT
89 } InfoFontSize;
90 gchar *INFO_FONT_TEXT[INFO_FONT_ENUM_COUNT];
91
92 /** This enum defines all of the key-customizable actions. */
93 typedef enum {
94         CUSTOM_ACTION_PAN_NORTH,
95         CUSTOM_ACTION_PAN_WEST,
96         CUSTOM_ACTION_PAN_SOUTH,
97         CUSTOM_ACTION_PAN_EAST,
98         CUSTOM_ACTION_TOGGLE_AUTOCENTER,
99         CUSTOM_ACTION_ZOOM_IN,
100         CUSTOM_ACTION_ZOOM_OUT,
101         CUSTOM_ACTION_TOGGLE_FULLSCREEN,
102         CUSTOM_ACTION_TOGGLE_TRACKS,
103         CUSTOM_ACTION_TOGGLE_SCALE,
104         CUSTOM_ACTION_TOGGLE_POI,
105         CUSTOM_ACTION_CHANGE_REPO,
106         CUSTOM_ACTION_ROUTE_DISTNEXT,
107         CUSTOM_ACTION_ROUTE_DISTLAST,
108         CUSTOM_ACTION_TRACK_BREAK,
109         CUSTOM_ACTION_TRACK_DISTLAST,
110         CUSTOM_ACTION_TRACK_DISTFIRST,
111         CUSTOM_ACTION_TOGGLE_GPS,
112         CUSTOM_ACTION_TOGGLE_GPSINFO,
113         CUSTOM_ACTION_TOGGLE_SPEEDLIMIT,
114         CUSTOM_ACTION_ENUM_COUNT
115 } CustomAction;
116 gchar *CUSTOM_ACTION_TEXT[CUSTOM_ACTION_ENUM_COUNT];
117
118 /** This enum defines all of the customizable keys. */
119 typedef enum {
120         CUSTOM_KEY_UP,
121         CUSTOM_KEY_LEFT,
122         CUSTOM_KEY_DOWN,
123         CUSTOM_KEY_RIGHT,
124         CUSTOM_KEY_SELECT,
125         CUSTOM_KEY_INCREASE,
126         CUSTOM_KEY_DECREASE,
127         CUSTOM_KEY_FULLSCREEN,
128         CUSTOM_KEY_ESC,
129         CUSTOM_KEY_ENUM_COUNT
130 } CustomKey;
131 gchar *CUSTOM_KEY_GCONF[CUSTOM_KEY_ENUM_COUNT];
132 gchar *CUSTOM_KEY_ICON[CUSTOM_KEY_ENUM_COUNT];
133 CustomAction CUSTOM_KEY_DEFAULT[CUSTOM_KEY_ENUM_COUNT];
134
135 /** This enum defines all of the colorable objects. */
136 typedef enum {
137         COLORABLE_MARK,
138         COLORABLE_MARK_VELOCITY,
139         COLORABLE_MARK_OLD,
140         COLORABLE_TRACK,
141         COLORABLE_TRACK_MARK,
142         COLORABLE_TRACK_BREAK,
143         COLORABLE_ROUTE,
144         COLORABLE_ROUTE_WAY,
145         COLORABLE_ROUTE_BREAK,
146         COLORABLE_POI,
147         COLORABLE_ENUM_COUNT
148 } Colorable;
149 gchar *COLORABLE_GCONF[COLORABLE_ENUM_COUNT];
150 GdkColor COLORABLE_DEFAULT[COLORABLE_ENUM_COUNT];
151
152 typedef enum {
153         DDPDDDDD,
154         DD_MMPMMM,
155         DD_MM_SSPS,
156         DDPDDDDD_NSEW,
157         DD_MMPMMM_NSEW,
158         DD_MM_SSPS_NSEW,
159         DEG_FORMAT_ENUM_COUNT
160 } DegFormat;
161 gchar *DEG_FORMAT_TEXT[DEG_FORMAT_ENUM_COUNT];
162
163 typedef enum {
164         SPEED_LOCATION_TOP_LEFT,
165         SPEED_LOCATION_TOP_RIGHT,
166         SPEED_LOCATION_BOTTOM_RIGHT,
167         SPEED_LOCATION_BOTTOM_LEFT,
168         SPEED_LOCATION_ENUM_COUNT
169 } SpeedLocation;
170 gchar *SPEED_LOCATION_TEXT[SPEED_LOCATION_ENUM_COUNT];
171
172 /** Data regarding a map repository. */
173 typedef struct _RepoData RepoData;
174 struct _RepoData {
175         gchar *name;
176         gchar *url;
177         gchar *cache_dir;
178         guint dl_zoom_steps;
179         guint view_zoom_steps;
180         gboolean double_size;
181         gboolean nextable;
182         RepoType type;
183         GtkWidget *menu_item;
184 };
185
186 /** Data used during the asynchronous progress update phase of automatic map
187  * downloading. */
188 typedef struct _ProgressUpdateInfo ProgressUpdateInfo;
189 struct _ProgressUpdateInfo {
190         gchar *src_str;
191         gchar *dest_str;
192         RepoData *repo;
193         guint tilex, tiley, zoom;       /* for refresh. */
194         gint retries;           /* if equal to zero, it means we're DELETING maps. */
195         guint priority;
196         FILE *file;
197 };
198
199 typedef struct _RouteDownloadData RouteDownloadData;
200 struct _RouteDownloadData {
201         gchar *bytes;
202         guint bytes_read;
203 };
204
205 /** Data used during the asynchronous automatic route downloading operation. */
206 typedef struct _AutoRouteDownloadData AutoRouteDownloadData;
207 struct _AutoRouteDownloadData {
208         gboolean enabled;
209         gboolean in_progress;
210         gchar *dest;
211         CURL *curl_easy;
212         gchar *src_str;
213         RouteDownloadData rdl_data;
214 };
215
216 typedef struct _BrowseInfo BrowseInfo;
217 struct _BrowseInfo {
218         GtkWidget *dialog;
219         GtkWidget *txt;
220 };
221
222 #endif