25 |
/* OSD_DIAMETER */ |
/* OSD_DIAMETER */ |
26 |
/* OSD_X, OSD_Y */ |
/* OSD_X, OSD_Y */ |
27 |
|
|
28 |
|
#define OSD_NAV |
29 |
|
|
30 |
#ifndef USE_CAIRO |
#ifndef USE_CAIRO |
31 |
#error "OSD control display lacks a non-cairo implementation!" |
#error "OSD control display lacks a non-cairo implementation!" |
32 |
#endif |
#endif |
78 |
} crosshair; |
} crosshair; |
79 |
#endif |
#endif |
80 |
|
|
81 |
|
#ifdef OSD_NAV |
82 |
|
struct { |
83 |
|
cairo_surface_t *surface; |
84 |
|
} nav; |
85 |
|
#endif |
86 |
|
|
87 |
#ifdef OSD_COORDINATES |
#ifdef OSD_COORDINATES |
88 |
struct { |
struct { |
89 |
cairo_surface_t *surface; |
cairo_surface_t *surface; |
296 |
xs += priv->balloon.rect.x + priv->balloon.offset_x; |
xs += priv->balloon.rect.x + priv->balloon.offset_x; |
297 |
ys += priv->balloon.rect.y + priv->balloon.offset_y; |
ys += priv->balloon.rect.y + priv->balloon.offset_y; |
298 |
|
|
|
/* handle the fact that the balloon may have been created by the */ |
|
|
/* button down event */ |
|
|
|
|
299 |
gboolean is_in = |
gboolean is_in = |
300 |
(x > xs) && (x < xs + priv->balloon.rect.w) && |
(x > xs) && (x < xs + priv->balloon.rect.w) && |
301 |
(y > ys) && (y < ys + priv->balloon.rect.h); |
(y > ys) && (y < ys + priv->balloon.rect.h); |
302 |
|
|
303 |
|
/* handle the fact that the balloon may have been created by the */ |
304 |
|
/* button down event */ |
305 |
if(!is_in && !down && !priv->balloon.just_created) { |
if(!is_in && !down && !priv->balloon.just_created) { |
306 |
/* the user actually clicked outside the balloon */ |
/* the user actually clicked outside the balloon */ |
307 |
|
|
960 |
#endif |
#endif |
961 |
|
|
962 |
if(but == OSD_NONE) { |
if(but == OSD_NONE) { |
963 |
x -= OSD_X; |
gint mx = x - OSD_X; |
964 |
y -= OSD_Y; |
gint my = y - OSD_Y; |
965 |
|
|
966 |
if(OSD_X < 0) |
if(OSD_X < 0) |
967 |
x -= (osd->widget->allocation.width - OSD_W); |
mx -= (osd->widget->allocation.width - OSD_W); |
968 |
|
|
969 |
if(OSD_Y < 0) |
if(OSD_Y < 0) |
970 |
y -= (osd->widget->allocation.height - OSD_H); |
my -= (osd->widget->allocation.height - OSD_H); |
971 |
|
|
972 |
/* first do a rough test for the OSD area. */ |
/* first do a rough test for the OSD area. */ |
973 |
/* this is just to avoid an unnecessary detailed test */ |
/* this is just to avoid an unnecessary detailed test */ |
974 |
if(x > 0 && x < OSD_W && y > 0 && y < OSD_H) { |
if(mx > 0 && mx < OSD_W && my > 0 && my < OSD_H) { |
975 |
#ifndef OSD_NO_DPAD |
#ifndef OSD_NO_DPAD |
976 |
but = osd_check_dpad(x, y); |
but = osd_check_dpad(mx, my); |
977 |
#endif |
#endif |
978 |
} |
} |
979 |
|
|
980 |
if(but == OSD_NONE) |
if(but == OSD_NONE) |
981 |
but = osd_check_zoom(x, y); |
but = osd_check_zoom(mx, my); |
982 |
} |
} |
983 |
|
|
984 |
#ifdef OSD_BALLOON |
#ifdef OSD_BALLOON |
1199 |
} |
} |
1200 |
#endif // OSD_COORDINATES |
#endif // OSD_COORDINATES |
1201 |
|
|
1202 |
|
#ifdef OSD_NAV |
1203 |
|
#define OSD_NAV_W (100) |
1204 |
|
#define OSD_NAV_H (100) |
1205 |
|
|
1206 |
|
static void |
1207 |
|
osd_render_nav(osm_gps_map_osd_t *osd) |
1208 |
|
{ |
1209 |
|
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1210 |
|
|
1211 |
|
/* first fill with transparency */ |
1212 |
|
cairo_t *cr = cairo_create(priv->nav.surface); |
1213 |
|
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1214 |
|
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.2); |
1215 |
|
cairo_paint(cr); |
1216 |
|
cairo_set_operator(cr, CAIRO_OPERATOR_OVER); |
1217 |
|
|
1218 |
|
cairo_destroy(cr); |
1219 |
|
} |
1220 |
|
|
1221 |
|
#endif // OSD_NAV |
1222 |
|
|
1223 |
|
|
1224 |
#ifdef OSD_CROSSHAIR |
#ifdef OSD_CROSSHAIR |
1225 |
|
|
1226 |
#ifndef OSD_CROSSHAIR_RADIUS |
#ifndef OSD_CROSSHAIR_RADIUS |
1548 |
osd_render_crosshair(osd); |
osd_render_crosshair(osd); |
1549 |
#endif |
#endif |
1550 |
|
|
1551 |
|
#ifdef OSD_NAV |
1552 |
|
osd_render_nav(osd); |
1553 |
|
#endif |
1554 |
|
|
1555 |
#ifdef OSD_COORDINATES |
#ifdef OSD_COORDINATES |
1556 |
osd_render_coordinates(osd); |
osd_render_coordinates(osd); |
1557 |
#endif |
#endif |
1596 |
priv->crosshair.rendered = FALSE; |
priv->crosshair.rendered = FALSE; |
1597 |
#endif |
#endif |
1598 |
|
|
1599 |
|
#ifdef OSD_NAV |
1600 |
|
priv->nav.surface = |
1601 |
|
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
1602 |
|
OSD_NAV_W, OSD_NAV_H); |
1603 |
|
#endif |
1604 |
|
|
1605 |
#ifdef OSD_COORDINATES |
#ifdef OSD_COORDINATES |
1606 |
priv->coordinates.surface = |
priv->coordinates.surface = |
1607 |
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
1637 |
cairo_paint(cr); |
cairo_paint(cr); |
1638 |
#endif |
#endif |
1639 |
|
|
1640 |
|
#ifdef OSD_NAV |
1641 |
|
x = OSD_X; |
1642 |
|
if(x < 0) x += osd->widget->allocation.width - OSD_NAV_W; |
1643 |
|
y = (osd->widget->allocation.height - OSD_NAV_H)/2; |
1644 |
|
|
1645 |
|
cairo_set_source_surface(cr, priv->nav.surface, x, y); |
1646 |
|
cairo_paint(cr); |
1647 |
|
#endif |
1648 |
|
|
1649 |
#ifdef OSD_COORDINATES |
#ifdef OSD_COORDINATES |
1650 |
x = -OSD_X; |
x = -OSD_X; |
1651 |
y = -OSD_Y; |
y = -OSD_Y; |
1737 |
cairo_surface_destroy(priv->crosshair.surface); |
cairo_surface_destroy(priv->crosshair.surface); |
1738 |
#endif |
#endif |
1739 |
|
|
1740 |
|
#ifdef OSD_NAV |
1741 |
|
if (priv->nav.surface) |
1742 |
|
cairo_surface_destroy(priv->nav.surface); |
1743 |
|
#endif |
1744 |
|
|
1745 |
#ifdef OSD_COORDINATES |
#ifdef OSD_COORDINATES |
1746 |
if (priv->coordinates.surface) |
if (priv->coordinates.surface) |
1747 |
cairo_surface_destroy(priv->coordinates.surface); |
cairo_surface_destroy(priv->coordinates.surface); |