[cairo-commit] roadster/src db.c, 1.3, 1.4 geometryset.c, 1.1.1.1, 1.2 import.c, 1.1.1.1, 1.2 import_tiger.c, 1.2, 1.3 main.c, 1.1.1.1, 1.2 mainwindow.c, 1.1.1.1, 1.2 map.c, 1.2, 1.3

Ian McIntosh commit at pdx.freedesktop.org
Sun Feb 20 06:58:49 PST 2005


Committed by: ian

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

Modified Files:
	db.c geometryset.c import.c import_tiger.c main.c mainwindow.c 
	map.c 
Log Message:


Index: db.c
===================================================================
RCS file: /cvs/cairo/roadster/src/db.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- db.c	19 Feb 2005 14:18:32 -0000	1.3
+++ db.c	20 Feb 2005 14:58:46 -0000	1.4
@@ -248,6 +248,8 @@
 
 	g_assert(g_pDB == NULL);
 	g_pDB = pNewConnection;
+
+	// just in case (this could mess with multi-user databases)
 	return TRUE;
 }
 
@@ -718,6 +720,20 @@
 		" PRIMARY KEY (ID));", NULL);
 }
 
+void db_enable_keys(void)
+{
+	db_query("ALTER TABLE Road ENABLE KEYS", NULL);
+	db_query("ALTER TABLE RoadName ENABLE KEYS", NULL);
+	db_query("ALTER TABLE Road_RoadName ENABLE KEYS", NULL);
+}
+
+void db_disable_keys(void)
+{
+	db_query("ALTER TABLE Road DISABLE KEYS", NULL);
+	db_query("ALTER TABLE RoadName DISABLE KEYS", NULL);
+	db_query("ALTER TABLE Road_RoadName DISABLE KEYS", NULL);
+}
+
 /*
 TABLES
 ======

Index: geometryset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/geometryset.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- geometryset.c	18 Feb 2005 04:22:52 -0000	1.1.1.1
+++ geometryset.c	20 Feb 2005 14:58:46 -0000	1.2
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 /*
 	A GeometrySet holds an array of geometry objects (used for roads, railroads and parks right now)
 */
@@ -169,7 +169,7 @@
 	gint nActiveLayerCount = 0;
 	gint i;
 	for(i=LAYER_FIRST ; i <= LAYER_LAST ;i++) {
-		if(g_aLayers[i].m_Style.m_aSubLayers[0].m_afLineWidths[nZoomLevel-1] != 0.0 || 
+		if(g_aLayers[i].m_Style.m_aSubLayers[0].m_afLineWidths[nZoomLevel-1] != 0.0 ||
 		   g_aLayers[i].m_Style.m_aSubLayers[1].m_afLineWidths[nZoomLevel-1] != 0.0)
 		{
 			gchar azLayerNumber[10];
@@ -202,7 +202,7 @@
 		pRect->m_A.m_fLatitude, pRect->m_A.m_fLongitude		// upper left again
 		);
 	TIMER_SHOW(mytimer, "after SQL generation");
-g_print("sql: %s\n", pszSQL);
+//g_print("sql: %s\n", pszSQL);
 
 	db_query(pszSQL, &pResultSet);
 	g_free(pszSQL);
@@ -246,7 +246,7 @@
 			if(aRow[3] != NULL && aRow[4] != NULL) {
 				gint nSuffixID = atoi(aRow[4]);
 				const gchar* pszSuffix = map_road_suffix_itoa(nSuffixID, SUFFIX_TYPE_SHORT);
-				g_snprintf(azFullName, 100, "%s%s%s", 
+				g_snprintf(azFullName, 100, "%s%s%s",
 					aRow[3], (pszSuffix[0] != '\0') ? " " : "", pszSuffix);
 			}
 			pNewPointString->m_pszName = g_strdup(azFullName);
@@ -254,7 +254,7 @@
 			// Add this item to layer's list of pointstrings
 			g_ptr_array_add(g_aLayers[nTypeID].m_pGeometrySet->m_pPointStringsArray, pNewPointString);
 		} // end while loop on rows
-		g_print(" -- got %d rows\n", uRowCount);
+		g_print("[%d rows]\n", uRowCount);
 		TIMER_SHOW(mytimer, "after rows retrieved");
 
 		db_free_result(pResultSet);

Index: import.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- import.c	18 Feb 2005 04:22:56 -0000	1.1.1.1
+++ import.c	20 Feb 2005 14:58:46 -0000	1.2
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <gtk/gtk.h>
 #include "../include/importwindow.h"
 #include "../include/import_tiger.h"
@@ -59,7 +59,11 @@
 
 		gint nTigerSetNumber = atoi(buf);
 		// just assume it's a TIGER file for now since it's all we support
+		
+		db_disable_keys();
 		bResult = import_tiger_from_uri(pszURI, nTigerSetNumber);
+		db_enable_keys();
+
 		if(bResult) {
 			importwindow_log_append("success.\n\n");
 		}

Index: import_tiger.c
===================================================================
RCS file: /cvs/cairo/roadster/src/import_tiger.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- import_tiger.c	19 Feb 2005 14:18:32 -0000	1.2
+++ import_tiger.c	20 Feb 2005 14:58:46 -0000	1.3
@@ -20,9 +20,11 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 // See TGR2003.PDF page 208 for county list
 
+#include <stdlib.h>			// for strtod
+
 #include <string.h>
 #include <gnome-vfs-2.0/libgnomevfs/gnome-vfs.h>
 
@@ -88,7 +90,7 @@
 
 typedef struct tiger_record_rt8
 {
-	gint m_nPOLYID;		// index (for each polygon, we'll get the 
+	gint m_nPOLYID;		// index (for each polygon, we'll get the
 	gint m_nLANDID;		// FK to table 7
 } tiger_record_rt8_t;
 
@@ -117,26 +119,48 @@
 	GPtrArray* m_pRT1LinksArray;
 } tiger_record_rti_t;
 
+gboolean import_tiger_read_lat(gint8* pBuffer, gdouble* pValue)
+{
+	// 0,1,2,3
+	// - 1 2 . 1 2 3 4 5 6
+	char buffer[11];
+	memcpy(&buffer[0], &pBuffer[0], 3);	// copy first 3 bytes
+	buffer[3] = '.';					// and 1
+	memcpy(&buffer[4], &pBuffer[3], 6);	// copy next 6
+	buffer[10] = '\0';
 
-gboolean import_tiger_read_float(gint8* pBuffer, gdouble* pValue)
+	char* p = buffer;
+	gdouble fVal = strtod(buffer, &p);
+	if(p == buffer) {
+		g_warning("strtod('%s') resulted in an error\n", buffer);
+		return FALSE;
+	}
+	*pValue = fVal;
+	return TRUE;
+}
+
+gboolean import_tiger_read_lon(char* pBuffer, gdouble* pValue)
 {
-	gint8 buffer[10];
-	memcpy(buffer, pBuffer, 9);
-	buffer[9] = '\0';
+	char buffer[12];
+	memcpy(&buffer[0], &pBuffer[0], 4);	// copy first 4 bytes (yes, this is different than lat, TIGER!!)
+	buffer[4] = '.';
+	memcpy(&buffer[5], &pBuffer[4], 6);
+	buffer[11] = '\0';
 
-	gint* pEnd;
-	gdouble fVal = strtod(buffer, &pEnd);
-	if(pEnd == buffer) {
-		// if the pointer hasn't moved, it's a parsing error
-		g_assert_not_reached();
+	char* p = buffer;
+	gdouble fVal = strtod(buffer, &p);
+	if(p == buffer) {
+		g_warning("strtod('%s') resulted in an error\n", buffer);
+		return FALSE;
+	}
+	if(fVal > 180.0 || fVal < -180.0) {
+		g_warning("bad longitude fVal (%f) from string (%s)\n", fVal, buffer);
 	}
-//	gdouble fVal = atof(buffer);
-	
-	fVal /= 1000000.0;
 	*pValue = fVal;
 	return TRUE;
 }
 
+
 gboolean import_tiger_read_int(gint8* pBuffer, gint nLen, gint32* pValue)
 {
 	gint8 buffer[11];
@@ -197,8 +221,8 @@
 {
 	//g_print("%c%c%c\n", *(pBuffer), *(pBuffer+1), *(pBuffer+2));
 	gchar chFeatureClass 	= *(pBuffer+0);
-	gint8 chCode 			= *(pBuffer+1); 
-	gint8 chSubCode 		= *(pBuffer+2); 
+	gint8 chCode 			= *(pBuffer+1);
+	gint8 chSubCode 		= *(pBuffer+2);
 
 	// See TGR2003.PDF pages 81-96 for full list of feature classes/codes
 	if(chFeatureClass == 'A') {
@@ -265,7 +289,6 @@
 		//~ }
 		//~ else
 		if(chCode == '8') {
-			g_print("found D8%c: open space (park)\n", chSubCode);
 			*pValue = LAYER_PARK;
 			return TRUE;
 		}
@@ -299,10 +322,10 @@
 	else if(chFeatureClass == 'E') {		// topographic
 		/*
 		E2*
-		E23 island 
+		E23 island
 		E25 marsh
 		*/
-		g_print("found topographic (E%c%c)\n", chCode, chSubCode);
+//		g_print("found topographic (E%c%c)\n", chCode, chSubCode);
 	}
 	else if(chFeatureClass == 'H') { 	// water
 		if(chCode == '0') {
@@ -348,12 +371,13 @@
 void debug_print_string(char* str, gint len)
 {
 	char* p = str;
-	while(*p != '\0' && len > 0) {
-		printf("(%c %02d)", *p, *p);
+	while(len > 0) {
+		g_print("(%c %02d)", *p, *p);
 		p++;
 		len--;
+		if(*p == '\0') break;
 	}
-	printf("\n");
+	g_print("\n");
 }
 
 gchar* import_tiger_copy_line(const gchar* pszString)
@@ -415,7 +439,7 @@
 		import_tiger_read_address(&pLine[81-1], 11, &pRecord->m_nAddressRightStart);
 		import_tiger_read_address(&pLine[92-1], 11, &pRecord->m_nAddressRightEnd);
 
-		// columns 6 to 15 is the TLID - 
+		// columns 6 to 15 is the TLID -
 		import_tiger_read_int(&pLine[6-1], TIGER_TLID_LENGTH, &pRecord->m_nTLID);
 		import_tiger_read_string(&pLine[20-1], TIGER_CHAIN_NAME_LEN, &pRecord->m_achName[0]);
 
@@ -433,11 +457,15 @@
 		//~ import_tiger_read_int(&pLine[50-1], 4, &nFeatureType);
 		//~ g_print("name: '%s' (%d)\n", pRecord->m_achName, nFeatureType);
 
+//g_print("for name %s\n", pRecord->m_achName);
+
  		// lat/lon coordinates...
-		import_tiger_read_float(&pLine[191-1], &pRecord->m_PointA.m_fLongitude);
-		import_tiger_read_float(&pLine[201-1], &pRecord->m_PointA.m_fLatitude);
-		import_tiger_read_float(&pLine[210-1], &pRecord->m_PointB.m_fLongitude);
-		import_tiger_read_float(&pLine[220-1], &pRecord->m_PointB.m_fLatitude);
+		import_tiger_read_lon(&pLine[191-1], &pRecord->m_PointA.m_fLongitude);
+		import_tiger_read_lat(&pLine[201-1], &pRecord->m_PointA.m_fLatitude);
+		import_tiger_read_lon(&pLine[210-1], &pRecord->m_PointB.m_fLongitude);
+		import_tiger_read_lat(&pLine[220-1], &pRecord->m_PointB.m_fLatitude);
+
+//g_print("name: %s, (%f,%f) (%f,%f)\n", pRecord->m_achName, pRecord->m_PointA.m_fLongitude, pRecord->m_PointA.m_fLatitude, pRecord->m_PointB.m_fLongitude, pRecord->m_PointB.m_fLatitude);
 
 		// add to table
 		g_hash_table_insert(pTable, &pRecord->m_nTLID, pRecord);
@@ -453,7 +481,7 @@
 
 		gchar* pLine = &pBuffer[i];
 
-		// columns 6 to 15 is the TLID - 
+		// columns 6 to 15 is the TLID -
 		gint nTLID;
 		import_tiger_read_int(&pLine[6-1], TIGER_TLID_LENGTH, &nTLID);
 		tiger_record_rt2_t* pRecord = g_hash_table_lookup(pTable, &nTLID);
@@ -473,8 +501,8 @@
 		mappoint_t point;
 		gint iPoint;
 		for(iPoint=0 ; iPoint< TIGER_RT2_MAX_POINTS ; iPoint++) {
-			import_tiger_read_float(&pLine[19 + (iPoint * 19)], &point.m_fLongitude);
-			import_tiger_read_float(&pLine[28 + (iPoint * 19)], &point.m_fLatitude);
+			import_tiger_read_lon(&pLine[19-1 + (iPoint * 19)], &point.m_fLongitude);
+			import_tiger_read_lat(&pLine[29-1 + (iPoint * 19)], &point.m_fLatitude);
 			if(point.m_fLatitude == 0.0 && point.m_fLongitude == 0.0) {
 				break;
 			}
@@ -506,7 +534,7 @@
 		pRecord = g_new0(tiger_record_rt7_t, 1);
 		pRecord->m_nRecordType = nRecordType;
 
-		// columns 11 to 20 is the TLID - 
+		// columns 11 to 20 is the TLID -
 		import_tiger_read_int(&pLine[11-1], TIGER_LANDID_LENGTH, &pRecord->m_nLANDID);
 
 		import_tiger_read_string(&pLine[25-1], TIGER_LANDMARK_NAME_LEN, &pRecord->m_achName[0]);
@@ -530,10 +558,10 @@
 		tiger_record_rt8_t* pRecord;
 		pRecord = g_new0(tiger_record_rt8_t, 1);
 
-		// columns 16 to 25 is the TLID - 
+		// columns 16 to 25 is the TLID -
 		import_tiger_read_int(&pLine[16-1], TIGER_POLYID_LENGTH, &pRecord->m_nPOLYID);
 		
-		// columns 26 to 35 is the TLID - 
+		// columns 26 to 35 is the TLID -
 		import_tiger_read_int(&pLine[26-1], TIGER_LANDID_LENGTH, &pRecord->m_nLANDID);
 
 // g_print("record 8: POLYID=%d LANDID=%d\n", pRecord->m_nPOLYID, pRecord->m_nLANDID);
@@ -544,8 +572,10 @@
 	return TRUE;
 }
 
+
 gboolean import_tiger_parse_table_i(gint8* pBuffer, gint nLength, GHashTable *pTable)
 {
+	g_print("nLength = %d, TIGER_RTi_LINE_LENGTH = %d\n", nLength, TIGER_RTi_LINE_LENGTH);
 	gint i;
 	for(i=0 ; i<(nLength-TIGER_RTi_LINE_LENGTH) ; i+=TIGER_RTi_LINE_LENGTH) {
 		gchar* pLine = &pBuffer[i];
@@ -648,7 +678,7 @@
 	if(pRecordRT1->m_nRecordType != LAYER_NONE) {
 		gint nRoadID;
 		
-		db_insert_road(pRecordRT1->m_nRecordType, 
+		db_insert_road(pRecordRT1->m_nRecordType,
 			pRecordRT1->m_nAddressLeftStart,
 			pRecordRT1->m_nAddressLeftEnd,
 			pRecordRT1->m_nAddressRightStart,
@@ -721,17 +751,18 @@
 	tiger_record_rt7_t* pRecordRT7 = g_hash_table_lookup(pImportProcess->m_pTableRT7, &pRecordRT8->m_nLANDID);
 	if(pRecordRT7 == NULL) return;	// allowed to be null(?)
 
+	// create a temp array to hold the points for this polygon (in order)
 	GPtrArray* pTempPointsArray = g_ptr_array_new();
 
-	// start with the RT1Link at index 0 (and remove it)
 	g_assert(pRecordRTi->m_pRT1LinksArray != NULL);
 	g_assert(pRecordRTi->m_pRT1LinksArray->len >= 1);
 
+	// start with the RT1Link at index 0 (and remove it)
 	tiger_rt1_link_t* pCurrentRT1Link = g_ptr_array_index(pRecordRTi->m_pRT1LinksArray, 0);
 	g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, 0);	// TODO: should maybe choose the last one instead? :)  easier to remove and arbitrary anyway!
 
 	// we'll use the first RT1 in forward order, that is A->B...
-	tiger_util_add_RT1_points_to_array(pImportProcess, pCurrentRT1Link->m_nTLID, 
+	tiger_util_add_RT1_points_to_array(pImportProcess, pCurrentRT1Link->m_nTLID,
 		pTempPointsArray, ORDER_FORWARD);
 	// ...so B is the last TZID for now.
 	gint nLastTZID = pCurrentRT1Link->m_nPointBTZID;
@@ -754,13 +785,13 @@
 				// this (pNextRT1Link) RT1Link becomes the new "current"
 				// remove it from the array!
 				g_ptr_array_remove_index(pRecordRTi->m_pRT1LinksArray, iRT1Link);
-				// we're done forever with the old 'current' 
+				// we're done forever with the old 'current'
 				// (the RT1 it links to has already had its points copied to the list!)
 				g_free(pCurrentRT1Link);
 				pCurrentRT1Link = pNextRT1Link;
 
 				// add this new RT1's points
-				tiger_util_add_RT1_points_to_array(pImportProcess, pCurrentRT1Link->m_nTLID, 
+				tiger_util_add_RT1_points_to_array(pImportProcess, pCurrentRT1Link->m_nTLID,
 					pTempPointsArray, ORDER_FORWARD);
 
 				nLastTZID = pCurrentRT1Link->m_nPointBTZID;	// Note: point *B* of this RT1Link
@@ -776,7 +807,7 @@
 				pCurrentRT1Link = pNextRT1Link;
 
 				// add this new RT1's points
-				tiger_util_add_RT1_points_to_array(pImportProcess, pCurrentRT1Link->m_nTLID, 
+				tiger_util_add_RT1_points_to_array(pImportProcess, pCurrentRT1Link->m_nTLID,
 					pTempPointsArray, ORDER_BACKWARD);
 
 				nLastTZID = pCurrentRT1Link->m_nPointATZID;	// Note: point *A* of this RT1Link
@@ -797,7 +828,7 @@
 		// insert record
 		if(pRecordRT7->m_nRecordType != LAYER_NONE) {
 			gint nRoadID;
-			db_insert_road(pRecordRT7->m_nRecordType, 
+			db_insert_road(pRecordRT7->m_nRecordType,
 				0,0,0,0,
 				pTempPointsArray, &nRoadID);
 		}
@@ -813,7 +844,7 @@
 }
 
 //
-// 
+//
 //
 static gboolean import_tiger_from_directory(const gchar* pszDirectoryPath, gint nTigerSetNumber);
 static gboolean import_tiger_from_buffers(gint8* pBufferMET, gint nLengthMET, gint8* pBufferRT1, gint nLengthRT1, gint8* pBufferRT2, gint nLengthRT2,	gint8* pBufferRT7, gint nLengthRT7,	gint8* pBufferRT8, gint nLengthRT8, gint8* pBufferRTi, gint nLengthRTi);

Index: main.c
===================================================================
RCS file: /cvs/cairo/roadster/src/main.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- main.c	18 Feb 2005 04:22:52 -0000	1.1.1.1
+++ main.c	20 Feb 2005 14:58:46 -0000	1.2
@@ -2,7 +2,7 @@
  *            main.c
  *
  *  Copyright  2005  Ian McIntosh
- *  ian_mcintosh at linuxadvocate.org 
+ *  ian_mcintosh at linuxadvocate.org
  ****************************************************************************/
 
 /*
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -49,7 +49,6 @@
 	*/
 	geometryset_init();
 	locationset_init();
-
 	gpsclient_init();
 	gui_init();
 	layers_init();

Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- mainwindow.c	18 Feb 2005 04:22:56 -0000	1.1.1.1
+++ mainwindow.c	20 Feb 2005 14:58:46 -0000	1.2
@@ -2,7 +2,7 @@
  *            mainwindow.c
  *
  *  Copyright  2005  Ian McIntosh
- *  ian_mcintosh at linuxadvocate.org 
+ *  ian_mcintosh at linuxadvocate.org
  ****************************************************************************/
 
 /*
@@ -20,7 +20,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #include <glade/glade.h>
 
 #ifdef HAVE_CONFIG_H
@@ -43,7 +43,8 @@
 #include "../include/databasewindow.h"
 
 #include <gdk/gdkx.h>
-#include <cairo.h>
+#include <cairo/cairo.h>
+#include <cairo/cairo-xlib.h>
 
 #define PROGRAM_NAME		"Roadster"
 #define PROGRAM_COPYRIGHT	"Copyright (c) 2005 Ian McIntosh"
@@ -89,7 +90,7 @@
 struct {
 	GtkWindow* m_pWindow;
 	GtkTooltips* m_pTooltips;
-	GtkMenu* m_pMapPopupMenu; 
+	GtkMenu* m_pMapPopupMenu;
 
 	screenpoint_t m_ptClickLocation;
 
@@ -105,7 +106,7 @@
 	
 	// Sidebar
 	
-	// "Draw" Sidebar 
+	// "Draw" Sidebar
 	GtkTreeView* m_pLayersListTreeView;
 	GtkTreeView* m_pLocationSetsTreeView;
 	
@@ -135,12 +136,11 @@
 	{"Pointer Tool", {GDK_LEFT_PTR, NULL}},
 	{"Zoom Tool", {GDK_CIRCLE, NULL}},
 };
-
 void cursor_init()
 {
 	int i;
 	for(i=0 ; i<NUM_ELEMS(g_Tools) ; i++) {
-        g_Tools[i].m_Cursor.m_pGdkCursor = gdk_cursor_new(g_Tools[i].m_Cursor.m_CursorType);
+		g_Tools[i].m_Cursor.m_pGdkCursor = gdk_cursor_new(g_Tools[i].m_Cursor.m_CursorType);
 	}
 }
 
@@ -151,6 +151,16 @@
 	gdk_pixbuf_unref(pPixbuf);
 }
 
+void mainwindow_set_statusbar_position(gchar* pMessage)
+{
+	gtk_label_set_text(GTK_LABEL(g_MainWindow.m_pPositionLabel), pMessage);
+}
+
+void mainwindow_set_statusbar_zoomscale(gchar* pMessage)
+{
+	gtk_label_set_text(GTK_LABEL(g_MainWindow.m_pZoomScaleLabel), pMessage);
+}
+
 void* mainwindow_set_busy()
 {
 	GdkCursor* pCursor = gdk_cursor_new(GDK_WATCH);
@@ -170,47 +180,13 @@
 	gdk_cursor_unref(*ppCursor);
 	gdk_flush();
 
-	// HACK: manually restore the cursor for selected tool :/ 
+	// HACK: manually restore the cursor for selected tool :/
 	mainwindow_setup_selected_tool();
 }
 
 /*
 ** Status bar
 */
-void mainwindow_set_statusbar_position(gchar* pMessage)
-{
-	gtk_label_set_text(GTK_LABEL(g_MainWindow.m_pPositionLabel), pMessage);
-}
-
-void mainwindow_set_statusbar_zoomscale(gchar* pMessage)
-{
-	gtk_label_set_text(GTK_LABEL(g_MainWindow.m_pZoomScaleLabel), pMessage);
-}
-
-static void on_layervisible_checkbox_clicked(GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
-{
-	GtkTreeModel *model = (GtkTreeModel *)data;
-	GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
-	GtkTreeIter iter;
-	gboolean toggle_item;
-	gint *column;
-
-	column = g_object_get_data (G_OBJECT (cell), "column");
-
-	/* get toggled iter */
-	gtk_tree_model_get_iter (model, &iter, path);
-	gtk_tree_model_get (model, &iter, column, &toggle_item, -1);
-
-	/* do something with the value */
-	toggle_item ^= 1;
-
-	/* set new value */
-	gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column,
-			  toggle_item, -1);
-
-	/* clean up */
-	gtk_tree_path_free (path);
-}
 
 void mainwindow_load_locationset_list();
 
@@ -242,7 +218,7 @@
 	// add signal handlers to drawing area
 	gtk_widget_add_events(GTK_WIDGET(g_MainWindow.m_pDrawingArea), GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
 	g_signal_connect(G_OBJECT(g_MainWindow.m_pDrawingArea), "expose_event", G_CALLBACK(mainwindow_on_expose_event), NULL);
-	g_signal_connect(G_OBJECT(g_MainWindow.m_pDrawingArea),"configure_event", G_CALLBACK(mainwindow_on_configure_event), NULL);
+	g_signal_connect(G_OBJECT(g_MainWindow.m_pDrawingArea), "configure_event", G_CALLBACK(mainwindow_on_configure_event), NULL);
 	g_signal_connect(G_OBJECT(g_MainWindow.m_pDrawingArea), "button_press_event", G_CALLBACK(mainwindow_on_mouse_button_click), NULL);
 
 	// Pack canvas into application window
@@ -255,7 +231,7 @@
 	cursor_init();
 
 	/*
-	** 
+	**
 	*/
 	// create layers tree view
 	GtkListStore* pLocationSetsListStore = gtk_list_store_new(2, G_TYPE_BOOLEAN, G_TYPE_STRING);
@@ -267,7 +243,7 @@
 	// add a checkbox column for layer enabled/disabled
 	pCellRenderer = gtk_cell_renderer_toggle_new();
   	g_object_set_data(G_OBJECT(pCellRenderer), "column", (gint *)LAYERLIST_COLUMN_ENABLED);
-	g_signal_connect(pCellRenderer, "toggled", G_CALLBACK(on_layervisible_checkbox_clicked), pLocationSetsListStore);
+//	g_signal_connect(pCellRenderer, "toggled", G_CALLBACK(on_layervisible_checkbox_clicked), pLocationSetsListStore);
 	pColumn = gtk_tree_view_column_new_with_attributes("Visible", pCellRenderer, "active", LAYERLIST_COLUMN_ENABLED, NULL);	
 	gtk_tree_view_append_column(g_MainWindow.m_pLocationSetsTreeView, pColumn);
 
@@ -277,7 +253,7 @@
 	gtk_tree_view_append_column(g_MainWindow.m_pLocationSetsTreeView, pColumn);
 
 	/*
-	** 
+	**
 	*/
 	// create layers tree view
 	GtkListStore* pLayersListStore = gtk_list_store_new(2, G_TYPE_BOOLEAN, G_TYPE_STRING);
@@ -299,7 +275,7 @@
 	gtk_tree_view_append_column(g_MainWindow.m_pLayersListTreeView, pColumn);
 
 	/*
-	** 
+	**
 	*/
 	mainwindow_statusbar_update_zoomscale();
 	mainwindow_statusbar_update_position();	
@@ -315,7 +291,7 @@
 		gboolean bEnabled = TRUE;
 
 		gtk_list_store_append(GTK_LIST_STORE(pLayersListStore), &iter);
-		gtk_list_store_set(GTK_LIST_STORE(pLayersListStore), &iter, 
+		gtk_list_store_set(GTK_LIST_STORE(pLayersListStore), &iter,
 			LAYERLIST_COLUMN_ENABLED, bEnabled,
 			LAYERLIST_COLUMN_NAME, g_aLayers[i].m_pszName,
 			-1);
@@ -348,7 +324,7 @@
 		gboolean bEnabled = TRUE;
 
 		gtk_list_store_append(pListStore, &iter);
-		gtk_list_store_set(pListStore, &iter, 
+		gtk_list_store_set(pListStore, &iter,
 			LAYERLIST_COLUMN_ENABLED, bEnabled,
 			LAYERLIST_COLUMN_NAME, pLocationSet->m_pszName,
 			-1);
@@ -683,7 +659,7 @@
                 g_MainWindow.m_pWindow,
                 GTK_FILE_CHOOSER_ACTION_OPEN,
     			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-				"Import", GTK_RESPONSE_ACCEPT,                                         
+				"Import", GTK_RESPONSE_ACCEPT,
 				NULL);
 
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(pDialog), TRUE);
@@ -747,6 +723,7 @@
 	cairo_t *pCairoInstance;
 	pCairoInstance = cairo_create ();
 		// draw on an off-screen buffer
+		
 		cairo_set_target_drawable(pCairoInstance, dpy, drawable);
 		map_draw(pCairoInstance);
 	cairo_destroy(pCairoInstance);
@@ -820,7 +797,7 @@
 
 gboolean mainwindow_callback_on_gps_redraw_timeout(gpointer __unused)
 {
-	// NOTE: we're setting tooltips on the image's 
+	// NOTE: we're setting tooltips on the image's
 	GtkWidget* pWidget = gtk_widget_get_parent(GTK_WIDGET(g_MainWindow.m_pStatusbarGPSIcon));
 
 	gpsdata_t* pData = gpsclient_getdata();
@@ -879,3 +856,30 @@
 //	g_print("set GPS status = %d\n", pData->m_eStatus);
 	return TRUE;
 }
+
+#if 0
+static void on_layervisible_checkbox_clicked(GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
+{
+	GtkTreeModel *model = (GtkTreeModel *)data;
+	GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+	GtkTreeIter iter;
+	gboolean toggle_item;
+	gint *column;
+
+	column = g_object_get_data (G_OBJECT (cell), "column");
+
+	/* get toggled iter */
+	gtk_tree_model_get_iter (model, &iter, path);
+	gtk_tree_model_get (model, &iter, column, &toggle_item, -1);
+
+	/* do something with the value */
+	toggle_item ^= 1;
+
+	/* set new value */
+	gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column,
+			  toggle_item, -1);
+
+	/* clean up */
+	gtk_tree_path_free (path);
+}
+#endif

Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- map.c	19 Feb 2005 14:18:32 -0000	1.2
+++ map.c	20 Feb 2005 14:58:46 -0000	1.3
@@ -255,13 +255,13 @@
 	//
 	// Labels
 	//
-	{LAYER_MINORSTREET, 0, map_draw_layer_labels},
-	{LAYER_MAJORSTREET, 0, map_draw_layer_labels},
+     	{LAYER_MINORSTREET, 0, map_draw_layer_labels},
+     	{LAYER_MAJORSTREET, 0, map_draw_layer_labels},
 
-	{LAYER_MINORHIGHWAY, 0, map_draw_layer_labels},
-	{LAYER_MAJORHIGHWAY, 0, map_draw_layer_labels},
+     	{LAYER_MINORHIGHWAY, 0, map_draw_layer_labels},
+     	{LAYER_MAJORHIGHWAY, 0, map_draw_layer_labels},
 
-	{LAYER_RAILROAD, 0, map_draw_layer_labels},
+     	{LAYER_RAILROAD, 0, map_draw_layer_labels},
 };
 
 // ========================================================
@@ -925,7 +925,6 @@
 	gboolean bAddition = FALSE;
 
 	cairo_save(pCairo);
-//		cairo_set_tolerance(pCairo, 30);
 		cairo_set_rgb_color(pCairo, 123.0/255.0, 48.0/255.0, 1.0);
 		cairo_set_alpha(pCairo, 0.3);
 
@@ -1047,16 +1046,16 @@
 		cairo_set_tolerance(pCairo, 8);
 	}
 	else if(fLineWidth <= 6.0) {
-		cairo_set_tolerance(pCairo, 4);
+		cairo_set_tolerance(pCairo, 6);
 	}
 	else {
 		cairo_set_tolerance(pCairo, 0.5);
 	}
 
 	gint nCapStyle = pSubLayerStyle->m_nCapStyle;
-	if(nCapStyle == CAIRO_LINE_CAP_ROUND && fLineWidth <= 4.0) {
-		nCapStyle = CAIRO_LINE_CAP_BUTT;
-	}
+//     if(nCapStyle == CAIRO_LINE_CAP_ROUND && fLineWidth <= 6.0) {
+//         nCapStyle = CAIRO_LINE_CAP_SQUARE;
+//     }
 	
 	// Set layer attributes	
 	cairo_set_rgb_color(pCairo, pSubLayerStyle->m_clrColor.m_fRed, pSubLayerStyle->m_clrColor.m_fGreen, pSubLayerStyle->m_clrColor.m_fBlue);




More information about the cairo-commit mailing list