[cairo-commit]
roadster/src Makefile.am, 1.9, 1.10 databasewindow.c,
1.4, 1.5 db.c, 1.11, 1.12 db.h, 1.6, 1.7 glyph.c, 1.2,
1.3 glyph.h, 1.1, 1.2 gotowindow.c, 1.5, 1.6 gpsclient.c, 1.4,
1.5 main.c, 1.9, 1.10 mainwindow.c, 1.12, 1.13 map.c, 1.14,
1.15 map.h, 1.3, 1.4 search_road.c, 1.11, 1.12 searchwindow.c,
1.7, 1.8 searchwindow.h, 1.2, 1.3 util.h, 1.2, 1.3
Ian McIntosh
commit at pdx.freedesktop.org
Thu Mar 3 18:27:31 PST 2005
- Previous message: [cairo-commit] cairo/src cairo_glitz_surface.c, 1.19,
1.20 cairo_image_surface.c, 1.26, 1.27 cairo_pdf_surface.c,
1.15, 1.16 cairo_png_surface.c, 1.16, 1.17 cairo_ps_surface.c,
1.23, 1.24 cairo_surface.c, 1.42, 1.43 cairo_xlib_surface.c,
1.45, 1.46 cairoint.h, 1.100, 1.101
- Next message: [cairo-commit] roadster ChangeLog,1.33,1.34
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: ian
Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv29799/src
Modified Files:
Makefile.am databasewindow.c db.c db.h glyph.c glyph.h
gotowindow.c gpsclient.c main.c mainwindow.c map.c map.h
search_road.c searchwindow.c searchwindow.h util.h
Log Message:
* map.c: Removed drawing code, added two rendering backends.
* map_draw_cairo.c:
* map_draw_gdk.c: Added.
* glyph.c: Made libsvg optional.
* gotowindow.c: Removed lots of unused code.
* main.c: Initialize threading (currently disabled).
* search_road.c: Don't pass RoadID to search results window.
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/roadster/src/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.am 2 Mar 2005 21:28:55 -0000 1.9
+++ Makefile.am 4 Mar 2005 02:27:29 -0000 1.10
@@ -43,6 +43,8 @@
pointstring.c\
track.c\
glyph.c\
+ map_draw_cairo.c\
+ map_draw_gdk.c\
road.c
roadster_LDADD = \
Index: databasewindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/databasewindow.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- databasewindow.c 26 Feb 2005 04:41:40 -0000 1.4
+++ databasewindow.c 4 Mar 2005 02:27:29 -0000 1.5
@@ -23,8 +23,6 @@
#ifdef ROADSTER_DEAD_CODE
-
-
#include <gtk/gtk.h>
#include <glade/glade.h>
Index: db.c
===================================================================
RCS file: /cvs/cairo/roadster/src/db.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- db.c 2 Mar 2005 06:25:48 -0000 1.11
+++ db.c 4 Mar 2005 02:27:29 -0000 1.12
@@ -53,17 +53,7 @@
#define MYSQL_GET_RESULT(x) mysql_store_result((x))
db_connection_t* g_pDB = NULL;
-GMutex* g_pDBMutex = NULL;
-
-void db_lock(void)
-{
- g_mutex_lock(g_pDBMutex);
-}
-void db_unlock(void)
-{
- g_mutex_unlock(g_pDBMutex);
-}
gboolean db_query(const gchar* pszSQL, db_resultset_t** ppResultSet)
{
@@ -192,7 +182,7 @@
// call once on program start-up
void db_init()
{
- g_pDBMutex = g_mutex_new();
+// g_pDBMutex = g_mutex_new();
#ifdef HAVE_MYSQL_EMBED
gchar* pszDataDir = g_strdup_printf("%s/.roadster/data", g_get_home_dir());
@@ -519,11 +509,9 @@
gint nGeometryType = *((gint32*)data)++;
g_assert(nGeometryType == WKB_LINESTRING);
- // next 4 bytes is the point count
gint nNumPoints = *((gint32*)data)++; // NOTE for later: this field doesn't exist for type POINT
while(nNumPoints > 0) {
- // g_print("reading a point...\n");
mappoint_t* pPoint = NULL;
if(!callback_get_point(&pPoint)) return;
@@ -860,6 +848,29 @@
g_assert_not_reached();
}
}
+
+GMutex* g_pDBMutex = NULL;
+
+void db_lock(void)
+{
+ g_mutex_lock(g_pDBMutex);
+}
+
+void db_unlock(void)
+{
+ g_mutex_unlock(g_pDBMutex);
+}
+
+void db_begin_thread(void)
+{
+ mysql_thread_init();
+}
+
+void db_end_thread(void)
+{
+ mysql_thread_end();
+}
+
*/
#endif
Index: db.h
===================================================================
RCS file: /cvs/cairo/roadster/src/db.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- db.h 2 Mar 2005 06:25:48 -0000 1.6
+++ db.h 4 Mar 2005 02:27:29 -0000 1.7
@@ -73,6 +73,9 @@
void db_free_result(db_resultset_t* pResultSet);
gint db_get_last_insert_id(void);
+void db_begin_thread(void);
+void db_end_thread(void);
+
gchar* db_make_escaped_string(const gchar* pszString);
void db_free_escaped_string(gchar* pszString);
Index: glyph.c
===================================================================
RCS file: /cvs/cairo/roadster/src/glyph.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glyph.c 1 Mar 2005 19:48:21 -0000 1.2
+++ glyph.c 4 Mar 2005 02:27:29 -0000 1.3
@@ -22,14 +22,21 @@
*/
#include <gnome.h>
+
+#include <cairo.h>
+
+#ifdef HAVE_LIBSVG
#include <svg-cairo.h>
+#endif
typedef enum { GLYPHTYPE_NONE=0, GLYPHTYPE_BITMAP, GLYPHTYPE_VECTOR } EGlyphType;
typedef struct glyph {
EGlyphType m_eType;
+#ifdef HAVE_LIBSVG
svg_cairo_t *m_pCairoSVG;
+#endif
gint m_nWidth;
gint m_nHeight;
@@ -47,6 +54,7 @@
gint glyph_load(const gchar* pszPath)
{
+#ifdef HAVE_LIBSVG
svg_cairo_t* pCairoSVG = NULL;
if(SVG_CAIRO_STATUS_SUCCESS != svg_cairo_create(&pCairoSVG)) {
@@ -68,6 +76,9 @@
g_ptr_array_add(g_Glyph.m_pGlyphArray, pNewGlyph);
return nGlyphHandle;
+#else
+ return 0;
+#endif
}
static gboolean glyph_lookup(gint nGlyphHandle, glyph_t** ppReturnGlyph)
@@ -85,6 +96,7 @@
void glyph_draw_centered(cairo_t* pCairo, gint nGlyphHandle, gdouble fX, gdouble fY)
{
+#ifdef HAVE_LIBSVG
if(nGlyphHandle == 0) return;
glyph_t* pGlyph = NULL;
@@ -97,9 +109,14 @@
cairo_translate(pCairo, (fX - (pGlyph->m_nWidth/2)), (fY - (pGlyph->m_nHeight/2)));
svg_cairo_render(pGlyph->m_pCairoSVG, pCairo);
cairo_restore(pCairo);
+#else
+ return;
+#endif
}
void glyph_deinit(void)
{
+#ifdef HAVE_LIBSVG
// svg_cairo_destroy(svgc) all glyphs
+#endif
}
Index: glyph.h
===================================================================
RCS file: /cvs/cairo/roadster/src/glyph.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- glyph.h 28 Feb 2005 03:34:04 -0000 1.1
+++ glyph.h 4 Mar 2005 02:27:29 -0000 1.2
@@ -24,6 +24,8 @@
#ifndef _GLYPH_H_
#define _GLYPH_H_
+#include <cairo.h>
+
void glyph_init(void);
gint glyph_load(const gchar* pszPath);
void glyph_draw_centered(cairo_t* pCairo, gint nGlyphHandle, gdouble fX, gdouble fY);
Index: gotowindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/gotowindow.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gotowindow.c 1 Mar 2005 19:48:21 -0000 1.5
+++ gotowindow.c 4 Mar 2005 02:27:29 -0000 1.6
@@ -23,97 +23,29 @@
#include <glade/glade.h>
#include <gnome.h>
-#include "util.h"
-#include "map.h"
#include "mainwindow.h"
#include "gotowindow.h"
-#define LOCATIONLIST_COLUMN_NAME (0)
-#define LOCATIONLIST_COLUMN_LOCATION (1)
-#define LOCATIONLIST_COLUMN_LATITUDE (2)
-#define LOCATIONLIST_COLUMN_LONGITUDE (3)
-#define LOCATIONLIST_NUM_COLUMNS (4)
-
-void gotowindow_on_locationlist_row_activated(GtkTreeView *treeview, GtkTreePath *arg1, GtkTreeViewColumn *arg2, gpointer user_data);
-void gotowindow_on_location_list_selection_changed(GtkTreeSelection *treeselection, gpointer user_data);
-
struct {
GtkWindow* m_pWindow;
-// GtkRadioButton* m_pNewLocationRadioButton;
-// GtkRadioButton* m_pKnownLocationRadioButton;
- GtkTreeView* m_pLocationListTreeView;
- GtkListStore* m_pLocationListModel;
GtkEntry* m_pLongitudeEntry;
GtkEntry* m_pLatitudeEntry;
} g_GotoWindow;
void gotowindow_init(GladeXML* pGladeXML)
{
- g_GotoWindow.m_pWindow = GTK_WINDOW(glade_xml_get_widget(pGladeXML, "gotowindow")); g_return_if_fail(g_GotoWindow.m_pWindow != NULL);
- //g_GotoWindow.m_pNewLocationRadioButton = GTK_RADIO_BUTTON(glade_xml_get_widget(pGladeXML, "newlocationradiobutton")); g_return_if_fail(g_GotoWindow.m_pNewLocationRadioButton != NULL);
- //g_GotoWindow.m_pKnownLocationRadioButton = GTK_RADIO_BUTTON(glade_xml_get_widget(pGladeXML, "knownlocationradiobutton")); g_return_if_fail(g_GotoWindow.m_pKnownLocationRadioButton != NULL);
- g_GotoWindow.m_pLocationListTreeView = GTK_TREE_VIEW(glade_xml_get_widget(pGladeXML, "knownlocationtreeview")); g_return_if_fail(g_GotoWindow.m_pLocationListTreeView != NULL);
+ g_GotoWindow.m_pWindow = GTK_WINDOW(glade_xml_get_widget(pGladeXML, "gotowindow")); g_return_if_fail(g_GotoWindow.m_pWindow != NULL);
g_GotoWindow.m_pLongitudeEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "longitudeentry")); g_return_if_fail(g_GotoWindow.m_pLongitudeEntry != NULL);
g_GotoWindow.m_pLatitudeEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "latitudeentry")); g_return_if_fail(g_GotoWindow.m_pLatitudeEntry != NULL);
// don't delete window on X, just hide it
- g_signal_connect(G_OBJECT(g_GotoWindow.m_pWindow), "delete_event", G_CALLBACK(gtk_widget_hide), NULL);
-
- g_GotoWindow.m_pLocationListModel = gtk_list_store_new(LOCATIONLIST_NUM_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_DOUBLE,
- G_TYPE_DOUBLE);
- gtk_tree_view_set_model(g_GotoWindow.m_pLocationListTreeView, GTK_TREE_MODEL(g_GotoWindow.m_pLocationListModel));
-
- GtkTreeSelection* pTreeSelection = gtk_tree_view_get_selection(g_GotoWindow.m_pLocationListTreeView);
- g_signal_connect(G_OBJECT(pTreeSelection), "changed", (GtkSignalFunc)gotowindow_on_location_list_selection_changed, NULL);
-
- GtkCellRenderer* pCellRenderer;
- GtkTreeViewColumn* pColumn;
-
- /* add Layer Name column (with a text renderer) */
- pCellRenderer = gtk_cell_renderer_text_new();
- pColumn = gtk_tree_view_column_new_with_attributes("Name", pCellRenderer, "text", LOCATIONLIST_COLUMN_NAME, NULL);
- gtk_tree_view_append_column(g_GotoWindow.m_pLocationListTreeView, pColumn);
-
- /* add Location column */
- pCellRenderer = gtk_cell_renderer_text_new();
- pColumn = gtk_tree_view_column_new_with_attributes("Location", pCellRenderer, "text", LOCATIONLIST_COLUMN_LOCATION, NULL);
- gtk_tree_view_append_column(g_GotoWindow.m_pLocationListTreeView, pColumn);
-
- //
- // add some fake data (FIXME)
- //
- struct { gchar* name; double lat; double lon; } list[] = {
- {"Home", 42.3718, -71.0906},
- {"Concord, NH", 43.2062, -71.5363},
- {"Cambridge Common, MA", 42.3768, -71.1212},
- {"Central Park, NY", 40.78410, -73.96429},
- };
- GtkTreeIter iter;
- int i;
- for(i=0 ; i<NUM_ELEMS(list) ;i++) {
- gtk_list_store_append(g_GotoWindow.m_pLocationListModel, &iter);
-
- gtk_list_store_set(g_GotoWindow.m_pLocationListModel, &iter,
- LOCATIONLIST_COLUMN_NAME, list[i].name,
- LOCATIONLIST_COLUMN_LOCATION, g_strdup_printf("(%8.5f, %8.5f)", list[i].lat, list[i].lon),
- LOCATIONLIST_COLUMN_LATITUDE, list[i].lat,
- LOCATIONLIST_COLUMN_LONGITUDE, list[i].lon,
- -1);
- }
+ g_signal_connect(G_OBJECT(g_GotoWindow.m_pWindow), "delete_event", G_CALLBACK(gtk_widget_hide), NULL);
}
void gotowindow_show(void)
{
if(!GTK_WIDGET_VISIBLE(g_GotoWindow.m_pWindow)) {
-// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_GotoWindow.m_pKnownLocationRadioButton), TRUE);
- gtk_widget_grab_focus(GTK_WIDGET(g_GotoWindow.m_pLocationListTreeView));
-
- //~ gtk_entry_set_text(g_GotoWindow.m_pLongitudeEntry, "");
- //~ gtk_entry_set_text(g_GotoWindow.m_pLatitudeEntry, "");
-
+ gtk_widget_grab_focus(GTK_WIDGET(g_GotoWindow.m_pLatitudeEntry));
gtk_widget_show(GTK_WIDGET(g_GotoWindow.m_pWindow));
}
gtk_window_present(g_GotoWindow.m_pWindow);
@@ -151,35 +83,12 @@
if(!util_string_to_double(pszLatitude, &(pt.m_fLatitude))) return FALSE;
if(!util_string_to_double(pszLongitude, &(pt.m_fLongitude))) return FALSE;
- // TODO: error checking for 0 (meaning either bad text "3a21" or "000" etc.
-
mainwindow_set_centerpoint(&pt);
mainwindow_draw_map();
mainwindow_statusbar_update_position();
return TRUE;
}
-//~ gboolean gotowindow_goto_known_location()
-//~ {
- //~ double fLatitude = 0, fLongitude = 0;
- //~ GtkTreeIter iter;
- //~ GtkTreeSelection *pKnownLocationSelection;
- //~ GtkTreeModel* pModel = GTK_TREE_MODEL(g_GotoWindow.m_pLocationListModel);
- //~ pKnownLocationSelection = gtk_tree_view_get_selection(g_GotoWindow.m_pLocationListTreeView);
- //~ if(gtk_tree_selection_get_selected(pKnownLocationSelection, &pModel, &iter)) {
- //~ gtk_tree_model_get(pModel,
- //~ &iter,
- //~ LOCATIONLIST_COLUMN_LATITUDE, &fLatitude,
- //~ LOCATIONLIST_COLUMN_LONGITUDE, &fLongitude,
- //~ -1);
-
- //~ map_center_on_worldpoint(fLatitude, fLongitude);
- //~ mainwindow_draw_map();
- //~ return TRUE;
- //~ }
- //~ return FALSE;
-//~ }
-
//
// Callbacks
//
@@ -197,25 +106,3 @@
gotowindow_hide();
}
}
-
-void gotowindow_on_location_list_selection_changed(GtkTreeSelection *treeselection, gpointer user_data)
-{
- double fLatitude = 0, fLongitude = 0;
- GtkTreeIter iter;
- GtkTreeSelection *pLocationSelection;
- GtkTreeModel* pModel = GTK_TREE_MODEL(g_GotoWindow.m_pLocationListModel);
- pLocationSelection = gtk_tree_view_get_selection(g_GotoWindow.m_pLocationListTreeView);
-
- if(gtk_tree_selection_get_selected(pLocationSelection, &pModel, &iter)) {
- gtk_tree_model_get(pModel,
- &iter,
- LOCATIONLIST_COLUMN_LATITUDE, &fLatitude,
- LOCATIONLIST_COLUMN_LONGITUDE, &fLongitude,
- -1);
- gchar azValue[50];
- g_snprintf(azValue, 50, "%.5f", fLatitude);
- gtk_entry_set_text(g_GotoWindow.m_pLatitudeEntry, azValue);
- g_snprintf(azValue, 50, "%.5f", fLongitude);
- gtk_entry_set_text(g_GotoWindow.m_pLongitudeEntry, azValue);
- }
-}
Index: gpsclient.c
===================================================================
RCS file: /cvs/cairo/roadster/src/gpsclient.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gpsclient.c 26 Feb 2005 04:41:40 -0000 1.4
+++ gpsclient.c 4 Mar 2005 02:27:29 -0000 1.5
@@ -32,12 +32,19 @@
gboolean gpsclient_callback_data_waiting(GIOChannel *source, GIOCondition condition, gpointer data);
-static void gpsclient_callback_raw_data(char* p)
+void gpsclient_init()
{
- // g_print("raw: %s\n", p);
+ g_GPSClient.m_pPublicGPSData = g_new0(gpsdata_t, 1);
+
+ gpsclient_connect();
}
-void gpsclient_debug_print(void);
+// static void gpsclient_callback_raw_data(char* p)
+// {
+// // g_print("raw: %s\n", p);
+// }
+
+// void gpsclient_debug_print(void);
static void gpsclient_connect(void)
{
@@ -67,12 +74,6 @@
}
}
-void gpsclient_init()
-{
- g_GPSClient.m_pPublicGPSData = g_new0(gpsdata_t, 1);
-
- gpsclient_connect();
-}
const gpsdata_t* gpsclient_getdata()
{
@@ -148,7 +149,7 @@
}
#ifdef ROADSTER_DEAD_CODE
-
+/*
static void gpsclient_debug_print(void)
{
struct gps_data_t* d = g_GPSClient.m_pGPSConnection; // gpsd data
@@ -170,5 +171,5 @@
g_print("gps_fd = %d\n\n", d->gps_fd);
}
-
+*/
#endif
Index: main.c
===================================================================
RCS file: /cvs/cairo/roadster/src/main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- main.c 3 Mar 2005 06:45:09 -0000 1.9
+++ main.c 4 Mar 2005 02:27:29 -0000 1.10
@@ -49,6 +49,10 @@
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
textdomain(PACKAGE);
#endif
+
+// g_thread_init(NULL);
+// gdk_threads_init();
+
gnome_init(PACKAGE, VERSION, argc, argv);
if(!main_init()) {
@@ -106,7 +110,7 @@
g_print("connecting to db\n");
gboolean bConnected = db_connect(NULL, NULL, NULL, "");
- g_print("creating needed tables\n");
+ g_print("creating database tables\n");
db_create_tables();
g_print("initialization complete\n");
Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mainwindow.c 3 Mar 2005 08:28:32 -0000 1.12
+++ mainwindow.c 4 Mar 2005 02:27:29 -0000 1.13
@@ -220,8 +220,7 @@
// create drawing area
g_MainWindow.m_pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new());
-
- g_print("creating map\n");
+ // create map
map_new(&g_MainWindow.m_pMap, GTK_WIDGET(g_MainWindow.m_pDrawingArea));
// add signal handlers to drawing area
@@ -239,7 +238,6 @@
cursor_init();
- g_print("loading at %s\n", PACKAGE_DATA_DIR);
g_MainWindow.m_nGPSLocationGlyph = glyph_load(PACKAGE_DATA_DIR"/car.svg");
/*
@@ -470,30 +468,6 @@
}
}
-/*
-** callbacks
-*/
-//~ void on_searchbutton_clicked (GtkToolButton *toolbutton, gpointer user_data)
-//~ {
- //~ gchar* pchSearchString = gtk_editable_get_chars(GTK_EDITABLE(g_MainWindow.m_pSearchBox), 0, MAX_SEARCH_TEXT_LENGTH);
- //~ search_execute(pchSearchString);
- //~ g_free(pchSearchString);
-//~ }
-
-#if ROADSTER_DEAD_CODE
-static gboolean on_searchbox_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
-{
- // Enter key?
- if(event->keyval == 65293) {
- // Grab the first MAX_SEARCH_TEXT_LENGTH characters from search box
- gchar* pchSearchString = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, MAX_SEARCH_TEXT_LENGTH);
- search_road_execute(pchSearchString);
- g_free(pchSearchString);
- }
- return FALSE;
-}
-#endif /* ROADSTER_DEAD_CODE */
-
// User clicked Quit window
void on_quitmenuitem_activate(GtkMenuItem *menuitem, gpointer user_data)
{
@@ -507,13 +481,6 @@
return FALSE; // satisfy strick compiler
}
-#if ROADSTER_DEAD_CODE
-static void on_searchbox_editing_done(GtkCellEditable *celleditable, gpointer user_data)
-{
-// g_message("on_searchbox_editing_done()\n");
-}
-#endif /* ROADSTER_DEAD_CODE */
-
// the range slider changed value
void on_zoomscale_value_changed(GtkRange *range, gpointer user_data)
{
@@ -638,7 +605,7 @@
gdk_window_get_pointer(w->window, &nX, &nY, NULL);
// Left double-click
- if(event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
+ if(event->button == 1 && event->type == GDK_BUTTON_PRESS) {
if(g_MainWindow.m_eSelectedTool == kToolZoom) {
map_center_on_windowpoint(g_MainWindow.m_pMap, nX, nY);
zoom_in_one();
@@ -725,7 +692,8 @@
void mainwindow_draw_map(void)
{
- map_draw_thread_begin(g_MainWindow.m_pMap, GTK_WIDGET(g_MainWindow.m_pDrawingArea));
+ map_draw(g_MainWindow.m_pMap);
+ //map_draw_thread_begin(g_MainWindow.m_pMap, GTK_WIDGET(g_MainWindow.m_pDrawingArea));
}
static gint mainwindow_on_configure_event(GtkWidget *pDrawingArea, GdkEventConfigure *event)
@@ -855,7 +823,6 @@
}
}
}
-// g_print("set GPS status = %d\n", pData->m_eStatus);
return TRUE;
}
@@ -866,6 +833,7 @@
#ifdef ROADSTER_DEAD_CODE
+/*
void on_importmenuitem_activate(GtkMenuItem *menuitem, gpointer user_data)
{
g_print("on_importmenuitem_activate\n");
@@ -882,18 +850,18 @@
column = g_object_get_data (G_OBJECT (cell), "column");
- /* get toggled iter */
+ // 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 */
+ // do something with the value
toggle_item ^= 1;
- /* set new value */
+ // set new value
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column,
toggle_item, -1);
- /* clean up */
+ // clean up
gtk_tree_path_free (path);
}
@@ -902,4 +870,16 @@
datasetwindow_show();
}
+static gboolean on_searchbox_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ // Enter key?
+ if(event->keyval == 65293) {
+ // Grab the first MAX_SEARCH_TEXT_LENGTH characters from search box
+ gchar* pchSearchString = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, MAX_SEARCH_TEXT_LENGTH);
+ search_road_execute(pchSearchString);
+ g_free(pchSearchString);
+ }
+ return FALSE;
+}
+*/
#endif /* ROADSTER_DEAD_CODE */
Index: map.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- map.c 3 Mar 2005 06:45:09 -0000 1.14
+++ map.c 4 Mar 2005 02:27:29 -0000 1.15
@@ -26,10 +26,13 @@
#include <gnome.h>
#include <math.h>
-#define HACK_AROUND_CAIRO_LINE_CAP_BUG // enable to ensure roads have rounded caps if the style dictates
+//#define THREADED_RENDERING
-#define ROAD_FONT "Bitstream Vera Sans"
-#define AREA_FONT "Bitstream Vera Sans" // "Bitstream Charter"
+// #ifdef THREADED_RENDERING
+// #define RENDERING_THREAD_YIELD g_thread_yield()
+// #else
[...1201 lines suppressed...]
+ gdk_gc_set_rgb_fg_color(pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)], &clr);
+
+ gdk_gc_set_line_attributes(pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)],
+ 12,GDK_LINE_SOLID,GDK_CAP_ROUND,GDK_JOIN_MITER);
+ gdk_draw_lines(pPixmapTemp, pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)],
+ //TRUE,
+ points, 5);
+
+ gdk_gc_set_line_attributes(pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)],
+ 9,GDK_LINE_SOLID,GDK_CAP_ROUND,GDK_JOIN_MITER);
+
+ clr.red = clr.green = clr.blue = 65535;
+ gdk_gc_set_rgb_fg_color(pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)], &clr);
+ gdk_draw_lines(pPixmapTemp, pMap->m_pTargetWidget->style->fg_gc[GTK_WIDGET_STATE(pMap->m_pTargetWidget)],
+ //TRUE,
+ points, 5);
+ }
+ TIMER_END(gdktimer, "ending gdk");
+*/
+#endif /* ROADSTER_DEAD_CODE */
Index: map.h
===================================================================
RCS file: /cvs/cairo/roadster/src/map.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- map.h 1 Mar 2005 19:48:21 -0000 1.3
+++ map.h 4 Mar 2005 02:27:29 -0000 1.4
@@ -24,8 +24,6 @@
#ifndef _MAP_H_
#define _MAP_H_
-#include <cairo.h>
-
typedef enum {
kSublayerBottom,
kSublayerTop,
@@ -130,6 +128,8 @@
gint m_nWindowWidth;
gint m_nWindowHeight;
} rendermetrics_t;
+#define SCALE_X(p, x) ((((x) - (p)->m_rWorldBoundingBox.m_A.m_fLongitude) / (p)->m_fScreenLongitude) * (p)->m_nWindowWidth)
+#define SCALE_Y(p, y) ((p)->m_nWindowHeight - ((((y) - (p)->m_rWorldBoundingBox.m_A.m_fLatitude) / (p)->m_fScreenLatitude) * (p)->m_nWindowHeight))
typedef struct {
GPtrArray* m_pPointStringsArray; // this should probably change to an array of 'roads'
@@ -137,7 +137,7 @@
typedef struct {
// Mutex and the data it controls (always lock before reading/writing)
- GMutex* m_pDataMutex;
+ //GMutex* m_pDataMutex;
mappoint_t m_MapCenter;
dimensions_t m_MapDimensions;
guint16 m_uZoomLevel;
@@ -146,10 +146,33 @@
scenemanager_t* m_pSceneManager;
// Mutex and the data it controls (always lock before reading/writing)
- GMutex* m_pPixmapMutex;
+ //GMutex* m_pPixmapMutex;
GdkPixmap* m_pPixmap;
} map_t;
+typedef enum {
+ SUBLAYER_RENDERTYPE_LINES,
+ SUBLAYER_RENDERTYPE_POLYGONS,
+ SUBLAYER_RENDERTYPE_LINE_LABELS,
+ SUBLAYER_RENDERTYPE_POLYGON_LABELS
+} ESubLayerRenderType;
+
+typedef struct {
+ gint nLayer;
+ gint nSubLayer;
+ ESubLayerRenderType eSubLayerRenderType;
+
+// void (*pFunc)(map_t*, cairo_t*, rendermetrics_t*, GPtrArray*, sublayerstyle_t*, textlabelstyle_t*);
+} draworder_t;
+
+// Draw flags
+#define DRAWFLAG_LABELS (1)
+#define DRAWFLAG_BACKGROUND (2)
+#define DRAWFLAG_GEOMETRY (4) // next is 8
+
+
+#define NUM_SUBLAYER_TO_DRAW (22)
+extern draworder_t layerdraworder[NUM_SUBLAYER_TO_DRAW]; //
void map_init(void);
gboolean map_new(map_t** ppMap, GtkWidget* pTargetWidget);
@@ -178,11 +201,11 @@
// remove this!
void map_center_on_windowpoint(map_t* pMap, guint16 uX, guint16 uY);
-
GdkPixmap* map_get_pixmap(map_t* pMap);
void map_release_pixmap(map_t* pMap);
-void map_draw_thread_begin(map_t* pMap, GtkWidget* pTargetWidget);
+//void map_draw_thread_begin(map_t* pMap, GtkWidget* pTargetWidget);
-void map_draw(map_t* pMap, cairo_t *cr);
+void map_draw(map_t* pMap);
+double map_degrees_to_pixels(map_t* pMap, gdouble fDegrees, guint16 uZoomLevel);
#endif
Index: search_road.c
===================================================================
RCS file: /cvs/cairo/roadster/src/search_road.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- search_road.c 2 Mar 2005 06:25:48 -0000 1.11
+++ search_road.c 4 Mar 2005 02:27:29 -0000 1.12
@@ -29,7 +29,6 @@
#include "util.h"
#include "pointstring.h"
#include "point.h"
-#include "searchwindow.h"
#include "search.h"
#include "search_road.h"
#include "road.h"
@@ -573,7 +572,7 @@
// reverse start/end for the dear user :)
g_snprintf(azBuffer, BUFFER_SIZE, "%d-%d %s %s\n%s", nAddressRightEnd, nAddressRightStart, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZRight);
}
- searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
+ searchwindow_add_result(azBuffer, &ptAddress);
// do left side, same as right side (see above)
if(nAddressLeftStart == 0 && nAddressLeftEnd == 0) {
@@ -586,7 +585,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(nRoadID, azBuffer, &ptAddress);
+ searchwindow_add_result(azBuffer, &ptAddress);
}
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
@@ -611,7 +610,7 @@
pointstring_walk_percentage(pPointString, fPercent, ROADSIDE_LEFT, &ptAddress);
}
g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZLeft);
- searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
+ searchwindow_add_result(azBuffer, &ptAddress);
}
else if(nRoadNumber >= nAddressLeftEnd && nRoadNumber <= nAddressLeftStart) {
// MATCH: left side backwards
@@ -627,7 +626,7 @@
pointstring_walk_percentage(pPointString, (100.0 - fPercent), ROADSIDE_RIGHT, &ptAddress);
}
g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZLeft);
- searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
+ searchwindow_add_result(azBuffer, &ptAddress);
}
}
@@ -648,7 +647,7 @@
pointstring_walk_percentage(pPointString, fPercent, ROADSIDE_RIGHT, &ptAddress);
}
g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZRight);
- searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
+ searchwindow_add_result(azBuffer, &ptAddress);
}
else if(nRoadNumber >= nAddressRightEnd && nRoadNumber <= nAddressRightStart) {
// MATCH: right side backwards
@@ -664,7 +663,8 @@
pointstring_walk_percentage(pPointString, (100.0 - fPercent), ROADSIDE_LEFT, &ptAddress);
}
g_snprintf(azBuffer, BUFFER_SIZE, "%d %s %s\n%s", nRoadNumber, pszRoadName, road_suffix_itoa(nRoadSuffixID, ROAD_SUFFIX_LENGTH_LONG), pszCSZRight);
- searchwindow_add_result(nRoadID, azBuffer, &ptAddress);
+ searchwindow_add_result
+ (azBuffer, &ptAddress);
}
}
}
Index: searchwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- searchwindow.c 1 Mar 2005 19:48:21 -0000 1.7
+++ searchwindow.c 4 Mar 2005 02:27:29 -0000 1.8
@@ -24,121 +24,48 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
-#include <gdk/gdkx.h>
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <gnome.h>
-
#include "search_road.h"
#include "search_location.h"
-#include "searchwindow.h"
-#include "locationset.h"
#include "mainwindow.h"
+#include "searchwindow.h"
+
+#define GTK_PROCESS_MAINLOOP while (gtk_events_pending ()) { gtk_main_iteration (); }
+
+#define RESULTLIST_COLUMN_NAME 0
+#define RESULTLIST_LATITUDE 1
+#define RESULTLIST_LONGITUDE 2
-static void fill_combobox_with_distance_unit_names(GtkComboBox* pComboBox)
-{
- gint i;
- for(i=UNIT_FIRST ; i<=UNIT_LAST ; i++) {
- gtk_combo_box_append_text(pComboBox, g_aDistanceUnitNames[i]);
- }
- gtk_combo_box_set_active(pComboBox, DEFAULT_UNIT);
-}
struct {
// window
GtkComboBox* m_pSearchTypeComboBox; // choose between types of searches
- // address search
- GtkVBox* m_pAddressSearchBox;
- GtkEntry* m_pAddressStreetEntry;
- GtkEntry* m_pAddressCityEntry;
- GtkEntry* m_pAddressStateEntry;
- GtkEntry* m_pAddressZIPCodeEntry;
-
- // location search
- GtkVBox* m_pLocationSearchBox;
- GtkEntry* m_pLocationNameEntry;
- GtkComboBox* m_pLocationSetComboBox;
- GtkListStore* m_pLocationSetComboBoxModel;
- GtkComboBox* m_pLocationDistanceUnitComboBox;
- GtkSpinButton* m_pLocationDistanceSpinButton;
+ // search text box (on the toolbar)
+ GtkEntry* m_pSearchEntry;
- // common to all searches
- GtkButton* m_pFindButton;
+ // search button (on the toolbar)
+ GtkButton* m_pSearchButton;
- // results list
+ // results list (on the sidebar)
GtkTreeView* m_pResultsTreeView;
GtkListStore* m_pResultsListStore;
+
+ // go to selected result button (on the sidebar)
GtkButton* m_pGoButton;
} g_SearchWindow = {0};
-#define SEARCH_TYPE_ADDRESS 0
-#define SEARCH_TYPE_LOCATIONS 1
-
-#define RESULTLIST_COLUMN_NAME 0
-#define RESULTLIST_LATITUDE 1
-#define RESULTLIST_LONGITUDE 2
-
-void searchwindow_on_resultslist_selection_changed(GtkTreeSelection *treeselection, gpointer user_data);
+static void searchwindow_on_resultslist_selection_changed(GtkTreeSelection *treeselection, gpointer user_data);
void searchwindow_init(GladeXML* pGladeXML)
{
- g_SearchWindow.m_pSearchTypeComboBox = GTK_COMBO_BOX(glade_xml_get_widget(pGladeXML, "searchtypecombo")); g_return_if_fail(g_SearchWindow.m_pSearchTypeComboBox != NULL);
- g_SearchWindow.m_pAddressStreetEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "addressstreetentry")); g_return_if_fail(g_SearchWindow.m_pAddressStreetEntry != NULL);
- g_SearchWindow.m_pAddressCityEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "addresscityentry")); g_return_if_fail(g_SearchWindow.m_pAddressCityEntry != NULL);
- g_SearchWindow.m_pAddressStateEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "addressstateentry")); g_return_if_fail(g_SearchWindow.m_pAddressStateEntry != NULL);
- g_SearchWindow.m_pAddressZIPCodeEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "addresszipcodeentry")); g_return_if_fail(g_SearchWindow.m_pAddressZIPCodeEntry != NULL);
- g_SearchWindow.m_pResultsTreeView = GTK_TREE_VIEW(glade_xml_get_widget(pGladeXML, "addressresultstreeview")); g_return_if_fail(g_SearchWindow.m_pResultsTreeView != NULL);
- g_SearchWindow.m_pLocationSearchBox = GTK_VBOX(glade_xml_get_widget(pGladeXML, "locationsearchbox")); g_return_if_fail(g_SearchWindow.m_pLocationSearchBox != NULL);
- g_SearchWindow.m_pAddressSearchBox = GTK_VBOX(glade_xml_get_widget(pGladeXML, "addresssearchbox")); g_return_if_fail(g_SearchWindow.m_pAddressSearchBox != NULL);
- g_SearchWindow.m_pFindButton = GTK_BUTTON(glade_xml_get_widget(pGladeXML, "searchfindbutton")); g_return_if_fail(g_SearchWindow.m_pFindButton!= NULL);
- g_SearchWindow.m_pGoButton = GTK_BUTTON(glade_xml_get_widget(pGladeXML, "searchgobutton")); g_return_if_fail(g_SearchWindow.m_pGoButton != NULL);
- g_SearchWindow.m_pLocationNameEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "locationnameentry")); g_return_if_fail(g_SearchWindow.m_pLocationNameEntry != NULL);
- g_SearchWindow.m_pLocationSetComboBox = GTK_COMBO_BOX(glade_xml_get_widget(pGladeXML, "locationsetcombobox")); g_return_if_fail(g_SearchWindow.m_pLocationSetComboBox != NULL);
- g_SearchWindow.m_pLocationDistanceSpinButton = GTK_SPIN_BUTTON(glade_xml_get_widget(pGladeXML, "locationdistancespinbutton")); g_return_if_fail(g_SearchWindow.m_pLocationDistanceSpinButton != NULL);
- g_SearchWindow.m_pLocationDistanceUnitComboBox = GTK_COMBO_BOX(glade_xml_get_widget(pGladeXML, "locationdistanceunitcombobox")); g_return_if_fail(g_SearchWindow.m_pLocationDistanceUnitComboBox != NULL);
-
- //
- fill_combobox_with_distance_unit_names(g_SearchWindow.m_pLocationDistanceUnitComboBox);
-
- gtk_combo_box_set_active(g_SearchWindow.m_pSearchTypeComboBox, SEARCH_TYPE_ADDRESS);
- gtk_widget_hide(GTK_WIDGET(g_SearchWindow.m_pLocationSearchBox));
- gtk_widget_show(GTK_WIDGET(g_SearchWindow.m_pAddressSearchBox));
-
- //
- //
- //
- g_SearchWindow.m_pLocationSetComboBoxModel = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
- gtk_combo_box_set_model(g_SearchWindow.m_pLocationSetComboBox, GTK_TREE_MODEL(g_SearchWindow.m_pLocationSetComboBoxModel));
-
-#define LOCATIONSETLIST_COLUMN_NAME 0
-#define LOCATIONSETLIST_COLUMN_ID 1
-
- gint i;
- const GPtrArray* pLocationSets = locationset_get_set_array();
- //~ gtk_combo_box_append_text(g_SearchWindow.m_pLocationSetComboBox, "All");
-
- GtkTreeIter iter;
-
- gtk_list_store_append(g_SearchWindow.m_pLocationSetComboBoxModel, &iter);
- gtk_list_store_set(g_SearchWindow.m_pLocationSetComboBoxModel, &iter,
- LOCATIONSETLIST_COLUMN_NAME, "All",
- LOCATIONSETLIST_COLUMN_ID, 0,
- -1);
- gtk_combo_box_set_active_iter(g_SearchWindow.m_pLocationSetComboBox, &iter);
-
- for(i=0 ; i<pLocationSets->len ;i++) {
- locationset_t* pLocationSet = g_ptr_array_index(pLocationSets, i);
-
- gtk_list_store_append(g_SearchWindow.m_pLocationSetComboBoxModel, &iter);
- gtk_list_store_set(g_SearchWindow.m_pLocationSetComboBoxModel, &iter,
- LOCATIONSETLIST_COLUMN_NAME, pLocationSet->m_pszName,
- LOCATIONSETLIST_COLUMN_ID, pLocationSet->m_nID,
- -1);
- }
+ g_SearchWindow.m_pSearchEntry = GTK_ENTRY(glade_xml_get_widget(pGladeXML, "searchentry")); g_return_if_fail(g_SearchWindow.m_pSearchEntry != NULL);
+ g_SearchWindow.m_pSearchButton = GTK_BUTTON(glade_xml_get_widget(pGladeXML, "searchbutton")); g_return_if_fail(g_SearchWindow.m_pSearchButton != NULL);
+ g_SearchWindow.m_pResultsTreeView = GTK_TREE_VIEW(glade_xml_get_widget(pGladeXML, "searchresultstreeview")); g_return_if_fail(g_SearchWindow.m_pResultsTreeView != NULL);
+ g_SearchWindow.m_pGoButton = GTK_BUTTON(glade_xml_get_widget(pGladeXML, "searchgobutton")); g_return_if_fail(g_SearchWindow.m_pGoButton != NULL);
// create results tree view
g_SearchWindow.m_pResultsListStore = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
@@ -157,20 +84,6 @@
g_signal_connect(G_OBJECT(pTreeSelection), "changed", (GtkSignalFunc)searchwindow_on_resultslist_selection_changed, NULL);
}
-static gint searchwindow_get_selected_locationset(void)
-{
- gint nID;
- GtkTreeIter iter;
-
- if(gtk_combo_box_get_active_iter(g_SearchWindow.m_pLocationSetComboBox, &iter)) {
- gtk_tree_model_get(GTK_TREE_MODEL(g_SearchWindow.m_pLocationSetComboBoxModel), &iter,
- LOCATIONSETLIST_COLUMN_ID, &nID,
- -1);
- return nID;
- }
- return 0;
-}
-
void searchwindow_clear_results(void)
{
// remove all search results from the list
@@ -182,41 +95,23 @@
// begin a search
void searchwindow_on_findbutton_clicked(GtkWidget *pWidget, gpointer* p)
{
- gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.m_pFindButton), FALSE);
+ g_print("begin search\n");
- searchwindow_clear_results();
+ gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.m_pSearchButton), FALSE);
- gint nSearchType = gtk_combo_box_get_active(g_SearchWindow.m_pSearchTypeComboBox);
- if(nSearchType == SEARCH_TYPE_ADDRESS) {
- const gchar* pStreet = gtk_entry_get_text(g_SearchWindow.m_pAddressStreetEntry);
+ searchwindow_clear_results();
- void* pBusy = mainwindow_set_busy();
- search_road_execute(pStreet);
- mainwindow_set_not_busy(&pBusy);
- }
- else {
- const gchar* pszSearch = gtk_entry_get_text(g_SearchWindow.m_pLocationNameEntry);
- gint nLocationSetID = searchwindow_get_selected_locationset();
- gfloat fDistance = gtk_spin_button_get_value(g_SearchWindow.m_pLocationDistanceSpinButton);
- gint nDistanceUnit = gtk_combo_box_get_active(g_SearchWindow.m_pLocationDistanceUnitComboBox);
-
- //~ const gchar* pSearch = gtk_entry_get_text(g_SearchWindow.m_pLocationNameEntry);
- //~ GtkComboBox* m_pLocationSetComboBox;
- //~ GtkComboBox* m_pLocationDistanceUnitComboBox;
- g_print("pszSearch = %s, nLocationSetID = %d, fDistance = %f, nDistanceUnit=%d\n", pszSearch, nLocationSetID, fDistance, nDistanceUnit);
+ const gchar* pszSearch = gtk_entry_get_text(g_SearchWindow.m_pSearchEntry);
- void* pBusy = mainwindow_set_busy();
- search_location_execute(pszSearch, nLocationSetID, fDistance, nDistanceUnit);
- mainwindow_set_not_busy(&pBusy);
- }
+ void* pBusy = mainwindow_set_busy();
+ search_road_execute(pszSearch);
+ mainwindow_set_not_busy(&pBusy);
- gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.m_pFindButton), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.m_pSearchButton), TRUE);
}
-#define GTK_PROCESS_MAINLOOP while (gtk_events_pending ()) { gtk_main_iteration (); }
-
// add a result row to the list
-void searchwindow_add_result(gint nRoadID, const gchar* pszText, mappoint_t* pPoint)
+void searchwindow_add_result(const gchar* pszText, mappoint_t* pPoint)
{
GtkTreeIter iter;
@@ -228,27 +123,9 @@
RESULTLIST_LONGITUDE, pPoint->m_fLongitude,
-1);
g_free(pszBuffer);
- //GTK_PROCESS_MAINLOOP;
-}
-
-// when the "Address"/"Points of Interest" combo chances, make the proper 'box' visible
-void searchwindow_on_searchtypecombo_changed(GtkWidget *pWidget, gpointer* p)
-{
- gint nSearchType = gtk_combo_box_get_active(g_SearchWindow.m_pSearchTypeComboBox);
- if(nSearchType == SEARCH_TYPE_ADDRESS) {
- gtk_widget_hide(GTK_WIDGET(g_SearchWindow.m_pLocationSearchBox));
- gtk_widget_show(GTK_WIDGET(g_SearchWindow.m_pAddressSearchBox));
- gtk_widget_grab_focus(GTK_WIDGET(g_SearchWindow.m_pAddressStreetEntry));
- }
- else {
- gtk_widget_hide(GTK_WIDGET(g_SearchWindow.m_pAddressSearchBox));
- gtk_widget_show(GTK_WIDGET(g_SearchWindow.m_pLocationSearchBox));
- gtk_widget_grab_focus(GTK_WIDGET(g_SearchWindow.m_pLocationNameEntry));
- }
- searchwindow_clear_results();
}
-void searchwindow_go_to_selected_result(void)
+static void searchwindow_go_to_selected_result(void)
{
GtkTreeSelection* pSelection = gtk_tree_view_get_selection(
g_SearchWindow.m_pResultsTreeView);
@@ -256,10 +133,8 @@
GtkTreeIter iter;
GtkTreeModel* pModel = GTK_TREE_MODEL(g_SearchWindow.m_pResultsListStore);
if(gtk_tree_selection_get_selected(pSelection, &pModel, &iter)) {
-// gchar* pszText;
mappoint_t pt;
gtk_tree_model_get(GTK_TREE_MODEL(g_SearchWindow.m_pResultsListStore), &iter,
-// RESULTLIST_COLUMN_NAME, &pszText,
RESULTLIST_LATITUDE, &pt.m_fLatitude,
RESULTLIST_LONGITUDE, &pt.m_fLongitude,
-1);
@@ -267,7 +142,6 @@
mainwindow_set_centerpoint(&pt);
mainwindow_draw_map();
mainwindow_statusbar_update_position();
-// g_print("yay: %s\n", pszText);
}
}
@@ -281,7 +155,7 @@
searchwindow_go_to_selected_result();
}
-void searchwindow_on_resultslist_selection_changed(GtkTreeSelection *treeselection, gpointer user_data)
+static void searchwindow_on_resultslist_selection_changed(GtkTreeSelection *treeselection, gpointer user_data)
{
/* set "Remove" button sensitive if >0 items selected */
gtk_widget_set_sensitive(GTK_WIDGET(g_SearchWindow.m_pGoButton), gtk_tree_selection_count_selected_rows(treeselection) > 0);
Index: searchwindow.h
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- searchwindow.h 3 Mar 2005 07:32:46 -0000 1.2
+++ searchwindow.h 4 Mar 2005 02:27:29 -0000 1.3
@@ -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.
*/
-
+
#ifndef _SEARCHWINDOW_H
#define _SEARCHWINDOW_H
@@ -31,7 +31,7 @@
void searchwindow_init(GladeXML* pGladeXML);
-void searchwindow_add_result(gint nRoadID, const gchar* pszText, mappoint_t* pPoint);
+void searchwindow_add_result(const gchar* pszText, mappoint_t* pPoint);
void searchwindow_go_to_selected_result(void);
Index: util.h
===================================================================
RCS file: /cvs/cairo/roadster/src/util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- util.h 1 Mar 2005 19:48:21 -0000 1.2
+++ util.h 4 Mar 2005 02:27:29 -0000 1.3
@@ -30,7 +30,9 @@
void util_random_color(void* pColor);
-#if 1
+// #define ENABLE_TIMING
+
+#ifdef ENABLE_TIMING
#define TIMER_BEGIN(name, str) GTimer* name = g_timer_new(); g_print("\n%s (%f)\n", str, g_timer_elapsed(name, NULL))
#define TIMER_SHOW(name, str) g_print(" %s (%f)\n", str, g_timer_elapsed(name, NULL))
#define TIMER_END(name, str) g_print("%s (%f)\n", str, g_timer_elapsed(name, NULL)); g_timer_destroy(name); name = NULL
- Previous message: [cairo-commit] cairo/src cairo_glitz_surface.c, 1.19,
1.20 cairo_image_surface.c, 1.26, 1.27 cairo_pdf_surface.c,
1.15, 1.16 cairo_png_surface.c, 1.16, 1.17 cairo_ps_surface.c,
1.23, 1.24 cairo_surface.c, 1.42, 1.43 cairo_xlib_surface.c,
1.45, 1.46 cairoint.h, 1.100, 1.101
- Next message: [cairo-commit] roadster ChangeLog,1.33,1.34
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list