Contents of /trunk/src/gpxview.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 246 - (show annotations)
Tue Jan 19 20:26:37 2010 UTC (14 years, 3 months ago) by harbaum
File MIME type: text/plain
File size: 7717 byte(s)
Initial Espeak support
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 gboolean cachelist_hide_found;
124
125 /* geotext related */
126 char *geotext_text;
127 int geotext_shift;
128
129 gpx_t *gpx;
130 GtkListStore *gpxstore;
131 GtkWidget *gpxview;
132 GConfClient *gconf_client;
133
134 gboolean compass_locked;
135 int compass_damping;
136
137 gboolean disable_gcvote;
138
139 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 #ifndef NO_COPY_N_PASTE
150 /* do enable/disable the edit entries */
151 GtkWidget *menu_cut, *menu_copy, *menu_paste;
152 GtkTextBuffer *active_buffer;
153 #endif
154
155 GtkClipboard *clipboard; /* clipboard for copy/paste */
156
157 #ifdef USE_STACKABLE_WINDOW
158 GtkWidget *export_menu, *tools_menu;
159 #endif
160
161 /* 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 #ifdef ENABLE_MAEMO_MAPPER
181 pos_t mmpos; /* position received from Maemo Mapper */
182 gboolean mmpos_valid;
183 #endif
184
185 gboolean mmpoi_dontlaunch;
186
187 gboolean cachelist_disable_screensaver;
188 gboolean goto_disable_screensaver;
189
190 HildonProgram *program;
191 HildonWindow *window;
192 osso_context_t *osso_context;
193 #else
194 GtkWidget *window;
195 #endif
196
197 gboolean cachelist_update;
198
199 #if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
200 /* reference to enable/disable these while walking the crumb trail */
201 GtkWidget *menu_import, *menu_export;
202 GtkWidget *menu_search;
203
204 GtkWidget *bct;
205 #endif
206
207 /* keep track of current "path" in the bread crumb trail */
208 gpx_t *cur_gpx;
209 cache_t *cur_cache;
210 struct cache_context_s *cache_context;
211
212 gpx_t *search_results;
213
214 #ifdef ENABLE_OSM_GPS_MAP
215 struct {
216 struct map_context_s *context;
217 int source;
218 int zoom;
219 pos_t pos;
220 } map;
221 #endif
222
223 /* username is also used to detect own caches (by log entry) */
224 char *username;
225
226 /* stuff to call geotoad */
227 struct {
228 char *password, *filename;
229 float distance, lat, lon;
230 int flags;
231 } gt;
232
233 #ifdef ESPEAK
234 /* espeak handling */
235 struct {
236 gboolean enabled;
237 int sample_rate; // or init error
238 } espeak;
239 #endif
240
241 #ifndef USE_STACKABLE_WINDOW
242 GtkWidget *vbox;
243 #endif
244 } appdata_t;
245
246 /* all includes that rely on appdata_t go here ... */
247 #include "gps.h"
248 #include "goto.h"
249 #include "gconf.h"
250 #include "html.h"
251 #include "icons.h"
252 #include "gcvote.h"
253 #include "cache.h"
254 #include "geomath.h"
255 #include "geotext.h"
256 #include "notes.h"
257 #include "help.h"
258 #include "mm_poi.h"
259 #include "precpos.h"
260 #include "garmin_export.h"
261 #include "geotoad.h"
262 #include "about.h"
263
264 #ifdef ENABLE_OSM_GPS_MAP
265 #include "map-tool.h"
266 #endif
267
268 #ifdef USE_MAEMO
269 #include "dbus.h"
270 #endif
271
272 #define SEARCH_ID (1<<0)
273 #define SEARCH_NAME (1<<1)
274 #define SEARCH_DESC (1<<2)
275 #define SEARCH_OWNER (1<<3)
276 #define SEARCH_FINDS (1<<4)
277
278 #ifdef USE_MAEMO
279 #define DIALOG_WIDTH 800
280 #define DIALOG_HEIGHT 480
281 #define GTK_FM_OK GTK_RESPONSE_OK
282 #else
283 #define DIALOG_WIDTH 560
284 #define DIALOG_HEIGHT 340
285 #define GTK_FM_OK GTK_RESPONSE_ACCEPT
286 #endif
287
288 #include "misc.h"
289
290 #define CHANGE_FLAG_POS (1<<0)
291 #define CHANGE_FLAG_MASK (1<<1)
292
293 extern void main_after_settings_redraw(appdata_t *appdata, int flags);
294
295 #include <stdarg.h>
296 extern void errorf(const char *fmt, ...);
297 extern gboolean on_window_key_press(GtkWidget *widget,
298 GdkEventKey *event, appdata_t *appdata);
299 #ifdef USE_STACKABLE_WINDOW
300 HildonAppMenu *menu_create(appdata_t *appdata, int mode);
301 #endif
302 void cachelist_goto_cache(appdata_t *appdata, cache_t *cache);
303 void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx);
304 gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx);
305 void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx);
306 void gpxlist_add(appdata_t *appdata, gpx_t *new);
307 void cachelist_redraw(appdata_t *appdata);
308
309 #endif // GPXVIEW_H