82 |
cairo_surface_t *surface; |
cairo_surface_t *surface; |
83 |
float lat, lon; |
float lat, lon; |
84 |
char *name; |
char *name; |
85 |
gboolean imperial; // display distance imperial/metric |
gboolean imperial, mode; // display distance imperial/metric |
86 |
|
int click_sep; |
87 |
} nav; |
} nav; |
88 |
#endif |
#endif |
89 |
|
|
136 |
|
|
137 |
#define CLOSE_BUTTON_RADIUS (BALLOON_CORNER_RADIUS) |
#define CLOSE_BUTTON_RADIUS (BALLOON_CORNER_RADIUS) |
138 |
|
|
139 |
|
#if 0 |
140 |
#define FIN printf("entering function %s\n", __func__); |
#define FIN printf("entering function %s\n", __func__); |
141 |
#define FOUT printf("leaving function %s\n", __func__); |
#define FOUT printf("leaving function %s\n", __func__); |
142 |
|
#else |
143 |
|
#define FIN ; |
144 |
|
#define FOUT ; |
145 |
|
#endif |
146 |
|
|
147 |
/* draw the bubble shape. this is used twice, once for the shape and once */ |
/* draw the bubble shape. this is used twice, once for the shape and once */ |
148 |
/* for the shadow */ |
/* for the shadow */ |
190 |
|
|
191 |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
192 |
|
|
193 |
|
if(!priv->balloon.surface) |
194 |
|
return; |
195 |
|
|
196 |
/* get zoom */ |
/* get zoom */ |
197 |
gint zoom; |
gint zoom; |
198 |
g_object_get(OSM_GPS_MAP(osd->widget), "zoom", &zoom, NULL); |
g_object_get(OSM_GPS_MAP(osd->widget), "zoom", &zoom, NULL); |
253 |
priv->balloon.rect.w = x1 - x0 - 2*BALLOON_BORDER; |
priv->balloon.rect.w = x1 - x0 - 2*BALLOON_BORDER; |
254 |
priv->balloon.rect.h = y1 - y0 - 2*BALLOON_BORDER; |
priv->balloon.rect.h = y1 - y0 - 2*BALLOON_BORDER; |
255 |
|
|
256 |
|
g_assert(priv->balloon.surface); |
257 |
cairo_t *cr = cairo_create(priv->balloon.surface); |
cairo_t *cr = cairo_create(priv->balloon.surface); |
258 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
259 |
cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.0); |
cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.0); |
653 |
/* internal value to draw the arrow on the "puller" */ |
/* internal value to draw the arrow on the "puller" */ |
654 |
#define OSD_S_D0 (OSD_S_RAD/2) |
#define OSD_S_D0 (OSD_S_RAD/2) |
655 |
#ifndef OSD_FONT_SIZE |
#ifndef OSD_FONT_SIZE |
656 |
#define OSD_FONT_SIZE 16.0 |
#define OSD_FONT_SIZE (16.0) |
657 |
#endif |
#endif |
658 |
#define OSD_TEXT_BORDER (OSD_FONT_SIZE/2) |
#define OSD_TEXT_BORDER (OSD_FONT_SIZE/2) |
659 |
#define OSD_TEXT_SKIP (OSD_FONT_SIZE/8) |
#define OSD_TEXT_SKIP (OSD_FONT_SIZE/8) |
765 |
|
|
766 |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
767 |
|
|
768 |
if(priv->source_sel.rendered && !force_rerender) |
if(!priv->source_sel.surface || |
769 |
|
(priv->source_sel.rendered && !force_rerender)) |
770 |
return; |
return; |
771 |
|
|
772 |
priv->source_sel.rendered = TRUE; |
priv->source_sel.rendered = TRUE; |
778 |
#endif |
#endif |
779 |
|
|
780 |
/* draw source selector */ |
/* draw source selector */ |
781 |
|
g_assert(priv->source_sel.surface); |
782 |
cairo_t *cr = cairo_create(priv->source_sel.surface); |
cairo_t *cr = cairo_create(priv->source_sel.surface); |
783 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
784 |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
829 |
cairo_text_extents_t extents; |
cairo_text_extents_t extents; |
830 |
|
|
831 |
/* determine content size */ |
/* determine content size */ |
832 |
|
g_assert(priv->source_sel.surface); |
833 |
cairo_t *cr = cairo_create(priv->source_sel.surface); |
cairo_t *cr = cairo_create(priv->source_sel.surface); |
834 |
cairo_select_font_face (cr, "Sans", |
cairo_select_font_face (cr, "Sans", |
835 |
CAIRO_FONT_SLANT_NORMAL, |
CAIRO_FONT_SLANT_NORMAL, |
1016 |
} |
} |
1017 |
#endif // OSD_SOURCE_SEL |
#endif // OSD_SOURCE_SEL |
1018 |
|
|
|
static osd_button_t |
|
|
osd_check_int(osm_gps_map_osd_t *osd, gboolean click, gboolean down, gint x, gint y) { |
|
|
FIN; |
|
|
osd_button_t but = OSD_NONE; |
|
|
|
|
|
#ifdef OSD_BALLOON |
|
|
if(down) { |
|
|
/* needed to handle balloons that are created at click */ |
|
|
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
|
|
priv->balloon.just_created = FALSE; |
|
|
} |
|
|
#endif |
|
|
|
|
|
#ifdef OSD_SOURCE_SEL |
|
|
/* the source selection area is handles internally */ |
|
|
but = osd_source_check(osd, down, x, y); |
|
|
#endif |
|
|
|
|
|
if(but == OSD_NONE) { |
|
|
gint mx = x - OSD_X; |
|
|
gint my = y - OSD_Y; |
|
|
|
|
|
if(OSD_X < 0) |
|
|
mx -= (osd->widget->allocation.width - OSD_W); |
|
|
|
|
|
if(OSD_Y < 0) |
|
|
my -= (osd->widget->allocation.height - OSD_H); |
|
|
|
|
|
/* first do a rough test for the OSD area. */ |
|
|
/* this is just to avoid an unnecessary detailed test */ |
|
|
if(mx > 0 && mx < OSD_W && my > 0 && my < OSD_H) { |
|
|
#ifndef OSD_NO_DPAD |
|
|
but = osd_check_dpad(mx, my); |
|
|
#endif |
|
|
} |
|
|
|
|
|
if(but == OSD_NONE) |
|
|
but = osd_check_zoom(mx, my); |
|
|
} |
|
|
|
|
|
#ifdef OSD_BALLOON |
|
|
if(but == OSD_NONE) { |
|
|
/* check if user clicked into balloon */ |
|
|
if(osd_balloon_check(osd, click, down, x, y)) |
|
|
but = OSD_BG; |
|
|
} |
|
|
#endif |
|
|
|
|
|
FOUT; |
|
|
return but; |
|
|
} |
|
|
|
|
1019 |
#ifndef OSD_NO_DPAD |
#ifndef OSD_NO_DPAD |
1020 |
static void |
static void |
1021 |
osd_dpad_labels(cairo_t *cr, gint x, gint y) { |
osd_dpad_labels(cairo_t *cr, gint x, gint y) { |
1089 |
#ifdef OSD_COORDINATES |
#ifdef OSD_COORDINATES |
1090 |
|
|
1091 |
#ifndef OSD_COORDINATES_FONT_SIZE |
#ifndef OSD_COORDINATES_FONT_SIZE |
1092 |
#define OSD_COORDINATES_FONT_SIZE 12 |
#define OSD_COORDINATES_FONT_SIZE (12.0) |
1093 |
#endif |
#endif |
1094 |
|
|
1095 |
#define OSD_COORDINATES_OFFSET (OSD_COORDINATES_FONT_SIZE/6) |
#define OSD_COORDINATES_OFFSET (OSD_COORDINATES_FONT_SIZE/6) |
1158 |
osd_render_centered_text(cairo_t *cr, int y, int width, char *text) { |
osd_render_centered_text(cairo_t *cr, int y, int width, char *text) { |
1159 |
FIN; |
FIN; |
1160 |
|
|
|
printf("params: %p %d %d %p\n", cr, y, width, text); // XXX |
|
|
|
|
1161 |
if(!text) return y; |
if(!text) return y; |
1162 |
|
|
|
printf("text given: %s\n", text); // XXX |
|
|
|
|
1163 |
char *p = g_malloc(strlen(text)+4); // space for "...\n" |
char *p = g_malloc(strlen(text)+4); // space for "...\n" |
1164 |
strcpy(p, text); |
strcpy(p, text); |
1165 |
|
|
1166 |
cairo_text_extents_t extents; |
cairo_text_extents_t extents; |
1167 |
printf("getting extents for \"%s\"\n", p); // XXX |
memset(&extents, 0, sizeof(cairo_text_extents_t)); |
1168 |
cairo_text_extents (cr, p, &extents); |
cairo_text_extents (cr, p, &extents); |
1169 |
printf("initial extents.width = %d\n", extents.width); // XXX |
g_assert(extents.width != 0.0); |
1170 |
|
|
1171 |
/* check if text needs to be truncated */ |
/* check if text needs to be truncated */ |
1172 |
int trunc_at = strlen(text)-1; |
int trunc_at = strlen(text); |
1173 |
while(extents.width > width) { |
while(extents.width > width) { |
|
g_assert(trunc_at > 0); |
|
1174 |
|
|
1175 |
printf("trunc at %d\n", trunc_at); // XXX |
/* cut off all utf8 multibyte remains so the actual */ |
1176 |
printf("extents.width = %d > %d\n", extents.width, width); // XXX |
/* truncation only deals with one byte */ |
1177 |
|
while((p[trunc_at-1] & 0xc0) == 0x80) { |
1178 |
|
trunc_at--; |
1179 |
|
g_assert(trunc_at > 0); |
1180 |
|
} |
1181 |
|
|
1182 |
trunc_at--; |
trunc_at--; |
1183 |
|
g_assert(trunc_at > 0); |
1184 |
|
|
1185 |
strcpy(p+trunc_at, "..."); |
strcpy(p+trunc_at, "..."); |
|
printf("getting extents for \"%s\"\n", p); // XXX |
|
1186 |
cairo_text_extents (cr, p, &extents); |
cairo_text_extents (cr, p, &extents); |
1187 |
} |
} |
1188 |
|
|
|
printf("painting\n"); // XXX |
|
|
|
|
1189 |
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); |
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); |
1190 |
cairo_set_line_width (cr, OSD_COORDINATES_FONT_SIZE/6); |
cairo_set_line_width (cr, OSD_COORDINATES_FONT_SIZE/6); |
1191 |
cairo_move_to (cr, (width - extents.width)/2, y - extents.y_bearing); |
cairo_move_to (cr, (width - extents.width)/2, y - extents.y_bearing); |
1209 |
FIN; |
FIN; |
1210 |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1211 |
|
|
1212 |
|
if(!priv->coordinates.surface) |
1213 |
|
return; |
1214 |
|
|
1215 |
/* get current map position */ |
/* get current map position */ |
1216 |
gfloat lat, lon; |
gfloat lat, lon; |
1217 |
g_object_get(osd->widget, "latitude", &lat, "longitude", &lon, NULL); |
g_object_get(osd->widget, "latitude", &lat, "longitude", &lon, NULL); |
1227 |
priv->coordinates.lon = lon; |
priv->coordinates.lon = lon; |
1228 |
|
|
1229 |
/* first fill with transparency */ |
/* first fill with transparency */ |
1230 |
|
|
1231 |
|
g_assert(priv->coordinates.surface); |
1232 |
cairo_t *cr = cairo_create(priv->coordinates.surface); |
cairo_t *cr = cairo_create(priv->coordinates.surface); |
1233 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1234 |
// cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.5); |
// cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.5); |
1287 |
return; |
return; |
1288 |
|
|
1289 |
/* first fill with transparency */ |
/* first fill with transparency */ |
1290 |
|
g_assert(priv->nav.surface); |
1291 |
cairo_t *cr = cairo_create(priv->nav.surface); |
cairo_t *cr = cairo_create(priv->nav.surface); |
1292 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1293 |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
1306 |
y = osd_render_centered_text(cr, y, OSD_NAV_W, priv->nav.name); |
y = osd_render_centered_text(cr, y, OSD_NAV_W, priv->nav.name); |
1307 |
y = osd_render_centered_text(cr, y, OSD_NAV_W, latitude); |
y = osd_render_centered_text(cr, y, OSD_NAV_W, latitude); |
1308 |
y = osd_render_centered_text(cr, y, OSD_NAV_W, longitude); |
y = osd_render_centered_text(cr, y, OSD_NAV_W, longitude); |
1309 |
|
|
1310 |
g_free(latitude); |
g_free(latitude); |
1311 |
g_free(longitude); |
g_free(longitude); |
1312 |
|
|
1313 |
|
/* everything below this is the compass. we need to know this */ |
1314 |
|
/* to differ between coordinate clicks and compass clicks */ |
1315 |
|
priv->nav.click_sep = y; |
1316 |
|
|
1317 |
/* draw the compass */ |
/* draw the compass */ |
1318 |
int radius = (OSD_NAV_H - y - 5*OSD_COORDINATES_FONT_SIZE/4)/2; |
int radius = (OSD_NAV_H - y - 5*OSD_COORDINATES_FONT_SIZE/4)/2; |
1319 |
if(radius > OSD_NAV_W/2) |
if(radius > OSD_NAV_W/2) |
1336 |
#define ARROW_WIDTH 0.3 |
#define ARROW_WIDTH 0.3 |
1337 |
#define ARROW_LENGTH 0.7 |
#define ARROW_LENGTH 0.7 |
1338 |
|
|
1339 |
coord_t *gps = osm_gps_map_get_gps (OSM_GPS_MAP(osd->widget)); |
coord_t mpos, *pos = osm_gps_map_get_gps (OSM_GPS_MAP(osd->widget)); |
1340 |
if(gps) { |
if(priv->nav.mode) { |
1341 |
float arot = get_bearing(gps->rlat, gps->rlon, |
gfloat lat, lon; |
1342 |
|
g_object_get(osd->widget, "latitude", &lat, "longitude", &lon, NULL); |
1343 |
|
mpos.rlat = deg2rad(lat); |
1344 |
|
mpos.rlon = deg2rad(lon); |
1345 |
|
pos = &mpos; |
1346 |
|
} |
1347 |
|
|
1348 |
|
if(pos) { |
1349 |
|
float arot = get_bearing(pos->rlat, pos->rlon, |
1350 |
deg2rad(priv->nav.lat), deg2rad(priv->nav.lon)); |
deg2rad(priv->nav.lat), deg2rad(priv->nav.lon)); |
1351 |
|
|
1352 |
cairo_move_to(cr, |
cairo_move_to(cr, |
1366 |
y + radius * -ARROW_LENGTH * -cos(arot-ARROW_WIDTH)); |
y + radius * -ARROW_LENGTH * -cos(arot-ARROW_WIDTH)); |
1367 |
|
|
1368 |
cairo_close_path(cr); |
cairo_close_path(cr); |
1369 |
cairo_set_source_rgb (cr, 0, 0, 0); |
if(priv->nav.mode) |
1370 |
|
cairo_set_source_rgb (cr, 0, 0, 0); |
1371 |
|
else |
1372 |
|
cairo_set_source_rgb (cr, 0, 0, 0.8); |
1373 |
|
|
1374 |
cairo_fill (cr); |
cairo_fill (cr); |
1375 |
|
|
1376 |
y += radius + OSD_COORDINATES_FONT_SIZE/4; |
y += radius + OSD_COORDINATES_FONT_SIZE/4; |
1377 |
|
|
1378 |
float dist = get_distance(gps->rlat, gps->rlon, |
float dist = get_distance(pos->rlat, pos->rlon, |
1379 |
deg2rad(priv->nav.lat), deg2rad(priv->nav.lon)); |
deg2rad(priv->nav.lat), deg2rad(priv->nav.lon)); |
1380 |
|
|
1381 |
char *dist_str = NULL; |
char *dist_str = NULL; |
1405 |
FOUT; |
FOUT; |
1406 |
} |
} |
1407 |
|
|
1408 |
|
/* check if the user clicked inside the source selection area */ |
1409 |
|
static osd_button_t |
1410 |
|
osd_nav_check(osm_gps_map_osd_t *osd, gboolean down, gint x, gint y) { |
1411 |
|
FIN; |
1412 |
|
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1413 |
|
|
1414 |
|
if(!priv->nav.surface || down) |
1415 |
|
return OSD_NONE; |
1416 |
|
|
1417 |
|
x -= OSD_X; |
1418 |
|
if(OSD_X < 0) |
1419 |
|
x -= (osd->widget->allocation.width - OSD_NAV_W); |
1420 |
|
|
1421 |
|
y -= (osd->widget->allocation.height - OSD_NAV_H)/2; |
1422 |
|
|
1423 |
|
if(x >= 0 && y >= 0 && x <= OSD_NAV_W && y <= OSD_NAV_H) { |
1424 |
|
if(y < priv->nav.click_sep) |
1425 |
|
osm_gps_map_set_center(OSM_GPS_MAP(osd->widget), |
1426 |
|
priv->nav.lat, priv->nav.lon); |
1427 |
|
else { |
1428 |
|
priv->nav.mode = !priv->nav.mode; |
1429 |
|
osm_gps_map_redraw(OSM_GPS_MAP(osd->widget)); |
1430 |
|
} |
1431 |
|
} |
1432 |
|
|
1433 |
|
FOUT; |
1434 |
|
return OSD_NONE; |
1435 |
|
} |
1436 |
|
|
1437 |
void osm_gps_map_osd_clear_nav (OsmGpsMap *map) { |
void osm_gps_map_osd_clear_nav (OsmGpsMap *map) { |
1438 |
FIN; |
FIN; |
1439 |
g_return_if_fail (OSM_IS_GPS_MAP (map)); |
g_return_if_fail (OSM_IS_GPS_MAP (map)); |
1487 |
|
|
1488 |
#endif // OSD_NAV |
#endif // OSD_NAV |
1489 |
|
|
1490 |
|
static osd_button_t |
1491 |
|
osd_check_int(osm_gps_map_osd_t *osd, gboolean click, gboolean down, gint x, gint y) { |
1492 |
|
FIN; |
1493 |
|
osd_button_t but = OSD_NONE; |
1494 |
|
|
1495 |
|
#ifdef OSD_BALLOON |
1496 |
|
if(down) { |
1497 |
|
/* needed to handle balloons that are created at click */ |
1498 |
|
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1499 |
|
priv->balloon.just_created = FALSE; |
1500 |
|
} |
1501 |
|
#endif |
1502 |
|
|
1503 |
|
#ifdef OSD_SOURCE_SEL |
1504 |
|
/* the source selection area is handles internally */ |
1505 |
|
but = osd_source_check(osd, down, x, y); |
1506 |
|
#endif |
1507 |
|
|
1508 |
|
#ifdef OSD_NAV |
1509 |
|
if(but == OSD_NONE) { |
1510 |
|
/* the source selection area is handles internally */ |
1511 |
|
but = osd_nav_check(osd, down, x, y); |
1512 |
|
} |
1513 |
|
#endif |
1514 |
|
|
1515 |
|
if(but == OSD_NONE) { |
1516 |
|
gint mx = x - OSD_X; |
1517 |
|
gint my = y - OSD_Y; |
1518 |
|
|
1519 |
|
if(OSD_X < 0) |
1520 |
|
mx -= (osd->widget->allocation.width - OSD_W); |
1521 |
|
|
1522 |
|
if(OSD_Y < 0) |
1523 |
|
my -= (osd->widget->allocation.height - OSD_H); |
1524 |
|
|
1525 |
|
/* first do a rough test for the OSD area. */ |
1526 |
|
/* this is just to avoid an unnecessary detailed test */ |
1527 |
|
if(mx > 0 && mx < OSD_W && my > 0 && my < OSD_H) { |
1528 |
|
#ifndef OSD_NO_DPAD |
1529 |
|
but = osd_check_dpad(mx, my); |
1530 |
|
#endif |
1531 |
|
} |
1532 |
|
|
1533 |
|
if(but == OSD_NONE) |
1534 |
|
but = osd_check_zoom(mx, my); |
1535 |
|
} |
1536 |
|
|
1537 |
|
#ifdef OSD_BALLOON |
1538 |
|
if(but == OSD_NONE) { |
1539 |
|
/* check if user clicked into balloon */ |
1540 |
|
if(osd_balloon_check(osd, click, down, x, y)) |
1541 |
|
but = OSD_BG; |
1542 |
|
} |
1543 |
|
#endif |
1544 |
|
|
1545 |
|
FOUT; |
1546 |
|
return but; |
1547 |
|
} |
1548 |
|
|
1549 |
|
|
1550 |
#ifdef OSD_CROSSHAIR |
#ifdef OSD_CROSSHAIR |
1551 |
|
|
1588 |
FIN; |
FIN; |
1589 |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1590 |
|
|
1591 |
if(priv->crosshair.rendered) |
if(!priv->crosshair.surface || priv->crosshair.rendered) |
1592 |
return; |
return; |
1593 |
|
|
1594 |
priv->crosshair.rendered = TRUE; |
priv->crosshair.rendered = TRUE; |
1595 |
|
|
1596 |
/* first fill with transparency */ |
/* first fill with transparency */ |
1597 |
|
g_assert(priv->crosshair.surface); |
1598 |
cairo_t *cr = cairo_create(priv->crosshair.surface); |
cairo_t *cr = cairo_create(priv->crosshair.surface); |
1599 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1600 |
cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.0); |
cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.0); |
1619 |
#ifdef OSD_SCALE |
#ifdef OSD_SCALE |
1620 |
|
|
1621 |
#ifndef OSD_SCALE_FONT_SIZE |
#ifndef OSD_SCALE_FONT_SIZE |
1622 |
#define OSD_SCALE_FONT_SIZE 12 |
#define OSD_SCALE_FONT_SIZE (12.0) |
1623 |
#endif |
#endif |
1624 |
#define OSD_SCALE_W (10*OSD_SCALE_FONT_SIZE) |
#define OSD_SCALE_W (10*OSD_SCALE_FONT_SIZE) |
1625 |
#define OSD_SCALE_H (5*OSD_SCALE_FONT_SIZE/2) |
#define OSD_SCALE_H (5*OSD_SCALE_FONT_SIZE/2) |
1637 |
FIN; |
FIN; |
1638 |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1639 |
|
|
1640 |
|
if(!priv->scale.surface) |
1641 |
|
return; |
1642 |
|
|
1643 |
/* this only needs to be rendered if the zoom has changed */ |
/* this only needs to be rendered if the zoom has changed */ |
1644 |
gint zoom; |
gint zoom; |
1645 |
g_object_get(OSM_GPS_MAP(osd->widget), "zoom", &zoom, NULL); |
g_object_get(OSM_GPS_MAP(osd->widget), "zoom", &zoom, NULL); |
1651 |
float m_per_pix = osm_gps_map_get_scale(OSM_GPS_MAP(osd->widget)); |
float m_per_pix = osm_gps_map_get_scale(OSM_GPS_MAP(osd->widget)); |
1652 |
|
|
1653 |
/* first fill with transparency */ |
/* first fill with transparency */ |
1654 |
|
g_assert(priv->scale.surface); |
1655 |
cairo_t *cr = cairo_create(priv->scale.surface); |
cairo_t *cr = cairo_create(priv->scale.surface); |
1656 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1657 |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
1772 |
FIN; |
FIN; |
1773 |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
osd_priv_t *priv = (osd_priv_t*)osd->priv; |
1774 |
|
|
1775 |
|
if(!priv->controls.surface) |
1776 |
|
return; |
1777 |
|
|
1778 |
if(priv->controls.rendered |
if(priv->controls.rendered |
1779 |
#ifdef OSD_GPS_BUTTON |
#ifdef OSD_GPS_BUTTON |
1780 |
&& (priv->controls.gps_enabled == (osd->cb != NULL)) |
&& (priv->controls.gps_enabled == (osd->cb != NULL)) |
1794 |
#endif |
#endif |
1795 |
|
|
1796 |
/* first fill with transparency */ |
/* first fill with transparency */ |
1797 |
|
g_assert(priv->controls.surface); |
1798 |
cairo_t *cr = cairo_create(priv->controls.surface); |
cairo_t *cr = cairo_create(priv->controls.surface); |
1799 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1800 |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.0); |
2092 |
cairo_surface_destroy(priv->balloon.surface); |
cairo_surface_destroy(priv->balloon.surface); |
2093 |
#endif |
#endif |
2094 |
|
|
2095 |
|
printf("freeing priv\n"); |
2096 |
g_free(priv); |
g_free(priv); |
2097 |
FOUT; |
FOUT; |
2098 |
} |
} |
2136 |
{ |
{ |
2137 |
FIN; |
FIN; |
2138 |
osd_priv_t *priv = osd_classic.priv = g_new0(osd_priv_t, 1); |
osd_priv_t *priv = osd_classic.priv = g_new0(osd_priv_t, 1); |
2139 |
|
printf("alloc new osd priv\n"); |
2140 |
|
|
2141 |
#ifdef OSD_BALLOON |
#ifdef OSD_BALLOON |
2142 |
priv->balloon.lat = OSM_GPS_MAP_INVALID; |
priv->balloon.lat = OSM_GPS_MAP_INVALID; |