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