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