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