Contents of /trunk/src/gpxview.h

Parent Directory Parent Directory | Revision Log Revision Log


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