Changeset 3320
- Timestamp:
- 11/01/07 17:21:18 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2/applications/openmoko-worldclock2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
src/worldclock-main.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/ChangeLog
r3313 r3320 1 2007-11-01 Chris Lord <chris@openedhand.com> 2 3 * src/worldclock-main.c: (map_button_press_event_cb), (main): 4 Use a static map and add code to find the nearest timezone to where the 5 user clicks 6 1 7 2007-10-31 Chris Lord <chris@openedhand.com> 2 8 -
trunk/src/target/OM-2007.2/applications/openmoko-worldclock2/src/worldclock-main.c
r3313 r3320 25 25 #include <time.h> 26 26 #include <sys/time.h> 27 #include <math.h> 27 28 #include "worldclock-data.h" 28 29 … … 269 270 WorldClockData *data) 270 271 { 271 gdouble lat, lon; 272 GList *markers, *m; 273 gdouble lat, lon, old_distance; 274 JanaGtkWorldMapMarker *marker; 272 275 273 276 jana_gtk_world_map_get_latlon (map, event->x, event->y, &lat, &lon); 274 g_message ("Map clicked at latitude, longitude: %lg, %lg", lat, lon); 277 markers = jana_gtk_world_map_get_markers (map); 278 279 marker = NULL; 280 old_distance = G_MAXDOUBLE; 281 for (m = markers; m; m = m->next) { 282 gdouble distance; 283 JanaGtkWorldMapMarker *marker2 = 284 (JanaGtkWorldMapMarker *)m->data; 285 286 distance = sqrt (pow (marker2->lat - lat, 2) + 287 pow (marker2->lon - lon, 2)); 288 if (distance < old_distance) { 289 marker = marker2; 290 old_distance = distance; 291 } 292 } 293 294 if (marker) { 295 WorldClockZoneData *tzdata = (WorldClockZoneData *) 296 g_object_get_data (G_OBJECT (marker), "zone"); 297 g_debug ("Nearest location: %s", tzdata->name); 298 } 299 300 g_list_free (markers); 275 301 276 302 return FALSE; … … 321 347 /* Create scrolling map */ 322 348 data.map = jana_gtk_world_map_new (); 349 jana_gtk_world_map_set_width (JANA_GTK_WORLD_MAP (data.map), 2048); 350 jana_gtk_world_map_set_height (JANA_GTK_WORLD_MAP (data.map), 1024); 351 jana_gtk_world_map_set_static (JANA_GTK_WORLD_MAP (data.map), TRUE); 323 352 add_marks (&data); 324 353 gtk_widget_add_events (GTK_WIDGET (data.map), GDK_BUTTON_PRESS_MASK);
Note: See TracChangeset
for help on using the changeset viewer.
