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