You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Danny B. <dan...@us...> - 2010-09-19 07:55:35
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10872 Modified Files: buildmap_osm_text.c Log Message: Two changes : - an additional call so areas are converted now (the polygon wasn't properly built) - (see the list) a fix that prevents ways with unrecognized tags from screwing up the internals of buildmap_osm Index: buildmap_osm_text.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_osm_text.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** buildmap_osm_text.c 16 Sep 2010 21:13:47 -0000 1.17 --- buildmap_osm_text.c 19 Sep 2010 07:55:27 -0000 1.18 *************** *** 704,708 **** buildmap_fatal(0, "Wasn't in a way (%s)", data); ! if (WayLandUseNotInteresting) { #if 0 buildmap_info("discarding way %d, landuse %s", in_way, data); --- 704,708 ---- buildmap_fatal(0, "Wasn't in a way (%s)", data); ! if (WayLandUseNotInteresting || WayLayer == 0) { #if 0 buildmap_info("discarding way %d, landuse %s", in_way, data); *************** *** 726,737 **** tolat = buildmap_point_get_latitude(to_point); - if (WayLayer == 0) { - buildmap_info ("Way %d (%s) layer 0 is invalid", - in_way, - WayStreetName ? WayStreetName : - WayStreetRef ? WayStreetRef : ""); - WayLayer = TRAIL; - } - if ((WayFlags & AREA) && (fromlon == tolon) && (fromlat == tolat)) { static int polyid = 0; --- 726,729 ---- *************** *** 760,763 **** --- 752,756 ---- (LineId, WayLayer, prevpoint, point, ROADMAP_LINE_DIRECTION_BOTH); + buildmap_polygon_add_line (cenid, polyid, LineId, POLYGON_SIDE_RIGHT); } } else { |
From: Danny B. <dan...@us...> - 2010-09-16 21:13:55
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv31057 Modified Files: buildmap_osm_text.c Log Message: Once a way was flagged as Invalid, this never got reset so all ways in the file were discarded. This fixes an issue with OSM XML files processed by splitter.jar . Index: buildmap_osm_text.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_osm_text.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** buildmap_osm_text.c 19 Apr 2009 16:53:35 -0000 1.16 --- buildmap_osm_text.c 16 Sep 2010 21:13:47 -0000 1.17 *************** *** 696,701 **** int was_split = 0; ! if (WayInvalid) return 0; if (in_way == 0) --- 696,703 ---- int was_split = 0; ! if (WayInvalid) { ! buildmap_osm_text_reset_way(); return 0; + } if (in_way == 0) |
From: Paul F. <pg...@us...> - 2010-09-09 14:03:48
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23167 Modified Files: roadmap_trip.c Log Message: remove further residue from navigation merge, to make route directions work again. Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** roadmap_trip.c 11 Jul 2010 16:46:16 -0000 1.110 --- roadmap_trip.c 9 Sep 2010 14:03:40 -0000 1.111 *************** *** 2380,2389 **** roadmap_math_trip_set_distance ('W', distance_to_next); - #if 1 - /* Hack */ - roadmap_message_set ('D', "?? %s", roadmap_math_trip_unit()); - roadmap_message_set ('X', "??"); - roadmap_message_set ('Y', "?? %s", roadmap_math_trip_unit()); - #endif } --- 2380,2383 ---- |
From: Danny B. <dan...@us...> - 2010-09-05 20:54:04
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv14725 Modified Files: buildmap_osm_main.c buildmap_osm_binary.c Log Message: Respond to "bandwidth limit exceeded" with a bit more sense. Index: buildmap_osm_binary.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_osm_binary.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** buildmap_osm_binary.c 29 Mar 2009 11:51:49 -0000 1.11 --- buildmap_osm_binary.c 5 Sep 2010 20:53:56 -0000 1.12 *************** *** 494,499 **** /** ! * @brief ! * @param data * @return */ --- 494,505 ---- /** ! * @brief interpret the data read and collect error information ! * ! * known cases : ! * return -2 on error 5 (The tile is too big, or contains too much data) ! * convert HTTP error code in return value (negative) ! * return -1 otherwise ! * ! * @param data string received * @return */ *************** *** 506,509 **** --- 512,523 ---- if (error == 5) return -2; + + /* + * Interpret the HTTP error code, if present + */ + if (slen > 14 && strncasecmp(data+5, "http", 4) == 0) { + error = atoi(data + 14); + return -error; + } return -1; } Index: buildmap_osm_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/buildmap_osm_main.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** buildmap_osm_main.c 7 Jul 2009 01:51:43 -0000 1.18 --- buildmap_osm_main.c 5 Sep 2010 20:53:56 -0000 1.19 *************** *** 226,231 **** } return ret; - } --- 226,253 ---- } + /* + * When the OSM server is congested, it returns + * HTTP/1.1 509 Bandwidth Limit Exceeded + * + * Don't fail on this, but retry after a while. + */ + int cnt = 0; + while (ret == -509 && cnt++ < 100) { + sleep(30); + fdata = popen(urlcmd, "r"); + if (fdata == NULL) { + buildmap_fatal(0, "couldn't open \"%s\"", urlcmd); + } + + buildmap_osm_common_find_layers(); + + ret = buildmap_osm_binary_read(fdata); + + if (pclose(fdata) != 0) { + buildmap_error(0, "problem fetching data (pclose: %s), continuing", strerror(errno)); + // ret = -1; + } + } return ret; } |
From: Danny B. <dan...@us...> - 2010-09-04 12:15:16
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv13677 Modified Files: roadmap_label.c Log Message: Add description of this module, that Paul sent on the list. Index: roadmap_label.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_label.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** roadmap_label.c 7 Oct 2008 14:48:26 -0000 1.33 --- roadmap_label.c 4 Sep 2010 12:15:08 -0000 1.34 *************** *** 1,8 **** ! /* roadmap_label.c - Manage map labels. ! * * LICENSE: * * Copyright 2006 Ehud Shabtai ! * Label cache 2006, Paul Fox * * This code was mostly taken from UMN Mapserver --- 1,7 ---- ! /* * LICENSE: * * Copyright 2006 Ehud Shabtai ! * Label cache 2006, 2010, Paul Fox * * This code was mostly taken from UMN Mapserver *************** *** 23,28 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ! * TODO: * - As the cache holds labels which are not drawn, we need a way to clean * the cache by throwing out old entries. The age mechanism will keep --- 22,51 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + /** + * @file + * @brief roadmap_label.c - Manage map labels. * ! * Quick overview (Paul gave a great answer to a vague question) : ! * ! * For every visible county, and for every street on the screen, ! * it tries to find a segment that's long enough to "hold" the street's name, ! * so that it can be printed parallel to the street. ! * (I don't recall how that selection is affected if we're printing non-angled ! * labels.) ! * Labels also can't overlap other labels, so their bounding box has to be ! * taken account of. ! * Every street is only labeled once per county per screen. ! * This should arguably be "once per screen" -- currently if you have two counties ! * visible (or, more likely, because they're smaller, two quadtiles) ! * you'll get a street label in each county. ! * Partly because the placement calculation is expensive, but mostly because ! * you want labels to stay put as the screen is redrawn, we keep a cache of ! * placement information. (i.e., without the cache, the algorithm may completely ! * shuffle labels when a new area of map comes in view, since it changes ! * where some labels might be placed, which in turn affects others.) ! * ! * TODO (old?) : * - As the cache holds labels which are not drawn, we need a way to clean * the cache by throwing out old entries. The age mechanism will keep *************** *** 40,47 **** * list onto the "spares" list rather than onto the cache, to free * up cache entries. - * - * SYNOPSYS: - * - * See roadmap_label.h. */ --- 63,66 ---- |
From: Danny B. <dan...@us...> - 2010-08-29 12:30:20
|
Update of /cvsroot/roadmap/roadmap/src/android In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv17289 Modified Files: roadmap_canvas.c roadmap_dialog.c Log Message: Work in progress : this is a big chunk of the dialog implementation for Android. Index: roadmap_canvas.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/roadmap_canvas.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_canvas.c 14 Aug 2010 06:22:54 -0000 1.1 --- roadmap_canvas.c 29 Aug 2010 12:30:11 -0000 1.2 *************** *** 201,206 **** *can_tilt = 0; // copied from Win32 implementation ! __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "text(%s) wid %d asc %d desc %d", ! text, *width, *ascent, *descent); return; } --- 201,205 ---- *can_tilt = 0; // copied from Win32 implementation ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "text get extents(%s) wid %d asc %d desc %d", text, *width, *ascent, *descent); return; } *************** *** 339,343 **** jmethodID mid = TheMethod(cls, "DrawString", "(IIIILjava/lang/String;)V"); ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "draw_string(%s)", text); js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, text); --- 338,342 ---- jmethodID mid = TheMethod(cls, "DrawString", "(IIIILjava/lang/String;)V"); ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "draw_string(%s) x %d y %d corner %d", text, position->x, position->y, corner); js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, text); *************** *** 354,357 **** --- 353,358 ---- jmethodID mid = TheMethod(cls, "DrawStringAngle", "(IIIILjava/lang/String;)V"); + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "draw_string_angle(%s) x %d y %d", text, position->x, position->y); + js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, text); (*RoadMapJniEnv)->CallVoidMethod(RoadMapJniEnv, PanelThiz, mid, *************** *** 390,394 **** * Not doing this buffering gets the JNI into trouble. */ ! #define RM_MAXLINES 40 /** --- 391,395 ---- * Not doing this buffering gets the JNI into trouble. */ ! #define RM_MAXLINES 4000 /** Index: roadmap_dialog.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/roadmap_dialog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_dialog.c 14 Aug 2010 06:22:54 -0000 1.1 --- roadmap_dialog.c 29 Aug 2010 12:30:11 -0000 1.2 *************** *** 31,45 **** #include <stdlib.h> - // #include <gtk/gtk.h> - - #ifdef ROADMAP_USES_GPE - #include <libdisplaymigration/displaymigration.h> - #endif - #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_start.h" ! // #include "roadmap_gtkmain.h" ! // #include "roadmap_keyboard.h" #define __ROADMAP_DIALOG_NO_LANG --- 31,38 ---- #include <stdlib.h> #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_start.h" ! #include "roadmap_jni.h" #define __ROADMAP_DIALOG_NO_LANG *************** *** 92,96 **** int widget_type; ! // GtkWidget *w; short rank; --- 85,89 ---- int widget_type; ! int w; short rank; *************** *** 107,114 **** static RoadMapDialogItem RoadMapDialogCurrent = NULL; static RoadMapDialogItem roadmap_dialog_get (RoadMapDialogItem parent, const char *name) { ! #if 0 RoadMapDialogItem child; --- 100,145 ---- static RoadMapDialogItem RoadMapDialogCurrent = NULL; + /* + * JNI + */ + #define MYCLS2 "net/sourceforge/projects/roadmap/RoadMap" + static jclass myRmClassCache = (jclass) 0; + + static jclass TheRoadMapClass() + { + if (myRmClassCache == 0) { + myRmClassCache = (*RoadMapJniEnv)->FindClass(RoadMapJniEnv, MYCLS2); + myRmClassCache = (*RoadMapJniEnv)->NewGlobalRef(RoadMapJniEnv, myRmClassCache); + } + if (myRmClassCache == 0) { + __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "Class not found"); + // throw + (*RoadMapJniEnv)->ThrowNew(RoadMapJniEnv, + (*RoadMapJniEnv)->FindClass(RoadMapJniEnv, "java/io/IOException"), + "A JNI Exception occurred"); + } + + return myRmClassCache; + } + static jmethodID TheMethod(const jclass cls, const char *name, const char *signature) + { + jmethodID mid; + + mid = (*RoadMapJniEnv)->GetMethodID(RoadMapJniEnv, cls, name, signature); + if (mid == 0) { + (*RoadMapJniEnv)->ThrowNew(RoadMapJniEnv, + (*RoadMapJniEnv)->FindClass(RoadMapJniEnv, "java/io/IOException"), + "A JNI Exception occurred"); + } + return mid; + } + + /* + * roadmap_dialog.c + */ static RoadMapDialogItem roadmap_dialog_get (RoadMapDialogItem parent, const char *name) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_get(%s)", name); RoadMapDialogItem child; *************** *** 166,170 **** return child; - #endif } --- 197,200 ---- *************** *** 178,352 **** } ! #if 0 ! static gint roadmap_dialog_action (GtkWidget *w, gpointer data) { ! ! RoadMapDialogItem item = (RoadMapDialogItem)data; ! RoadMapDialogCallback callback = item->callback; ! ! if (callback != NULL) { ! ! while (item->parent != NULL) { ! item = item->parent; ! } ! RoadMapDialogCurrent = item; ! ! (*callback) (item->name, item->context); ! } ! ! return FALSE; ! } ! #endif ! ! #if 0 ! static gint roadmap_dialog_destroyed (GtkWidget *w, gpointer data) { ! ! RoadMapDialogItem item = (RoadMapDialogItem)data; ! RoadMapDialogItem child; ! ! /* Forget about the whole Gtk dialog: it is being destroyed. */ ! ! for (child = item->children; child != NULL; child = child->next) { ! roadmap_dialog_destroyed (w, child); ! } ! item->w = NULL; ! ! return TRUE; ! } ! ! static gint roadmap_dialog_selected ! (GtkWidget *w, GdkEventButton *event, gpointer data) { ! ! roadmap_keyboard_set_focus ((RoadMapKeyboard) data, w); ! ! return FALSE; ! } ! ! ! static gint roadmap_dialog_chosen (gpointer data, GtkMenuItem *w) { ! ! RoadMapDialogSelection *selection = (RoadMapDialogSelection *)data; ! ! if (selection != NULL) { ! ! selection->item->value = selection->value; ! ! if (selection->callback != NULL) { ! ! RoadMapDialogItem item = selection->item; ! ! while (item->parent != NULL) { ! item = item->parent; ! } ! RoadMapDialogCurrent = item; ! ! (*selection->callback) (item->name, item->context); ! } ! } ! ! return FALSE; ! } ! ! ! static gboolean roadmap_dialog_list_selected ! (GtkTreeSelection *selection, ! GtkTreeModel *model, ! GtkTreePath *path, ! gboolean path_currently_selected, ! gpointer data) { ! ! RoadMapDialogSelection *choice = (RoadMapDialogSelection *) data; ! ! if (! path_currently_selected) { ! ! int i = *gtk_tree_path_get_indices(path); ! ! if (choice != NULL && i >= 0) { ! ! roadmap_dialog_chosen (choice + i, NULL); ! } ! } ! ! return TRUE; ! } ! ! static RoadMapDialogItem roadmap_dialog_new_item (const char *frame, ! const char *name, ! GtkWidget *w, ! int expand) { RoadMapDialogItem parent; RoadMapDialogItem child; parent = roadmap_dialog_get (RoadMapDialogCurrent, frame); child = roadmap_dialog_get (parent, name); ! ! if (w == NULL) { ! child->w = w; ! return child; ! } if (parent->w == NULL) { ! /* This is a new frame: create the Gtk table for it. */ ! parent->w = gtk_table_new (1, 2, FALSE); ! ! gtk_table_set_row_spacings (GTK_TABLE(parent->w), 2); ! ! } else { ! ! /* This is an existing frame: increase the size of the frame. */ ! gtk_table_resize (GTK_TABLE(parent->w), parent->count, 2); ! } ! ! if (expand) { ! expand = GTK_EXPAND+GTK_FILL+GTK_SHRINK; } if (name[0] != '.') { ! GtkWidget *label; ! int length = strlen(name); ! char *title = malloc (length + 6); ! ! if (title != NULL) { ! ! title[0] = ' '; ! strcpy (title+1, name); ! if (name[length-1] != ':') { ! title[++length] = ':'; ! } ! title[++length] = ' '; ! title[++length] = 0; ! ! label = gtk_label_new (title); ! free(title); ! ! } else { ! ! label = gtk_label_new (name); ! } ! ! gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5); ! ! gtk_table_attach (GTK_TABLE(parent->w), ! label, 0, 1, child->rank, child->rank+1, ! GTK_FILL, GTK_FILL, 2, 2); ! ! gtk_table_attach (GTK_TABLE(parent->w), ! w, 1, 2, child->rank, child->rank+1, ! GTK_EXPAND+GTK_FILL+GTK_SHRINK, ! expand, 2, 2); } else { ! ! gtk_table_attach (GTK_TABLE(parent->w), ! w, 0, 2, child->rank, child->rank+1, ! GTK_EXPAND+GTK_FILL+GTK_SHRINK, ! expand, 2, 2); } - child->w = w; - return child; } - #endif /** --- 208,251 ---- } ! static RoadMapDialogItem roadmap_dialog_new_item (const char *frame, const char *name) { RoadMapDialogItem parent; RoadMapDialogItem child; + // __android_log_print (ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_item(%s,%s)", frame, name); + parent = roadmap_dialog_get (RoadMapDialogCurrent, frame); child = roadmap_dialog_get (parent, name); ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_item -> parent->w %d", parent->w); ! // if (child) __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_item -> child->w %d", child->w); if (parent->w == NULL) { + /* + * New sub-dialog : create a separate Android dialog + */ + jclass cls = TheRoadMapClass(); + jmethodID mid = TheMethod(cls, "CreateDialog", "(Ljava/lang/String;I)I"); + jstring js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, frame); ! parent->w = (*RoadMapJniEnv)->CallIntMethod(RoadMapJniEnv, RoadMapThiz, mid, js, ! parent->parent->w); ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "CreateDialog -> parent->w %d", parent->w); } + /* + * Create a widget to show the name of this object. + * A separate widget will be the data entry field (e.g. created by roadmap_dialog_new_entry). + */ if (name[0] != '.') { + jclass cls = TheRoadMapClass(); + jmethodID mid = TheMethod(cls, "DialogAddButton", "(ILjava/lang/String;)I"); + jstring js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, name); ! child->w = (*RoadMapJniEnv)->CallIntMethod(RoadMapJniEnv, RoadMapThiz, mid, parent->w, js); } else { ! /* ?? FIX ME Not sure what to do with this */ } return child; } /** *************** *** 362,398 **** * @return returns 1 if this is a new, undefined, dialog; 0 otherwise. */ ! int roadmap_dialog_activate (const char *name, void *context) { ! #if 0 ! RoadMapDialogItem dialog = roadmap_dialog_get (NULL, name); ! dialog->context = context; ! if (dialog->w != NULL) { ! /* The dialog exists already: show it on top. */ ! RoadMapDialogCurrent = dialog; ! gdk_window_show (dialog->w->window); ! gdk_window_raise (dialog->w->window); ! gtk_widget_show_all (GTK_WIDGET(dialog->w)); ! return 0; /* Tell the caller the dialog already exists. */ ! } ! /* Create the dialog's window. */ ! dialog->w = gtk_dialog_new(); ! #ifdef ROADMAP_USES_GPE ! displaymigration_mark_window (dialog->w); ! #endif ! gtk_window_set_title (GTK_WINDOW(dialog->w), roadmap_start_get_title(name)); ! gtk_button_box_set_layout ! (GTK_BUTTON_BOX(GTK_DIALOG(dialog->w)->action_area), ! GTK_BUTTONBOX_SPREAD); ! return 1; /* Tell the caller this is a new, undefined, dialog. */ ! #endif } --- 261,296 ---- * @return returns 1 if this is a new, undefined, dialog; 0 otherwise. */ ! int roadmap_dialog_activate (const char *name, void *context) ! { ! __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_activate(%s)", name); ! RoadMapDialogItem dialog = roadmap_dialog_get (NULL, name); ! dialog->context = context; ! if (dialog->w != NULL) { ! /* The dialog exists already: show it on top. */ ! RoadMapDialogCurrent = dialog; ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_activate(%s) -> id %d -> ShowDialog", name, dialog->w); ! jclass cls = TheRoadMapClass(); ! jmethodID mid = TheMethod(cls, "ShowDialog", "(I)V"); ! (*RoadMapJniEnv)->CallVoidMethod(RoadMapJniEnv, RoadMapThiz, mid, dialog->w); ! return 0; /* Tell the caller the dialog already exists. */ ! } ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_activate(%s) -> CreateDialog", name); ! /* Create the dialog's window. */ ! jclass cls = TheRoadMapClass(); ! jmethodID mid = TheMethod(cls, "CreateDialog", "(Ljava/lang/String;I)I"); ! jstring js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, name); ! dialog->w = (*RoadMapJniEnv)->CallIntMethod(RoadMapJniEnv, RoadMapThiz, mid, js, 0); ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "CreateDialog -> dialog->w %d, int name %s", dialog->w, dialog->name); ! return 1; /* Tell the caller this is a new, undefined, dialog. */ } *************** *** 403,406 **** --- 301,305 ---- void roadmap_dialog_hide (const char *name) { + __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_hide(%s)", name); roadmap_dialog_hide_window (roadmap_dialog_get (NULL, name)); } *************** *** 412,421 **** */ void roadmap_dialog_new_entry (const char *frame, const char *name) { ! #if 0 ! GtkWidget *w = gtk_entry_new (); ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name, w, 0); ! child->widget_type = ROADMAP_WIDGET_ENTRY; ! #endif } --- 311,327 ---- */ void roadmap_dialog_new_entry (const char *frame, const char *name) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_entry(%s,%s)", frame, name); ! jclass cls = TheRoadMapClass(); ! jmethodID mid = TheMethod(cls, "DialogAddTextEntry", "(ILjava/lang/String;)I"); ! jstring js = (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, name); ! /* Side effect of .._new_item() : creates a widget with this name */ ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name); ! // RoadMapDialogItem parent = roadmap_dialog_get (NULL, frame); ! // RoadMapDialogItem child = roadmap_dialog_get (parent, name); ! RoadMapDialogItem parent = roadmap_dialog_get (RoadMapDialogCurrent, frame); ! ! /* Now also create the real "edit" widget */ ! int w = (*RoadMapJniEnv)->CallIntMethod(RoadMapJniEnv, RoadMapThiz, mid, parent->w, js); } *************** *** 426,432 **** */ void roadmap_dialog_new_label (const char *frame, const char *name) { #if 0 GtkWidget *w = gtk_label_new (name); ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name, w, 0); child->widget_type = ROADMAP_WIDGET_LABEL; --- 332,339 ---- */ void roadmap_dialog_new_label (const char *frame, const char *name) { + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_label(%s,%s)", frame, name); #if 0 GtkWidget *w = gtk_label_new (name); ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name); child->widget_type = ROADMAP_WIDGET_LABEL; *************** *** 441,444 **** --- 348,352 ---- void roadmap_dialog_new_color (const char *frame, const char *name) { + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_color(%s,%s)", frame, name); roadmap_dialog_new_entry (frame, name); } *************** *** 451,456 **** void roadmap_dialog_new_hidden (const char *frame, const char *name) { #if 0 ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name, 0, 0); child->widget_type = ROADMAP_WIDGET_HIDDEN; --- 359,365 ---- void roadmap_dialog_new_hidden (const char *frame, const char *name) { + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_hidden(%s,%s)", frame, name); #if 0 ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name); child->widget_type = ROADMAP_WIDGET_HIDDEN; *************** *** 477,523 **** void *values, RoadMapDialogCallback callback) { ! #if 0 ! int i; ! GtkWidget *w = gtk_option_menu_new (); ! RoadMapDialogItem child = roadmap_dialog_new_item (frame, name, w, 0); ! GtkWidget *menu; ! GtkWidget *menu_item; ! RoadMapDialogSelection *choice; ! char **vals = (char **)values; ! ! child->widget_type = ROADMAP_WIDGET_CHOICE; ! ! menu = gtk_menu_new (); ! ! choice = (RoadMapDialogSelection *) calloc (count, sizeof(*choice)); ! roadmap_check_allocated(choice); ! ! for (i = 0; i < count; ++i) { ! ! choice[i].typeid = "RoadMapDialogSelection"; ! choice[i].item = child; ! choice[i].value = vals[i]; ! choice[i].callback = NULL; ! ! menu_item = gtk_menu_item_new_with_label (labels[i]); ! gtk_menu_shell_append (GTK_MENU_SHELL(menu), menu_item); ! ! g_signal_connect_swapped ! (menu_item, ! "activate", ! (GCallback) roadmap_dialog_chosen, ! (gpointer) (choice+i)); ! ! gtk_widget_show (menu_item); ! } ! gtk_option_menu_set_menu (GTK_OPTION_MENU(w), menu); ! gtk_option_menu_set_history (GTK_OPTION_MENU(w), current); ! ! if (child->choice != NULL) { ! free(child->choice); ! } ! child->choice = choice; ! child->value = choice[0].value; ! #endif } --- 386,390 ---- void *values, RoadMapDialogCallback callback) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_choice(%s,%s)", frame, name); } *************** *** 531,570 **** */ void roadmap_dialog_new_list (const char *frame, const char *name) { ! #if 0 ! GtkWidget *listbox; ! GtkListStore *store; ! GtkTreeViewColumn *column; ! ! ! GtkWidget *scrollbox = gtk_scrolled_window_new (NULL, NULL); ! ! RoadMapDialogItem child = ! roadmap_dialog_new_item (frame, name, scrollbox, 1); ! ! store = gtk_list_store_new (RM_LIST_WAYPOINT_COLUMNS, G_TYPE_STRING); ! listbox = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); ! g_object_unref (G_OBJECT (store)); ! ! // gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(listbox), 0); ! ! gtk_scrolled_window_add_with_viewport ! (GTK_SCROLLED_WINDOW(scrollbox), listbox); ! ! child->w = listbox; ! child->widget_type = ROADMAP_WIDGET_LIST; ! ! if (name[0] == '.') name += 1; ! ! column = gtk_tree_view_column_new_with_attributes ! (name, gtk_cell_renderer_text_new (), ! "text", RM_LIST_WAYPOINT_NAME, ! NULL); ! ! gtk_tree_view_append_column (GTK_TREE_VIEW (listbox), column); ! ! gtk_tree_selection_set_mode ! (gtk_tree_view_get_selection (GTK_TREE_VIEW (listbox)), ! GTK_SELECTION_SINGLE); ! #endif } --- 398,402 ---- */ void roadmap_dialog_new_list (const char *frame, const char *name) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_list(%s,%s)", frame, name); } *************** *** 576,635 **** void **values, RoadMapDialogCallback callback) { ! #if 0 ! int i; ! RoadMapDialogItem parent; ! RoadMapDialogItem child; ! RoadMapDialogSelection *choice; ! ! GtkTreeModel *model; ! GtkTreeIter iterator; ! ! parent = roadmap_dialog_get (RoadMapDialogCurrent, frame); ! if (parent->w == NULL) { ! roadmap_log (ROADMAP_ERROR, ! "list %s in dialog %s filled before built", name, frame); ! return; ! } ! ! child = roadmap_dialog_get (parent, name); ! if (child->w == NULL) { ! roadmap_log (ROADMAP_ERROR, ! "list %s in dialog %s filled before finished", name, frame); ! return; ! } ! model = gtk_tree_view_get_model (GTK_TREE_VIEW(child->w)); ! ! if (child->choice != NULL) { ! gtk_list_store_clear (GTK_LIST_STORE(model)); ! free (child->choice); ! child->choice = NULL; ! } ! ! choice = (RoadMapDialogSelection *) calloc (count, sizeof(*choice)); ! roadmap_check_allocated(choice); ! ! gtk_tree_selection_set_select_function ! (gtk_tree_view_get_selection (GTK_TREE_VIEW (child->w)), ! roadmap_dialog_list_selected, ! (gpointer)choice, ! NULL); ! ! for (i = 0; i < count; ++i) { ! ! choice[i].typeid = "RoadMapDialogSelection"; ! choice[i].item = child; ! choice[i].value = values[i]; ! choice[i].callback = callback; ! ! gtk_list_store_append (GTK_LIST_STORE(model), &iterator); ! gtk_list_store_set (GTK_LIST_STORE(model), &iterator, ! RM_LIST_WAYPOINT_NAME, labels[i], ! -1); ! } ! child->choice = choice; ! child->value = choice[0].value; ! ! gtk_widget_show (parent->w); ! #endif } --- 408,412 ---- void **values, RoadMapDialogCallback callback) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_show_list(%s,%s)", frame, name); } *************** *** 641,666 **** void roadmap_dialog_add_button (const char *label, RoadMapDialogCallback callback) { ! #if 0 ! RoadMapDialogItem dialog = RoadMapDialogCurrent; ! RoadMapDialogItem child; ! ! GtkWidget *button = gtk_button_new_with_label (label); ! ! child = roadmap_dialog_get (dialog, label); ! ! child->w = button; ! child->callback = callback; ! child->widget_type = ROADMAP_WIDGET_BUTTON; ! ! g_signal_connect (button, "clicked", ! (GCallback) roadmap_dialog_action, child); ! ! GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); ! ! gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->action_area), ! button, TRUE, FALSE, 0); ! ! gtk_widget_grab_default (button); ! #endif } --- 418,422 ---- void roadmap_dialog_add_button (const char *label, RoadMapDialogCallback callback) { ! __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_add_button(%s)", label); } *************** *** 671,775 **** void roadmap_dialog_complete (int use_keyboard) { ! #if 0 ! int count; ! RoadMapDialogItem dialog = RoadMapDialogCurrent; ! RoadMapDialogItem frame; ! ! ! count = 0; ! ! for (frame = dialog->children; frame != NULL; frame = frame->next) { ! if (frame->widget_type == ROADMAP_WIDGET_CONTAINER) { ! count += 1; ! } ! } ! ! if (count > 1) { ! ! /* There are several frames in that dialog: use a notebook widget ! * to let the user access all of them. ! */ ! GtkWidget *notebook = gtk_notebook_new(); ! ! gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE); ! ! gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->vbox), ! notebook, TRUE, TRUE, 0); ! ! for (frame = dialog->children; frame != NULL; frame = frame->next) { ! ! if (frame->widget_type == ROADMAP_WIDGET_CONTAINER) { ! ! GtkWidget *label = gtk_label_new (frame->name); ! ! gtk_notebook_append_page (GTK_NOTEBOOK(notebook), frame->w, label); ! } ! } ! ! } else if (count == 1) { ! ! /* There is only one frame in that dialog: show it straight. */ ! ! for (frame = dialog->children; frame != NULL; frame = frame->next) { ! ! if (frame->widget_type == ROADMAP_WIDGET_CONTAINER) { ! ! gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->vbox), ! frame->w, TRUE, TRUE, 0); ! break; ! } ! } ! ! } else { ! roadmap_log (ROADMAP_FATAL, ! "no frame defined for dialog %s", dialog->name); ! } ! ! if (use_keyboard) { ! ! RoadMapDialogItem last_item = NULL; ! RoadMapKeyboard keyboard = roadmap_keyboard_new (); ! ! gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->vbox), ! roadmap_keyboard_widget(keyboard), ! TRUE, TRUE, 0); ! ! for (frame = dialog->children; frame != NULL; frame = frame->next) { ! ! if (frame->widget_type == ROADMAP_WIDGET_CONTAINER) { ! ! RoadMapDialogItem item; ! ! for (item = frame->children; item != NULL; item = item->next) { ! ! if (item->widget_type == ROADMAP_WIDGET_ENTRY) { ! ! g_signal_connect (item->w, "button_press_event", ! (GCallback) roadmap_dialog_selected, ! keyboard); ! ! last_item = item; ! } ! } ! } ! } ! if (last_item != NULL) { ! roadmap_keyboard_set_focus (keyboard, last_item->w); ! } ! } ! ! gtk_container_set_border_width ! (GTK_CONTAINER(GTK_BOX(GTK_DIALOG(dialog->w)->vbox)), 4); ! ! g_signal_connect (dialog->w, "destroy", ! (GCallback) roadmap_dialog_destroyed, ! dialog); ! ! roadmap_main_set_window_size (dialog->w, ! roadmap_option_width(dialog->name), ! roadmap_option_height(dialog->name)); ! gtk_widget_show_all (GTK_WIDGET(dialog->w)); ! #endif } --- 427,436 ---- void roadmap_dialog_complete (int use_keyboard) { ! RoadMapDialogItem dialog = RoadMapDialogCurrent; ! jclass cls = TheRoadMapClass(); ! jmethodID mid = TheMethod(cls, "ShowDialog", "(I)V"); ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_complete %d", dialog->w); ! (*RoadMapJniEnv)->CallVoidMethod(RoadMapJniEnv, RoadMapThiz, mid, dialog->w); } *************** *** 777,780 **** --- 438,442 ---- void roadmap_dialog_select (const char *dialog) { + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_select(%s)", dialog); RoadMapDialogCurrent = roadmap_dialog_get (NULL, dialog); } *************** *** 783,803 **** void *roadmap_dialog_get_data (const char *frame, const char *name) { ! #if 0 ! RoadMapDialogItem this_frame; ! RoadMapDialogItem this_item; ! ! ! this_frame = roadmap_dialog_get (RoadMapDialogCurrent, frame); ! this_item = roadmap_dialog_get (this_frame, name); ! ! switch (this_item->widget_type) { ! ! case ROADMAP_WIDGET_ENTRY: ! ! return (void *)gtk_entry_get_text (GTK_ENTRY(this_item->w)); ! } ! ! return this_item->value; ! #endif } --- 445,449 ---- void *roadmap_dialog_get_data (const char *frame, const char *name) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_get_data(%s,%s)", frame, name); } *************** *** 805,812 **** void roadmap_dialog_set_data (const char *frame, const char *name, const void *data) { ! #if 0 ! RoadMapDialogItem this_frame; ! RoadMapDialogItem this_item; ! this_frame = roadmap_dialog_get (RoadMapDialogCurrent, frame); --- 451,456 ---- void roadmap_dialog_set_data (const char *frame, const char *name, const void *data) { ! // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_set_data(%s,%s)", frame, name); ! RoadMapDialogItem this_frame, this_item; this_frame = roadmap_dialog_get (RoadMapDialogCurrent, frame); *************** *** 817,834 **** case ROADMAP_WIDGET_ENTRY: ! gtk_entry_set_text (GTK_ENTRY(this_item->w), (const char *)data); break; case ROADMAP_WIDGET_LABEL: ! gtk_label_set_text (GTK_LABEL(this_item->w), (const char *)data); break; } this_item->value = (char *)data; - #endif } void roadmap_dialog_new_progress (const char *frame, const char *name) { #warning implement roadmap_dialog_new_progress } --- 461,478 ---- case ROADMAP_WIDGET_ENTRY: ! // gtk_entry_set_text (GTK_ENTRY(this_item->w), (const char *)data); break; case ROADMAP_WIDGET_LABEL: ! // gtk_label_set_text (GTK_LABEL(this_item->w), (const char *)data); break; } this_item->value = (char *)data; } void roadmap_dialog_new_progress (const char *frame, const char *name) { + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_new_progress(%s,%s)", frame, name); #warning implement roadmap_dialog_new_progress } *************** *** 836,840 **** void roadmap_dialog_set_progress (const char *frame, const char *name, int progress) { #warning implement roadmap_dialog_set_progress } - --- 480,484 ---- void roadmap_dialog_set_progress (const char *frame, const char *name, int progress) { + // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "roadmap_dialog_set_progress(%s,%s,%d)", frame, name, progress); #warning implement roadmap_dialog_set_progress } |
From: Danny B. <dan...@us...> - 2010-08-29 12:30:19
|
Update of /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv17289/src/net/sourceforge/projects/roadmap Modified Files: Pen.java RoadMap.java Log Message: Work in progress : this is a big chunk of the dialog implementation for Android. Index: RoadMap.java =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap/RoadMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RoadMap.java 21 Aug 2010 09:56:49 -0000 1.5 --- RoadMap.java 29 Aug 2010 12:30:11 -0000 1.6 *************** *** 3,8 **** import android.os.Bundle; import android.app.Activity; - import android.widget.TextView; - import android.widget.Toast; import android.content.Context; import android.util.Log; --- 3,6 ---- *************** *** 10,16 **** import android.view.View; import android.view.View.OnClickListener; - import android.widget.Button; - import android.widget.ImageButton; - import android.widget.LinearLayout; import android.graphics.Bitmap; import android.graphics.BitmapFactory; --- 8,11 ---- *************** *** 22,25 **** --- 17,28 ---- import android.os.Message; + import android.widget.Button; + import android.widget.ImageButton; + import android.widget.LinearLayout; + import android.widget.TextView; + import android.widget.EditText; + import android.widget.Toast; + import android.widget.ScrollView; + import android.location.Location; import android.location.LocationListener; *************** *** 35,38 **** --- 38,49 ---- import android.os.PowerManager; + import android.app.Dialog; + import android.app.AlertDialog; + import android.app.AlertDialog.Builder; + import android.content.DialogInterface; + import android.view.ViewGroup; + import android.util.AttributeSet; + import android.view.Gravity; + public class RoadMap extends Activity { *************** *** 444,457 **** } - /* - public void MenuParent(int m, String s) - { - try { - } catch (Exception e) { - Log.e("RoadMap", "LabelMenu(" + m + "," + s + ") : " + e); - } - } - */ - class MenuItemCacheEntry { int parent; --- 455,458 ---- *************** *** 560,562 **** --- 561,697 ---- nToolbarCache++; } + + private int dialog_id = 1; + final int maxdialogs = 50; + + class Dialogs { + String name; + LinearLayout ll, row; + AlertDialog ad; + }; + Dialogs dialogs[] = new Dialogs[maxdialogs]; + + protected Dialog onCreateDialog(int dlg_id) + { + Log.e("RoadMap", "onCreateDialog(" + dlg_id + ")"); + + if (dlg_id <= 0 || dlg_id >= dialog_id) { + // Log.e("RoadMap", "onCreateDialog -> null 1"); + return null; + } + + if (dialogs[dlg_id] != null && dialogs[dlg_id].ad != null) { + // Log.e("RoadMap", "onCreateDialog -> null 2"); + return dialogs[dlg_id].ad; + } + + if (dialogs[dlg_id] != null && dialogs[dlg_id].ll != null) { + AlertDialog.Builder db = new AlertDialog.Builder(this); + ScrollView sv; + + // Log.e("RoadMap", "onCreateDialog build"); + + db.setMessage(dialogs[dlg_id].name) + .setCancelable(true) + .setNegativeButton("Close", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) + { + dialog.cancel(); + } + } + ); + + AlertDialog d = db.create(); + + LinearLayout ll = dialogs[dlg_id].ll; + sv = new ScrollView(this); + d.setView(sv); + sv.addView(ll); + + dialogs[dlg_id].ad = d; + + return d; + } + return null; + } + + /* + * 2nd parameter is the reference to the parent dialog + */ + public int CreateDialog(String name, int parent) + { + // Log.e("RoadMap", "CreateDialog(" + name + ") -> " + dialog_id); + + dialogs[dialog_id] = new Dialogs(); + dialogs[dialog_id].name = name; + dialogs[dialog_id].ll = new LinearLayout(this); + dialogs[dialog_id].ll.setOrientation(LinearLayout.VERTICAL); + + if (dialogs[parent] != null) { + // Log.e("RoadMap", "Add button {" + name + "} in dlg " + parent + " (" + dialogs[parent].name + ")"); + Button b = new Button(thiz); + b.setText(name); + dialogs[parent].ll.addView(b); + b.setOnClickListener( + new View.OnClickListener() { + final int dlg = dialog_id; + public void onClick(View v) + { + // Log.e("RoadMap", "ShowDialog(" + dlg + ")"); + showDialog(dlg); + } + }); + } else { + Log.e("RoadMap", "CreateDialog(" + name + ") - no parent ??"); + } + + return dialog_id++; + } + + public void ShowDialog(int id) + { + showDialog(id); + } + + /* + * Add an object that shows a label + * Precede this by creating a "row" object + */ + public int DialogAddButton(int id, String name) + { + // Log.e("RoadMap", "DialogAddButton(" + id + "," + name + ")"); + try { + LinearLayout row = new LinearLayout(this); + row.setOrientation(LinearLayout.HORIZONTAL); + + dialogs[id].ll.addView(row); + dialogs[id].row = row; + + Button b = new Button(thiz); + b.setText(name); + row.addView(b); + b.setGravity(Gravity.LEFT); + } catch (Exception e) { + Log.e("RoadMap", "DialogAddButton(" + id + "," + name + ") exception " + e); + } + return 1; + } + + public int DialogAddTextEntry(int id, String name) + { + try { + EditText tv = new EditText(thiz); + tv.setGravity(Gravity.FILL_HORIZONTAL); + // tv.setLayoutGravity(Gravity.FILL_HORIZONTAL); + tv.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + LinearLayout row = dialogs[id].row; + row.addView(tv); + } catch (Exception e) { + Log.e("RoadMap", "DialogAddTextEntry(" + id + "," + name + ") exception " + e); + } + return 1; + } } Index: Pen.java =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap/Pen.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Pen.java 14 Aug 2010 06:22:54 -0000 1.1 --- Pen.java 29 Aug 2010 12:30:11 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- private int current = -1; private Paint pens[]; + private Paint fallback = null; private int maxPens = 0; private float[] dash = new float[] {5, 5}; *************** *** 78,82 **** { try { ! // Log.e("RoadMap", "GetPaint(" + current + ")"); return pens[current]; } catch (Exception e) { --- 79,88 ---- { try { ! if (pens[current] == null) { ! Log.e("RoadMap.Pen", "GetPaint(" + current + ") replaced by dummy paint"); ! if (fallback == null) ! fallback = new Paint(); ! return fallback; ! } return pens[current]; } catch (Exception e) { |
From: Danny B. <dan...@us...> - 2010-08-22 09:06:54
|
Update of /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv13982/src/net/sourceforge/projects/roadmap Modified Files: Panel.java Log Message: Get the text drawing in better shape, copy the code from gtk2/roadmap_canvas.c . Index: Panel.java =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap/Panel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Panel.java 14 Aug 2010 06:22:54 -0000 1.1 --- Panel.java 22 Aug 2010 09:06:46 -0000 1.2 *************** *** 157,163 **** } public void DrawString(int x, int y, int corner, int size, String text) { ! DrawStringAngle(x, y, size, 0, text); } --- 157,195 ---- } + // Copy from roadmap_canvas.h + private final int ROADMAP_CANVAS_RIGHT = 1; + private final int ROADMAP_CANVAS_BOTTOM = 2; + private final int ROADMAP_CANVAS_CENTER_X = 4; + private final int ROADMAP_CANVAS_CENTER_Y = 8; + public void DrawString(int x, int y, int corner, int size, String text) { ! try { ! paint = pen.GetPaint(); ! ! // Copy from gtk2/roadmap_canvas.c:roadmap_canvas_draw_string() ! int width = (int)paint.measureText(text); ! int descent = (int)paint.descent(); ! // Ascent is negative on Android ! int ascent = (int)-paint.ascent(); ! ! int height = ascent + descent; ! ! if ((corner & ROADMAP_CANVAS_RIGHT) != 0) ! x -= width; ! else if ((corner & ROADMAP_CANVAS_CENTER_X) != 0) ! x -= width / 2; ! ! if ((corner & ROADMAP_CANVAS_BOTTOM) != 0) ! y -= descent; ! else if ((corner & ROADMAP_CANVAS_CENTER_Y) != 0) ! y -= descent + height / 2; ! else /* TOP */ ! y += ascent; ! ! cacheCanvas.drawText(text, x, y, paint); ! } catch (Exception e) { ! Log.e("RoadMap", "Exception " + e + " in DrawString"); ! } } *************** *** 253,265 **** } public void DrawStringAngle(int x, int y, int size, int angle, String text) { ! /* FIX ME Haven't looked into the angle yet */ ! try { ! paint = pen.GetPaint(); ! cacheCanvas.drawText(text, x, y, paint); ! } catch (Exception e) { ! Log.e("RoadMap", "Exception " + e + " in DrawStringAngle"); ! } } --- 285,292 ---- } + // RoadMap cannot cope with the angle, so just call DrawString. public void DrawStringAngle(int x, int y, int size, int angle, String text) { ! DrawString(x, y, ROADMAP_CANVAS_CENTER_X | ROADMAP_CANVAS_BOTTOM, 0, text); } *************** *** 291,294 **** --- 318,322 ---- paint = pen.GetPaint(); // Log.e("RoadMap", "MeasureAscent() -> " + paint.ascent()); + // Ascent is negative on Android return (int)-paint.ascent(); } catch (Exception e) { |
From: Danny B. <dan...@us...> - 2010-08-21 09:56:58
|
Update of /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv27598/src/net/sourceforge/projects/roadmap Modified Files: RoadMap.java Log Message: Fix the metrics calculation that caused the wrong speed to display. Index: RoadMap.java =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap/RoadMap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RoadMap.java 20 Aug 2010 18:27:33 -0000 1.4 --- RoadMap.java 21 Aug 2010 09:56:49 -0000 1.5 *************** *** 223,231 **** /* */ int gpstime = (int) location.getTime(), lat = (int) (location.getLatitude() * 1000000), lon = (int) (location.getLongitude() * 1000000), alt = (int) (location.getAltitude() * 1000000), ! speed = (int) (location.getSpeed() * 1000), steering = (int) location.getBearing(); --- 223,236 ---- /* */ + /* getTime() returns UTC of this fix in ms since 1/1/1970 */ int gpstime = (int) location.getTime(), lat = (int) (location.getLatitude() * 1000000), lon = (int) (location.getLongitude() * 1000000), + /* getAltitude() returns m */ alt = (int) (location.getAltitude() * 1000000), ! /* getSpeed() returns m/s, this calculation ! * turns it into knots, see roadmap_gpsd2.c */ ! speed = (int) (1944 * location.getSpeed() / 1000), ! /* getBearing returns degrees East of true North */ steering = (int) location.getBearing(); |
From: Danny B. <dan...@us...> - 2010-08-20 20:46:31
|
Update of /cvsroot/roadmap/roadmap/doc In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv18343 Modified Files: Configuration Log Message: Add a line describing gpsd3. Index: Configuration =================================================================== RCS file: /cvsroot/roadmap/roadmap/doc/Configuration,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Configuration 9 Apr 2009 06:12:54 -0000 1.5 --- Configuration 20 Aug 2010 20:46:23 -0000 1.6 *************** *** 863,866 **** --- 863,867 ---- the NMEA raw mode of gpsd, while the gpsd2 protocol (gpsd2://<hostname>[:<port>]) uses the gpsd native protocol. + Newer versions of gpsd (2.90 and up) support the gpsd3 protocol. The object protocol (object:<id>) makes it possible to use an internal RoadMap object as GPS source (so that a driver |
From: Danny B. <dan...@us...> - 2010-08-20 18:29:46
|
Update of /cvsroot/roadmap/roadmap/src/android In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1617 Added Files: .cvsignore Log Message: Tell CVS not to look in binary directories. --- NEW FILE: .cvsignore --- bin libs gen net |
From: Danny B. <dan...@us...> - 2010-08-20 18:27:41
|
Update of /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1210/d/src/net/sourceforge/projects/roadmap Modified Files: RoadMap.java Log Message: Clean up some compiler warnings. Fix an issue with remove_periodic, RoadMap didn't work after being restarted because the same handler was entered again, and its pointer was still in the table. Add an exception handler for the shared library load. Index: RoadMap.java =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap/RoadMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RoadMap.java 19 Aug 2010 19:40:44 -0000 1.3 --- RoadMap.java 20 Aug 2010 18:27:33 -0000 1.4 *************** *** 178,183 **** // the activity is terminated by the user. // ! System.loadLibrary("expat-1"); ! System.loadLibrary("rmnative"); } --- 178,187 ---- // the activity is terminated by the user. // ! try { ! System.loadLibrary("expat-1"); ! System.loadLibrary("rmnative"); ! } catch (Exception e) { ! Log.e("RoadMap", "Shared library installation problem"); ! } } |
From: Danny B. <dan...@us...> - 2010-08-20 18:27:41
|
Update of /cvsroot/roadmap/roadmap/src/android In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1210/d Modified Files: Makefile roadmap_androidgps.c roadmap_androidgps.h roadmap_main.c Log Message: Clean up some compiler warnings. Fix an issue with remove_periodic, RoadMap didn't work after being restarted because the same handler was entered again, and its pointer was still in the table. Add an exception handler for the shared library load. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 14 Aug 2010 06:22:54 -0000 1.1 --- Makefile 20 Aug 2010 18:27:33 -0000 1.2 *************** *** 57,65 **** # I used this with Android 2.1 # - #NDKHOME= /home/danny/src/android/android-ndk-r3 - #SDKPLAT= ${SDKHOME}/platforms/android-7 - #NDK_CFLAGS= -I$(NDKHOME)/build/platforms/android-5/arch-arm/usr/include \ - # -I$(NDK)/apps/ndk_demo/project/jni \ - # -DANDROID -fno-short-enums -g NDKHOME= /home/danny/src/android/android-ndk-r4 --- 57,60 ---- *************** *** 67,74 **** SDKPLAT= ${SDKHOME}/platforms/android-8 NDK_CFLAGS= -I$(NDKHOME)/build/platforms/android-5/arch-arm/usr/include \ - -I$(NDK)/apps/ndk_demo/project/jni \ -DANDROID -fno-short-enums -g NDK_LDFLAGS= -nostdlib -Wl,-shared,-Bsymbolic -Wl,--no-undefined -Wl,-z,noexecstack - #JAVAC_FLAGS= -cp ${SDKPLAT}/android.jar -sourcepath gen:src JAVA= /usr/share/java JAVAC_FLAGS= -cp ${JAVA}/jaxp_parser_impl.jar:${JAVA}/xml-commons-apis.jar:${JAVA}/antlr.jar:${JAVA}/ant/ant-antlr.jar:${JAVA}/regexp.jar:${JAVA}/ant/ant-apache-regexp.jar:${JAVA}/jakarta-commons-logging.jar:${JAVA}/ant/ant-commons-logging.jar:${JAVA}/javamail.jar:${JAVA}/jaf.jar:${JAVA}/ant/ant-javamail.jar:${JAVA}/jsch.jar:${JAVA}/ant/ant-jsch.jar:/usr/lib/jvm/java/lib/tools.jar:${SDKPLAT}/android.jar -sourcepath gen:src -bootclasspath ${SDKPLAT}/android.jar --- 62,67 ---- Index: roadmap_androidgps.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/roadmap_androidgps.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_androidgps.c 14 Aug 2010 06:22:54 -0000 1.1 --- roadmap_androidgps.c 20 Aug 2010 18:27:33 -0000 1.2 *************** *** 42,48 **** * These functions need to be called when Android has info from the GPS. */ ! static RoadMapGpsdNavigation RoadmapGpsd2NavigationListener = NULL; ! static RoadMapGpsdSatellite RoadmapGpsd2SatelliteListener = NULL; ! static RoadMapGpsdDilution RoadmapGpsd2DilutionListener = NULL; /** --- 42,48 ---- * These functions need to be called when Android has info from the GPS. */ ! static RoadMapGpsdNavigation navigationListener = NULL; ! static RoadMapGpsdSatellite satelliteListener = NULL; ! static RoadMapGpsdDilution dilutionListener = NULL; /** *************** *** 55,59 **** void roadmap_androidgps_subscribe_to_navigation (RoadMapGpsdNavigation navigation) { ! RoadmapGpsd2NavigationListener = navigation; } --- 55,59 ---- void roadmap_androidgps_subscribe_to_navigation (RoadMapGpsdNavigation navigation) { ! navigationListener = navigation; } *************** *** 61,65 **** void roadmap_androidgps_subscribe_to_satellites (RoadMapGpsdSatellite satellite) { ! RoadmapGpsd2SatelliteListener = satellite; } --- 61,65 ---- void roadmap_androidgps_subscribe_to_satellites (RoadMapGpsdSatellite satellite) { ! satelliteListener = satellite; } *************** *** 67,71 **** void roadmap_androidgps_subscribe_to_dilution (RoadMapGpsdDilution dilution) { ! RoadmapGpsd2DilutionListener = dilution; } --- 67,71 ---- void roadmap_androidgps_subscribe_to_dilution (RoadMapGpsdDilution dilution) { ! dilutionListener = dilution; } *************** *** 80,92 **** int status, int gpstime, int lat, int lon, int alt, int speed, int steering) { ! if (! RoadmapGpsd2NavigationListener) { // FIX ME should be an exception ? __android_log_print (ANDROID_LOG_ERROR, "RoadMap", "No listener"); return; } ! roadmap_log (ROADMAP_DEBUG, ! "HereAmI(st %d, gps %d %d, spd %d, tm %d)", ! status, lat, lon, speed, gpstime); ! RoadmapGpsd2NavigationListener(status, gpstime, lat, lon, alt, speed, steering); } --- 80,92 ---- int status, int gpstime, int lat, int lon, int alt, int speed, int steering) { ! if (! navigationListener) { // FIX ME should be an exception ? __android_log_print (ANDROID_LOG_ERROR, "RoadMap", "No listener"); return; } ! ! // roadmap_log (ROADMAP_DEBUG, "HereAmI(st %d, gps %d %d, spd %d, tm %d)", status, lat, lon, speed, gpstime); ! ! navigationListener(status, gpstime, lat, lon, alt, speed, steering); } *************** *** 131,135 **** // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "Satellite(%d,%d,%d,%d,%d,%d", sequence, id, elevation, azimuth, strength, active); ! RoadmapGpsd2SatelliteListener(sequence, id, elevation, azimuth, strength, active); } --- 131,135 ---- // __android_log_print(ANDROID_LOG_ERROR, "RoadMap", "Satellite(%d,%d,%d,%d,%d,%d", sequence, id, elevation, azimuth, strength, active); ! satelliteListener(sequence, id, elevation, azimuth, strength, active); } Index: roadmap_androidgps.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/roadmap_androidgps.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_androidgps.h 14 Aug 2010 06:22:54 -0000 1.1 --- roadmap_androidgps.h 20 Aug 2010 18:27:33 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- void roadmap_androidgps_periodic (void); + void roadmap_androidgps_close (void); #endif // INCLUDE__ROADMAP_ANDROIDGPS__H Index: roadmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/roadmap_main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_main.c 14 Aug 2010 06:22:54 -0000 1.1 --- roadmap_main.c 20 Aug 2010 18:27:33 -0000 1.2 *************** *** 39,42 **** --- 39,43 ---- #include "roadmap_config.h" #include "roadmap_history.h" + #include "roadmap_canvas.h" #include "roadmap_main.h" *************** *** 251,255 **** jmethodID mid; jstring jslabel, jsicon, jstip; - char *fnicon; if ((label == 0 || strlen(label) == 0) && (icon == 0 || strlen(icon) == 0)) --- 252,255 ---- *************** *** 266,270 **** * The Java code doesn't handle this because we do it here. */ ! fnicon = roadmap_path_search_icon(icon); jsicon = fnicon ? (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, fnicon) : NULL; --- 266,270 ---- * The Java code doesn't handle this because we do it here. */ ! const char *fnicon = roadmap_path_search_icon(icon); jsicon = fnicon ? (*RoadMapJniEnv)->NewStringUTF(RoadMapJniEnv, fnicon) : NULL; *************** *** 340,344 **** RoadMapMainIo[i].io = *io; RoadMapMainIo[i].callback = callback; ! RoadMapMainIo[i].id = NULL; break; } --- 340,344 ---- RoadMapMainIo[i].io = *io; RoadMapMainIo[i].callback = callback; ! RoadMapMainIo[i].id = 0; break; } *************** *** 376,379 **** --- 376,382 ---- for (index = 0; index < ROADMAP_MAX_TIMER; ++index) { if (RoadMapMainPeriodicTimer[index].callback == callback) { + /* this should not happen */ + roadmap_log(ROADMAP_ERROR, "roadmap_main_set_periodic - duplicate %d %p", + interval, callback); return; } *************** *** 424,427 **** --- 427,432 ---- (*RoadMapJniEnv)->CallVoidMethod(RoadMapJniEnv, RoadMapThiz, mid, index); + + RoadMapMainPeriodicTimer[index].callback = NULL; } } |
From: Danny B. <dan...@us...> - 2010-08-20 18:27:41
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1210 Modified Files: roadmap_start.c roadmap_canvas.h roadmap_gps.c Log Message: Clean up some compiler warnings. Fix an issue with remove_periodic, RoadMap didn't work after being restarted because the same handler was entered again, and its pointer was still in the table. Add an exception handler for the shared library load. Index: roadmap_gps.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_gps.c,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** roadmap_gps.c 17 Aug 2010 18:57:10 -0000 1.52 --- roadmap_gps.c 20 Aug 2010 18:27:33 -0000 1.53 *************** *** 1126,1130 **** #ifdef ANDROID case ROADMAP_GPS_ANDROID: - roadmap_log (ROADMAP_DEBUG, "Subscribe to Android GPS services"); roadmap_androidgps_connect (NULL); roadmap_androidgps_subscribe_to_navigation (roadmap_gps_navigation); --- 1126,1129 ---- Index: roadmap_canvas.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_canvas.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** roadmap_canvas.h 4 Nov 2008 14:56:23 -0000 1.13 --- roadmap_canvas.h 20 Aug 2010 18:27:33 -0000 1.14 *************** *** 206,209 **** --- 206,211 ---- int size, const char *text); + void roadmap_canvas_shutdown (void); + #ifdef IPHONE void roadmap_canvas_get_chording_pt (RoadMapGuiPoint points[MAX_CHORDING_POINTS]); Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** roadmap_start.c 17 Aug 2010 18:57:10 -0000 1.161 --- roadmap_start.c 20 Aug 2010 18:27:33 -0000 1.162 *************** *** 1240,1244 **** static int RoadMapSynchronous = -1; ! // roadmap_log (ROADMAP_WARNING, "roadmap_start_gps_listen"); if (RoadMapStartFrozen) { --- 1240,1250 ---- static int RoadMapSynchronous = -1; ! /* ! roadmap_log (ROADMAP_WARNING, ! "roadmap_start_gps_listen(recep %d) frozen %d pos %d %d (%s)", ! reception, RoadMapStartFrozen, ! gps_position->longitude, gps_position->latitude, ! roadmap_start_now()); ! /* */ if (RoadMapStartFrozen) { |
From: Danny B. <dan...@us...> - 2010-08-19 20:32:17
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv5368 Modified Files: roadmap_screen.h roadmap_display.h roadmap_factory.h roadmap_config.h roadmap_sprite.h roadmap_layer.h Log Message: Declare the shutdown functions in these modules. Index: roadmap_factory.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_factory.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** roadmap_factory.h 10 Feb 2009 11:41:02 -0000 1.14 --- roadmap_factory.h 19 Aug 2010 20:32:09 -0000 1.15 *************** *** 3,7 **** * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. --- 3,7 ---- * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2008, 2010, Danny Backx. * * This file is part of RoadMap. *************** *** 74,77 **** --- 74,78 ---- void roadmap_factory_usage (const char *section, const RoadMapAction *action); + void roadmap_factory_shutdown (void); #endif /* INCLUDE__ROADMAP_FACTORY__H */ Index: roadmap_display.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_display.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** roadmap_display.h 2 Jan 2008 17:21:41 -0000 1.11 --- roadmap_display.h 19 Aug 2010 20:32:09 -0000 1.12 *************** *** 4,7 **** --- 4,8 ---- * * Copyright 2002 Pascal F. Martin + * Copyright 2010, Danny Backx * * This file is part of RoadMap. *************** *** 29,32 **** --- 30,34 ---- void roadmap_display_initialize (void); + void roadmap_display_shutdown (void); void roadmap_display_page (const char *name); Index: roadmap_config.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_config.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadmap_config.h 12 Feb 2009 17:54:46 -0000 1.8 --- roadmap_config.h 19 Aug 2010 20:32:09 -0000 1.9 *************** *** 3,7 **** * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2009, Danny Backx * * This file is part of RoadMap. --- 3,7 ---- * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2009, 2010, Danny Backx * * This file is part of RoadMap. *************** *** 98,101 **** --- 98,102 ---- void roadmap_config_save (int force); void roadmap_config_reload (const char *); + void roadmap_config_shutdown (void); int roadmap_config_get_type (RoadMapConfigDescriptor *descriptor); Index: roadmap_screen.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** roadmap_screen.h 29 Mar 2009 11:47:21 -0000 1.24 --- roadmap_screen.h 19 Aug 2010 20:32:09 -0000 1.25 *************** *** 85,88 **** --- 85,89 ---- (int id, const char *text, int size, int *width, int *ascent, int *descent, int *can_tilt); + void roadmap_screen_shutdown (void); #ifdef ROADMAP_DBG_TIME Index: roadmap_sprite.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_sprite.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_sprite.h 14 Nov 2007 19:29:49 -0000 1.5 --- roadmap_sprite.h 19 Aug 2010 20:32:09 -0000 1.6 *************** *** 4,7 **** --- 4,8 ---- * * Copyright 2002 Pascal F. Martin + * Copyright (c) 2010, Danny Backx * * This file is part of RoadMap. *************** *** 41,44 **** --- 42,46 ---- void roadmap_sprite_bbox (const char *name, RoadMapGuiRect *bbox); + void roadmap_sprite_shutdown (void); #endif // INCLUDE__ROADMAP_CANVAS__H Index: roadmap_layer.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_layer.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_layer.h 12 Feb 2009 16:12:39 -0000 1.7 --- roadmap_layer.h 19 Aug 2010 20:32:09 -0000 1.8 *************** *** 3,7 **** * * Copyright 2003 Pascal F. Martin ! * Copyright (c) 2008, 2009, Danny Backx. * * This file is part of RoadMap. --- 3,7 ---- * * Copyright 2003 Pascal F. Martin ! * Copyright (c) 2008, 2009, 2010, Danny Backx. * * This file is part of RoadMap. *************** *** 103,106 **** --- 103,107 ---- int roadmap_layer_declare_navigation_mode (const char *name); void roadmap_layer_initialize (void); + void roadmap_layer_shutdown (void); int roadmap_layer_last(void); |
From: Danny B. <dan...@us...> - 2010-08-19 19:40:52
|
Update of /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv30214/src/net/sourceforge/projects/roadmap Modified Files: RoadMap.java Log Message: Fix issue after renaming the shared library in the android/Makefile. Index: RoadMap.java =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/android/src/net/sourceforge/projects/roadmap/RoadMap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RoadMap.java 14 Aug 2010 13:54:45 -0000 1.2 --- RoadMap.java 19 Aug 2010 19:40:44 -0000 1.3 *************** *** 179,183 **** // System.loadLibrary("expat-1"); ! System.loadLibrary("jni"); } --- 179,183 ---- // System.loadLibrary("expat-1"); ! System.loadLibrary("rmnative"); } |
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv22535 Modified Files: Makefile config.mk roadmap_gpsd2.c roadmap_gps.c roadmap_start.c Added Files: roadmap_gpsd3.c roadmap_gpsd3.h Log Message: Implement the new gpsd protocol as "gpsd3:", in two new source files. Rollback earlier change to support that protocol from roadmap_gpsd2.c . Implement Android support in files left out of earlier commits. Index: config.mk =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/config.mk,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** config.mk 15 Aug 2010 13:54:03 -0000 1.37 --- config.mk 17 Aug 2010 18:57:10 -0000 1.38 *************** *** 15,18 **** --- 15,19 ---- USE_TRIP_PLUGIN = no USE_NAVIGATE_PLUGIN = no + USE_POI_PLUGIN = no # default installation directory. *************** *** 114,121 **** # EXPAT = NO ! # Experimental code ! # Use the new libgps ! CFLAGS += -DROADMAP_USE_LIBGPS ! LIBS += -lgps # RoadMap users in the USA will probably use the Tiger maps from --- 115,124 ---- # EXPAT = NO ! # ! # Implement the new gpsd protocol, referred to as gpsd3 . ! # This requires the libgps library, part of the gpsd distribution. ! # ! # CFLAGS += -DROADMAP_USES_LIBGPS ! # LIBS += -lgps # RoadMap users in the USA will probably use the Tiger maps from Index: roadmap_gps.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_gps.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** roadmap_gps.c 12 Feb 2009 19:05:36 -0000 1.51 --- roadmap_gps.c 17 Aug 2010 18:57:10 -0000 1.52 *************** *** 3,6 **** --- 3,7 ---- * * Copyright 2002 Pascal F. Martin + * Copyright 2010 Danny Backx * * This file is part of RoadMap. *************** *** 44,47 **** --- 45,49 ---- #include "roadmap_nmea.h" #include "roadmap_gpsd2.h" + #include "roadmap_gpsd3.h" #include "roadmap_vii.h" #include "roadmap_driver.h" *************** *** 49,52 **** --- 51,58 ---- #include "roadmap_gps.h" + #ifdef ANDROID + #include "android/roadmap_androidgps.h" + #endif + static RoadMapConfigDescriptor RoadMapConfigGPSAccuracy = *************** *** 87,90 **** --- 93,99 ---- #define ROADMAP_GPS_VII 3 #define ROADMAP_GPS_OBJECT 4 + #define ROADMAP_GPS_ANDROID 5 + #define ROADMAP_GPS_GPSD3 6 + static int RoadMapGpsProtocol = ROADMAP_GPS_NONE; *************** *** 231,235 **** /** ! * @brief */ static void roadmap_gps_got_data(void) { --- 240,244 ---- /** ! * @brief Record the time at which we got GPS data, so we know how old our latest data is. */ static void roadmap_gps_got_data(void) { *************** *** 238,246 **** /** ! * @brief */ static void roadmap_gps_call_all_listeners (void) { int i; for (i = 0; i < ROADMAP_GPS_CLIENTS; ++i) { --- 247,257 ---- /** ! * @brief spread information that comes in periodically to all 'listeners'. ! * Similar mechanism to "monitors", the information provided is different. */ static void roadmap_gps_call_all_listeners (void) { int i; + int count = 0; for (i = 0; i < ROADMAP_GPS_CLIENTS; ++i) { *************** *** 248,251 **** --- 259,263 ---- if (RoadMapGpsListeners[i] == NULL) break; + count++; (RoadMapGpsListeners[i]) (RoadMapGpsReception, RoadMapGpsReceivedTime, *************** *** 254,261 **** } } /** ! * @brief */ static void roadmap_gps_call_all_monitors (void) { --- 266,279 ---- } + if (count == 0) { + /* Note this frequently happens when the application is shutting down. */ + roadmap_log (ROADMAP_DEBUG, "roadmap_gps_call_all_listeners: no listeners"); + return; + } } /** ! * @brief spread information that comes in periodically to all "monitors". ! * Similar mechanism to 'listeners', the information provided is different. */ static void roadmap_gps_call_all_monitors (void) { *************** *** 369,373 **** } ! static void roadmap_gps_gga (void *context, const RoadMapNmeaFields *fields) { --- 387,395 ---- } ! /** ! * @brief ! * @param context ! * @param fields ! */ static void roadmap_gps_gga (void *context, const RoadMapNmeaFields *fields) { *************** *** 592,595 **** --- 614,627 ---- /* GPSD (or other) protocol support ------------------------------------ */ + /** + * @brief + * @param status + * @param gmt_time + * @param latitude + * @param longitude + * @param altitude + * @param speed + * @param steering + */ static void roadmap_gps_navigation (char status, int gmt_time, *************** *** 635,639 **** } ! static void roadmap_gps_satellites (int sequence, int id, --- 667,684 ---- } ! /** ! * @brief This function takes individual satellite date, ! * calculates the number of (active) satellites, ! * and stores all data in RoadMapGpsDetected. ! * ! * It appears to rely on "sequence" arriving as a sequence :-) ! * ! * @param sequence ! * @param id ! * @param elevation ! * @param azimuth ! * @param strength ! * @param active ! */ static void roadmap_gps_satellites (int sequence, int id, *************** *** 723,730 **** /* End of OBJECT protocol support -------------------------------------- */ void roadmap_gps_initialize (void) { ! static int RoadMapGpsInitialized = 0; if (! RoadMapGpsInitialized) { --- 768,780 ---- /* End of OBJECT protocol support -------------------------------------- */ + int RoadMapGpsInitialized = 0; void roadmap_gps_initialize (void) { ! int i; ! ! for (i=0; i<ROADMAP_GPS_CLIENTS; ++i) { ! RoadMapGpsListeners[i] = NULL; ! } if (! RoadMapGpsInitialized) { *************** *** 765,770 **** --- 815,828 ---- void roadmap_gps_shutdown (void) { + int i; + if (RoadMapGpsLink.subsystem == ROADMAP_IO_INVALID) return; + #ifdef ANDROID + if (RoadMapGpsLink.subsystem == ROADMAP_IO_ANDROID) { + roadmap_androidgps_close (); + } + #endif + (*RoadMapGpsPeriodicRemove) (roadmap_gps_keep_alive); *************** *** 772,775 **** --- 830,838 ---- roadmap_io_close (&RoadMapGpsLink); + + RoadMapGpsInitialized = 0; + for (i=0; i<ROADMAP_GPS_CLIENTS; ++i) { + RoadMapGpsListeners[i] = NULL; + } } *************** *** 791,796 **** /** ! * @brief ! * @param monitor */ void roadmap_gps_register_monitor (roadmap_gps_monitor monitor) { --- 854,859 ---- /** ! * @brief add monitor, this is called when new info about GPS reception is available ! * @param monitor the function to be called */ void roadmap_gps_register_monitor (roadmap_gps_monitor monitor) { *************** *** 806,810 **** } ! void roadmap_gps_open (void) { --- 869,876 ---- } ! /** ! * @brief function to call the system-dependent stuff to activate/open the GPS, ! * and register the right functions in the system-independent roadmap_io module. ! */ void roadmap_gps_open (void) { *************** *** 818,821 **** --- 884,888 ---- roadmap_gps_update_reception (); + #ifndef ANDROID url = roadmap_gps_source (); *************** *** 864,867 **** --- 931,944 ---- } + } else if (strncasecmp (url, "gpsd3://", 8) == 0) { + + RoadMapGpsLink.os.socket = roadmap_gpsd3_connect (url+8); + + if (ROADMAP_NET_IS_VALID(RoadMapGpsLink.os.socket)) { + + RoadMapGpsLink.subsystem = ROADMAP_IO_NET; + RoadMapGpsProtocol = ROADMAP_GPS_GPSD3; + } + } else if (strncasecmp (url, "vii://", 6) == 0) { *************** *** 998,1005 **** RoadMapGpsRetryPending = 0; } ! /* Give time for the whole system to initialize itself. */ roadmap_gps_got_data(); (*RoadMapGpsPeriodicAdd) (roadmap_gps_keep_alive); --- 1075,1090 ---- RoadMapGpsRetryPending = 0; } + #else /* ANDROID */ + RoadMapGpsLink.subsystem = ROADMAP_IO_ANDROID; + RoadMapGpsProtocol = ROADMAP_GPS_ANDROID; + #endif ! /* Give time for the whole system to initialize itself. */ roadmap_gps_got_data(); + /* + * Don't remove the keepalive, even if it isn't necessary for the connection : + * the underlying roadmap_gps_update_reception() call is required. + */ (*RoadMapGpsPeriodicAdd) (roadmap_gps_keep_alive); *************** *** 1024,1027 **** --- 1109,1119 ---- break; + case ROADMAP_GPS_GPSD3: + + roadmap_gpsd3_subscribe_to_navigation (roadmap_gps_navigation); + roadmap_gpsd3_subscribe_to_satellites (roadmap_gps_satellites); + roadmap_gpsd3_subscribe_to_dilution (roadmap_gps_dilution); + break; + case ROADMAP_GPS_VII: *************** *** 1032,1035 **** --- 1124,1138 ---- break; + #ifdef ANDROID + case ROADMAP_GPS_ANDROID: + roadmap_log (ROADMAP_DEBUG, "Subscribe to Android GPS services"); + roadmap_androidgps_connect (NULL); + roadmap_androidgps_subscribe_to_navigation (roadmap_gps_navigation); + roadmap_androidgps_subscribe_to_satellites (roadmap_gps_satellites); + roadmap_androidgps_subscribe_to_dilution (roadmap_gps_dilution); + break; + + #endif + default: *************** *** 1101,1104 **** --- 1204,1213 ---- break; + case ROADMAP_GPS_GPSD3: + + decode.decoder = roadmap_gpsd3_decode; + decode.decoder_context = NULL; + break; + case ROADMAP_GPS_VII: *************** *** 1111,1114 **** --- 1220,1230 ---- return; + #ifdef ANDROID + case ROADMAP_GPS_ANDROID: + decode.decoder = roadmap_androidgps_decode; + decode.decoder_context = NULL; + break; + #endif + default: *************** *** 1129,1133 **** --- 1245,1251 ---- /* Try to establish a new IO channel, but don't reread a file: */ + #ifndef ANDROID (*RoadMapGpsPeriodicRemove) (roadmap_gps_keep_alive); + #endif if (RoadMapGpsLink.subsystem != ROADMAP_IO_FILE) { roadmap_gps_open(); *************** *** 1159,1162 **** --- 1277,1281 ---- case ROADMAP_GPS_NMEA: return 1; case ROADMAP_GPS_GPSD2: return 0; + case ROADMAP_GPS_GPSD3: return 0; case ROADMAP_GPS_VII: return 0; case ROADMAP_GPS_OBJECT: return 0; Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/Makefile,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** Makefile 15 Aug 2010 19:11:38 -0000 1.143 --- Makefile 17 Aug 2010 18:57:10 -0000 1.144 *************** *** 37,41 **** roadmap_input.c \ roadmap_nmea.c \ ! roadmap_gpsd2.c \ roadmap_io.c \ roadmap_gps.c \ --- 37,41 ---- roadmap_input.c \ roadmap_nmea.c \ ! roadmap_gpsd2.c roadmap_gpsd3.c \ roadmap_io.c \ roadmap_gps.c \ *************** *** 94,101 **** roadmap_copy.c \ roadmap_httpcopy.c \ ! $(EDITOR_PLUGINSRC) \ ! $(TRIP_PLUGINSRC) \ ! $(NAVIGATE_PLUGINSRC) \ ! $(POI_PLUGINSRC) RMPLUGINOBJS=$(RMPLUGINSRC:.c=.o) --- 94,98 ---- roadmap_copy.c \ roadmap_httpcopy.c \ ! $(EDITOR_PLUGINSRC) $(TRIP_PLUGINSRC) $(NAVIGATE_PLUGINSRC) RMPLUGINOBJS=$(RMPLUGINSRC:.c=.o) *************** *** 249,253 **** roadmap_geocode.h \ roadmap_gps.h \ ! roadmap_gpsd2.h \ roadmap_gpx.h \ roadmap_gui.h \ --- 246,250 ---- roadmap_geocode.h \ roadmap_gps.h \ ! roadmap_gpsd2.h roadmap_gpsd3.h \ roadmap_gpx.h \ roadmap_gui.h \ *************** *** 406,426 **** endif - # --- Additions for POI plugin ------------------------------- - - ifeq ($(USE_POI_PLUGIN),yes) - POI_PLUGINSRC = \ - poi/poi_plugin.c \ - poi/poi.c - - POC_PLUGIN_HDR = \ - poi/poi.h \ - poi/poi_plugin.h - - CFLAGS += -DHAVE_POI_PLUGIN - PLUGIN_CLEAN += ${POI_PLUGINSRC:.c=.o} - else - POI_PLUGINSRC = - endif - # --- Additions for Navigate plugin ------------------------------- --- 403,406 ---- --- NEW FILE: roadmap_gpsd3.h --- /* * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * DESCRIPTION: * * This module hides the gpsd library API (version 2). */ /** * @file * @brief roadmap_gpsd3.h - a module to interact with gpsd using its library. */ #ifndef INCLUDE__ROADMAP_GPSD3__H #define INCLUDE__ROADMAP_GPSD3__H #include "roadmap_gpsd2.h" #include "roadmap_net.h" #include "roadmap_input.h" void roadmap_gpsd3_subscribe_to_navigation (RoadMapGpsdNavigation navigation); void roadmap_gpsd3_subscribe_to_satellites (RoadMapGpsdSatellite satellite); void roadmap_gpsd3_subscribe_to_dilution (RoadMapGpsdDilution dilution); RoadMapSocket roadmap_gpsd3_connect (const char *name); int roadmap_gpsd3_decode (void *user_context, void *decoder_context, char *sentence); #endif // INCLUDE__ROADMAP_GPSD3__H --- NEW FILE: roadmap_gpsd3.c --- /* * LICENSE: * * Copyright 2002 Pascal F. Martin * Copyright 2010, Danny Backx. * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @file * @brief roadmap_gpsd3.c - a module to interact with gpsd using its library. */ #include <time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include "roadmap.h" #include "roadmap_gpsd3.h" #include "errno.h" #ifdef ROADMAP_USES_LIBGPS #include "gps.h" #endif static RoadMapGpsdNavigation RoadmapGpsd2NavigationListener = NULL; static RoadMapGpsdSatellite RoadmapGpsd2SatelliteListener = NULL; static RoadMapGpsdDilution RoadmapGpsd2DilutionListener = NULL; RoadMapSocket gpsd3_socket; struct gps_data_t *gpsdp; RoadMapSocket roadmap_gpsd3_connect (const char *name) { #ifdef ROADMAP_USES_LIBGPS gpsdp = gps_open(name, "2947"); if (gpsdp == NULL) return ROADMAP_INVALID_SOCKET; gps_stream(gpsdp, WATCH_NMEA, NULL); return (RoadMapSocket)gpsdp->gps_fd; #else return 0; #endif } void roadmap_gpsd3_subscribe_to_navigation (RoadMapGpsdNavigation navigation) { RoadmapGpsd2NavigationListener = navigation; } void roadmap_gpsd3_subscribe_to_satellites (RoadMapGpsdSatellite satellite) { RoadmapGpsd2SatelliteListener = satellite; } void roadmap_gpsd3_subscribe_to_dilution (RoadMapGpsdDilution dilution) { RoadmapGpsd2DilutionListener = dilution; } int roadmap_gpsd3_decode (void *user_context, void *decoder_context, char *sentence) { #ifdef ROADMAP_USES_LIBGPS int status = 0; int latitude = 0; int longitude = 0; int altitude = 0; int speed = 0; int steering = 0; int gps_time = 0; int i, j, s; static bool used[MAXCHANNELS]; #define MAX_POSSIBLE_SATS (MAXCHANNELS - 2) if (gps_read(gpsdp) < 0) { roadmap_log(ROADMAP_ERROR, "gpsd error %d", errno); } if (gpsdp->satellites_visible == 0) return 0; // No data status = (gpsdp->fix.mode >= MODE_2D) ? 'A' : 'V'; if (gpsdp->fix.mode >= MODE_2D) { if (isnan(gpsdp->fix.longitude) == 0) { longitude = 1000000 * gpsdp->fix.longitude; } if (isnan(gpsdp->fix.latitude) == 0) { latitude = 1000000 * gpsdp->fix.latitude; } if (isnan(gpsdp->fix.speed) == 0) { speed = gpsdp->fix.speed; } if (isnan(gpsdp->fix.altitude) == 0) { altitude = gpsdp->fix.altitude; } if (isnan(gpsdp->fix.time) == 0) { gps_time = gpsdp->fix.time; } } RoadmapGpsd2NavigationListener (status, gps_time, latitude, longitude, altitude, speed, steering); /* See demo app cgps.c in gpsd source distribution */ /* Must build bit vector of which satellites are used */ for (i = 0; i < MAXCHANNELS; i++) { used[i] = false; for (j = 0; j < gpsdp->satellites_used; j++) if (gpsdp->used[j] == gpsdp->PRN[i]) used[i] = true; } for (i=0, s=1; i<MAX_POSSIBLE_SATS; i++) { if (gpsdp->used[i]) { (*RoadmapGpsd2SatelliteListener) (s, // sequence gpsdp->PRN[i], // id gpsdp->elevation[i], // elevation gpsdp->azimuth[i], // azimuth (int)gpsdp->ss[i], // strength gpsdp->used[i]); // active s++; } } (*RoadmapGpsd2SatelliteListener) (0, 0, 0, 0, 0, 0); return 1; #else return 0; #endif } Index: roadmap_gpsd2.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_gpsd2.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** roadmap_gpsd2.c 15 Aug 2010 13:54:03 -0000 1.12 --- roadmap_gpsd2.c 17 Aug 2010 18:57:10 -0000 1.13 *************** *** 3,7 **** * * Copyright 2002 Pascal F. Martin - * Copyright 2010, Danny Backx. * * This file is part of RoadMap. --- 3,6 ---- *************** *** 24,30 **** /** * @file ! * @brief roadmap_gpsd2.c - a module to interact with gpsd using its library. ! * This module hides the gpsd library API (version 2). ! * If ROADMAP_USES_LIBGPS is defined, use the (pre) version 3 libgps. */ --- 23,31 ---- /** * @file ! * @brief roadmap_gpsd2.c - a module to interact with gpsd, version 2. ! * ! * Note : version 2 of gpsd is being obsoleted in 2010. An implementation ! * that works with version 3 is in roadmap_gpsd3.c . ! * */ *************** *** 38,46 **** #include "roadmap_math.h" - #ifdef ROADMAP_USES_LIBGPS - #include "errno.h" - #include "gps.h" - #endif - static RoadMapGpsdNavigation RoadmapGpsd2NavigationListener = NULL; --- 39,42 ---- *************** *** 104,119 **** RoadMapSocket gpsd2_socket; - #ifdef ROADMAP_USES_LIBGPS - struct gps_data_t *gpsdp; - #endif RoadMapSocket roadmap_gpsd2_connect (const char *name) { ! #ifdef ROADMAP_USES_LIBGPS ! gpsdp = gps_open(name, "2947"); ! if (gpsdp == NULL) ! return ROADMAP_INVALID_SOCKET; ! gps_stream(gpsdp, WATCH_NMEA, NULL); ! return (RoadMapSocket)gpsdp->gps_fd; ! #else gpsd2_socket = roadmap_net_connect ("tcp", name, 2947); --- 100,106 ---- RoadMapSocket gpsd2_socket; RoadMapSocket roadmap_gpsd2_connect (const char *name) { ! gpsd2_socket = roadmap_net_connect ("tcp", name, 2947); *************** *** 135,148 **** return gpsd2_socket; - #endif } - /** - * @brief this is probably a keepalive FIX ME - */ void roadmap_gpsd2_periodic (void) { ! #ifndef ROADMAP_USES_LIBGPS roadmap_net_send (gpsd2_socket, "q\n", 2); - #endif } --- 122,130 ---- return gpsd2_socket; } void roadmap_gpsd2_periodic (void) { ! roadmap_net_send (gpsd2_socket, "q\n", 2); } *************** *** 167,170 **** --- 149,158 ---- int roadmap_gpsd2_decode (void *user_context, void *decoder_context, char *sentence) { + + int got_navigation_data; + + int got_o = 0; + int got_q = 0; + int status; int latitude; *************** *** 174,245 **** int steering; - int gps_time = 0; - - #ifdef ROADMAP_USES_LIBGPS - int i, j, s; - static bool used[MAXCHANNELS]; - #define MAX_POSSIBLE_SATS (MAXCHANNELS - 2) - - if (gps_read(gpsdp) < 0) { - roadmap_log(ROADMAP_ERROR, "gpsd error %d", errno); - } - - if (gpsdp->satellites_visible == 0) - return 0; // No data - - roadmap_log(ROADMAP_WARNING, "gpsd sats %d", gpsdp->satellites_visible); - - status = (gpsdp->fix.mode >= MODE_2D) ? 'A' : 'V'; - - if (gpsdp->fix.mode >= MODE_2D) { - if (isnan(gpsdp->fix.longitude) == 0) { - longitude = 1000000 * gpsdp->fix.longitude; - } - if (isnan(gpsdp->fix.latitude) == 0) { - latitude = 1000000 * gpsdp->fix.latitude; - } - if (isnan(gpsdp->fix.speed) == 0) { - speed = gpsdp->fix.speed; - } - if (isnan(gpsdp->fix.altitude) == 0) { - altitude = gpsdp->fix.altitude; - } - if (isnan(gpsdp->fix.time) == 0) { - gps_time = gpsdp->fix.time; - } - } - - RoadmapGpsd2NavigationListener - (status, gps_time, latitude, longitude, altitude, speed, steering); - - /* See demo app cgps.c in gpsd source distribution */ - /* Must build bit vector of which satellites are used */ - for (i = 0; i < MAXCHANNELS; i++) { - used[i] = false; - for (j = 0; j < gpsdp->satellites_used; j++) - if (gpsdp->used[j] == gpsdp->PRN[i]) - used[i] = true; - } - - for (i=0, s=1; i<MAX_POSSIBLE_SATS; i++) { - if (gpsdp->used[i]) { - (*RoadmapGpsd2SatelliteListener) - (s, // sequence - gpsdp->PRN[i], // id - gpsdp->elevation[i], // elevation - gpsdp->azimuth[i], // azimuth - (int)gpsdp->ss[i], // strength - gpsdp->used[i]); // active - s++; - } - } - (*RoadmapGpsd2SatelliteListener) (0, 0, 0, 0, 0, 0); - return 1; - #else - int got_navigation_data; - - int got_o = 0; - int got_q = 0; - char *reply[256]; int reply_count; --- 162,165 ---- *************** *** 255,258 **** --- 175,180 ---- double vdop = 0.0; + int gps_time = 0; + reply_count = roadmap_input_split (sentence, ',', reply, 256); *************** *** 485,488 **** return 0; - #endif } --- 407,410 ---- return 0; } + Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** roadmap_start.c 13 Jul 2010 05:52:39 -0000 1.160 --- roadmap_start.c 17 Aug 2010 18:57:10 -0000 1.161 *************** *** 101,104 **** --- 101,107 ---- #include "navigate/navigate_plugin.h" #endif + #ifdef HAVE_POI_PLUGIN + #include "poi/poi_plugin.h" + #endif #ifdef _WIN32 *************** *** 272,275 **** --- 275,288 ---- /** + * @brief get a string indicating current time + * @return the string, pointer to a static array (overwritten next call, don't free) + */ + char * roadmap_start_now() { + + return roadmap_time_get_date_hours_minutes (time(NULL)); + + } + + /** * @brief show a list of all active plugins. * This needs to be here, moving the roadmap_messagebox() call into roadmap_plugin.c would *************** *** 1060,1064 **** }; - static char const *RoadMapStartToolbar[] = { --- 1073,1076 ---- *************** *** 1271,1274 **** --- 1283,1294 ---- } + /** + * @brief GPS monitor : periodically provide information about reception, satellites, .. + * @param reception + * @param precision + * @param satellites + * @param activecount + * @param count + */ static void roadmap_start_gps_monitor (int reception, *************** *** 1348,1351 **** --- 1368,1376 ---- + /** + * @brief second part of startup, maybe window oriented. + * Note : not sure why this works across platforms if it may rely on windows + * being created already. + */ static void roadmap_start_window (void) { *************** *** 1427,1440 **** } - /** - * @brief get a string indicating current time - * @return the string, pointer to a static array (overwritten next call, don't free) - */ - char * roadmap_start_now() { - - return roadmap_time_get_date_hours_minutes (time(NULL)); - - } - static void roadmap_start_screen_configure (void) { roadgps_screen_configure(); --- 1452,1455 ---- *************** *** 1448,1451 **** --- 1463,1469 ---- int navigate_plugin_id = 0; #endif + #ifdef HAVE_POI_PLUGIN + int poi_plugin_id = 0; + #endif #ifdef HAVE_TRIP_PLUGIN int trip_plugin_id = 0; *************** *** 1458,1461 **** --- 1476,1482 ---- void roadmap_start_plugin_register (void) { + #ifdef HAVE_POI_PLUGIN + poi_plugin_id = poi_plugin_register (); + #endif #if 1 /* *************** *** 1622,1625 **** --- 1643,1647 ---- roadmap_osm_initialize(); + roadmap_factory_initialize(); roadmap_factory_keymap (RoadMapStartActions, RoadMapStartKeyBinding); *************** *** 1720,1725 **** #endif roadmap_config_save (0); ! roadmap_display_shutdown (); roadmap_gps_shutdown (); roadmap_log (ROADMAP_WARNING, "RoadMap exiting, time %s", roadmap_start_now()); } --- 1742,1753 ---- #endif roadmap_config_save (0); ! roadmap_screen_shutdown(); ! roadmap_display_shutdown (); roadmap_gps_shutdown (); + roadmap_factory_shutdown(); + roadmap_config_shutdown (); + roadmap_sprite_shutdown (); + roadmap_layer_shutdown (); + roadmap_path_shutdown (); roadmap_log (ROADMAP_WARNING, "RoadMap exiting, time %s", roadmap_start_now()); } |
From: Danny B. <dan...@us...> - 2010-08-17 18:46:03
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv21572 Modified Files: roadmap_scan.c Log Message: Add documentation (the previous comments looked obsolete). Index: roadmap_scan.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_scan.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_scan.c 2 Jul 2008 14:05:19 -0000 1.2 --- roadmap_scan.c 17 Aug 2010 18:45:50 -0000 1.3 *************** *** 1,4 **** ! /* roadmap_scan.c - a module to scan for files using path lists. ! * * LICENSE: * --- 1,3 ---- ! /* * LICENSE: * *************** *** 20,32 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * ! * ! * DESCRIPTION: ! * ! * The roadmap_scan_first() function returns a single directory path ! * where the given file exists. ! * ! * The roadmap_scan_next() function returns all successive directories ! * where to find the given file. */ --- 19,27 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /** ! * @file ! * @brief a module to scan for files using path lists. */ *************** *** 38,45 **** const char *roadmap_scan_next (const char *set, const char *name, const char *sequence) { - if (roadmap_path_is_full_path(name)) { --- 33,46 ---- + /** + * @brief returns all successive directories where to find the given file. + * @param set + * @param name + * @param sequence + * @return + */ const char *roadmap_scan_next (const char *set, const char *name, const char *sequence) { if (roadmap_path_is_full_path(name)) { *************** *** 76,80 **** } ! const char *roadmap_scan (const char *set, const char *name) { --- 77,86 ---- } ! /** ! * @brief returns a single directory path where the given file exists. ! * @param set ! * @param name ! * @return ! */ const char *roadmap_scan (const char *set, const char *name) { |
From: Danny B. <dan...@us...> - 2010-08-16 05:37:06
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv22781/unix Modified Files: roadmap_file.c Log Message: Cosmetic change Index: roadmap_file.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/unix/roadmap_file.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** roadmap_file.c 12 Jul 2008 13:54:56 -0000 1.21 --- roadmap_file.c 16 Aug 2010 05:36:58 -0000 1.22 *************** *** 112,118 **** /** ! * @brief ! * @param path ! * @param name */ int roadmap_file_exists (const char *path, const char *name) { --- 112,118 ---- /** ! * @brief check existence of a file ! * @param path full path name ! * @param name file name */ int roadmap_file_exists (const char *path, const char *name) { |
From: Danny B. <dan...@us...> - 2010-08-16 05:34:54
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv22509 Modified Files: roadmap_option.c Log Message: Cosmetic changes Index: roadmap_option.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_option.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** roadmap_option.c 25 Jun 2008 21:45:17 -0000 1.24 --- roadmap_option.c 16 Aug 2010 05:34:46 -0000 1.25 *************** *** 119,123 **** } ! int roadmap_verbosity (void) { --- 119,126 ---- } ! /** ! * @brief return the default verbosity ! * @return the default verbosity ! */ int roadmap_verbosity (void) { *************** *** 125,129 **** } ! char **roadmap_debug (void) { --- 128,135 ---- } ! /** ! * @brief return the current debug level ! * @return the current debug level ! */ char **roadmap_debug (void) { |
From: Danny B. <dan...@us...> - 2010-08-16 05:33:17
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv22323 Modified Files: roadmap_io.h roadmap_io.c Log Message: Add Android cases. Index: roadmap_io.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_io.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_io.h 25 Jul 2005 06:37:26 -0000 1.3 --- roadmap_io.h 16 Aug 2010 05:33:08 -0000 1.4 *************** *** 1,7 **** ! /* roadmap_file.h - a module to open/read/close a roadmap database file. ! * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. --- 1,7 ---- ! /* * LICENSE: * * Copyright 2002 Pascal F. Martin + * Copyright 2010 Danny Backx * * This file is part of RoadMap. *************** *** 20,24 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * * * DESCRIPTION: --- 20,28 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /** ! * @file ! * @brief roadmap_file.h - a module to open/read/close a roadmap database file. * * DESCRIPTION: *************** *** 49,52 **** --- 53,57 ---- #define ROADMAP_IO_PIPE 4 #define ROADMAP_IO_NULL 5 /* Bottomless pitt (i.e., no IO). */ + #define ROADMAP_IO_ANDROID 6 typedef struct { *************** *** 70,72 **** #endif // INCLUDE__ROADMAP_IO__H - --- 75,76 ---- Index: roadmap_io.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_io.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_io.c 25 Jul 2005 06:37:51 -0000 1.5 --- roadmap_io.c 16 Aug 2010 05:33:08 -0000 1.6 *************** *** 1,7 **** ! /* roadmap_io.c - a module to hide OS-specific IO operations. ! * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. --- 1,7 ---- ! /* * LICENSE: * * Copyright 2002 Pascal F. Martin + * Copyright 2010 Danny Backx * * This file is part of RoadMap. *************** *** 20,24 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * * * DESCRIPTION: --- 20,28 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /** ! * @file ! * @brief roadmap_io.c - a module to hide OS-specific IO operations. * * DESCRIPTION: *************** *** 52,55 **** --- 56,60 ---- case ROADMAP_IO_NULL: + case ROADMAP_IO_ANDROID: return 0; /* Cannot receive anything from there. */ } *************** *** 75,78 **** --- 80,84 ---- case ROADMAP_IO_NULL: + case ROADMAP_IO_ANDROID: return length; /* It's all done, since there is nothing to do. */ } *************** *** 102,105 **** --- 108,112 ---- case ROADMAP_IO_NULL: + case ROADMAP_IO_ANDROID: break; } *************** *** 134,137 **** --- 141,145 ---- case ROADMAP_IO_NULL: + case ROADMAP_IO_ANDROID: break; /* No reason to be any different from each other. */ } *************** *** 139,141 **** return 1; /* We did not find any difference. */ } - --- 147,148 ---- |
From: Danny B. <dan...@us...> - 2010-08-16 05:31:53
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv22020 Modified Files: roadmap_gps.h Log Message: Cosmetic changes Index: roadmap_gps.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_gps.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** roadmap_gps.h 7 May 2008 14:01:11 -0000 1.15 --- roadmap_gps.h 16 Aug 2010 05:31:45 -0000 1.16 *************** *** 1,4 **** ! /* roadmap_gps.h - GPS interface for the RoadMap application. ! * * LICENSE: * --- 1,3 ---- ! /* * LICENSE: * *************** *** 22,25 **** --- 21,29 ---- */ + /** + * @file + * @brief roadmap_gps.h - GPS interface for the RoadMap application. + */ + #ifndef INCLUDED__ROADMAP_GPS__H #define INCLUDED__ROADMAP_GPS__H |
From: Danny B. <dan...@us...> - 2010-08-16 05:22:13
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv20939 Modified Files: roadmap_factory.c roadmap_config.c roadmap_layer.c Log Message: Add shutdown functions in each of these modules. Also remove a return statement that prevented RoadMap from passing through initialisation more than once. Index: roadmap_config.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_config.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** roadmap_config.c 12 Feb 2009 17:54:46 -0000 1.31 --- roadmap_config.c 16 Aug 2010 05:22:04 -0000 1.32 *************** *** 3,7 **** * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. --- 3,7 ---- * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2008, 2010, Danny Backx. * * This file is part of RoadMap. *************** *** 1039,1040 **** --- 1039,1061 ---- } } + + /* + * @brief recursive helper function for cleanup + * @param p pointer to chain to be cleaned up + */ + static void roadmap_config_recursive_cleanup (RoadMapConfig *p) + { + if (p == 0) + return; + roadmap_config_recursive_cleanup(p->next); + free(p); + } + + /** + * @brief cleanup + */ + void roadmap_config_shutdown (void) + { + roadmap_config_recursive_cleanup(RoadMapConfigFiles); + RoadMapConfigFiles = NULL; + } Index: roadmap_factory.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_factory.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** roadmap_factory.c 30 Mar 2009 13:59:43 -0000 1.36 --- roadmap_factory.c 16 Aug 2010 05:22:04 -0000 1.37 *************** *** 3,6 **** --- 3,7 ---- * * Copyright 2002 Pascal F. Martin + * Copyright 2010 Danny Backx * * This file is part of RoadMap. *************** *** 1013,1014 **** --- 1014,1034 ---- } } + + /** + * @brief initialize + */ + void roadmap_factory_initialize (void) + { + } + + /** + * @brief cleanup + */ + void roadmap_factory_shutdown (void) + { + RoadMapFactoryBindings = NULL; + RoadMapFactoryMenuPopupCount = 0; + RoadMapFactoryBindings = NULL; + RoadMapFactoryKeyLength = 0; + RoadMapFactoryPopupList = NULL; + } Index: roadmap_layer.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_layer.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** roadmap_layer.c 11 Jul 2010 16:46:50 -0000 1.24 --- roadmap_layer.c 16 Aug 2010 05:22:04 -0000 1.25 *************** *** 3,7 **** * * Copyright 2003 Pascal F. Martin ! * Copyright (c) 2008, 2009, Danny Backx. * * This file is part of RoadMap. --- 3,7 ---- * * Copyright 2003 Pascal F. Martin ! * Copyright (c) 2008, 2009, 2010, Danny Backx. * * This file is part of RoadMap. *************** *** 230,237 **** ! static int roadmap_layer_is_visible (RoadMapLayer *layer) { ! ! return roadmap_math_declutter ! (roadmap_config_get_integer (&layer->declutter)); } --- 230,238 ---- ! static int roadmap_layer_is_visible (RoadMapLayer *layer) ! { ! int d = roadmap_config_get_integer (&layer->declutter), ! r = roadmap_math_declutter (d); ! return r; } *************** *** 313,317 **** } ! void roadmap_layer_adjust (void) { --- 314,320 ---- } ! /** ! * @brief ! */ void roadmap_layer_adjust (void) { *************** *** 322,326 **** RoadMapLayer *layer; - if (RoadMapLayerCurrentClass == NULL) return; --- 325,328 ---- *************** *** 738,742 **** "class %s (set %s) redefined in %s", class_name, set->name, class_file); ! return; } --- 740,748 ---- "class %s (set %s) redefined in %s", class_name, set->name, class_file); ! /* ! * Removed the return statement to cope with multiple passes. ! * ! * return; ! */ } *************** *** 1124,1125 **** --- 1130,1140 ---- return roadmap_config_get_integer (&TheLayer->speed); } + + void roadmap_layer_shutdown (void) + { + RoadMapNavigationModeCount = 0; + RoadMapLayerCurrentClass = NULL; + RoadMapMaxUsedPen = 1; + RoadMapMaxDefinedLayers = 1; + RoadMapLayerActiveSet = NULL; + } |
From: Danny B. <dan...@us...> - 2010-08-16 05:13:49
|
Update of /cvsroot/roadmap/roadmap/src/unix In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19935/unix Modified Files: roadmap_path.c Log Message: Android changes : add a roadmap_path_shutdown(), and (conditionally compiled) remove the code that requires relies on the ftw() function not present on Android. Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/unix/roadmap_path.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** roadmap_path.c 30 Mar 2009 14:00:47 -0000 1.30 --- roadmap_path.c 16 Aug 2010 05:13:40 -0000 1.31 *************** *** 1,9 **** ! /** ! * @brief roadmap_path.c - a module to handle file path in an OS independent way. ! * * LICENSE: * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2008, Danny Backx. * * This file is part of RoadMap. --- 1,7 ---- ! /* * LICENSE: * * Copyright 2002 Pascal F. Martin ! * Copyright (c) 2008, 2010, Danny Backx. * * This file is part of RoadMap. *************** *** 22,26 **** * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! * */ --- 20,28 ---- * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! /** ! * @file ! * @brief roadmap_path.c - (Unix version of) a module to handle file path in an OS independent way. */ *************** *** 35,39 **** --- 37,45 ---- #include <unistd.h> #include <dirent.h> + #ifndef ANDROID #include <ftw.h> + #else + #include <android/log.h> + #endif #include "roadmap.h" *************** *** 68,77 **** static RoadMapPathList RoadMapPaths = NULL; ! ! /* This list exist because the user context is a special case * that we want to handle in a standard way. */ static const char *RoadMapPathUser[] = { "~/.roadmap", NULL --- 74,90 ---- static RoadMapPathList RoadMapPaths = NULL; + static const char *RoadMapUser = NULL; + static const char *RoadMapTrips = NULL; + static char *RoadMapPathHome = NULL; + static const char *RoadMapPathEmptyList = NULL; ! /** ! * @brief This list exist because the user context is a special case * that we want to handle in a standard way. */ static const char *RoadMapPathUser[] = { + #ifdef ANDROID + "/sdcard/roadmap", + #endif "~/.roadmap", NULL *************** *** 80,84 **** ! /* The hardcoded path for configuration files (the "config" path). * (Note that the user directory (~/.roadmap) does not appear here * as it is implicitely used by the callers--see above.) --- 93,98 ---- ! /** ! * @brief The hardcoded path for configuration files (the "config" path). * (Note that the user directory (~/.roadmap) does not appear here * as it is implicitely used by the callers--see above.) *************** *** 88,92 **** ROADMAP_CONFIG_DIR, #endif ! #ifdef QWS /* This is for the Sharp Zaurus PDA.. */ "/opt/QtPalmtop/share/roadmap", --- 102,110 ---- ROADMAP_CONFIG_DIR, #endif ! #if defined(ANDROID) ! "/sdcard/roadmap", ! "/data/roadmap", ! "/data/data/net.sourceforge.projects.roadmap", ! #elif defined(QWS) /* This is for the Sharp Zaurus PDA.. */ "/opt/QtPalmtop/share/roadmap", *************** *** 150,153 **** --- 168,176 ---- /* The default path for the icon files (the "icons" path): */ static const char *RoadMapPathIcons[] = { + #ifdef ANDROID + "/sdcard/roadmap/icons", + "/data/roadmap/icons", + "/data/data/net.sourceforge.projects.roadmap/icons", + #else "~/.roadmap/pixmaps", #ifdef ROADMAP_CONFIG_DIR *************** *** 156,159 **** --- 179,183 ---- "/usr/local/share/pixmaps", "/usr/share/pixmaps", + #endif NULL }; *************** *** 180,186 **** static RoadMapPathList roadmap_path_list_create(const char *name, const char **items, ! const char *preferred) { ! ! RoadMapPathList new_path; char *p; --- 204,209 ---- static RoadMapPathList roadmap_path_list_create(const char *name, const char **items, ! const char *preferred) ! { RoadMapPathList new_path; char *p; *************** *** 231,235 **** */ static RoadMapPathList roadmap_path_find (const char *name, int init_ok) { - RoadMapPathList cursor; --- 254,257 ---- *************** *** 328,333 **** static const char *roadmap_path_home (void) { - static char *RoadMapPathHome = NULL; - if (RoadMapPathHome == NULL) { --- 350,353 ---- *************** *** 343,350 **** const char *roadmap_path_user (void) { - static const char *RoadMapUser = NULL; - if (RoadMapUser == NULL) { RoadMapUser = roadmap_path_first ("user"); --- 363,372 ---- + /** + * @brief Determine the path for user files, create if necessary + * @return the path + */ const char *roadmap_path_user (void) { if (RoadMapUser == NULL) { RoadMapUser = roadmap_path_first ("user"); *************** *** 357,362 **** const char *roadmap_path_trips (void) { - static const char *RoadMapTrips = NULL; - if (RoadMapTrips == NULL) { --- 379,382 ---- *************** *** 397,400 **** --- 417,421 ---- /* Path lists operations. -------------------------------------------------- */ + #ifndef ANDROID /* bah. globals. too bad ftw() doesn't take a "void *cookie" argument */ static RoadMapList *RoadMapPathFTWDirList; *************** *** 422,427 **** return 0; } ! static void roadmap_path_addlist(RoadMapList *list, char *path) { int len; len = strlen(path); --- 443,451 ---- return 0; } + #endif ! static void roadmap_path_addlist(RoadMapList *list, char *path) ! { ! #ifndef ANDROID int len; len = strlen(path); *************** *** 432,436 **** ftw(path, roadmap_path_ftw_cb, 30); free(path); ! } else { RoadMapPathItem *pathitem; pathitem = malloc(sizeof(RoadMapPathItem)); --- 456,476 ---- ftw(path, roadmap_path_ftw_cb, 30); free(path); ! } else ! { ! RoadMapPathItem *pathitem; ! pathitem = malloc(sizeof(RoadMapPathItem)); ! roadmap_check_allocated(pathitem); ! ! pathitem->path = path; ! roadmap_list_append(list, &pathitem->link); ! } ! #else ! /* Android : ignore the /... stuff */ ! int len; ! len = strlen(path); ! if (len > 4 && strcmp(&path[len-4], "/...") == 0) { ! path[len-4] = '\0'; ! } ! { RoadMapPathItem *pathitem; pathitem = malloc(sizeof(RoadMapPathItem)); *************** *** 440,447 **** roadmap_list_append(list, &pathitem->link); } } void roadmap_path_set (const char *name, const char *path) { - const char *item; const char *next_item; --- 480,492 ---- roadmap_list_append(list, &pathitem->link); } + #endif } + /** + * @brief + * @param name + * @param path + */ void roadmap_path_set (const char *name, const char *path) { const char *item; const char *next_item; *************** *** 533,536 **** --- 578,586 ---- + /** + * @brief select the last element from a path + * @param name use this named path + * @return the element requested + */ const char *roadmap_path_last (const char *name) { *************** *** 550,554 **** } ! const char *roadmap_path_previous (const char *name, const char *current) { --- 600,609 ---- } ! /** ! * @brief called after roadmap_path_last, return previous elements of the list ! * @param name keyword ! * @param current the previous path ! * @return the previous one ! */ const char *roadmap_path_previous (const char *name, const char *current) { *************** *** 571,576 **** ! /* This function always return a hardcoded default location, * which is the recommended location for these objects. */ const char *roadmap_path_preferred (const char *name) { --- 626,634 ---- ! /** ! * @brief This function always return a hardcoded default location, * which is the recommended location for these objects. + * @param name the name of the path + * @return a path name */ const char *roadmap_path_preferred (const char *name) { *************** *** 594,600 **** } - - static char *RoadMapPathEmptyList = NULL; - /** * @brief create a list of files matching the specified path and extension --- 652,655 ---- *************** *** 681,685 **** } ! const char *roadmap_path_search_icon (const char *name) { --- 736,744 ---- } ! /** ! * @brief find the absolute path for an icon, keep the name convention in mind ! * @param name the name of this icon (e.g. "gps") ! * @return full path name (e.g. /sdcard/roadmap/icons/rm_gps.png) ! */ const char *roadmap_path_search_icon (const char *name) { *************** *** 729,730 **** --- 788,812 ---- } + /** + * @brief recursively clean up a linked list + */ + static void roadmap_path_cleanup_recursive (RoadMapPathList p) + { + if (p == NULL) + return; + roadmap_path_cleanup_recursive (p->next); + free(p); + } + + /** + * @brief cleanup + */ + void roadmap_path_shutdown (void) + { + roadmap_path_cleanup_recursive (RoadMapPaths); + RoadMapPaths = NULL; + + RoadMapUser = NULL; // this only points into a structure, free() happens elsewhere + RoadMapTrips = NULL; // this only points into a structure, free() happens elsewhere + RoadMapPathHome = NULL; // getenv() result or a constant : don't free + } |
From: Danny B. <dan...@us...> - 2010-08-16 05:06:05
|
Update of /cvsroot/roadmap/roadmap/src In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv19057 Modified Files: roadmap_sprite.c Log Message: Add roadmap_sprite_shutdown(). Index: roadmap_sprite.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_sprite.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** roadmap_sprite.c 19 Feb 2009 18:15:29 -0000 1.22 --- roadmap_sprite.c 16 Aug 2010 05:05:56 -0000 1.23 *************** *** 3,6 **** --- 3,7 ---- * * Copyright 2002 Pascal F. Martin + * Copyright 2010 Danny Backx * * This file is part of RoadMap. *************** *** 1025,1026 **** --- 1026,1039 ---- } + + /** + * @brief cleanup + */ + void roadmap_sprite_shutdown (void) + { + RoadMapSpriteList = NULL; + RoadMapSpriteDefault = NULL; + RoadMapSpritePointCount = 0; + RoadMapSpritePoints = NULL; + RoadMapSpriteFile = NULL; + } |