[cairo-commit] roadster/src db.c, 1.28, 1.29 glyph.c, 1.7, 1.8 glyph.h, 1.4, 1.5 location.c, 1.7, 1.8 location.h, 1.5, 1.6 locationset.c, 1.14, 1.15 locationset.h, 1.8, 1.9 main.c, 1.25, 1.26 mainwindow.c, 1.42, 1.43 map.c, 1.46, 1.47 map_draw_gdk.c, 1.19, 1.20 point.c, 1.7, 1.8 pointstring.c, 1.7, 1.8 search.c, 1.8, 1.9 search.h, 1.3, 1.4 search_city.c, 1.1, 1.2 search_location.c, 1.13, 1.14 search_road.c, 1.24, 1.25 searchwindow.c, 1.23, 1.24 searchwindow.h, 1.5, 1.6 track.c, 1.7, 1.8

Ian McIntosh commit at pdx.freedesktop.org
Mon Sep 26 06:57:16 PDT 2005


Committed by: ian

Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv5123/src

Modified Files:
	db.c glyph.c glyph.h location.c location.h locationset.c 
	locationset.h main.c mainwindow.c map.c map_draw_gdk.c point.c 
	pointstring.c search.c search.h search_city.c 
	search_location.c search_road.c searchwindow.c searchwindow.h 
	track.c 
Log Message:
	* data/help/roadster-help.xml:
	* data/help/legal.xml:
	* data/help/figures/window_layout.png: Added the basics of a help system.

	* src/db.c: Removed debug stuff.
	* src/glyph.c: Added glyph drawing (via gdk/pixbufs).
	* src/location.c: Added location attribute name inserting / retrieving.
	* src/locationset.c: Added 'icon' field.
	* src/main.c: Add some debug code to insert test POI data.
	* src/search.c: Removed knowledge of search result type icons.  Now each type can provide its own.
	* src/search_*.c: Provide an icon suggestion along with results.
	* src/map.c:
	* src/map_draw_gdk.c: Re-enable / fix POI drawing.
	* src/point.c:
	* src/pointstring.c:
	* src/locationset.c: Fixed area_size of chunk allocators.	


Index: db.c
===================================================================
RCS file: /cvs/cairo/roadster/src/db.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- db.c	25 Sep 2005 19:02:37 -0000	1.28
+++ db.c	26 Sep 2005 13:57:13 -0000	1.29
@@ -131,6 +131,7 @@
 	if(nResult != MYSQL_RESULT_SUCCESS) {
 		gint nErrorNumber = mysql_errno(g_pDB->pMySQLConnection);
 
+		// show an error (except for duplicate key 'error', which is common)
 		if(nErrorNumber != MYSQL_ERROR_DUPLICATE_KEY) {
 			g_warning("db_query: %d:%s (SQL: %s)\n", mysql_errno(g_pDB->pMySQLConnection), mysql_error(g_pDB->pMySQLConnection), pszSQL);
 		}
@@ -632,14 +633,6 @@
 		" PRIMARY KEY (ID),"
 		" UNIQUE INDEX (Name));", NULL);
 
-	gchar* pszSQL = g_strdup_printf("INSERT INTO LocationAttributeName SET ID=%d, Name='name'", LOCATION_ATTRIBUTE_ID_NAME);
-	db_query(pszSQL, NULL);
-        g_free(pszSQL);
-
-	pszSQL = g_strdup_printf("INSERT INTO LocationAttributeName SET ID=%d, Name='address'", LOCATION_ATTRIBUTE_ID_ADDRESS);
-	db_query(pszSQL, NULL);
-        g_free(pszSQL);
-
 	// Location Attribute Value
 	db_query("CREATE TABLE IF NOT EXISTS LocationAttributeValue("
 		// a unique ID for the value

Index: glyph.c
===================================================================
RCS file: /cvs/cairo/roadster/src/glyph.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- glyph.c	25 Sep 2005 19:02:37 -0000	1.7
+++ glyph.c	26 Sep 2005 13:57:13 -0000	1.8
@@ -106,6 +106,8 @@
 
 glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight)
 {
+	g_print("glyph.c: loading %s\n", pszName);
+
 	// NOTE: We always return something!
 	glyph_t* pNewGlyph = g_new0(glyph_t, 1);
 
@@ -129,16 +131,15 @@
 	return pGlyph->pPixbuf;
 }
 
-void glyph_draw_centered(cairo_t* pCairo, gint nGlyphHandle, gdouble fX, gdouble fY)
+void glyph_draw_centered(glyph_t* pGlyph, GdkDrawable* pTargetDrawable, GdkGC* pGC, gdouble fX, gdouble fY)
 {
-//     GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size("/home/yella/Desktop/interstate-sign.svg", 32, 32, NULL);
-//     gdk_draw_pixbuf(GTK_WIDGET(g_MainWindow.pDrawingArea)->window,
-//                     GTK_WIDGET(g_MainWindow.pDrawingArea)->style->fg_gc[GTK_WIDGET_STATE(g_MainWindow.pDrawingArea)],
-//                     pixbuf,
-//                     0,0,                        // src
-//                     100,100,                    // x/y to draw to
-//                     32,32,                      // width/height
-//                     GDK_RGB_DITHER_NONE,0,0);   // no dithering
+	gdk_draw_pixbuf(pTargetDrawable,
+					pGC,
+					pGlyph->pPixbuf,
+					0,0,                        		// src
+					(gint)(fX - (pGlyph->nWidth/2)), (gint)(fY - (pGlyph->nHeight/2)),                 // x/y to draw to
+					pGlyph->nWidth, pGlyph->nHeight,    // width/height
+					GDK_RGB_DITHER_NONE,0,0);   		// no dithering
 }
 
 void glyph_free(glyph_t* pGlyph)

Index: glyph.h
===================================================================
RCS file: /cvs/cairo/roadster/src/glyph.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- glyph.h	25 Sep 2005 19:02:37 -0000	1.4
+++ glyph.h	26 Sep 2005 13:57:13 -0000	1.5
@@ -40,6 +40,7 @@
 glyph_t* glyph_load_at_size(const gchar* pszName, gint nMaxWidth, gint nMaxHeight);
 GdkPixbuf* glyph_get_pixbuf(const glyph_t* pGlyph);
 //void glyph_draw_centered(cairo_t* pCairo, gint nGlyphHandle, gdouble fX, gdouble fY);
+void glyph_draw_centered(glyph_t* pGlyph, GdkDrawable* pTargetDrawable, GdkGC* pGC, gdouble fX, gdouble fY);
 void glyph_deinit(void);
 
 #endif

Index: location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/location.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- location.c	25 Sep 2005 19:02:37 -0000	1.7
+++ location.c	26 Sep 2005 13:57:13 -0000	1.8
@@ -34,7 +34,7 @@
 void location_init()
 {
 	g_Location.pLocationChunkAllocator = g_mem_chunk_new("ROADSTER locations",
-			sizeof(location_t), 1000, G_ALLOC_AND_FREE);
+			sizeof(location_t), sizeof(location_t) * 1000, G_ALLOC_AND_FREE);
 	g_return_if_fail(g_Location.pLocationChunkAllocator != NULL);
 }
 
@@ -85,20 +85,77 @@
 	return TRUE;
 }
 
+gboolean location_insert_attribute_name(const gchar* pszName, gint* pnReturnID)
+{
+	g_assert(pszName != NULL);
+
+	gchar* pszSafeName = db_make_escaped_string(pszName);
+	gchar* pszSQL = g_strdup_printf(
+		"INSERT INTO LocationAttributeName"
+		" SET Name='%s';", 
+		pszSafeName
+		);
+
+	gboolean bResult = db_query(pszSQL, NULL);
+	g_free(pszSQL);
+	db_free_escaped_string(pszSafeName);
+
+	// inserted?
+	if(bResult == TRUE) {
+		if(pnReturnID) {
+			*pnReturnID = db_get_last_insert_id();
+			g_print("returning %d\n", *pnReturnID);
+		}
+		return TRUE;
+	}
+	else {
+		// couldn't insert?  try to find existing
+		if(location_lookup_attribute_name(pszName, pnReturnID)) {
+			return TRUE;
+		}
+		return FALSE;
+	}
+}
+
+gboolean location_lookup_attribute_name(const gchar* pszName, gint* pnReturnID)
+{
+	g_assert(pszName != NULL);
+
+	gchar* pszSafeName = db_make_escaped_string(pszName);
+	gchar* pszSQL = g_strdup_printf("SELECT ID FROM LocationAttributeName WHERE Name='%s';", pszSafeName);
+
+	db_resultset_t* pResultSet = NULL;
+
+	db_query(pszSQL, &pResultSet);
+	g_free(pszSQL);
+	db_free_escaped_string(pszSafeName);
+
+	db_row_t aRow;
+	if(aRow = db_fetch_row(pResultSet)) {
+		if(pnReturnID) {
+			*pnReturnID = atoi(aRow[0]);
+		}
+		return TRUE;
+	}
+	return FALSE;
+}
+
 gboolean location_insert_attribute(gint nLocationID, gint nAttributeID, const gchar* pszValue, gint* pnReturnID)
 {
 	g_assert(nLocationID != 0);
 	g_assert(nAttributeID != 0);
 	g_assert(pszValue != NULL);
 
+	gchar* pszSafeValue = db_make_escaped_string(pszValue);
 	gchar* pszSQL = g_strdup_printf(
 		"INSERT INTO LocationAttributeValue"
 		" SET LocationID=%d, AttributeNameID=%d, Value='%s';", 
-		nLocationID, nAttributeID, pszValue
+		nLocationID, nAttributeID, pszSafeValue
 		);
 
 	db_query(pszSQL, NULL);
 	g_free(pszSQL);
+	db_free_escaped_string(pszSafeValue);
 
 	if(pnReturnID) {
 		*pnReturnID = db_get_last_insert_id();

Index: location.h
===================================================================
RCS file: /cvs/cairo/roadster/src/location.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- location.h	25 Sep 2005 19:02:37 -0000	1.5
+++ location.h	26 Sep 2005 13:57:13 -0000	1.6
@@ -28,7 +28,7 @@
 
 G_BEGIN_DECLS
 
-#define LOCATION_ATTRIBUTE_ID_NAME	(1)		// "name" must be #1 in the DB
+#define LOCATION_ATTRIBUTE_ID_NAME		(1)		// "name" must be #1 in the DB
 #define LOCATION_ATTRIBUTE_ID_ADDRESS	(2)		// "address" must be #2 in the DB
 #define LOCATION_ATTRIBUTE_ID________	(3)		// "" must be #3 in the DB
 

Index: locationset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- locationset.c	25 Sep 2005 19:02:37 -0000	1.14
+++ locationset.c	26 Sep 2005 13:57:13 -0000	1.15
@@ -32,6 +32,7 @@
 #include "locationset.h"
 #include "db.h"
 #include "util.h"
+#include "searchwindow.h"		// for defines about glyph size
 
 struct {
 	GPtrArray* pLocationSetArray;	// an array of locationsets
@@ -47,7 +48,7 @@
 
 	// create memory allocator
 	g_LocationSet.pLocationSetChunkAllocator = g_mem_chunk_new("ROADSTER locationsets",
-			sizeof(locationset_t), 20, G_ALLOC_AND_FREE);
+			sizeof(locationset_t), sizeof(locationset_t) * 20, G_ALLOC_AND_FREE);
 	g_return_if_fail(g_LocationSet.pLocationSetChunkAllocator != NULL);
 }
 
@@ -66,14 +67,17 @@
 	return TRUE;
 }
 
-gboolean locationset_insert(const gchar* pszName, gint* pnReturnID)
+gboolean locationset_insert(const gchar* pszName, const gchar* pszIconName, gint* pnReturnID)
 {
 	g_assert(pszName != NULL);
+	g_assert(pszIconName != NULL);
 	g_assert(pnReturnID != NULL);
 	g_assert(*pnReturnID == 0);
 
 	gchar* pszSafeName = db_make_escaped_string(pszName);
-	gchar* pszSQL = g_strdup_printf("INSERT INTO LocationSet SET Name='%s'", pszSafeName);
+	gchar* pszSafeIconName = db_make_escaped_string(pszIconName);
+	gchar* pszSQL = g_strdup_printf("INSERT INTO LocationSet SET Name='%s', IconName='%s'", pszSafeName, pszSafeIconName);
+	db_free_escaped_string(pszSafeIconName);
 	db_free_escaped_string(pszSafeName);
 
 	// create query SQL
@@ -81,6 +85,7 @@
 	g_free(pszSQL);
 
 	*pnReturnID = db_get_last_insert_id();
+	g_assert(*pnReturnID > 0);
 	return TRUE;
 }
 
@@ -100,6 +105,8 @@
 			pNewLocationSet->nID = atoi(aRow[0]);
 			pNewLocationSet->pszName = g_strdup(aRow[1]);
 			pNewLocationSet->pszIconName = g_strdup(aRow[2]);
+			pNewLocationSet->pGlyph = glyph_load_at_size(pNewLocationSet->pszIconName, SEARCHWINDOW_SEARCH_RESULT_GLYPH_WIDTH, SEARCHWINDOW_SEARCH_RESULT_GLYPH_HEIGHT);
+			pNewLocationSet->pMapGlyph = glyph_load_at_size(pNewLocationSet->pszIconName, 16, 16);
 			pNewLocationSet->nLocationCount = atoi(aRow[3]);
 
 			// Add the new set to both data structures

Index: locationset.h
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- locationset.h	25 Sep 2005 19:02:37 -0000	1.8
+++ locationset.h	26 Sep 2005 13:57:13 -0000	1.9
@@ -27,6 +27,7 @@
 G_BEGIN_DECLS
 
 #include "map.h"
+#include "glyph.h"
 
 // typedef struct locationsetstyle {
 //     // icon?
@@ -42,13 +43,15 @@
 	gint nLocationCount;
 	gboolean bVisible;		// user has chosen to view these
 //	locationsetstyle_t Style;
+	glyph_t* pGlyph;
+	glyph_t* pMapGlyph;
 } locationset_t;
 
 void locationset_init(void);
 void locationset_load_locationsets(void);
 const GPtrArray* locationset_get_array(void);
 gboolean locationset_find_by_id(gint nLocationSetID, locationset_t** ppLocationSet);
-gboolean locationset_insert(const gchar* pszName, gint* pnReturnID);
+gboolean locationset_insert(const gchar* pszName, const gchar* pszIconName, gint* pnReturnID);
 void locationset_set_visible(locationset_t* pLocationSet, gboolean bVisible);
 gboolean locationset_is_visible(locationset_t* pLocationSet);
 

Index: main.c
===================================================================
RCS file: /cvs/cairo/roadster/src/main.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- main.c	25 Sep 2005 19:02:37 -0000	1.25
+++ main.c	26 Sep 2005 13:57:13 -0000	1.26
@@ -58,13 +58,42 @@
 	if(!main_init())
 		return 1;
 
-// Insert some POI for testing...
-/*
-	gint nNewLocationSetID = 0;
-	locationset_insert("Coffee Shops", &nNewLocationSetID);
+	g_print("Running %s\n", g_thread_supported() ? "multi-threaded" : "single-threaded");
+
+	gui_run();
+	main_deinit();
+
+	return 0;
+}
 
+void main_debug_insert_test_data()
+{
+	//
+	// New POI Attributes 'name' and 'address'
+	//
+
+#if 0	// only run with this enabled once ;)
+	gint nNameAttributeID = 0;
+	location_insert_attribute_name("name", &nNameAttributeID);
+	g_assert(nNameAttributeID == LOCATION_ATTRIBUTE_ID_NAME);
+
+	gint nAddressAttributeID = 0;
+	location_insert_attribute_name("address", &nAddressAttributeID);
+	g_assert(nAddressAttributeID == LOCATION_ATTRIBUTE_ID_ADDRESS);
+
+	// and 'review'
+	gint nAttributeIDReview = 0;
+	location_insert_attribute_name("review", &nAttributeIDReview);
+
+	//
+	// New POI Type
+	//
+	gint nNewLocationSetID = 0;
 	gint nNewLocationID;
 
+	locationset_insert("Coffee Shops", "coffee-shops", &nNewLocationSetID);
+
+	// New POI
 	mappoint_t pt;
 	pt.fLatitude = 42.37382;
 	pt.fLongitude = -71.10054;
@@ -72,22 +101,32 @@
 	location_insert(nNewLocationSetID, &pt, &nNewLocationID);
 	location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "1369 Coffee House", NULL);
 	location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_ADDRESS, "1369 Cambridge Street\nCambridge, MA, 02141", NULL);
+	location_insert_attribute(nNewLocationID, nAttributeIDReview, "1369 Coffee House (specifically, the one on Mass Ave) has a special place in my heart; it's sort of my office away from the office, or my vacation home away from my tiny Central Square rented home. It's cozy. It's hip.", NULL);
 
+	// New POI
 	pt.fLatitude = 42.36650;
 	pt.fLongitude = -71.10554;
 	nNewLocationID = 0;
 	location_insert(nNewLocationSetID, &pt, &nNewLocationID);
 	location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "1369 Coffee House", NULL);
 	location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_ADDRESS, "757 Massachusetts Avenue\nCambridge, MA 02139", NULL);
-*/
-	g_print("Running %s\n", g_thread_supported() ? "multi-threaded" : "single-threaded");
+	location_insert_attribute(nNewLocationID, nAttributeIDReview, "Don't know if I've ever been to the Central Square version, but I've tried 1369 at Inman Square three times and will not go back. I drink regular coffee and am incredulous at how poorly 1369 serves it. Most real coffee drinkers have specific preferences for their sugar and milk and know that the sugar needs to go in first in order for it to dissolve, but 1369 has the milk and cream behind the counter and the sugar at the condiments bar. I could also taste the filthiness of the urn in each cup. Cool enough crowd, good location, but not for truly down-to-earth folks.", NULL);
 
-	gui_run();
-	main_deinit();
+	nNewLocationSetID = 0;
+	locationset_insert("Restaurants", "restaurants", &nNewLocationSetID);
 
-	return 0;
+	// New POI (Anna's)
+	pt.fLatitude = 42.38821;
+	pt.fLongitude = -71.11799;
+	nNewLocationID = 0;
+	location_insert(nNewLocationSetID, &pt, &nNewLocationID);
+	location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_NAME, "Anna's Taqueria", NULL);
+	location_insert_attribute(nNewLocationID, LOCATION_ATTRIBUTE_ID_ADDRESS, "822 Somerville Avenue\nCambridge, MA 02140", NULL);
+	location_insert_attribute(nNewLocationID, nAttributeIDReview, "Anna's kicks ass. Some of the best Mexican food I've ever had, and I've been to Mexico. You won't get better Mexican food than this anywhere in a day's drive.", NULL);
+#endif
 }
 
+
 gboolean main_init(void)
 {
 #ifdef USE_GNOME_VFS
@@ -129,6 +168,12 @@
 	g_print("initializing db\n");
 	db_init();
 
+	g_print("connecting to db\n");
+	gboolean bConnected = db_connect(NULL, NULL, NULL, "");
+
+	g_print("creating database tables\n");
+	db_create_tables();
+
 	g_print("initializing locationsets\n");
 	locationset_init();
 
@@ -138,11 +183,7 @@
 	g_print("initializing animator\n");
 	animator_init();
 
-	g_print("connecting to db\n");
-	gboolean bConnected = db_connect(NULL, NULL, NULL, "");
-
-	g_print("creating database tables\n");
-	db_create_tables();
+	main_debug_insert_test_data();
 
 	// Load location sets from DB.  This is "coffee shops", "ATMs", etc.
 	locationset_load_locationsets();

Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- mainwindow.c	25 Sep 2005 19:02:37 -0000	1.42
+++ mainwindow.c	26 Sep 2005 13:57:13 -0000	1.43
@@ -353,7 +353,7 @@
 	GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pStatusbar, GTK_VBOX, "statusbar");
 	GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pSidebox, GTK_WIDGET, "mainwindowsidebox");
 	GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pSidebarNotebook, GTK_NOTEBOOK, "sidebarnotebook");
-	GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pContentBox, GTK_HBOX, "mainwindowcontentsbox");
+	GLADE_LINK_WIDGET(pGladeXML, g_MainWindow.pContentBox, GTK_VBOX, "mainwindowcontentsbox");
 
 
 	// Zoom controls
@@ -513,12 +513,15 @@
 		gchar* pszName = g_strdup_printf("<small>%s</small>", pLocationSet->pszName);
 		gchar* pszCount = g_strdup_printf("<small><small>(%d)</small></small>", pLocationSet->nLocationCount);
 
+		GdkPixbuf* pPixbuf = glyph_get_pixbuf(pLocationSet->pGlyph);
+
 		gtk_list_store_append(g_MainWindow.pLocationSetsListStore, &iter);
 		gtk_list_store_set(g_MainWindow.pLocationSetsListStore, &iter, 
 						   LOCATIONSETLIST_COLUMN_NAME, pszName, 
 						   LOCATIONSETLIST_COLUMN_ENABLED, TRUE,
 						   LOCATIONSETLIST_COLUMN_ID, pLocationSet->nID,
 						   LOCATIONSETLIST_COLUMN_COUNT, pszCount,
+						   LOCATIONSETLIST_COLUMN_PIXBUF, pPixbuf,
 						   -1);
 		g_free(pszName);
 		g_free(pszCount);
@@ -1338,7 +1341,9 @@
 	// XXX: current there are no tools!
 	mainwindow_setup_selected_tool();
 }
-#define ENABLE_DRAW_LIVE_LABELS
+
+//#define ENABLE_DRAW_LIVE_LABELS
+
 void mainwindow_draw_map(gint nDrawFlags)
 {
 #ifdef ENABLE_DRAW_LIVE_LABELS

Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- map.c	25 Sep 2005 19:02:37 -0000	1.46
+++ map.c	26 Sep 2005 13:57:13 -0000	1.47
@@ -685,27 +685,32 @@
 	g_return_val_if_fail(pMap != NULL, FALSE);
 	g_return_val_if_fail(pRect != NULL, FALSE);
 
-	if(map_get_zoomlevel(pMap) < MIN_ZOOM_LEVEL_FOR_LOCATIONS) {
-		return TRUE;
-	}
+//     if(map_get_zoomlevel(pMap) < MIN_ZOOM_LEVEL_FOR_LOCATIONS) {
+//         return TRUE;
+//     }
 
 	TIMER_BEGIN(mytimer, "BEGIN Locations LOAD");
 
 	// generate SQL
 	gchar* pszSQL;
+	gchar azCoord1[20], azCoord2[20], azCoord3[20], azCoord4[20], azCoord5[20], azCoord6[20], azCoord7[20], azCoord8[20];
 	pszSQL = g_strdup_printf(
 		"SELECT Location.ID, Location.LocationSetID, AsBinary(Location.Coordinates), LocationAttributeValue_Name.Value"	// LocationAttributeValue_Name.Value is the "Name" field of this Location
 		" FROM Location"
 		" LEFT JOIN LocationAttributeValue AS LocationAttributeValue_Name ON (LocationAttributeValue_Name.LocationID=Location.ID AND LocationAttributeValue_Name.AttributeNameID=%d)"
 		" WHERE"
-		" MBRIntersects(GeomFromText('Polygon((%f %f,%f %f,%f %f,%f %f,%f %f))'), Coordinates)",
+		" MBRIntersects(GeomFromText('Polygon((%s %s,%s %s,%s %s,%s %s,%s %s))'), Coordinates)",
 		LOCATION_ATTRIBUTE_ID_NAME,	// attribute ID for 'name'
-		pRect->A.fLatitude, pRect->A.fLongitude, 	// upper left
-		pRect->A.fLatitude, pRect->B.fLongitude, 	// upper right
-		pRect->B.fLatitude, pRect->B.fLongitude, 	// bottom right
-		pRect->B.fLatitude, pRect->A.fLongitude, 	// bottom left
-		pRect->A.fLatitude, pRect->A.fLongitude		// upper left again
-		);
+		// upper left
+		g_ascii_dtostr(azCoord1, 20, pRect->A.fLatitude), g_ascii_dtostr(azCoord2, 20, pRect->A.fLongitude), 
+		// upper right
+		g_ascii_dtostr(azCoord3, 20, pRect->A.fLatitude), g_ascii_dtostr(azCoord4, 20, pRect->B.fLongitude), 
+		// bottom right
+		g_ascii_dtostr(azCoord5, 20, pRect->B.fLatitude), g_ascii_dtostr(azCoord6, 20, pRect->B.fLongitude), 
+		// bottom left
+		g_ascii_dtostr(azCoord7, 20, pRect->B.fLatitude), g_ascii_dtostr(azCoord8, 20, pRect->A.fLongitude), 
+		// upper left again
+		azCoord1, azCoord2);
 	//g_print("sql: %s\n", pszSQL);
 
 	db_resultset_t* pResultSet = NULL;

Index: map_draw_gdk.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map_draw_gdk.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- map_draw_gdk.c	25 Sep 2005 19:02:37 -0000	1.19
+++ map_draw_gdk.c	26 Sep 2005 13:57:13 -0000	1.20
@@ -339,11 +339,15 @@
 static void map_draw_gdk_locations(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics)
 {
 	const GPtrArray* pLocationSetsArray = locationset_get_array();
+
+	g_print("pLocationSetsArray->len = %d\n", pLocationSetsArray->len);
+
 	gint i;
 	for(i=0 ; i<pLocationSetsArray->len ; i++) {
 		locationset_t* pLocationSet = g_ptr_array_index(pLocationSetsArray, i);
 
 		if(!locationset_is_visible(pLocationSet)) continue;
+		g_print("visible one: %s\n", pLocationSet->pszName);
 
 		// 2. Get array of Locations from the hash table using LocationSetID
 		GPtrArray* pLocationsArray;
@@ -360,6 +364,7 @@
 
 static void map_draw_gdk_locationset(map_t* pMap, GdkPixmap* pPixmap, rendermetrics_t* pRenderMetrics, locationset_t* pLocationSet, GPtrArray* pLocationsArray)
 {
+	g_print("Drawing set with %d\n", pLocationsArray->len);
 	gint i;
 	for(i=0 ; i<pLocationsArray->len ; i++) {
 		location_t* pLocation = g_ptr_array_index(pLocationsArray, i);
@@ -376,30 +381,31 @@
 		gint nX = (gint)SCALE_X(pRenderMetrics, pLocation->Coordinates.fLongitude);
 		gint nY = (gint)SCALE_Y(pRenderMetrics, pLocation->Coordinates.fLatitude);
 
-//		g_print("drawing at %d,%d\n", nX,nY);
-		
 		GdkGC* pGC = pMap->pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->pTargetWidget)];
+		glyph_draw_centered(pLocationSet->pMapGlyph, pPixmap, pGC, (gdouble)nX, (gdouble)nY);
 
-		GdkColor clr1;
-		clr1.red = 255/255.0 * 65535;
-		clr1.green = 80/255.0 * 65535;
-		clr1.blue = 80/255.0 * 65535;
-		GdkColor clr2;
-		clr2.red = 255/255.0 * 65535;
-		clr2.green = 255/255.0 * 65535;
-		clr2.blue = 255/255.0 * 65535;
+//		g_print("drawing at %d,%d\n", nX,nY);
 
-		gdk_gc_set_rgb_fg_color(pGC, &clr1);
-		gdk_draw_rectangle(pPixmap, pGC, TRUE, 
-					nX-3,nY-3,
-					7, 7);
-		gdk_gc_set_rgb_fg_color(pGC, &clr2);
-		gdk_draw_rectangle(pPixmap, pGC, TRUE, 
-					nX-2,nY-2,
-					5, 5);
-		gdk_gc_set_rgb_fg_color(pGC, &clr1);
-		gdk_draw_rectangle(pPixmap, pGC, TRUE, 
-					nX-1,nY-1,
-					3, 3);
+//         GdkColor clr1;
+//         clr1.red = 255/255.0 * 65535;
+//         clr1.green = 80/255.0 * 65535;
+//         clr1.blue = 80/255.0 * 65535;
+//         GdkColor clr2;
+//         clr2.red = 255/255.0 * 65535;
+//         clr2.green = 255/255.0 * 65535;
+//         clr2.blue = 255/255.0 * 65535;
+//
+//         gdk_gc_set_rgb_fg_color(pGC, &clr1);
+//         gdk_draw_rectangle(pPixmap, pGC, TRUE,
+//                     nX-3,nY-3,
+//                     7, 7);
+//         gdk_gc_set_rgb_fg_color(pGC, &clr2);
+//         gdk_draw_rectangle(pPixmap, pGC, TRUE,
+//                     nX-2,nY-2,
+//                     5, 5);
+//         gdk_gc_set_rgb_fg_color(pGC, &clr1);
+//         gdk_draw_rectangle(pPixmap, pGC, TRUE,
+//                     nX-1,nY-1,
+//                     3, 3);
 	}
 }

Index: point.c
===================================================================
RCS file: /cvs/cairo/roadster/src/point.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- point.c	25 Sep 2005 19:02:37 -0000	1.7
+++ point.c	26 Sep 2005 13:57:13 -0000	1.8
@@ -40,7 +40,7 @@
 #else
 	// create memory allocators
 	g_pPointChunkAllocator = g_mem_chunk_new("ROADSTER points",
-			sizeof(mappoint_t), 1000, G_ALLOC_AND_FREE);
+			sizeof(mappoint_t), sizeof(mappoint_t)*1000, G_ALLOC_AND_FREE);
 #endif
 }
 

Index: pointstring.c
===================================================================
RCS file: /cvs/cairo/roadster/src/pointstring.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pointstring.c	25 Sep 2005 19:02:37 -0000	1.7
+++ pointstring.c	26 Sep 2005 13:57:13 -0000	1.8
@@ -40,7 +40,7 @@
 	g_pPointStringFreeList = g_free_list_new(sizeof(pointstring_t), 1000);
 #else
 	g_pPointStringChunkAllocator = g_mem_chunk_new("ROADSTER pointstrings",
-			sizeof(pointstring_t), 1000, G_ALLOC_AND_FREE);
+			sizeof(pointstring_t), sizeof(pointstring_t)*1000, G_ALLOC_AND_FREE);
 #endif
 }
 

Index: search.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- search.c	25 Sep 2005 19:02:37 -0000	1.8
+++ search.c	26 Sep 2005 13:57:13 -0000	1.9
@@ -29,35 +29,14 @@
 #include "search_road.h"
 #include "search_location.h"
 #include "search_city.h"
-#include "glyph.h"
-
-#define SEARCH_RESULT_TYPE_GLYPH_WIDTH		32
-#define SEARCH_RESULT_TYPE_GLYPH_HEIGHT		32
-
-struct {
-	glyph_t* apSearchResultTypeGlyphs[ NUM_SEARCH_RESULT_TYPES ];	// don't store pixbufs, store some custom glyph type
-} g_Search = {0};
 
 // functions
 
 void search_init()
 {
-	g_assert(NUM_SEARCH_RESULT_TYPES == 5);		// don't forget to add more here...
-
-	g_Search.apSearchResultTypeGlyphs[SEARCH_RESULT_TYPE_ROAD] = glyph_load_at_size("search-result-type-road", SEARCH_RESULT_TYPE_GLYPH_WIDTH, SEARCH_RESULT_TYPE_GLYPH_HEIGHT);
-	g_Search.apSearchResultTypeGlyphs[SEARCH_RESULT_TYPE_CITY] = glyph_load_at_size("search-result-type-city", SEARCH_RESULT_TYPE_GLYPH_WIDTH, SEARCH_RESULT_TYPE_GLYPH_HEIGHT);
-	g_Search.apSearchResultTypeGlyphs[SEARCH_RESULT_TYPE_STATE] = glyph_load_at_size("search-result-type-state", SEARCH_RESULT_TYPE_GLYPH_WIDTH, SEARCH_RESULT_TYPE_GLYPH_HEIGHT);
-	g_Search.apSearchResultTypeGlyphs[SEARCH_RESULT_TYPE_COUNTRY] = glyph_load_at_size("search-result-type-country", SEARCH_RESULT_TYPE_GLYPH_WIDTH, SEARCH_RESULT_TYPE_GLYPH_HEIGHT);
-	g_Search.apSearchResultTypeGlyphs[SEARCH_RESULT_TYPE_LOCATION] = glyph_load_at_size("search-result-type-location", SEARCH_RESULT_TYPE_GLYPH_WIDTH, SEARCH_RESULT_TYPE_GLYPH_HEIGHT);
-}
-
-glyph_t* search_glyph_for_search_result_type(ESearchResultType eType)
-{
-	g_assert(eType >= 0);
-	g_assert(eType < NUM_SEARCH_RESULT_TYPES);
-	g_assert(g_Search.apSearchResultTypeGlyphs[eType] != NULL);
-
-	return g_Search.apSearchResultTypeGlyphs[eType];
+	search_road_init();
+	search_location_init();
+	search_city_init();
 }
 
 // functions common to all searches

Index: search.h
===================================================================
RCS file: /cvs/cairo/roadster/src/search.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- search.h	24 Sep 2005 05:25:25 -0000	1.3
+++ search.h	26 Sep 2005 13:57:14 -0000	1.4
@@ -24,8 +24,6 @@
 #ifndef _SEARCH_H
 #define _SEARCH_H
 
-#include "glyph.h"
-
 typedef enum {
 	SEARCH_RESULT_TYPE_COUNTRY = 0,		// in order of importance (for search results)
 	SEARCH_RESULT_TYPE_STATE,
@@ -40,7 +38,6 @@
 
 void search_init();
 void search_clean_string(gchar* p);
-glyph_t* search_glyph_for_search_result_type(ESearchResultType eType);
 
 gboolean search_address_number_atoi(const gchar* pszText, gint* pnReturn);
 

Index: search_city.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_city.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- search_city.c	24 Sep 2005 05:25:25 -0000	1.1
+++ search_city.c	26 Sep 2005 13:57:14 -0000	1.2
@@ -31,6 +31,13 @@
 
 void search_city_on_words(gchar** aWords, gint nWordCount);
 
+static glyph_t* g_SearchResultTypeCityGlyph = NULL;
+
+void search_city_init()
+{
+	g_SearchResultTypeCityGlyph = glyph_load_at_size("search-result-type-city", SEARCHWINDOW_SEARCH_RESULT_GLYPH_WIDTH, SEARCHWINDOW_SEARCH_RESULT_GLYPH_HEIGHT);
+}
+
 void search_city_execute(const gchar* pszSentence)
 {
 	// Create an array of the words
@@ -130,7 +137,7 @@
 			mappoint_t point = {0,0};
 
 			gchar* pszResultText = g_strdup_printf("<b>%s,\n%s</b>", aRow[0], aRow[1]);	// XXX: add country?
-			searchwindow_add_result(SEARCH_RESULT_TYPE_CITY, pszResultText, &point, CITY_RESULT_SUGGESTED_ZOOMLEVEL);
+			searchwindow_add_result(SEARCH_RESULT_TYPE_CITY, pszResultText, g_SearchResultTypeCityGlyph, &point, CITY_RESULT_SUGGESTED_ZOOMLEVEL);
 			g_free(pszResultText);
 		}
 		db_free_result(pResultSet);

Index: search_location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_location.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- search_location.c	25 Sep 2005 19:02:37 -0000	1.13
+++ search_location.c	26 Sep 2005 13:57:14 -0000	1.14
@@ -28,12 +28,14 @@
 #include "db.h"
 #include "util.h"
 #include "location.h"
+#include "locationset.h"
 #include "search.h"
 #include "searchwindow.h"
 #include "search_location.h"
 
 #define MAX_QUERY					(4000)
 #define SEARCH_RESULT_COUNT_LIMIT	(100)
+#define LOCATION_RESULT_SUGGESTED_ZOOMLEVEL	(4)
 
 //typedef struct {
 //	mappoint_t ptCenter;
@@ -45,7 +47,12 @@
 //} locationsearch_t;
 
 void search_location_on_words(gchar** aWords, gint nWordCount);
-void search_location_filter_result(gint nLocationID, const gchar* pszName, const gchar* pszAddress, const mappoint_t* pCoordinates);
+void search_location_filter_result(gint nLocationID, gint nLocationSetID, const gchar* pszName, const gchar* pszAddress, const mappoint_t* pCoordinates);
+
+void search_location_init()
+{
+	
+}
 
 void search_location_execute(const gchar* pszSentence)
 {
@@ -92,22 +99,36 @@
 	gchar* pszInnerSelects = g_strdup("");
 	gint i;
 	for(i=0 ; i<nWordCount ; i++) {
+		
+		gchar* pszExcludeAddressFieldClause;
+
+		// Search the 'Address' attribute?
+		if(nWordCount >= 2) {
+			// Yes, allow it
+			pszExcludeAddressFieldClause = g_strdup("");
+		}
+		else {
+			pszExcludeAddressFieldClause = g_strdup_printf(" AND AttributeNameID != %d", LOCATION_ATTRIBUTE_ID_ADDRESS);
+		}
+
 		// add a join
 		gchar* pszNewSelect = g_strdup_printf(
 			" %s SELECT DISTINCT LocationID"	// the DISTINCT means a word showing up in 10 places for a POI will only count as 1 towards MatchedWords below
-			" FROM LocationAttributeValue WHERE MATCH(Value) AGAINST ('%s' IN BOOLEAN MODE)",
+			" FROM LocationAttributeValue WHERE (MATCH(Value) AGAINST ('%s' IN BOOLEAN MODE)%s)",	// note %s at the end
 				(i>0) ? "UNION ALL" : "",	// add "UNION ALL" between SELECTs
-				aWords[i]);
+				aWords[i],
+				pszExcludeAddressFieldClause);
 
 		// out with the old, in with the new.  yes, it's slow, but not in user-time. :)
 		gchar* pszTmp = g_strconcat(pszInnerSelects, pszNewSelect, NULL);
 		g_free(pszInnerSelects);
 		g_free(pszNewSelect);
+		g_free(pszExcludeAddressFieldClause);
 		pszInnerSelects = pszTmp;
 	}
 
 	gchar* pszSQL = g_strdup_printf(
-		"SELECT Location.ID, LocationAttributeValue_Name.Value AS Name, LocationAttributeValue_Address.Value AS Address, AsBinary(Location.Coordinates)"
+		"SELECT Location.ID, Location.LocationSetID, LocationAttributeValue_Name.Value AS Name, LocationAttributeValue_Address.Value AS Address, AsBinary(Location.Coordinates)"
 		" FROM ("
 		  "SELECT LocationID, COUNT(*) AS MatchedWords FROM ("
 		    "%s"
@@ -115,7 +136,7 @@
 		 " GROUP BY LocationID"
 		 " HAVING MatchedWords = %d"
 		 ") AS Matches, Location"
-		
+
 		// Get the two values we need: Name and Address
 		" LEFT JOIN LocationAttributeValue AS LocationAttributeValue_Name ON (Location.ID=LocationAttributeValue_Name.LocationID AND LocationAttributeValue_Name.AttributeNameID=%d)"
 		" LEFT JOIN LocationAttributeValue AS LocationAttributeValue_Address ON (Location.ID=LocationAttributeValue_Address.LocationID AND LocationAttributeValue_Address.AttributeNameID=%d)"
@@ -146,14 +167,14 @@
 			while((aRow = db_fetch_row(pResultSet))) {
 				nCount++;
 				if(nCount <= SEARCH_RESULT_COUNT_LIMIT) {
-					gint nLocationID = atoi(aRow[0]);
-					gchar* pszLocationName = aRow[1];
-					gchar* pszLocationAddress = aRow[2];
-					// Parse coordinates
 					mappoint_t pt;
-					db_parse_wkb_point(aRow[3], &pt);
+					gint nLocationID = atoi(aRow[0]);
+					gint nLocationSetID = atoi(aRow[1]);
+					gchar* pszLocationName = aRow[2];
+					gchar* pszLocationAddress = aRow[3];
+					db_parse_wkb_point(aRow[4], &pt);	// Parse coordinates
 
-					search_location_filter_result(nLocationID, pszLocationName, pszLocationAddress, &pt);
+					search_location_filter_result(nLocationID, nLocationSetID, pszLocationName, pszLocationAddress, &pt);
 				}
 			}
 			db_free_result(pResultSet);
@@ -168,15 +189,19 @@
 	}
 }
 
-#define LOCATION_RESULT_SUGGESTED_ZOOMLEVEL	(7)
-
-void search_location_filter_result(gint nLocationID, const gchar* pszName, const gchar* pszAddress, const mappoint_t* pCoordinates)
+void search_location_filter_result(gint nLocationID, gint nLocationSetID, const gchar* pszName, const gchar* pszAddress, const mappoint_t* pCoordinates)
 {
 	gchar* pszResultText = g_strdup_printf("<b>%s</b>%s%s", pszName,
 					       (pszAddress == NULL || pszAddress[0] == '\0') ? "" : "\n",
 					       (pszAddress == NULL || pszAddress[0] == '\0') ? "" : pszAddress);
 
-	searchwindow_add_result(SEARCH_RESULT_TYPE_LOCATION, pszResultText, pCoordinates, LOCATION_RESULT_SUGGESTED_ZOOMLEVEL);
+	glyph_t* pGlyph = NULL;
+
+	locationset_t* pLocationSet = NULL;
+	if(locationset_find_by_id(nLocationSetID, &pLocationSet)) {
+		pGlyph = pLocationSet->pGlyph;
+	}
+	searchwindow_add_result(SEARCH_RESULT_TYPE_LOCATION, pszResultText, pGlyph, pCoordinates, LOCATION_RESULT_SUGGESTED_ZOOMLEVEL);
 
 	g_free(pszResultText);
 }

Index: search_road.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_road.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- search_road.c	25 Sep 2005 19:02:37 -0000	1.24
+++ search_road.c	26 Sep 2005 13:57:14 -0000	1.25
@@ -33,6 +33,8 @@
 #include "search.h"
 #include "search_road.h"
 #include "road.h"
+#include "glyph.h"
+#include "searchwindow.h"		// for defines about glyph size
 
 #define ROAD_RESULT_SUGGESTED_ZOOMLEVEL		(4)
 
@@ -52,6 +54,15 @@
 #define SEARCH_RESULT_COUNT_LIMIT		(400)		// how many rows to get from DB
 #define MAX_QUERY 						(4000)
 
+
+static glyph_t* g_SearchResultTypeRoadGlyph = NULL;
+
+void search_road_init()
+{
+	g_SearchResultTypeRoadGlyph = glyph_load_at_size("search-result-type-road", SEARCHWINDOW_SEARCH_RESULT_GLYPH_WIDTH, SEARCHWINDOW_SEARCH_RESULT_GLYPH_HEIGHT);
+}
+
+
 //#define ROAD_MIN_LENGTH_FOR_WILDCARD_SEARCH	(4)	  wildcard search no longer used
 
 gboolean search_address_match_zipcode(const gchar* pszWord)
@@ -532,7 +543,7 @@
 			// swap address to keep smaller number to the left
 			g_snprintf(azBuffer, BUFFER_SIZE, "%d-%d %s %s\n%s", nAddressLeftEnd, nAddressLeftStart, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZLeft);
 		}
-*/		searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);		
+*/		searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, g_SearchResultTypeRoadGlyph, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);		
 	}
 	else {	// else the search had a road number
 		// NOTE: we have to filter out results like "97-157" when searching for "124" because it's
@@ -557,7 +568,7 @@
 					pointstring_walk_percentage(pPointString, fPercent, ROADSIDE_LEFT, &ptAddress);
 				}
 				g_snprintf(azBuffer, BUFFER_SIZE, FORMAT_ROAD_RESULT_WITH_NUMBER, nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZLeft);
-				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);				
+				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, g_SearchResultTypeRoadGlyph, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);				
 			}
 			else if(nRoadNumber >= nAddressLeftEnd && nRoadNumber <= nAddressLeftStart) {
 				// MATCH: left side backwards
@@ -573,7 +584,7 @@
 					pointstring_walk_percentage(pPointString, (100.0 - fPercent), ROADSIDE_RIGHT, &ptAddress);
 				}
 				g_snprintf(azBuffer, BUFFER_SIZE, FORMAT_ROAD_RESULT_WITH_NUMBER, nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZLeft);
-				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);
+				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, g_SearchResultTypeRoadGlyph, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);
 			}
 		}
 
@@ -594,7 +605,7 @@
 					pointstring_walk_percentage(pPointString, fPercent, ROADSIDE_RIGHT, &ptAddress);
 				}
 				g_snprintf(azBuffer, BUFFER_SIZE, FORMAT_ROAD_RESULT_WITH_NUMBER, nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZRight);
-				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);
+				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, g_SearchResultTypeRoadGlyph, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);
 			}
 			else if(nRoadNumber >= nAddressRightEnd && nRoadNumber <= nAddressRightStart) {
 				// MATCH: right side backwards
@@ -610,7 +621,7 @@
 					pointstring_walk_percentage(pPointString, (100.0 - fPercent), ROADSIDE_LEFT, &ptAddress);
 				}
 				g_snprintf(azBuffer, BUFFER_SIZE, FORMAT_ROAD_RESULT_WITH_NUMBER, nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZRight);
-				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);
+				searchwindow_add_result(SEARCH_RESULT_TYPE_ROAD, azBuffer, g_SearchResultTypeRoadGlyph, &ptAddress, ROAD_RESULT_SUGGESTED_ZOOMLEVEL);
 			}
 		}
 	}

Index: searchwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- searchwindow.c	25 Sep 2005 21:16:20 -0000	1.23
+++ searchwindow.c	26 Sep 2005 13:57:14 -0000	1.24
@@ -74,7 +74,8 @@
 
 static void searchwindow_on_resultslist_selection_changed(GtkTreeSelection *treeselection, gpointer user_data);
 static void searchwindow_set_message(gchar* pszMessage);
-static void searchwindow_update_next_and_prev_buttons();
+static void searchwindow_update_next_and_prev_buttons(void);
+static void searchwindow_go_to_selected_result(void);
 
 void searchwindow_init(GladeXML* pGladeXML)
 {
@@ -210,12 +211,12 @@
 
 	g_hash_table_destroy(g_SearchWindow.pResultsHashTable);
 	
-	//gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.pSearchButton), TRUE);
+	gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.pSearchButton), TRUE);
 	searchwindow_update_next_and_prev_buttons();
 }
 
 // add a result row to the list
-void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, mappoint_t* pPoint, gint nZoomLevel)
+void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, glyph_t* pGlyph, mappoint_t* pPoint, gint nZoomLevel)
 {
 	GtkTreeIter iter;
 
@@ -247,10 +248,10 @@
 
 	gchar* pszBuffer = g_strdup_printf(SEARCHWINDOW_RESULT_FORMAT, pszText);
 
-	glyph_t* pGlyph = search_glyph_for_search_result_type(eResultType);
-	g_assert(pGlyph != NULL);
-	GdkPixbuf* pRowPixbuf = glyph_get_pixbuf(pGlyph); 
-	g_assert(pRowPixbuf != NULL);
+//	glyph_t* pGlyph = search_glyph_for_search_result_type(eResultType);
+//	g_assert(pGlyph != NULL);
+	GdkPixbuf* pRowPixbuf = (pGlyph != NULL) ? glyph_get_pixbuf(pGlyph) : NULL; 
+//	g_assert(pRowPixbuf != NULL);
 
 	gtk_list_store_append(g_SearchWindow.pResultsListStore, &iter);
 	gtk_list_store_set(g_SearchWindow.pResultsListStore, &iter,
@@ -326,18 +327,16 @@
 
 void searchwindow_on_searchentry_changed(GtkWidget *pWidget, gpointer* p)
 {
-	// Clear results when search entry changes
-	searchwindow_clear_results();
-
-	// Set a message
-	const gchar* pszSearch = gtk_entry_get_text(g_SearchWindow.pSearchEntry);	// NOTE: do NOT free this pointer
-	if(pszSearch[0] != '\0') {
-		gchar* pszBuffer = g_strdup_printf(SEARCHWINDOW_INFO_FORMAT, "Hit <b>Enter</b> to search.");
-		searchwindow_set_message(pszBuffer);
-		g_free(pszBuffer);
-    }
+	// Clear results when search entry changes(?)
+	//searchwindow_clear_results();
+//     const gchar* pszSearch = gtk_entry_get_text(g_SearchWindow.pSearchEntry);   // NOTE: do NOT free this pointer
+//     if(pszSearch[0] != '\0') {
+//         gchar* pszBuffer = g_strdup_printf(SEARCHWINDOW_INFO_FORMAT, "Hit <b>Enter</b> to search.");
+//         searchwindow_set_message(pszBuffer);
+//         g_free(pszBuffer);
+//     }
 
-	// just make sure
-	gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.pSearchButton), TRUE);
+	//
+	//gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.pSearchButton), TRUE);
 }
 

Index: searchwindow.h
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- searchwindow.h	24 Sep 2005 05:25:25 -0000	1.5
+++ searchwindow.h	26 Sep 2005 13:57:14 -0000	1.6
@@ -30,26 +30,18 @@
 #include <glade/glade.h>
 #include "search.h"
 #include "map.h"
+#include "glyph.h"
 //#include "gpsclient.h"
 
-void searchwindow_init(GladeXML* pGladeXML);
+#define SEARCHWINDOW_SEARCH_RESULT_GLYPH_WIDTH	(24)
+#define SEARCHWINDOW_SEARCH_RESULT_GLYPH_HEIGHT	(24)
 
-void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, mappoint_t* pPoint, gint nZoomLevel);
+void searchwindow_init(GladeXML* pGladeXML);
 
-static void searchwindow_go_to_selected_result(void);
+void searchwindow_add_result(ESearchResultType eResultType, const gchar* pszText, glyph_t* pGlyph, mappoint_t* pPoint, gint nZoomLevel);
 
 void searchwindow_clear_results(void);
 
-/* Funky, auto-lookup glade signal handlers.
-
-   XXX: Better would be to hook these up manually, remove these
-   declarations, and make the functions static.
-*/
-void searchwindow_on_findbutton_clicked(GtkWidget *pWidget, gpointer* p);
-void searchwindow_on_searchtypecombo_changed(GtkWidget *pWidget, gpointer* p);
-void searchwindow_on_addressresultstreeview_row_activated(GtkWidget *pWidget, gpointer* p);
-void searchwindow_on_gobutton_clicked(GtkWidget *pWidget, gpointer* p);
-
 G_END_DECLS
 
 #endif /* _SEARCHWINDOW_H */

Index: track.c
===================================================================
RCS file: /cvs/cairo/roadster/src/track.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- track.c	25 Sep 2005 19:02:37 -0000	1.7
+++ track.c	26 Sep 2005 13:57:14 -0000	1.8
@@ -45,7 +45,7 @@
 {
 	g_Tracks.pTracksHash = g_hash_table_new(g_int_hash, g_int_equal);
 	g_Tracks.g_pTrackChunkAllocator = g_mem_chunk_new("ROADSTER tracks",
-			sizeof(track_t), 1000, G_ALLOC_AND_FREE);
+			sizeof(track_t), sizeof(track_t)*100, G_ALLOC_AND_FREE);
 	g_return_if_fail(g_Tracks.g_pTrackChunkAllocator != NULL);
 }
 



More information about the cairo-commit mailing list