[cairo-commit] roadster/src Makefile.am, 1.11, 1.12 location.c, NONE, 1.1 location.h, NONE, 1.1 locationset.c, 1.4, 1.5 locationset.h, 1.3, 1.4 mainwindow.c, 1.20, 1.21 map_draw_cairo.c, 1.5, 1.6 scenemanager.c, 1.6, 1.7 scenemanager.h, 1.3, 1.4

Ian McIntosh commit at pdx.freedesktop.org
Tue Mar 8 10:40:52 PST 2005


Committed by: ian

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

Modified Files:
	Makefile.am locationset.c locationset.h mainwindow.c 
	map_draw_cairo.c scenemanager.c scenemanager.h 
Added Files:
	location.c location.h 
Log Message:
	* src/location.c:
	* src/location.h: Added.
	* src/locationset.c: location code moved to location.c.  Code cleanup.
	* src/scenemanager.c: Implement using GdkRegion to prevent overlapping labels.
	* src/map_draw_cairo.c: Add new scenemanager calls.


Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/roadster/src/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.am	7 Mar 2005 23:31:41 -0000	1.11
+++ Makefile.am	8 Mar 2005 18:40:50 -0000	1.12
@@ -32,6 +32,7 @@
 	datasetwindow.c\
 	welcomewindow.c\
 	gpsclient.c\
+	location.c\
 	locationset.c\
 	searchwindow.c\
 	search_road.c\

--- NEW FILE: location.c ---
/***************************************************************************
 *            location.c
 *
 *  Copyright  2005  Ian McIntosh
 *  ian_mcintosh at linuxadvocate.org
 ****************************************************************************/

/*
 *  This program 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.
 *
 *  This program 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 Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  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 "map.h"
#include "location.h"

struct {
	GMemChunk* m_pLocationChunkAllocator;
} g_Location;

void location_init()
{
	g_Location.m_pLocationChunkAllocator = g_mem_chunk_new("location chunk allocator",
			sizeof(location_t), 1000, G_ALLOC_AND_FREE);
	g_return_if_fail(g_Location.m_pLocationChunkAllocator != NULL);
}

// get a new point struct from the allocator
gboolean location_new(location_t** ppLocation)
{
	g_return_val_if_fail(ppLocation != NULL, FALSE);
	g_return_val_if_fail(*ppLocation == NULL, FALSE);	// must be a pointer to a NULL pointer
	g_return_val_if_fail(g_Location.m_pLocationChunkAllocator != NULL, FALSE);

	location_t* pNew = g_mem_chunk_alloc0(g_Location.m_pLocationChunkAllocator);
	if(pNew) {
		*ppLocation = pNew;
		return TRUE;
	}
	return FALSE;
}

// return a location_t struct to the allocator
void location_free(location_t* pLocation)
{
	g_return_if_fail(pLocation != NULL);
	g_return_if_fail(g_Location.m_pLocationChunkAllocator != NULL);

	// give back to allocator
	g_mem_chunk_free(g_Location.m_pLocationChunkAllocator, pLocation);
}

--- NEW FILE: location.h ---
/***************************************************************************
 *            location.h
 *
 *  Copyright  2005  Ian McIntosh
 *  ian_mcintosh at linuxadvocate.org
 ****************************************************************************/

/*
 *  This program 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.
 *
 *  This program 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 Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef _LOCATION_H
#define _LOCATION_H

#include "map.h"

G_BEGIN_DECLS

// a single location (eg. "Someday Cafe")
typedef struct location {
	gint m_nID;
	gchar* m_pszName;
	mappoint_t m_Coordinates;
} location_t;

G_END_DECLS

#endif /* _LOCATION_H */

Index: locationset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- locationset.c	23 Feb 2005 17:22:07 -0000	1.4
+++ locationset.c	8 Mar 2005 18:40:50 -0000	1.5
@@ -23,6 +23,7 @@
 
 #include <stdlib.h>
 #include <gtk/gtk.h>
+#include "location.h"
 #include "locationset.h"
 #include "db.h"
 #include "util.h"
@@ -34,7 +35,6 @@
 	GPtrArray* m_pLocationSetArray;	// an array of locationsets
 	GHashTable* m_pLocationSetHash;	// stores pointers to locationsets, indexed by ID
 
-	GMemChunk* m_pLocationChunkAllocator;	// allocs location_t objects
 	GMemChunk* m_pLocationSetChunkAllocator;	// allocs locationset_t objects
 } g_LocationSet;
 
@@ -43,50 +43,21 @@
 	g_LocationSet.m_pLocationSetArray = g_ptr_array_new();
 	g_LocationSet.m_pLocationSetHash = g_hash_table_new(g_int_hash, g_int_equal);
 
-	// create memory allocators
-	g_LocationSet.m_pLocationChunkAllocator = g_mem_chunk_new("location chunk allocator",
-			sizeof(location_t), 1000, G_ALLOC_AND_FREE);
-	g_return_if_fail(g_LocationSet.m_pLocationChunkAllocator != NULL);
-
+	// create memory allocator
 	g_LocationSet.m_pLocationSetChunkAllocator = g_mem_chunk_new("locationset chunk allocator",
 			sizeof(locationset_t), 1000, G_ALLOC_AND_FREE);
 	g_return_if_fail(g_LocationSet.m_pLocationSetChunkAllocator != NULL);
 }
 
-// get a new point struct from the allocator
-static gboolean locationset_util_new_location(location_t** ppLocation)
-{
-	g_return_val_if_fail(ppLocation != NULL, FALSE);
-	g_return_val_if_fail(*ppLocation == NULL, FALSE);	// must be a pointer to a NULL pointer
-	g_return_val_if_fail(g_LocationSet.m_pLocationChunkAllocator != NULL, FALSE);
-
-	location_t* pNew = g_mem_chunk_alloc0(g_LocationSet.m_pLocationChunkAllocator);
-	if(pNew) {
-		*ppLocation = pNew;
-		return TRUE;
-	}
-	return FALSE;
-}
-
-// return a point struct to the allocator
-static void locationset_util_free_location(location_t* pLocation)
-{
-	g_return_if_fail(pLocation != NULL);
-	g_return_if_fail(g_LocationSet.m_pLocationChunkAllocator != NULL);
-
-	// give back to allocator
-	g_mem_chunk_free(g_LocationSet.m_pLocationChunkAllocator, pLocation);
-}
-
 // get a new locationset struct from the allocator
-static locationset_t* locationset_util_new_locationset(void)
+static locationset_t* locationset_new(void)
 {
 	g_return_val_if_fail(g_LocationSet.m_pLocationSetChunkAllocator != NULL, NULL);
 
 	return g_mem_chunk_alloc0(g_LocationSet.m_pLocationSetChunkAllocator);
 }
 
-static void locationset_util_clear_locationset(locationset_t* pLocationSet)
+static void locationset_clear(locationset_t* pLocationSet)
 {
 	g_return_if_fail(pLocationSet != NULL);
 	g_return_if_fail(g_LocationSet.m_pLocationSetChunkAllocator != NULL);
@@ -95,20 +66,18 @@
 	gint i;
 	for(i=((pLocationSet->m_pLocationsArray->len)-1) ; i>=0 ; i--) {
 		location_t* pLocation = g_ptr_array_remove_index_fast(pLocationSet->m_pLocationsArray, i);
-		locationset_util_free_location(pLocation);
+		location_free(pLocation);
 	}
 }
 
 // return a locationset struct (and all locations) to the allocator
-#if 0
-static void locationset_util_free_locationset(locationset_t* pLocationSet)
+static void locationset_free(locationset_t* pLocationSet)
 {
-	locationset_util_clear_locationset(pLocationSet);
+	locationset_clear(pLocationSet);
 
 	// give back to allocator
 	g_mem_chunk_free(g_LocationSet.m_pLocationSetChunkAllocator, pLocationSet);
 }
-#endif
 
 static void locationset_clear_all_locations(void)
 {
@@ -116,7 +85,7 @@
 	gint i;
 	for(i=(g_LocationSet.m_pLocationSetArray->len)-1 ; i>=0 ; i--) {
 		locationset_t* pLocationSet = g_ptr_array_index(g_LocationSet.m_pLocationSetArray, i);
-		locationset_util_clear_locationset(pLocationSet);
+		locationset_clear(pLocationSet);
 	}
 //	g_hash_table_foreach_steal(g_LocationSet.m_pLocationSets, callback_delete_pointset, NULL);
 //	g_assert(g_hash_table_size(g_LocationSet.m_pLocationSets) == 0);
@@ -131,11 +100,11 @@
 		db_row_t aRow;
 
 		while((aRow = db_fetch_row(pResultSet))) {
-			locationset_t* pNewLocationSet = locationset_util_new_locationset();
+			locationset_t* pNewLocationSet = locationset_new();
 
 			pNewLocationSet->m_nID = atoi(aRow[0]);
 			pNewLocationSet->m_pszName = g_strdup(aRow[1]);
-			pNewLocationSet->m_pLocationsArray = g_ptr_array_new();
+			//pNewLocationSet->m_pLocationsArray = g_ptr_array_new();
 
 			// Add the new set to both data structures
 			g_ptr_array_add(g_LocationSet.m_pLocationSetArray, pNewLocationSet);
@@ -152,58 +121,6 @@
 	return g_LocationSet.m_pLocationSetArray;
 }
 
-/**************************************************************
-** PointSets
-***************************************************************/
-
-#if 0
-gboolean db_pointset_insert(const gchar* pszName, gint* pReturnID)
-{
-	if(!db_is_connected()) return FALSE;
-	g_assert(pszName != NULL);
-	g_assert(pReturnID != NULL);
-
-	// create query SQL
-	gchar azQuery[MAX_SQLBUFFER_LEN];
-	gchar* pszEscapedName = db_make_escaped_string(pszName);
-	g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "INSERT INTO %s SET ID=NULL, Name='%s';", DB_LOCATIONSETS_TABLENAME, pszEscapedName);
-	db_free_escaped_string(pszEscapedName);
-
-	// run query
-	if(!db_query(azQuery, NULL)) {
-		return FALSE;
-	}
-	// return the new ID
-	*pReturnID = db_insert_id();
-	return TRUE;	
-}
-#endif
-
-#if 0
-gboolean db_pointset_delete(gint nPointSetID)
-{
-	if(!db_is_connected(g_pDB)) return FALSE;
-
-	gchar azQuery[MAX_SQLBUFFER_LEN];
-	g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "DELETE FROM %s WHERE ID=%d;", DB_LOCATIONSETS_TABLENAME, nPointSetID);
-	if(MYSQL_RESULT_SUCCESS != mysql_query(g_pDB->m_pMySQLConnection, azQuery)) {
-		g_warning("db_pointset_delete: deleting pointset failed: %s (SQL: %s)\n", mysql_error(g_pDB->m_pMySQLConnection), azQuery);
-		return FALSE;
-	}
-
-	g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "DELETE FROM %s WHERE LocationSetID=%d;", DB_LOCATIONS_TABLENAME, nPointSetID);
-	if(MYSQL_RESULT_SUCCESS != mysql_query(g_pDB->m_pMySQLConnection, azQuery)) {
-		g_warning("db_pointset_delete: deleting points failed: %s (SQL: %s)\n", mysql_error(g_pDB->m_pMySQLConnection), azQuery);
-		return FALSE;
-	}
-	return TRUE;
-}
-#endif
-
-/**************************************************************
-** Points
-***************************************************************/
-
 gboolean locationset_add_location(gint nLocationSetID, mappoint_t* pPoint, gint* pReturnID)
 {
 	g_assert(pPoint != NULL);
@@ -307,7 +224,7 @@
 				// if found (and it should be, at least once we filter by SetID in the SQL above)
 				// allocate a new location_t and add it to the set
 				location_t* pNewLocation = NULL;
-				if(locationset_util_new_location(&pNewLocation)) {
+				if(location_new(&pNewLocation)) {
 					pNewLocation->m_nID = nLocationID;
 					db_parse_point(aRow[2], &pNewLocation->m_Coordinates);
 					g_ptr_array_add(pLocationSet->m_pLocationsArray, pNewLocation);
@@ -328,7 +245,51 @@
 	return FALSE;
 }
 
-#if 0
+/**************************************************************
+** PointSets
+***************************************************************/
+
+#ifdef ROADSTER_DEAD_CODE
+/*
+gboolean db_pointset_insert(const gchar* pszName, gint* pReturnID)
+{
+	if(!db_is_connected()) return FALSE;
+	g_assert(pszName != NULL);
+	g_assert(pReturnID != NULL);
+
+	// create query SQL
+	gchar azQuery[MAX_SQLBUFFER_LEN];
+	gchar* pszEscapedName = db_make_escaped_string(pszName);
+	g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "INSERT INTO %s SET ID=NULL, Name='%s';", DB_LOCATIONSETS_TABLENAME, pszEscapedName);
+	db_free_escaped_string(pszEscapedName);
+
+	// run query
+	if(!db_query(azQuery, NULL)) {
+		return FALSE;
+	}
+	// return the new ID
+	*pReturnID = db_insert_id();
+	return TRUE;	
+}
+gboolean db_pointset_delete(gint nPointSetID)
+{
+	if(!db_is_connected(g_pDB)) return FALSE;
+
+	gchar azQuery[MAX_SQLBUFFER_LEN];
+	g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "DELETE FROM %s WHERE ID=%d;", DB_LOCATIONSETS_TABLENAME, nPointSetID);
+	if(MYSQL_RESULT_SUCCESS != mysql_query(g_pDB->m_pMySQLConnection, azQuery)) {
+		g_warning("db_pointset_delete: deleting pointset failed: %s (SQL: %s)\n", mysql_error(g_pDB->m_pMySQLConnection), azQuery);
+		return FALSE;
+	}
+
+	g_snprintf(azQuery, MAX_SQLBUFFER_LEN, "DELETE FROM %s WHERE LocationSetID=%d;", DB_LOCATIONS_TABLENAME, nPointSetID);
+	if(MYSQL_RESULT_SUCCESS != mysql_query(g_pDB->m_pMySQLConnection, azQuery)) {
+		g_warning("db_pointset_delete: deleting points failed: %s (SQL: %s)\n", mysql_error(g_pDB->m_pMySQLConnection), azQuery);
+		return FALSE;
+	}
+	return TRUE;
+}
+
 gboolean db_point_delete(gint nPointID)
 {
 	if(!db_is_connected()) return FALSE;
@@ -342,4 +303,5 @@
 	}
 	return TRUE;
 }
+*/
 #endif

Index: locationset.h
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- locationset.h	4 Mar 2005 09:27:26 -0000	1.3
+++ locationset.h	8 Mar 2005 18:40:50 -0000	1.4
@@ -33,13 +33,6 @@
 	int a;
 } locationsetstyle_t;
 
-// a single location (eg. "Someday Cafe")
-typedef struct location {
-	gint m_nID;
-	gchar* m_pszName;
-	mappoint_t m_Coordinates;
-} location_t;
-
 // a set of locations (eg. "Coffee Shops")
 typedef struct locationset {
 	gint m_nID;

Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mainwindow.c	7 Mar 2005 23:31:41 -0000	1.20
+++ mainwindow.c	8 Mar 2005 18:40:50 -0000	1.21
@@ -578,7 +578,7 @@
 	const gchar *ppAuthors[] = {
 		"Ian McIntosh <ian_mcintosh at linuxadvocate.org>",
 		"Nathan Fredrickson <nathan at silverorange.com>",
-	    NULL
+		NULL
 	};
 
   	GtkWidget *pAboutWindow = gnome_about_new(

Index: map_draw_cairo.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map_draw_cairo.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- map_draw_cairo.c	7 Mar 2005 23:31:41 -0000	1.5
+++ map_draw_cairo.c	8 Mar 2005 18:40:50 -0000	1.6
@@ -41,6 +41,7 @@
 #include "road.h"
 #include "point.h"
 #include "layers.h"
+#include "location.h"
 #include "locationset.h"
 #include "scenemanager.h"
 
@@ -150,7 +151,7 @@
 	gfloat fFontSize = pLabelStyle->m_afFontSizeAtZoomLevel[pRenderMetrics->m_nZoomLevel-1];
 	if(fFontSize == 0) return;
 
-	if(!scenemanager_can_draw_label(pMap->m_pSceneManager, pszLabel)) {
+	if(!scenemanager_can_draw_label_at(pMap->m_pSceneManager, pszLabel, NULL)) {
 		//g_print("dup label: %s\n", pszLabel);
 		return;
 	}
@@ -389,10 +390,12 @@
 			cairo_show_text(pCairo, azLabelSegment);
 			//cairo_fill(pCairo);
 		cairo_restore(pCairo);
+
+		// scenemanager_claim_polygon(pMap->m_pSceneManager, GdkPoint *pPoints, gint nNumPoints);
 	}
 	cairo_restore(pCairo);
 
-	scenemanager_label_drawn(pMap->m_pSceneManager, pszLabel);
+	scenemanager_claim_label(pMap->m_pSceneManager, pszLabel);
 }
 
 void map_draw_cairo_polygon_label(map_t* pMap, cairo_t *pCairo, textlabelstyle_t* pLabelStyle, rendermetrics_t* pRenderMetrics, pointstring_t* pPointString, const gchar* pszLabel)
@@ -405,7 +408,7 @@
 	gdouble fAlpha = pLabelStyle->m_clrColor.m_fAlpha;
 	if(fAlpha == 0.0) return;
 
-	if(!scenemanager_can_draw_label(pMap->m_pSceneManager, pszLabel)) {
+	if(!scenemanager_can_draw_label_at(pMap->m_pSceneManager, pszLabel, NULL)) {
 		//g_print("dup label: %s\n", pszLabel);
 		return;
 	}
@@ -488,9 +491,10 @@
 		}
 		cairo_show_text(pCairo, pszLabel);
 		//cairo_fill(pCairo);
+//		scenemanager_claim_polygon(pMap->m_pSceneManager, GdkPoint *pPoints, gint nNumPoints);
 	cairo_restore(pCairo);
 
-        scenemanager_label_drawn(pMap->m_pSceneManager, pszLabel);
+        scenemanager_claim_label(pMap->m_pSceneManager, pszLabel);
 }
 
 #define CROSSHAIR_LINE_RELIEF   (6)

Index: scenemanager.c
===================================================================
RCS file: /cvs/cairo/roadster/src/scenemanager.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- scenemanager.c	1 Mar 2005 19:48:21 -0000	1.6
+++ scenemanager.c	8 Mar 2005 18:40:50 -0000	1.7
@@ -41,44 +41,70 @@
 
 void scenemanager_new(scenemanager_t** ppReturn)
 {
+	// create new scenemanager and return it
 	scenemanager_t* pNew = g_new0(scenemanager_t, 1);
 	pNew->m_pLabelHash = g_hash_table_new(g_str_hash, g_str_equal);
+	pNew->m_pTakenRegion = gdk_region_new();
 	*ppReturn = pNew;
 }
 
-gboolean scenemanager_can_draw_label(scenemanager_t* pSceneManager, const gchar* pszLabel)
+gboolean scenemanager_can_draw_label_at(scenemanager_t* pSceneManager, const gchar* pszLabel, GdkPoint* pScreenLocation)
 {
 	g_assert(pSceneManager != NULL);
+	g_assert(pszLabel != NULL);
+	
+	// g_assert(pScreenLocation != NULL);
+	// NOTE: ignore pScreenLocation for now
 
-	gpointer pKey;
-	gpointer pValue;
+	gpointer pKey, pValue;
 
-	// can draw if it doesn't exist in table
-	gboolean bOK = (g_hash_table_lookup_extended(pSceneManager->m_pLabelHash,
-                                        pszLabel, &pKey, &pValue) == FALSE);
+	// Can draw if it doesn't exist in table
+	return (FALSE == g_hash_table_lookup_extended(pSceneManager->m_pLabelHash, pszLabel, &pKey, &pValue));
+}
+
+gboolean scenemanager_can_draw_polygon(scenemanager_t* pSceneManager, GdkPoint *pPoints, gint nNumPoints)
+{
+	GdkRegion* pNewRegion = gdk_region_polygon(pPoints, nNumPoints, GDK_WINDING_RULE);
+	
+	// Set pNewRegion to the intersection of it and the 'taken region'
+	gdk_region_intersect(pNewRegion, pSceneManager->m_pTakenRegion);
+	gboolean bOK = gdk_region_empty(pNewRegion);	// it's ok to draw here if the intersection is empty
+        gdk_region_destroy(pNewRegion);
 
-//	g_print("permission for %s: %s\n", pszLabel, bOK ? "YES" : "NO");
 	return bOK;
 }
 
-void scenemanager_label_drawn(scenemanager_t* pSceneManager, const gchar* pszLabel)
+void scenemanager_claim_label(scenemanager_t* pSceneManager, const gchar* pszLabel)
 {
 	g_assert(pSceneManager != NULL);
-//	g_print("drawn! %s\n", pszLabel);
+
+	// Just putting the label into the hash is enough
 	g_hash_table_insert(pSceneManager->m_pLabelHash, pszLabel, NULL);
 }
 
+void scenemanager_claim_polygon(scenemanager_t* pSceneManager, GdkPoint *pPoints, gint nNumPoints)
+{
+	// Create a GdkRegion from the given points and union it with the 'taken region'
+	GdkRegion* pNewRegion = gdk_region_polygon(pPoints, nNumPoints, GDK_WINDING_RULE);
+	gdk_region_union(pSceneManager->m_pTakenRegion, pNewRegion);
+        gdk_region_destroy(pNewRegion);
+}
+
+void scenemanager_claim_rectangle(scenemanager_t* pSceneManager, GdkRectangle* pRect)
+{
+	// Add the area of the rectangle to the region
+	gdk_region_union_with_rect(pSceneManager->m_pTakenRegion, pRect);
+}
+
 void scenemanager_clear(scenemanager_t* pSceneManager)
 {
 	g_assert(pSceneManager != NULL);
 
+	// destroy and recreate hash table (better way to clear it?)
 	g_hash_table_destroy(pSceneManager->m_pLabelHash);
 	pSceneManager->m_pLabelHash = g_hash_table_new(g_str_hash, g_str_equal);
-}
 
-
-#if ROADSTER_DEAD_CODE
-static void scenemanager_add_label_line(geometryset_t* pGeometry, gchar* pszLabel) {}
-static void scenemanager_add_label_polygon(geometryset_t* pGeometry, gchar* pszLabel) {}
-static void scenemanager_draw(void) {}
-#endif /* ROADSTER_DEAD_CODE */
+	// Empty the region (better way?)
+	gdk_region_destroy(pSceneManager->m_pTakenRegion);
+	pSceneManager->m_pTakenRegion = gdk_region_new();
+}

Index: scenemanager.h
===================================================================
RCS file: /cvs/cairo/roadster/src/scenemanager.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- scenemanager.h	4 Mar 2005 09:27:26 -0000	1.3
+++ scenemanager.h	8 Mar 2005 18:40:50 -0000	1.4
@@ -25,16 +25,20 @@
 #define _SCENEMANAGER_H_
 
 typedef struct scenemanager {
-	GPtrArray* m_p;
+	GdkRegion* m_pTakenRegion;
+
 	GHashTable* m_pLabelHash;
 } scenemanager_t;
 
 void scenemanager_init(void);
 void scenemanager_new(scenemanager_t** ppReturn);
 
-gboolean scenemanager_can_draw_label(scenemanager_t* pSceneManager, const gchar* pszLabel);
-void scenemanager_label_drawn(scenemanager_t* pSceneManager, const gchar* pszLabel);
-void scenemanager_clear(scenemanager_t* pSceneManager);
+gboolean scenemanager_can_draw_label_at(scenemanager_t* pSceneManager, const gchar* pszLabel, GdkPoint* pScreenLocation);
+gboolean scenemanager_can_draw_polygon(scenemanager_t* pSceneManager, GdkPoint *pPoints, gint nNumPoints);
+void scenemanager_claim_label(scenemanager_t* pSceneManager, const gchar* pszLabel);
+void scenemanager_claim_polygon(scenemanager_t* pSceneManager, GdkPoint *pPoints, gint nNumPoints);
+void scenemanager_claim_rectangle(scenemanager_t* pSceneManager, GdkRectangle* pRect);
 
+void scenemanager_clear(scenemanager_t* pSceneManager);
 
 #endif




More information about the cairo-commit mailing list