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