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