Contents of /trunk/src/gpxview.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 204 - (hide annotations)
Mon Nov 23 18:32:06 2009 UTC (14 years, 5 months ago) by harbaum
File MIME type: text/plain
File size: 7290 byte(s)
Map jump function
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     #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 harbaum 17 /* panning a gtkhtml view currently doesn't work well */
71     #define PANNABLE_HTML
72 harbaum 1 #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 harbaum 158 struct proxy_s *proxy; /* proxy settings */
120    
121 harbaum 1 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     pos_t manual_goto;
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     pos_t mmpos; /* position received from Maemo Mapper */
183     gboolean mmpos_valid;
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 harbaum 126 #else
194     GtkWidget *window;
195     #endif
196 harbaum 1
197 harbaum 129 gboolean cachelist_update;
198    
199 harbaum 128 #if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
200 harbaum 1 /* reference to enable/disable these while walking the crumb trail */
201     GtkWidget *menu_import, *menu_export;
202     GtkWidget *menu_search;
203    
204 harbaum 128 GtkWidget *bct;
205     #endif
206    
207 harbaum 1 /* keep track of current "path" in the bread crumb trail */
208     gpx_t *cur_gpx;
209     cache_t *cur_cache;
210    
211 harbaum 126 gpx_t *search_results;
212    
213 harbaum 48 #ifdef ENABLE_OSM_GPS_MAP
214     struct {
215 harbaum 56 struct map_context_s *context;
216 harbaum 89 int source;
217 harbaum 48 int zoom;
218     pos_t pos;
219     } map;
220     #endif
221    
222 harbaum 204 /* username is also used to detect own caches (by log entry) */
223     char *username;
224    
225 harbaum 196 /* stuff to call geotoad */
226     struct {
227 harbaum 204 char *password, *filename;
228 harbaum 196 float distance, lat, lon;
229     int flags;
230     } gt;
231    
232 harbaum 1 GtkWidget *vbox;
233     } appdata_t;
234    
235     /* all includes that rely on appdata_t go here ... */
236     #include "gps.h"
237     #include "goto.h"
238     #include "gconf.h"
239     #include "html.h"
240     #include "icons.h"
241 harbaum 158 #include "gcvote.h"
242 harbaum 1 #include "cache.h"
243     #include "geomath.h"
244     #include "geotext.h"
245     #include "notes.h"
246     #include "help.h"
247     #include "mm_poi.h"
248     #include "precpos.h"
249     #include "garmin_export.h"
250 harbaum 193 #include "geotoad.h"
251 harbaum 1
252 harbaum 32 #ifdef ENABLE_OSM_GPS_MAP
253     #include "map-tool.h"
254     #endif
255    
256 harbaum 1 #ifdef USE_MAEMO
257     #include "dbus.h"
258     #endif
259    
260     #define SEARCH_ID (1<<0)
261     #define SEARCH_NAME (1<<1)
262     #define SEARCH_DESC (1<<2)
263     #define SEARCH_OWNER (1<<3)
264     #define SEARCH_FINDS (1<<4)
265    
266     #ifdef USE_MAEMO
267     #define DIALOG_WIDTH 800
268     #define DIALOG_HEIGHT 480
269     #define GTK_FM_OK GTK_RESPONSE_OK
270     #else
271     #define DIALOG_WIDTH 560
272     #define DIALOG_HEIGHT 340
273     #define GTK_FM_OK GTK_RESPONSE_ACCEPT
274     #endif
275    
276     #include "misc.h"
277    
278     #define CHANGE_FLAG_POS (1<<0)
279     #define CHANGE_FLAG_MASK (1<<1)
280    
281     extern void main_after_settings_redraw(appdata_t *appdata, int flags);
282    
283     #include <stdarg.h>
284     extern void errorf(const char *fmt, ...);
285     extern gboolean on_window_key_press(GtkWidget *widget,
286 harbaum 11 GdkEventKey *event, appdata_t *appdata);
287 harbaum 3 #ifdef USE_STACKABLE_WINDOW
288     HildonAppMenu *menu_create(appdata_t *appdata, int mode);
289     #endif
290 harbaum 142 void cachelist_goto_cache(appdata_t *appdata, cache_t *cache);
291     void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx);
292 harbaum 1
293     #endif // GPXVIEW_H