Contents of /trunk/src/gpxview.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 282 - (hide annotations)
Wed May 26 19:21:47 2010 UTC (14 years ago) by harbaum
File MIME type: text/plain
File size: 8146 byte(s)
New gps integration
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 harbaum 282 #include "gps.h"
91 harbaum 1
92     #define GPXLIST_ITEM_VALID (1<<0)
93     #define GPXLIST_ITEM_DATE (1<<1)
94     #define GPXLIST_ITEM_CNUM (1<<2)
95     #define GPXLIST_ITEM_FILENAME (1<<3)
96     #define GPXLIST_ITEM_DEFAULT (GPXLIST_ITEM_VALID | GPXLIST_ITEM_CNUM)
97    
98     #define CACHELIST_ITEM_VALID (1<<0)
99     #define CACHELIST_ITEM_ID (1<<1)
100     #define CACHELIST_ITEM_SIZE (1<<2)
101     #define CACHELIST_ITEM_RATING (1<<3)
102     #define CACHELIST_ITEM_DEFAULT (CACHELIST_ITEM_VALID | CACHELIST_ITEM_ID)
103    
104     typedef struct {
105     pos_t home; /* current home geo position */
106     gboolean use_gps; /* use GPS if avbailable */
107     char *path; /* current path to select GPX from */
108    
109     location_t *location; /* extra home locations */
110     int active_location; /* index of active (extra) home location */
111    
112     gboolean imperial; /* display imperial units */
113    
114     char *image_path; /* path to cache images in */
115    
116     int search; /* "search in" items */
117     char *search_str;
118     int search_days;
119    
120 harbaum 158 struct proxy_s *proxy; /* proxy settings */
121    
122 harbaum 1 int gpxlist_items;
123     int cachelist_items;
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 harbaum 167 gboolean disable_gcvote;
139    
140 harbaum 1 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 harbaum 2 #ifndef NO_COPY_N_PASTE
151 harbaum 1 /* do enable/disable the edit entries */
152     GtkWidget *menu_cut, *menu_copy, *menu_paste;
153     GtkTextBuffer *active_buffer;
154 harbaum 2 #endif
155 harbaum 1
156 harbaum 133 GtkClipboard *clipboard; /* clipboard for copy/paste */
157    
158 harbaum 20 #ifdef USE_STACKABLE_WINDOW
159     GtkWidget *export_menu, *tools_menu;
160     #endif
161    
162 harbaum 1 /* 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 harbaum 231 #ifdef ENABLE_MAEMO_MAPPER
182 harbaum 1 pos_t mmpos; /* position received from Maemo Mapper */
183     gboolean mmpos_valid;
184 harbaum 231 #endif
185 harbaum 1
186     gboolean mmpoi_dontlaunch;
187    
188     gboolean cachelist_disable_screensaver;
189     gboolean goto_disable_screensaver;
190    
191     HildonProgram *program;
192     HildonWindow *window;
193     osso_context_t *osso_context;
194 harbaum 126 #else
195     GtkWidget *window;
196     #endif
197 harbaum 1
198 harbaum 129 gboolean cachelist_update;
199    
200 harbaum 128 #if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
201 harbaum 1 /* reference to enable/disable these while walking the crumb trail */
202     GtkWidget *menu_import, *menu_export;
203     GtkWidget *menu_search;
204    
205 harbaum 128 GtkWidget *bct;
206     #endif
207    
208 harbaum 1 /* keep track of current "path" in the bread crumb trail */
209     gpx_t *cur_gpx;
210     cache_t *cur_cache;
211 harbaum 228 struct cache_context_s *cache_context;
212 harbaum 1
213 harbaum 126 gpx_t *search_results;
214    
215 harbaum 48 #ifdef ENABLE_OSM_GPS_MAP
216     struct {
217 harbaum 56 struct map_context_s *context;
218 harbaum 89 int source;
219 harbaum 48 int zoom;
220     pos_t pos;
221 harbaum 280 gboolean dpix;
222 harbaum 48 } map;
223     #endif
224    
225 harbaum 204 /* username is also used to detect own caches (by log entry) */
226     char *username;
227    
228 harbaum 196 /* stuff to call geotoad */
229     struct {
230 harbaum 204 char *password, *filename;
231 harbaum 196 float distance, lat, lon;
232     int flags;
233 harbaum 252 gboolean no_owned_found;
234 harbaum 196 } gt;
235    
236 harbaum 246 #ifdef ESPEAK
237     /* espeak handling */
238     struct {
239     gboolean enabled;
240     int sample_rate; // or init error
241     } espeak;
242     #endif
243    
244 harbaum 237 #ifndef USE_STACKABLE_WINDOW
245 harbaum 1 GtkWidget *vbox;
246 harbaum 237 #endif
247 harbaum 282
248     struct {
249     gps_mask_t set;
250     struct gps_t fix;
251     pos_t saved; /* saved last gps position */
252     } gps;
253    
254 harbaum 1 } appdata_t;
255    
256     /* all includes that rely on appdata_t go here ... */
257     #include "goto.h"
258     #include "gconf.h"
259     #include "html.h"
260     #include "icons.h"
261 harbaum 158 #include "gcvote.h"
262 harbaum 1 #include "cache.h"
263     #include "geomath.h"
264     #include "geotext.h"
265     #include "notes.h"
266     #include "help.h"
267     #include "mm_poi.h"
268     #include "precpos.h"
269     #include "garmin_export.h"
270 harbaum 193 #include "geotoad.h"
271 harbaum 228 #include "about.h"
272 harbaum 1
273 harbaum 32 #ifdef ENABLE_OSM_GPS_MAP
274     #include "map-tool.h"
275     #endif
276    
277 harbaum 1 #ifdef USE_MAEMO
278     #include "dbus.h"
279     #endif
280    
281     #define SEARCH_ID (1<<0)
282     #define SEARCH_NAME (1<<1)
283     #define SEARCH_DESC (1<<2)
284     #define SEARCH_OWNER (1<<3)
285     #define SEARCH_FINDS (1<<4)
286    
287     #ifdef USE_MAEMO
288     #define DIALOG_WIDTH 800
289     #define DIALOG_HEIGHT 480
290     #define GTK_FM_OK GTK_RESPONSE_OK
291     #else
292     #define DIALOG_WIDTH 560
293     #define DIALOG_HEIGHT 340
294     #define GTK_FM_OK GTK_RESPONSE_ACCEPT
295     #endif
296    
297     #include "misc.h"
298    
299     #define CHANGE_FLAG_POS (1<<0)
300     #define CHANGE_FLAG_MASK (1<<1)
301    
302     extern void main_after_settings_redraw(appdata_t *appdata, int flags);
303    
304     #include <stdarg.h>
305     extern void errorf(const char *fmt, ...);
306     extern gboolean on_window_key_press(GtkWidget *widget,
307 harbaum 11 GdkEventKey *event, appdata_t *appdata);
308 harbaum 3 #ifdef USE_STACKABLE_WINDOW
309     HildonAppMenu *menu_create(appdata_t *appdata, int mode);
310     #endif
311 harbaum 142 void cachelist_goto_cache(appdata_t *appdata, cache_t *cache);
312     void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx);
313 harbaum 211 gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx);
314     void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx);
315 harbaum 223 void gpxlist_add(appdata_t *appdata, gpx_t *new);
316 harbaum 228 void cachelist_redraw(appdata_t *appdata);
317 harbaum 1
318 harbaum 282 /* interface to main windows gps callback */
319     pos_t *gps_get_pos(appdata_t *appdata);
320     float gps_get_heading(appdata_t *appdata);
321     gint gps_get_satnum(appdata_t *appdata);
322     gps_sat_t *gps_get_sats(appdata_t *appdata);
323     float gps_get_eph(appdata_t *appdata);
324     void gps_change_state(appdata_t *appdata);
325    
326 harbaum 1 #endif // GPXVIEW_H