Parent Directory | Revision Log
Started work on GeoToad
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 | 2 | // these are on maemo fremantle |
28 | harbaum | 3 | #include <hildon/hildon-button.h> |
29 | harbaum | 8 | #include <hildon/hildon-text-view.h> |
30 | harbaum | 11 | #include <hildon/hildon-window-stack.h> |
31 | harbaum | 8 | #define USE_HILDON_TEXT_VIEW |
32 | harbaum | 1 | #define USE_STACKABLE_WINDOW |
33 | harbaum | 2 | #define NO_COPY_N_PASTE |
34 | harbaum | 3 | #define MENU_GPXLIST 0 |
35 | #define MENU_CACHELIST 1 | ||
36 | #define MENU_CACHE 2 | ||
37 | harbaum | 1 | #endif |
38 | harbaum | 128 | #endif |
39 | |||
40 | #ifdef BCT | ||
41 | harbaum | 126 | #include "bct.h" |
42 | harbaum | 1 | #endif |
43 | |||
44 | #include "config.h" | ||
45 | |||
46 | #include <string.h> | ||
47 | #include <stdlib.h> | ||
48 | |||
49 | #include <locale.h> | ||
50 | #include <libintl.h> | ||
51 | |||
52 | #define _(String) gettext(String) | ||
53 | #define N_(String) (String) | ||
54 | |||
55 | #ifdef USE_MAEMO | ||
56 | #include <hildon/hildon-program.h> | ||
57 | #include <hildon/hildon-file-chooser-dialog.h> | ||
58 | #include <hildon/hildon-file-system-model.h> | ||
59 | #include <hildon/hildon-bread-crumb-trail.h> | ||
60 | #include <hildon/hildon-number-editor.h> | ||
61 | #include <libosso.h> /* required for screen saver timeout */ | ||
62 | #ifdef HILDON_HELP | ||
63 | #include <hildon/hildon-help.h> | ||
64 | #endif | ||
65 | #if MAEMO_VERSION_MAJOR >= 5 | ||
66 | #define USE_PANNABLE_AREA | ||
67 | #include <hildon/hildon-pannable-area.h> | ||
68 | harbaum | 17 | /* panning a gtkhtml view currently doesn't work well */ |
69 | #define PANNABLE_HTML | ||
70 | harbaum | 1 | #endif |
71 | #endif | ||
72 | |||
73 | #include <gtk/gtk.h> | ||
74 | #include <gtkhtml/gtkhtml.h> | ||
75 | |||
76 | /* list of current gpx files is being kept in gconf */ | ||
77 | #include <gconf/gconf.h> | ||
78 | #include <gconf/gconf-client.h> | ||
79 | |||
80 | #include <libgnomevfs/gnome-vfs.h> | ||
81 | #include <libgnomevfs/gnome-vfs-inet-connection.h> | ||
82 | |||
83 | /* all include appdata_t relies on go here ... */ | ||
84 | #include "gpx.h" | ||
85 | #include "settings.h" | ||
86 | |||
87 | #define GPXLIST_ITEM_VALID (1<<0) | ||
88 | #define GPXLIST_ITEM_DATE (1<<1) | ||
89 | #define GPXLIST_ITEM_CNUM (1<<2) | ||
90 | #define GPXLIST_ITEM_FILENAME (1<<3) | ||
91 | #define GPXLIST_ITEM_DEFAULT (GPXLIST_ITEM_VALID | GPXLIST_ITEM_CNUM) | ||
92 | |||
93 | #define CACHELIST_ITEM_VALID (1<<0) | ||
94 | #define CACHELIST_ITEM_ID (1<<1) | ||
95 | #define CACHELIST_ITEM_SIZE (1<<2) | ||
96 | #define CACHELIST_ITEM_RATING (1<<3) | ||
97 | #define CACHELIST_ITEM_DEFAULT (CACHELIST_ITEM_VALID | CACHELIST_ITEM_ID) | ||
98 | |||
99 | typedef struct { | ||
100 | pos_t home; /* current home geo position */ | ||
101 | gboolean use_gps; /* use GPS if avbailable */ | ||
102 | char *path; /* current path to select GPX from */ | ||
103 | |||
104 | location_t *location; /* extra home locations */ | ||
105 | int active_location; /* index of active (extra) home location */ | ||
106 | |||
107 | gboolean imperial; /* display imperial units */ | ||
108 | |||
109 | pos_t gps; /* saved last gps position */ | ||
110 | |||
111 | char *image_path; /* path to cache images in */ | ||
112 | |||
113 | int search; /* "search in" items */ | ||
114 | char *search_str; | ||
115 | int search_days; | ||
116 | |||
117 | harbaum | 158 | struct proxy_s *proxy; /* proxy settings */ |
118 | |||
119 | harbaum | 1 | int gpxlist_items; |
120 | int cachelist_items; | ||
121 | guint cachelist_handler_id; /* update timer */ | ||
122 | gboolean cachelist_hide_found; | ||
123 | |||
124 | /* geotext related */ | ||
125 | char *geotext_text; | ||
126 | int geotext_shift; | ||
127 | |||
128 | gpx_t *gpx; | ||
129 | GtkListStore *gpxstore; | ||
130 | GtkWidget *gpxview; | ||
131 | GConfClient *gconf_client; | ||
132 | |||
133 | pos_t manual_goto; | ||
134 | gboolean compass_locked; | ||
135 | int compass_damping; | ||
136 | |||
137 | harbaum | 167 | gboolean disable_gcvote; |
138 | |||
139 | harbaum | 1 | struct gps_state *gps_state; |
140 | |||
141 | /* keep track of all html views so zoom events can be delivered */ | ||
142 | struct html_view *html_view; | ||
143 | |||
144 | #ifndef REQUIRES_CLOSE_BUTTON | ||
145 | /* this is being activated and de-activated on selection/deselection */ | ||
146 | GtkWidget *menu_remove, *menu_close; | ||
147 | #endif | ||
148 | |||
149 | harbaum | 2 | #ifndef NO_COPY_N_PASTE |
150 | harbaum | 1 | /* do enable/disable the edit entries */ |
151 | GtkWidget *menu_cut, *menu_copy, *menu_paste; | ||
152 | GtkTextBuffer *active_buffer; | ||
153 | harbaum | 2 | #endif |
154 | harbaum | 1 | |
155 | harbaum | 133 | GtkClipboard *clipboard; /* clipboard for copy/paste */ |
156 | |||
157 | harbaum | 20 | #ifdef USE_STACKABLE_WINDOW |
158 | GtkWidget *export_menu, *tools_menu; | ||
159 | #endif | ||
160 | |||
161 | harbaum | 1 | /* save result here to be able to "goto" it */ |
162 | pos_t geomath; | ||
163 | |||
164 | int cur_items; | ||
165 | GtkWidget *cur_view; | ||
166 | |||
167 | char *mmpoi_path; /* path to save poi to */ | ||
168 | float mmpoi_radius; | ||
169 | gboolean mmpoi_use_radius; | ||
170 | gboolean mmpoi_dont_export_found; | ||
171 | gboolean mmpoi_dont_export_disabled; | ||
172 | |||
173 | char *fieldnotes_path; /* path to save field notes to */ | ||
174 | |||
175 | char *garmin_path; /* path to save garmin data to */ | ||
176 | gboolean garmin_ign_found; | ||
177 | |||
178 | #ifdef USE_MAEMO | ||
179 | gboolean fullscreen; | ||
180 | pos_t mmpos; /* position received from Maemo Mapper */ | ||
181 | gboolean mmpos_valid; | ||
182 | |||
183 | gboolean mmpoi_dontlaunch; | ||
184 | |||
185 | gboolean cachelist_disable_screensaver; | ||
186 | gboolean goto_disable_screensaver; | ||
187 | |||
188 | HildonProgram *program; | ||
189 | HildonWindow *window; | ||
190 | osso_context_t *osso_context; | ||
191 | harbaum | 126 | #else |
192 | GtkWidget *window; | ||
193 | #endif | ||
194 | harbaum | 1 | |
195 | harbaum | 129 | gboolean cachelist_update; |
196 | |||
197 | harbaum | 128 | #if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
198 | harbaum | 1 | /* reference to enable/disable these while walking the crumb trail */ |
199 | GtkWidget *menu_import, *menu_export; | ||
200 | GtkWidget *menu_search; | ||
201 | |||
202 | harbaum | 128 | GtkWidget *bct; |
203 | #endif | ||
204 | |||
205 | harbaum | 1 | /* keep track of current "path" in the bread crumb trail */ |
206 | gpx_t *cur_gpx; | ||
207 | cache_t *cur_cache; | ||
208 | |||
209 | harbaum | 126 | gpx_t *search_results; |
210 | |||
211 | harbaum | 48 | #ifdef ENABLE_OSM_GPS_MAP |
212 | struct { | ||
213 | harbaum | 56 | struct map_context_s *context; |
214 | harbaum | 89 | int source; |
215 | harbaum | 48 | int zoom; |
216 | pos_t pos; | ||
217 | } map; | ||
218 | #endif | ||
219 | |||
220 | harbaum | 1 | GtkWidget *vbox; |
221 | } appdata_t; | ||
222 | |||
223 | /* all includes that rely on appdata_t go here ... */ | ||
224 | #include "gps.h" | ||
225 | #include "goto.h" | ||
226 | #include "gconf.h" | ||
227 | #include "html.h" | ||
228 | #include "icons.h" | ||
229 | harbaum | 158 | #include "gcvote.h" |
230 | harbaum | 1 | #include "cache.h" |
231 | #include "geomath.h" | ||
232 | #include "geotext.h" | ||
233 | #include "notes.h" | ||
234 | #include "help.h" | ||
235 | #include "mm_poi.h" | ||
236 | #include "precpos.h" | ||
237 | #include "garmin_export.h" | ||
238 | harbaum | 193 | #include "geotoad.h" |
239 | harbaum | 1 | |
240 | harbaum | 32 | #ifdef ENABLE_OSM_GPS_MAP |
241 | #include "map-tool.h" | ||
242 | #endif | ||
243 | |||
244 | harbaum | 1 | #ifdef USE_MAEMO |
245 | #include "dbus.h" | ||
246 | #endif | ||
247 | |||
248 | #define SEARCH_ID (1<<0) | ||
249 | #define SEARCH_NAME (1<<1) | ||
250 | #define SEARCH_DESC (1<<2) | ||
251 | #define SEARCH_OWNER (1<<3) | ||
252 | #define SEARCH_FINDS (1<<4) | ||
253 | |||
254 | #ifdef USE_MAEMO | ||
255 | #define DIALOG_WIDTH 800 | ||
256 | #define DIALOG_HEIGHT 480 | ||
257 | #define GTK_FM_OK GTK_RESPONSE_OK | ||
258 | #else | ||
259 | #define DIALOG_WIDTH 560 | ||
260 | #define DIALOG_HEIGHT 340 | ||
261 | #define GTK_FM_OK GTK_RESPONSE_ACCEPT | ||
262 | #endif | ||
263 | |||
264 | #include "misc.h" | ||
265 | |||
266 | #define CHANGE_FLAG_POS (1<<0) | ||
267 | #define CHANGE_FLAG_MASK (1<<1) | ||
268 | |||
269 | extern void main_after_settings_redraw(appdata_t *appdata, int flags); | ||
270 | |||
271 | #include <stdarg.h> | ||
272 | extern void errorf(const char *fmt, ...); | ||
273 | extern gboolean on_window_key_press(GtkWidget *widget, | ||
274 | harbaum | 11 | GdkEventKey *event, appdata_t *appdata); |
275 | harbaum | 3 | #ifdef USE_STACKABLE_WINDOW |
276 | HildonAppMenu *menu_create(appdata_t *appdata, int mode); | ||
277 | #endif | ||
278 | harbaum | 142 | void cachelist_goto_cache(appdata_t *appdata, cache_t *cache); |
279 | void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx); | ||
280 | harbaum | 1 | |
281 | #endif // GPXVIEW_H |