From a6c5b681e1bb5106c681a05ebaff51f574c9d1a8 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 21 May 2008 14:43:04 +0300 Subject: [PATCH] MapWidget: Add center mark size param, fix colors --- src/gtkmap.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/gtkmap.c b/src/gtkmap.c index c355bb2..7dc5c6d 100644 --- a/src/gtkmap.c +++ b/src/gtkmap.c @@ -111,6 +111,8 @@ struct _GtkMapPriv gboolean gl; GdkRectangle scale_rect; + + guint center_mark_size; GdkRectangle center_rect; RepoData *curr_repo; @@ -405,10 +407,10 @@ BOUND(priv->center.unity, priv->min_center.unity, priv->max_center.unity); priv->base_tilex=grid2tile((gint) pixel2grid((gint) unit2pixel((gint) priv->center.unitx)) - (gint) priv->screen_grids_halfwidth); priv->base_tiley=grid2tile(pixel2grid(unit2pixel(priv->center.unity)) - priv->screen_grids_halfheight); -priv->center_rect.x=(priv->screen_width_pixels/2)-8; -priv->center_rect.y=(priv->screen_height_pixels/2)-8; -priv->center_rect.width=16; -priv->center_rect.height=16; +priv->center_rect.x=(priv->screen_width_pixels/2)-priv->center_mark_size/2; +priv->center_rect.y=(priv->screen_height_pixels/2)-priv->center_mark_size/2; +priv->center_rect.width=priv->center_mark_size; +priv->center_rect.height=priv->center_mark_size; } /******************************************************************************/ @@ -502,6 +504,8 @@ priv->speed_gc=priv->speed_gc1; priv->units_conv=1.85200; +priv->center_mark_size=8; + priv->icache=image_cache_new(64); priv->show_scale=TRUE; @@ -1125,17 +1129,15 @@ GtkMapPriv *priv; map=GTK_MAP(widget); priv=GTK_MAP_GET_PRIVATE(map); -g_debug("CenterMark: %d %d %d %d", priv->center_rect.x, priv->center_rect.y, priv->center_rect.width, priv->center_rect.height); - if (!gdk_rectangle_intersect(&event->area, &priv->center_rect, NULL)) return; #ifdef WITH_CAIRO cairo_save(priv->ct); cairo_rectangle(priv->ct, priv->center_rect.x, priv->center_rect.y, priv->center_rect.width, priv->center_rect.height); -cairo_set_source_rgb(priv->ct, 0.8, 0.8, 1); +cairo_set_source_rgba(priv->ct, 1, 1, 1, 0.8); cairo_fill_preserve(priv->ct); -cairo_set_source_rgba(priv->ct, 1, 1, 1, 0.5); +cairo_set_source_rgba(priv->ct, 0, 0, 0, 0.5); cairo_stroke(priv->ct); cairo_restore(priv->ct); #else -- 2.39.5