Parent Directory | Revision Log
Map widget update
1 | harbaum | 1 | /* |
2 | * Copyright (C) 2008 Till Harbaum <till@harbaum.org>. | ||
3 | * | ||
4 | * This file is part of GPXView. | ||
5 | * | ||
6 | * GPXView is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation, either version 3 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * GPXView is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with GPXView. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #ifndef GPXVIEW_H | ||
21 | #define GPXVIEW_H | ||
22 | |||
23 | #ifdef USE_MAEMO | ||
24 | #if MAEMO_VERSION_MAJOR < 5 | ||
25 | #define USE_BREAD_CRUMB_TRAIL | ||
26 | #else | ||
27 | harbaum | 204 | #define FREMANTLE |
28 | |||
29 | harbaum | 2 | // these are on maemo fremantle |
30 | harbaum | 3 | #include <hildon/hildon-button.h> |
31 | harbaum | 8 | #include <hildon/hildon-text-view.h> |
32 | harbaum | 11 | #include <hildon/hildon-window-stack.h> |
33 | harbaum | 8 | #define USE_HILDON_TEXT_VIEW |
34 | harbaum | 1 | #define USE_STACKABLE_WINDOW |
35 | harbaum | 2 | #define NO_COPY_N_PASTE |
36 | harbaum | 3 | #define MENU_GPXLIST 0 |
37 | #define MENU_CACHELIST 1 | ||
38 | #define MENU_CACHE 2 | ||
39 | harbaum | 1 | #endif |
40 | harbaum | 128 | #endif |
41 | |||
42 | #ifdef BCT | ||
43 | harbaum | 126 | #include "bct.h" |
44 | harbaum | 1 | #endif |
45 | |||
46 | #include "config.h" | ||
47 | |||
48 | #include <string.h> | ||
49 | #include <stdlib.h> | ||
50 | |||
51 | #include <locale.h> | ||
52 | #include <libintl.h> | ||
53 | |||
54 | harbaum | 280 | #ifndef _ |
55 | harbaum | 1 | #define _(String) gettext(String) |
56 | harbaum | 280 | #endif |
57 | harbaum | 1 | #define N_(String) (String) |
58 | |||
59 | #ifdef USE_MAEMO | ||
60 | #include <hildon/hildon-program.h> | ||
61 | #include <hildon/hildon-file-chooser-dialog.h> | ||
62 | #include <hildon/hildon-file-system-model.h> | ||
63 | #include <hildon/hildon-bread-crumb-trail.h> | ||
64 | #include <hildon/hildon-number-editor.h> | ||
65 | #include <libosso.h> /* required for screen saver timeout */ | ||
66 | #ifdef HILDON_HELP | ||
67 | #include <hildon/hildon-help.h> | ||
68 | #endif | ||
69 | #if MAEMO_VERSION_MAJOR >= 5 | ||
70 | #define USE_PANNABLE_AREA | ||
71 | #include <hildon/hildon-pannable-area.h> | ||
72 | harbaum | 17 | /* panning a gtkhtml view currently doesn't work well */ |
73 | #define PANNABLE_HTML | ||
74 | harbaum | 1 | #endif |
75 | #endif | ||
76 | |||
77 | #include <gtk/gtk.h> | ||
78 | #include <gtkhtml/gtkhtml.h> | ||
79 | |||
80 | /* list of current gpx files is being kept in gconf */ | ||
81 | #include <gconf/gconf.h> | ||
82 | #include <gconf/gconf-client.h> | ||
83 | |||
84 | #include <libgnomevfs/gnome-vfs.h> | ||
85 | #include <libgnomevfs/gnome-vfs-inet-connection.h> | ||
86 | |||
87 | /* all include appdata_t relies on go here ... */ | ||
88 | #include "gpx.h" | ||
89 | #include "settings.h" | ||
90 | |||
91 | #define GPXLIST_ITEM_VALID (1<<0) | ||
92 | #define GPXLIST_ITEM_DATE (1<<1) | ||
93 | #define GPXLIST_ITEM_CNUM (1<<2) | ||
94 | #define GPXLIST_ITEM_FILENAME (1<<3) | ||
95 | #define GPXLIST_ITEM_DEFAULT (GPXLIST_ITEM_VALID | GPXLIST_ITEM_CNUM) | ||
96 | |||
97 | #define CACHELIST_ITEM_VALID (1<<0) | ||
98 | #define CACHELIST_ITEM_ID (1<<1) | ||
99 | #define CACHELIST_ITEM_SIZE (1<<2) | ||
100 | #define CACHELIST_ITEM_RATING (1<<3) | ||
101 | #define CACHELIST_ITEM_DEFAULT (CACHELIST_ITEM_VALID | CACHELIST_ITEM_ID) | ||
102 | |||
103 | typedef struct { | ||
104 | pos_t home; /* current home geo position */ | ||
105 | gboolean use_gps; /* use GPS if avbailable */ | ||
106 | char *path; /* current path to select GPX from */ | ||
107 | |||
108 | location_t *location; /* extra home locations */ | ||
109 | int active_location; /* index of active (extra) home location */ | ||
110 | |||
111 | gboolean imperial; /* display imperial units */ | ||
112 | |||
113 | pos_t gps; /* saved last gps position */ | ||
114 | |||
115 | char *image_path; /* path to cache images in */ | ||
116 | |||
117 | int search; /* "search in" items */ | ||
118 | char *search_str; | ||
119 | int search_days; | ||
120 | |||
121 | harbaum | 158 | struct proxy_s *proxy; /* proxy settings */ |
122 | |||
123 | harbaum | 1 | int gpxlist_items; |
124 | int cachelist_items; | ||
125 | gboolean cachelist_hide_found; | ||
126 | |||
127 | /* geotext related */ | ||
128 | char *geotext_text; | ||
129 | int geotext_shift; | ||
130 | |||
131 | gpx_t *gpx; | ||
132 | GtkListStore *gpxstore; | ||
133 | GtkWidget *gpxview; | ||
134 | GConfClient *gconf_client; | ||
135 | |||
136 | gboolean compass_locked; | ||
137 | int compass_damping; | ||
138 | |||
139 | harbaum | 167 | gboolean disable_gcvote; |
140 | |||
141 | harbaum | 1 | struct gps_state *gps_state; |
142 | |||
143 | /* keep track of all html views so zoom events can be delivered */ | ||
144 | struct html_view *html_view; | ||
145 | |||
146 | #ifndef REQUIRES_CLOSE_BUTTON | ||
147 | /* this is being activated and de-activated on selection/deselection */ | ||
148 | GtkWidget *menu_remove, *menu_close; | ||
149 | #endif | ||
150 | |||
151 | harbaum | 2 | #ifndef NO_COPY_N_PASTE |
152 | harbaum | 1 | /* do enable/disable the edit entries */ |
153 | GtkWidget *menu_cut, *menu_copy, *menu_paste; | ||
154 | GtkTextBuffer *active_buffer; | ||
155 | harbaum | 2 | #endif |
156 | harbaum | 1 | |
157 | harbaum | 133 | GtkClipboard *clipboard; /* clipboard for copy/paste */ |
158 | |||
159 | harbaum | 20 | #ifdef USE_STACKABLE_WINDOW |
160 | GtkWidget *export_menu, *tools_menu; | ||
161 | #endif | ||
162 | |||
163 | harbaum | 1 | /* save result here to be able to "goto" it */ |
164 | pos_t geomath; | ||
165 | |||
166 | int cur_items; | ||
167 | GtkWidget *cur_view; | ||
168 | |||
169 | char *mmpoi_path; /* path to save poi to */ | ||
170 | float mmpoi_radius; | ||
171 | gboolean mmpoi_use_radius; | ||
172 | gboolean mmpoi_dont_export_found; | ||
173 | gboolean mmpoi_dont_export_disabled; | ||
174 | |||
175 | char *fieldnotes_path; /* path to save field notes to */ | ||
176 | |||
177 | char *garmin_path; /* path to save garmin data to */ | ||
178 | gboolean garmin_ign_found; | ||
179 | |||
180 | #ifdef USE_MAEMO | ||
181 | gboolean fullscreen; | ||
182 | harbaum | 231 | #ifdef ENABLE_MAEMO_MAPPER |
183 | harbaum | 1 | pos_t mmpos; /* position received from Maemo Mapper */ |
184 | gboolean mmpos_valid; | ||
185 | harbaum | 231 | #endif |
186 | harbaum | 1 | |
187 | gboolean mmpoi_dontlaunch; | ||
188 | |||
189 | gboolean cachelist_disable_screensaver; | ||
190 | gboolean goto_disable_screensaver; | ||
191 | |||
192 | HildonProgram *program; | ||
193 | HildonWindow *window; | ||
194 | osso_context_t *osso_context; | ||
195 | harbaum | 126 | #else |
196 | GtkWidget *window; | ||
197 | #endif | ||
198 | harbaum | 1 | |
199 | harbaum | 129 | gboolean cachelist_update; |
200 | |||
201 | harbaum | 128 | #if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
202 | harbaum | 1 | /* reference to enable/disable these while walking the crumb trail */ |
203 | GtkWidget *menu_import, *menu_export; | ||
204 | GtkWidget *menu_search; | ||
205 | |||
206 | harbaum | 128 | GtkWidget *bct; |
207 | #endif | ||
208 | |||
209 | harbaum | 1 | /* keep track of current "path" in the bread crumb trail */ |
210 | gpx_t *cur_gpx; | ||
211 | cache_t *cur_cache; | ||
212 | harbaum | 228 | struct cache_context_s *cache_context; |
213 | harbaum | 1 | |
214 | harbaum | 126 | gpx_t *search_results; |
215 | |||
216 | harbaum | 48 | #ifdef ENABLE_OSM_GPS_MAP |
217 | struct { | ||
218 | harbaum | 56 | struct map_context_s *context; |
219 | harbaum | 89 | int source; |
220 | harbaum | 48 | int zoom; |
221 | pos_t pos; | ||
222 | harbaum | 280 | gboolean dpix; |
223 | harbaum | 48 | } map; |
224 | #endif | ||
225 | |||
226 | harbaum | 204 | /* username is also used to detect own caches (by log entry) */ |
227 | char *username; | ||
228 | |||
229 | harbaum | 196 | /* stuff to call geotoad */ |
230 | struct { | ||
231 | harbaum | 204 | char *password, *filename; |
232 | harbaum | 196 | float distance, lat, lon; |
233 | int flags; | ||
234 | harbaum | 252 | gboolean no_owned_found; |
235 | harbaum | 196 | } gt; |
236 | |||
237 | harbaum | 246 | #ifdef ESPEAK |
238 | /* espeak handling */ | ||
239 | struct { | ||
240 | gboolean enabled; | ||
241 | int sample_rate; // or init error | ||
242 | } espeak; | ||
243 | #endif | ||
244 | |||
245 | harbaum | 237 | #ifndef USE_STACKABLE_WINDOW |
246 | harbaum | 1 | GtkWidget *vbox; |
247 | harbaum | 237 | #endif |
248 | harbaum | 1 | } appdata_t; |
249 | |||
250 | /* all includes that rely on appdata_t go here ... */ | ||
251 | #include "gps.h" | ||
252 | #include "goto.h" | ||
253 | #include "gconf.h" | ||
254 | #include "html.h" | ||
255 | #include "icons.h" | ||
256 | harbaum | 158 | #include "gcvote.h" |
257 | harbaum | 1 | #include "cache.h" |
258 | #include "geomath.h" | ||
259 | #include "geotext.h" | ||
260 | #include "notes.h" | ||
261 | #include "help.h" | ||
262 | #include "mm_poi.h" | ||
263 | #include "precpos.h" | ||
264 | #include "garmin_export.h" | ||
265 | harbaum | 193 | #include "geotoad.h" |
266 | harbaum | 228 | #include "about.h" |
267 | harbaum | 1 | |
268 | harbaum | 32 | #ifdef ENABLE_OSM_GPS_MAP |
269 | #include "map-tool.h" | ||
270 | #endif | ||
271 | |||
272 | harbaum | 1 | #ifdef USE_MAEMO |
273 | #include "dbus.h" | ||
274 | #endif | ||
275 | |||
276 | #define SEARCH_ID (1<<0) | ||
277 | #define SEARCH_NAME (1<<1) | ||
278 | #define SEARCH_DESC (1<<2) | ||
279 | #define SEARCH_OWNER (1<<3) | ||
280 | #define SEARCH_FINDS (1<<4) | ||
281 | |||
282 | #ifdef USE_MAEMO | ||
283 | #define DIALOG_WIDTH 800 | ||
284 | #define DIALOG_HEIGHT 480 | ||
285 | #define GTK_FM_OK GTK_RESPONSE_OK | ||
286 | #else | ||
287 | #define DIALOG_WIDTH 560 | ||
288 | #define DIALOG_HEIGHT 340 | ||
289 | #define GTK_FM_OK GTK_RESPONSE_ACCEPT | ||
290 | #endif | ||
291 | |||
292 | #include "misc.h" | ||
293 | |||
294 | #define CHANGE_FLAG_POS (1<<0) | ||
295 | #define CHANGE_FLAG_MASK (1<<1) | ||
296 | |||
297 | extern void main_after_settings_redraw(appdata_t *appdata, int flags); | ||
298 | |||
299 | #include <stdarg.h> | ||
300 | extern void errorf(const char *fmt, ...); | ||
301 | extern gboolean on_window_key_press(GtkWidget *widget, | ||
302 | harbaum | 11 | GdkEventKey *event, appdata_t *appdata); |
303 | harbaum | 3 | #ifdef USE_STACKABLE_WINDOW |
304 | HildonAppMenu *menu_create(appdata_t *appdata, int mode); | ||
305 | #endif | ||
306 | harbaum | 142 | void cachelist_goto_cache(appdata_t *appdata, cache_t *cache); |
307 | void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx); | ||
308 | harbaum | 211 | gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx); |
309 | void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx); | ||
310 | harbaum | 223 | void gpxlist_add(appdata_t *appdata, gpx_t *new); |
311 | harbaum | 228 | void cachelist_redraw(appdata_t *appdata); |
312 | harbaum | 1 | |
313 | #endif // GPXVIEW_H |