priv->mark_rect.height = abs(priv->mark_y1 - priv->mark_y2) + (4 * priv->draw_width);
}
+#define SCALE_PADDING (4)
+
static void
gtk_map_scale_draw(GtkWidget *widget, GdkEventExpose *event)
{
return;
/* Now calculate and draw the distance. */
-unit2latlon(priv->center.unitx - pixel2unit(SCALE_WIDTH / 2 - 4), priv->center.unity, lat1, lon1);
-unit2latlon(priv->center.unitx + pixel2unit(SCALE_WIDTH / 2 - 4), priv->center.unity, lat2, lon2);
+unit2latlon(priv->center.unitx - pixel2unit(SCALE_WIDTH / 2 - SCALE_PADDING), priv->center.unity, lat1, lon1);
+unit2latlon(priv->center.unitx + pixel2unit(SCALE_WIDTH / 2 - SCALE_PADDING), priv->center.unity, lat2, lon2);
distance=calculate_distance(lat1, lon1, lat2, lon2) * priv->units_conv;
if (distance < 1.f)
#ifdef WITH_CAIRO
cairo_rectangle(priv->ct, priv->scale_rect.x, priv->scale_rect.y, priv->scale_rect.width, priv->scale_rect.height);
-cairo_set_source_rgba(priv->ct, 1, 1, 1, 0.8);
+cairo_set_source_rgba(priv->ct, 1, 1, 1, 0.65);
cairo_fill_preserve(priv->ct);
-cairo_set_source_rgb(priv->ct, 0, 0, 0);
-cairo_stroke(priv->ct);
+cairo_set_source_rgba(priv->ct, 0, 0, 0, 0.81);
#else
gdk_draw_rectangle(widget->window, widget->style->bg_gc[GTK_WIDGET_STATE(widget)],
TRUE, priv->scale_rect.x, priv->scale_rect.y, priv->scale_rect.width, priv->scale_rect.height);
pango_layout_set_text(priv->scale_layout, buffer, -1);
pango_layout_get_pixel_size(priv->scale_layout, &width, NULL);
-/* Draw the layout itself. */
-gdk_draw_layout(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- priv->scale_rect.x + (priv->scale_rect.width - width) / 2,
- priv->scale_rect.y, priv->scale_layout);
-
/* Draw little hashes on the ends. */
+#ifdef WITH_CAIRO
+cairo_set_source_rgb(priv->ct, 0, 0, 0);
+cairo_move_to(priv->ct, priv->scale_rect.x + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 - SCALE_PADDING);
+cairo_line_to(priv->ct, priv->scale_rect.x + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 + SCALE_PADDING);
+
+cairo_move_to(priv->ct, priv->scale_rect.x + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2);
+cairo_line_to(priv->ct, priv->scale_rect.x + (priv->scale_rect.width - width) / 2 - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2);
+
+cairo_move_to(priv->ct, priv->scale_rect.x + priv->scale_rect.width - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 - SCALE_PADDING);
+cairo_line_to(priv->ct, priv->scale_rect.x + priv->scale_rect.width - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 + SCALE_PADDING);
+
+cairo_move_to(priv->ct, priv->scale_rect.x + priv->scale_rect.width - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2);
+cairo_line_to(priv->ct, priv->scale_rect.x + (priv->scale_rect.width + width) / 2 + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2);
+
+cairo_stroke(priv->ct);
+#else
gdk_draw_line(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- priv->scale_rect.x + 4,
- priv->scale_rect.y + priv->scale_rect.height / 2 - 4,
- priv->scale_rect.x + 4,
- priv->scale_rect.y + priv->scale_rect.height / 2 + 4);
+ priv->scale_rect.x + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 - SCALE_PADDING,
+ priv->scale_rect.x + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 + SCALE_PADDING);
gdk_draw_line(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- priv->scale_rect.x + 4,
- priv->scale_rect.y + priv->scale_rect.height / 2,
- priv->scale_rect.x + (priv->scale_rect.width - width) / 2 - 4,
- priv->scale_rect.y + priv->scale_rect.height / 2);
+ priv->scale_rect.x + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2,
+ priv->scale_rect.x + (priv->scale_rect.width - width) / 2 - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2);
gdk_draw_line(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- priv->scale_rect.x + priv->scale_rect.width - 4,
- priv->scale_rect.y + priv->scale_rect.height / 2 - 4,
- priv->scale_rect.x + priv->scale_rect.width - 4,
- priv->scale_rect.y + priv->scale_rect.height / 2 + 4);
+ priv->scale_rect.x + priv->scale_rect.width - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 - SCALE_PADDING,
+ priv->scale_rect.x + priv->scale_rect.width - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2 + SCALE_PADDING);
gdk_draw_line(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- priv->scale_rect.x + priv->scale_rect.width - 4,
- priv->scale_rect.y + priv->scale_rect.height / 2,
- priv->scale_rect.x + (priv->scale_rect.width + width) / 2 + 4,
- priv->scale_rect.y + priv->scale_rect.height / 2);
+ priv->scale_rect.x + priv->scale_rect.width - SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2,
+ priv->scale_rect.x + (priv->scale_rect.width + width) / 2 + SCALE_PADDING, priv->scale_rect.y + priv->scale_rect.height / 2);
+#endif
+
+/* Draw the layout itself. */
+gdk_draw_layout(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+ priv->scale_rect.x + (priv->scale_rect.width - width) / 2, priv->scale_rect.y, priv->scale_layout);
+
}
static void