Contents of /trunk/src/gpxview.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 288 - (hide annotations)
Mon Jun 7 19:19:50 2010 UTC (13 years, 11 months ago) by harbaum
File MIME type: text/plain
File size: 8322 byte(s)
GPS focus enable, portrait support and some attribute icon work
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 harbaum 288 #define MAEMO5
71 harbaum 1 #define USE_PANNABLE_AREA
72     #include <hildon/hildon-pannable-area.h>
73 harbaum 17 /* panning a gtkhtml view currently doesn't work well */
74     #define PANNABLE_HTML
75 harbaum 1 #endif
76     #endif
77    
78     #include <gtk/gtk.h>
79     #include <gtkhtml/gtkhtml.h>
80    
81     /* list of current gpx files is being kept in gconf */
82     #include <gconf/gconf.h>
83     #include <gconf/gconf-client.h>
84    
85     #include <libgnomevfs/gnome-vfs.h>
86     #include <libgnomevfs/gnome-vfs-inet-connection.h>
87    
88     /* all include appdata_t relies on go here ... */
89     #include "gpx.h"
90     #include "settings.h"
91 harbaum 282 #include "gps.h"
92 harbaum 288 #include "portrait.h"
93 harbaum 1
94     #define GPXLIST_ITEM_VALID (1<<0)
95     #define GPXLIST_ITEM_DATE (1<<1)
96     #define GPXLIST_ITEM_CNUM (1<<2)
97     #define GPXLIST_ITEM_FILENAME (1<<3)
98     #define GPXLIST_ITEM_DEFAULT (GPXLIST_ITEM_VALID | GPXLIST_ITEM_CNUM)
99    
100     #define CACHELIST_ITEM_VALID (1<<0)
101     #define CACHELIST_ITEM_ID (1<<1)
102     #define CACHELIST_ITEM_SIZE (1<<2)
103     #define CACHELIST_ITEM_RATING (1<<3)
104     #define CACHELIST_ITEM_DEFAULT (CACHELIST_ITEM_VALID | CACHELIST_ITEM_ID)
105    
106     typedef struct {
107     pos_t home; /* current home geo position */
108     gboolean use_gps; /* use GPS if avbailable */
109     char *path; /* current path to select GPX from */
110    
111     location_t *location; /* extra home locations */
112     int active_location; /* index of active (extra) home location */
113    
114     gboolean imperial; /* display imperial units */
115    
116     char *image_path; /* path to cache images in */
117    
118     int search; /* "search in" items */
119     char *search_str;
120     int search_days;
121    
122 harbaum 158 struct proxy_s *proxy; /* proxy settings */
123    
124 harbaum 1 int gpxlist_items;
125     int cachelist_items;
126     gboolean cachelist_hide_found;
127    
128     /* geotext related */
129     char *geotext_text;
130     int geotext_shift;
131    
132     gpx_t *gpx;
133     GtkListStore *gpxstore;
134     GtkWidget *gpxview;
135     GConfClient *gconf_client;
136    
137     gboolean compass_locked;
138     int compass_damping;
139    
140 harbaum 167 gboolean disable_gcvote;
141    
142 harbaum 1 struct gps_state *gps_state;
143    
144     /* keep track of all html views so zoom events can be delivered */
145     struct html_view *html_view;
146    
147     #ifndef REQUIRES_CLOSE_BUTTON
148     /* this is being activated and de-activated on selection/deselection */
149     GtkWidget *menu_remove, *menu_close;
150     #endif
151    
152 harbaum 2 #ifndef NO_COPY_N_PASTE
153 harbaum 1 /* do enable/disable the edit entries */
154     GtkWidget *menu_cut, *menu_copy, *menu_paste;
155     GtkTextBuffer *active_buffer;
156 harbaum 2 #endif
157 harbaum 1
158 harbaum 133 GtkClipboard *clipboard; /* clipboard for copy/paste */
159    
160 harbaum 20 #ifdef USE_STACKABLE_WINDOW
161     GtkWidget *export_menu, *tools_menu;
162     #endif
163    
164 harbaum 1 /* save result here to be able to "goto" it */
165     pos_t geomath;
166    
167     int cur_items;
168     GtkWidget *cur_view;
169    
170     char *mmpoi_path; /* path to save poi to */
171     float mmpoi_radius;
172     gboolean mmpoi_use_radius;
173     gboolean mmpoi_dont_export_found;
174     gboolean mmpoi_dont_export_disabled;
175    
176     char *fieldnotes_path; /* path to save field notes to */
177    
178     char *garmin_path; /* path to save garmin data to */
179     gboolean garmin_ign_found;
180    
181     #ifdef USE_MAEMO
182     gboolean fullscreen;
183 harbaum 231 #ifdef ENABLE_MAEMO_MAPPER
184 harbaum 1 pos_t mmpos; /* position received from Maemo Mapper */
185     gboolean mmpos_valid;
186 harbaum 231 #endif
187 harbaum 1
188     gboolean mmpoi_dontlaunch;
189    
190     gboolean cachelist_disable_screensaver;
191     gboolean goto_disable_screensaver;
192    
193     HildonProgram *program;
194     HildonWindow *window;
195     osso_context_t *osso_context;
196 harbaum 126 #else
197     GtkWidget *window;
198     #endif
199 harbaum 1
200 harbaum 129 gboolean cachelist_update;
201    
202 harbaum 128 #if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
203 harbaum 1 /* reference to enable/disable these while walking the crumb trail */
204     GtkWidget *menu_import, *menu_export;
205     GtkWidget *menu_search;
206    
207 harbaum 128 GtkWidget *bct;
208     #endif
209    
210 harbaum 1 /* keep track of current "path" in the bread crumb trail */
211     gpx_t *cur_gpx;
212     cache_t *cur_cache;
213 harbaum 228 struct cache_context_s *cache_context;
214 harbaum 1
215 harbaum 126 gpx_t *search_results;
216    
217 harbaum 48 #ifdef ENABLE_OSM_GPS_MAP
218     struct {
219 harbaum 56 struct map_context_s *context;
220 harbaum 89 int source;
221 harbaum 48 int zoom;
222     pos_t pos;
223 harbaum 280 gboolean dpix;
224 harbaum 48 } map;
225     #endif
226    
227 harbaum 204 /* username is also used to detect own caches (by log entry) */
228     char *username;
229    
230 harbaum 196 /* stuff to call geotoad */
231     struct {
232 harbaum 204 char *password, *filename;
233 harbaum 196 float distance, lat, lon;
234     int flags;
235 harbaum 252 gboolean no_owned_found;
236 harbaum 196 } gt;
237    
238 harbaum 246 #ifdef ESPEAK
239     /* espeak handling */
240     struct {
241     gboolean enabled;
242     int sample_rate; // or init error
243     } espeak;
244     #endif
245    
246 harbaum 237 #ifndef USE_STACKABLE_WINDOW
247 harbaum 1 GtkWidget *vbox;
248 harbaum 237 #endif
249 harbaum 282
250     struct {
251     gps_mask_t set;
252     struct gps_t fix;
253     pos_t saved; /* saved last gps position */
254     } gps;
255    
256 harbaum 1 } appdata_t;
257    
258     /* all includes that rely on appdata_t go here ... */
259     #include "goto.h"
260     #include "gconf.h"
261     #include "html.h"
262     #include "icons.h"
263 harbaum 158 #include "gcvote.h"
264 harbaum 1 #include "cache.h"
265     #include "geomath.h"
266     #include "geotext.h"
267     #include "notes.h"
268     #include "help.h"
269     #include "mm_poi.h"
270     #include "precpos.h"
271     #include "garmin_export.h"
272 harbaum 193 #include "geotoad.h"
273 harbaum 228 #include "about.h"
274 harbaum 283 #include "astro.h"
275 harbaum 1
276 harbaum 32 #ifdef ENABLE_OSM_GPS_MAP
277     #include "map-tool.h"
278     #endif
279    
280 harbaum 1 #ifdef USE_MAEMO
281     #include "dbus.h"
282     #endif
283    
284     #define SEARCH_ID (1<<0)
285     #define SEARCH_NAME (1<<1)
286     #define SEARCH_DESC (1<<2)
287     #define SEARCH_OWNER (1<<3)
288     #define SEARCH_FINDS (1<<4)
289    
290     #ifdef USE_MAEMO
291     #define DIALOG_WIDTH 800
292     #define DIALOG_HEIGHT 480
293     #define GTK_FM_OK GTK_RESPONSE_OK
294     #else
295     #define DIALOG_WIDTH 560
296     #define DIALOG_HEIGHT 340
297     #define GTK_FM_OK GTK_RESPONSE_ACCEPT
298     #endif
299    
300     #include "misc.h"
301    
302     #define CHANGE_FLAG_POS (1<<0)
303     #define CHANGE_FLAG_MASK (1<<1)
304    
305     extern void main_after_settings_redraw(appdata_t *appdata, int flags);
306    
307     #include <stdarg.h>
308     extern void errorf(const char *fmt, ...);
309     extern gboolean on_window_key_press(GtkWidget *widget,
310 harbaum 11 GdkEventKey *event, appdata_t *appdata);
311 harbaum 3 #ifdef USE_STACKABLE_WINDOW
312     HildonAppMenu *menu_create(appdata_t *appdata, int mode);
313     #endif
314 harbaum 142 void cachelist_goto_cache(appdata_t *appdata, cache_t *cache);
315     void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx);
316 harbaum 211 gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx);
317     void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx);
318 harbaum 223 void gpxlist_add(appdata_t *appdata, gpx_t *new);
319 harbaum 228 void cachelist_redraw(appdata_t *appdata);
320 harbaum 1
321 harbaum 282 /* interface to main windows gps callback */
322     pos_t *gps_get_pos(appdata_t *appdata);
323     float gps_get_heading(appdata_t *appdata);
324     gint gps_get_satnum(appdata_t *appdata);
325     gps_sat_t *gps_get_sats(appdata_t *appdata);
326     float gps_get_eph(appdata_t *appdata);
327     void gps_change_state(appdata_t *appdata);
328    
329 harbaum 288 /* change GPS state via main focus handling */
330     gboolean on_main_focus_change(GtkWidget *, GdkEventFocus *, gpointer);
331    
332    
333 harbaum 1 #endif // GPXVIEW_H