]> err.no Git - mapper/blob - src/mapper-types.h
Fix GPS settings dialog so it works.
[mapper] / src / mapper-types.h
1 #include "config.h"
2
3 #ifndef _MAPPER_TYPES_H
4 #define _MAPPER_TYPES_H
5
6 #include <math.h>
7 #include <gtk/gtk.h>
8 #include <curl/multi.h>
9
10 /** Generic search item list indexes */
11 typedef enum {
12         ITEM_ID,
13         ITEM_CATID,
14         ITEM_LAT,
15         ITEM_LON,
16         ITEM_DIST,
17         ITEM_LATLON,
18         ITEM_LABEL,
19         ITEM_DESC,
20         ITEM_CATLAB,
21         ITEM_ICON,
22         ITEM_COLOR,
23         ITEM_NUM_COLUMNS
24 } item_list_id;
25
26 /** This enumerated type defines the supported types of repositories. */
27 typedef enum {
28         REPOTYPE_NONE,          /* No URL set. */
29         REPOTYPE_XYZ,           /* x=%d, y=%d, and zoom=%d */
30         REPOTYPE_XYZ_INV,       /* zoom=%0d, x=%d, y=%d */
31         REPOTYPE_QUAD_QRST,     /* t=%s   (%s = {qrst}*) */
32         REPOTYPE_QUAD_ZERO,     /* t=%0s  (%0s = {0123}*) */
33         REPOTYPE_WMS            /* "service=wms" */
34 } RepoType;
35
36 /** Possible center modes.  The "WAS" modes imply no current center mode;
37  * they only hint at what the last center mode was, so that it can be
38  * recalled. */
39 typedef enum {
40         CENTER_WAS_LATLON = -2,
41         CENTER_WAS_LEAD = -1,
42         CENTER_MANUAL =0,
43         CENTER_LEAD = 1,
44         CENTER_LATLON = 2
45 } CenterMode;
46
47 /* Route list */
48 typedef enum {
49         ROUTE_LATLON,
50         ROUTE_DISTANCE,
51         ROUTE_WAYPOINT,
52         ROUTE_NUM_COLUMNS
53 } RouteList;
54
55 /** Category list **/
56 typedef enum {
57         CAT_ID,
58         CAT_ENABLED,
59         CAT_LABEL,
60         CAT_DESC,
61         CAT_POI_CNT,
62         CAT_ICON,
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         SPEED_LOCATION_TOP_LEFT,
154         SPEED_LOCATION_TOP_RIGHT,
155         SPEED_LOCATION_BOTTOM_RIGHT,
156         SPEED_LOCATION_BOTTOM_LEFT,
157         SPEED_LOCATION_ENUM_COUNT
158 } SpeedLocation;
159 gchar *SPEED_LOCATION_TEXT[SPEED_LOCATION_ENUM_COUNT];
160
161 /** Data regarding a map repository. */
162 typedef struct _RepoData RepoData;
163 struct _RepoData {
164         gchar *name;
165         gchar *url;
166         gchar *cache_dir;
167         guint dl_zoom_steps;
168         guint view_zoom_steps;
169         gboolean double_size;
170         gboolean nextable;
171         RepoType type;
172         GtkWidget *menu_item;
173 };
174
175 /** Data used during the asynchronous progress update phase of automatic map
176  * downloading. */
177 typedef struct _ProgressUpdateInfo ProgressUpdateInfo;
178 struct _ProgressUpdateInfo {
179         gchar *src_str;
180         gchar *dest_str;
181         RepoData *repo;
182         guint tilex, tiley, zoom;       /* for refresh. */
183         gint retries;           /* if equal to zero, it means we're DELETING maps. */
184         guint priority;
185         FILE *file;
186 };
187
188 typedef struct _RouteDownloadData RouteDownloadData;
189 struct _RouteDownloadData {
190         gchar *bytes;
191         guint bytes_read;
192 };
193
194 /** Data used during the asynchronous automatic route downloading operation. */
195 typedef struct _AutoRouteDownloadData AutoRouteDownloadData;
196 struct _AutoRouteDownloadData {
197         gboolean enabled;
198         gboolean in_progress;
199         gchar *dest;
200         CURL *curl_easy;
201         gchar *src_str;
202         RouteDownloadData rdl_data;
203 };
204
205 typedef struct _BrowseInfo BrowseInfo;
206 struct _BrowseInfo {
207         GtkWidget *dialog;
208         GtkWidget *txt;
209 };
210
211 #endif