#include "ui-common.h"
#include "db.h"
-#define POI_FONT_SIZE_BIG (14)
+#define POI_FONT_SIZE_BIG (12)
#define POI_FONT_SIZE_SMALL (10)
static GHashTable *poi_icon_hash = NULL;
static PangoContext *context = NULL;
static PangoLayout *layout = NULL;
static PangoFontDescription *fontdesc = NULL;
+static GdkGC *poi_gc;
gboolean
map_poi_init(GtkWidget *map_widget)
pango_layout_set_font_description (layout, fontdesc);
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
pango_layout_set_width(layout, 70*PANGO_SCALE);
+poi_gc=gdk_gc_new(map_widget->window);
return TRUE;
}
/**
* Render all the POI data. This should be done before rendering track data.
*/
-void
+void
map_render_poi(void)
{
guint unitx, unity;
}
if (_zoom<2) {
+ pango_font_description_set_size(fontdesc, POI_FONT_SIZE_BIG*PANGO_SCALE);
+ pango_layout_set_font_description (layout, fontdesc);
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
- pango_font_description_set_size(fontdesc, POI_FONT_SIZE_SMALL*PANGO_SCALE);
} else {
+ pango_font_description_set_size(fontdesc, POI_FONT_SIZE_SMALL*PANGO_SCALE);
+ pango_layout_set_font_description (layout, fontdesc);
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
- pango_font_description_set_size(fontdesc, POI_FONT_SIZE_BIG*PANGO_SCALE);
}
while (SQLITE_ROW == sqlite3_step(poisql.select_poi)) {
+ GdkColor color;
+ GdkGC *gc;
+
lat1 = sqlite3_column_double(poisql.select_poi, 0);
lon1 = sqlite3_column_double(poisql.select_poi, 1);
gchar *poi_label = sqlite3_column_text(poisql.select_poi, 3);
pixbuf=map_poi_get_icon(cat_icon);
+ // XXX: Cache instead of parsing every time...
+ if (gdk_color_parse(cat_color, &color)) {
+ gdk_gc_set_rgb_fg_color(poi_gc, &color);
+ gc=poi_gc;
+ g_printf("Using color: %s\n", cat_color);
+ } else {
+ gc=_gc[COLORABLE_POI];
+ }
+
if (!pixbuf) {
/* No icon for POI or for category - draw default. */
- gdk_draw_arc(_map_pixmap, _gc[COLORABLE_POI], FALSE,
- poix - _draw_width, poiy - _draw_width,
- (MAX_ZOOM-_zoom)/6 * _draw_width, (MAX_ZOOM-_zoom)/6 * _draw_width, 0, 360 * 64);
+ gdk_draw_arc(_map_pixmap, gc, FALSE,
+ poix - _draw_width, poiy - _draw_width,
+ (MAX_ZOOM-_zoom)/6 * _draw_width, (MAX_ZOOM-_zoom)/6 * _draw_width, 0, 360 * 64);
} else {
guint w,h;
w=gdk_pixbuf_get_width(pixbuf);
h=gdk_pixbuf_get_height(pixbuf);
gdk_draw_pixbuf(_map_pixmap,
- _gc[COLORABLE_POI],
+ gc,
pixbuf, 0, 0,
poix-w/2,
- poiy-h/2,
+ poiy-h/2,
-1, -1, GDK_RGB_DITHER_NONE,
0, 0);
if (_zoom<2)
- gdk_draw_rectangle(_map_pixmap, _gc[COLORABLE_POI], FALSE, poix-w/2-1, poiy-h/2-1, w+1, h+1);
+ gdk_draw_rectangle(_map_pixmap, gc, FALSE, poix-w/2-1, poiy-h/2-1, w+1, h+1);
}
if (_zoom<3 && poi_label) {
map_poi_title(poix, poiy, poi_label);