113 |
//the osd controls |
//the osd controls |
114 |
struct { |
struct { |
115 |
GdkPixmap *backup; |
GdkPixmap *backup; |
116 |
|
cairo_surface_t *overlay; |
117 |
gint backup_x, backup_y; |
gint backup_x, backup_y; |
118 |
// GdkPixbuf *pixbuf; |
OsmGpsMapOsdGpsCallback cb; |
119 |
|
gpointer data; |
120 |
} osd; |
} osd; |
121 |
#endif |
#endif |
122 |
|
|
665 |
#define BALLOON_AREA_HEIGHT 75 |
#define BALLOON_AREA_HEIGHT 75 |
666 |
#endif |
#endif |
667 |
#ifndef BALLOON_CORNER_RADIUS |
#ifndef BALLOON_CORNER_RADIUS |
668 |
#define BALLOON_CORNER_RADIUS 20 |
#define BALLOON_CORNER_RADIUS 10 |
669 |
#endif |
#endif |
670 |
|
|
671 |
#define BALLOON_BORDER (BALLOON_CORNER_RADIUS/4) |
#define BALLOON_BORDER (BALLOON_CORNER_RADIUS/2) |
672 |
#define BALLOON_WIDTH (BALLOON_AREA_WIDTH + 2 * BALLOON_BORDER) |
#define BALLOON_WIDTH (BALLOON_AREA_WIDTH + 2 * BALLOON_BORDER) |
673 |
#define BALLOON_HEIGHT (BALLOON_AREA_HEIGHT + 2 * BALLOON_BORDER) |
#define BALLOON_HEIGHT (BALLOON_AREA_HEIGHT + 2 * BALLOON_BORDER) |
674 |
#define BALLOON_TRANSPARENCY 0.8 |
#define BALLOON_TRANSPARENCY 0.8 |
675 |
#define POINTER_HEIGHT 20 |
#define POINTER_HEIGHT 20 |
676 |
#define POINTER_FOOT_WIDTH 20 |
#define POINTER_FOOT_WIDTH 20 |
677 |
#define POINTER_OFFSET (BALLOON_CORNER_RADIUS*3/4) |
#define POINTER_OFFSET (BALLOON_CORNER_RADIUS*3/4) |
678 |
#define BALLOON_SHADOW 5 |
#define BALLOON_SHADOW (BALLOON_CORNER_RADIUS/2) |
679 |
#define BALLOON_SHADOW_TRANSPARENCY 0.2 |
#define BALLOON_SHADOW_TRANSPARENCY 0.2 |
680 |
|
|
681 |
#define CLOSE_BUTTON_RADIUS (BALLOON_CORNER_RADIUS/3) |
#define CLOSE_BUTTON_RADIUS (BALLOON_CORNER_RADIUS) |
682 |
|
|
683 |
|
|
684 |
/* 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 */ |
688 |
gboolean bottom, int px, int py, int px0, int px1) { |
gboolean bottom, int px, int py, int px0, int px1) { |
689 |
|
|
690 |
cairo_move_to (cr, x0, y0 + BALLOON_CORNER_RADIUS); |
cairo_move_to (cr, x0, y0 + BALLOON_CORNER_RADIUS); |
691 |
cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + BALLOON_CORNER_RADIUS, y0); |
cairo_arc (cr, x0 + BALLOON_CORNER_RADIUS, y0 + BALLOON_CORNER_RADIUS, |
692 |
|
BALLOON_CORNER_RADIUS, -M_PI, -M_PI/2); |
693 |
if(!bottom) { |
if(!bottom) { |
694 |
/* insert top pointer */ |
/* insert top pointer */ |
695 |
cairo_line_to (cr, px1, y0); |
cairo_line_to (cr, px1, y0); |
698 |
} |
} |
699 |
|
|
700 |
cairo_line_to (cr, x1 - BALLOON_CORNER_RADIUS, y0); |
cairo_line_to (cr, x1 - BALLOON_CORNER_RADIUS, y0); |
701 |
cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + BALLOON_CORNER_RADIUS); |
cairo_arc (cr, x1 - BALLOON_CORNER_RADIUS, y0 + BALLOON_CORNER_RADIUS, |
702 |
|
BALLOON_CORNER_RADIUS, -M_PI/2, 0); |
703 |
cairo_line_to (cr, x1 , y1 - BALLOON_CORNER_RADIUS); |
cairo_line_to (cr, x1 , y1 - BALLOON_CORNER_RADIUS); |
704 |
cairo_curve_to (cr, x1, y1, x1, y1, x1 - BALLOON_CORNER_RADIUS, y1); |
cairo_arc (cr, x1 - BALLOON_CORNER_RADIUS, y1 - BALLOON_CORNER_RADIUS, |
705 |
|
BALLOON_CORNER_RADIUS, 0, M_PI/2); |
706 |
if(bottom) { |
if(bottom) { |
707 |
/* insert bottom pointer */ |
/* insert bottom pointer */ |
708 |
cairo_line_to (cr, px0, y1); |
cairo_line_to (cr, px0, y1); |
711 |
} |
} |
712 |
|
|
713 |
cairo_line_to (cr, x0 + BALLOON_CORNER_RADIUS, y1); |
cairo_line_to (cr, x0 + BALLOON_CORNER_RADIUS, y1); |
714 |
cairo_curve_to (cr, x0, y1, x0, y1, x0, y1 - BALLOON_CORNER_RADIUS); |
cairo_arc (cr, x0 + BALLOON_CORNER_RADIUS, y1 - BALLOON_CORNER_RADIUS, |
715 |
|
BALLOON_CORNER_RADIUS, M_PI/2, M_PI); |
716 |
|
|
717 |
cairo_close_path (cr); |
cairo_close_path (cr); |
718 |
} |
} |
803 |
cairo_stroke(cr); |
cairo_stroke(cr); |
804 |
|
|
805 |
cairo_set_source_rgba (cr, 1, 1, 1, 1.0); |
cairo_set_source_rgba (cr, 1, 1, 1, 1.0); |
806 |
cairo_set_line_width (cr, 3); |
cairo_set_line_width (cr, BALLOON_CORNER_RADIUS/3.3); |
807 |
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); |
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); |
808 |
cairo_move_to (cr, cx - crad/2, cy - crad/2); |
cairo_move_to (cr, cx - crad/2, cy - crad/2); |
809 |
cairo_line_to (cr, cx + crad/2, cy + crad/2); |
cairo_line_to (cr, cx + crad/2, cy + crad/2); |
1428 |
#define OSD_X (10) |
#define OSD_X (10) |
1429 |
#define OSD_Y (10) |
#define OSD_Y (10) |
1430 |
|
|
1431 |
#define OSD_COLOR 0.5, 0.5, 1 |
#define OSD_COLOR 0.5, 0.5, 1 |
1432 |
|
#define OSD_COLOR_DISABLED 0.8, 0.8, 0.8 |
1433 |
|
|
1434 |
/* parameters of the direction shape */ |
/* parameters of the direction shape */ |
1435 |
#define D_RAD (20) // diameter of dpad |
#ifndef OSM_GPS_MAP_OSD_DIAMETER |
1436 |
|
#define D_RAD (30) // diameter of dpad |
1437 |
|
#else |
1438 |
|
#define D_RAD (OSM_GPS_MAP_OSD_DIAMETER) |
1439 |
|
#endif |
1440 |
#define D_TIP (4*D_RAD/5) // distance of arrow tip from dpad center |
#define D_TIP (4*D_RAD/5) // distance of arrow tip from dpad center |
1441 |
#define D_LEN (D_RAD/4) // length of arrow |
#define D_LEN (D_RAD/4) // length of arrow |
1442 |
#define D_WID (D_LEN) // width of arrow |
#define D_WID (D_LEN) // width of arrow |
1443 |
|
|
1444 |
/* parameters of the "zoom" pad */ |
/* parameters of the "zoom" pad */ |
1445 |
#define Z_STEP (-D_RAD/8) // distance between dpad and zoom |
#define Z_STEP (D_RAD/4) // distance between dpad and zoom |
1446 |
#define Z_RAD (D_RAD/2) // radius of "caps" of zoom bar |
#define Z_RAD (D_RAD/2) // radius of "caps" of zoom bar |
1447 |
|
|
1448 |
/* shadow also depends on control size */ |
/* shadow also depends on control size */ |
1449 |
#define OSD_SHADOW (D_RAD/8) |
#define OSD_SHADOW (D_RAD/6) |
1450 |
|
|
1451 |
/* total width and height of controls incl. shadow */ |
/* total width and height of controls incl. shadow */ |
1452 |
#define OSD_W (2*D_RAD + OSD_SHADOW) |
#define OSD_W (2*D_RAD + OSD_SHADOW) |
1506 |
y -= (OSD_Y + D_RAD); |
y -= (OSD_Y + D_RAD); |
1507 |
|
|
1508 |
/* check for dpad center goes here! */ |
/* check for dpad center goes here! */ |
1509 |
if( osm_gps_map_in_circle(x, y, OSD_X + D_RAD, OSD_Y + D_RAD, D_RAD/3)) |
if( osm_gps_map_in_circle(x, y, 0, 0, D_RAD/3)) |
1510 |
return OSD_GPS; |
return OSD_GPS; |
1511 |
|
|
1512 |
if( y < 0 && abs(x) < abs(y)) |
if( y < 0 && abs(x) < abs(y)) |
1529 |
/* check whether x/y is within the zoom pads */ |
/* check whether x/y is within the zoom pads */ |
1530 |
static osd_button_t |
static osd_button_t |
1531 |
osm_gps_map_osd_check_zoom(gint x, gint y) { |
osm_gps_map_osd_check_zoom(gint x, gint y) { |
1532 |
if( x > OSD_X && x < (OSD_X + OSD_W) && y > Z_TOP && y < Z_BOT) { |
if( x > OSD_X && x < (OSD_X + OSD_W) && y > Z_TOP && y < (OSD_Y+Z_BOT)) { |
1533 |
|
|
1534 |
/* within circle around (-) label */ |
/* within circle around (-) label */ |
1535 |
if( osm_gps_map_in_circle(x, y, OSD_X + Z_LEFT, OSD_Y + Z_MID, Z_RAD)) |
if( osm_gps_map_in_circle(x, y, OSD_X + Z_LEFT, OSD_Y + Z_MID, Z_RAD)) |
1559 |
/* this is just to avoid an unnecessary detailed test */ |
/* this is just to avoid an unnecessary detailed test */ |
1560 |
if(x > OSD_X && x < OSD_X + OSD_W && |
if(x > OSD_X && x < OSD_X + OSD_W && |
1561 |
y > OSD_Y && y < OSD_Y + OSD_H) { |
y > OSD_Y && y < OSD_Y + OSD_H) { |
|
|
|
1562 |
but = osm_gps_map_osd_check_dpad(x, y); |
but = osm_gps_map_osd_check_dpad(x, y); |
1563 |
|
|
1564 |
if(but == OSD_NONE) |
if(but == OSD_NONE) |
1649 |
} |
} |
1650 |
|
|
1651 |
static void |
static void |
1652 |
osm_gps_map_osd_labels(cairo_t *cr, gint width) { |
osm_gps_map_osd_labels(cairo_t *cr, gint width, gboolean enabled) { |
1653 |
cairo_set_source_rgb (cr, OSD_COLOR); |
if(enabled) cairo_set_source_rgb (cr, OSD_COLOR); |
1654 |
|
else cairo_set_source_rgb (cr, OSD_COLOR_DISABLED); |
1655 |
cairo_set_line_width (cr, width); |
cairo_set_line_width (cr, width); |
1656 |
cairo_stroke (cr); |
cairo_stroke (cr); |
1657 |
} |
} |
1658 |
|
|
1659 |
static void |
static void |
1660 |
osm_gps_map_osd_labels_shadow(cairo_t *cr, gint width) { |
osm_gps_map_osd_labels_shadow(cairo_t *cr, gint width, gboolean enabled) { |
1661 |
cairo_set_source_rgba (cr, 0, 0, 0, 0.2); |
cairo_set_source_rgba (cr, 0, 0, 0, enabled?0.3:0.15); |
1662 |
cairo_set_line_width (cr, width); |
cairo_set_line_width (cr, width); |
1663 |
cairo_stroke (cr); |
cairo_stroke (cr); |
1664 |
} |
} |
1665 |
|
|
1666 |
static void |
static void |
1667 |
osm_gps_map_osd_draw_controls (OsmGpsMap *map, gint xoffset, gint yoffset) |
osm_gps_map_osd_render(OsmGpsMapPrivate *priv) { |
|
{ |
|
|
OsmGpsMapPrivate *priv = map->priv; |
|
|
|
|
|
/* backup previous contents */ |
|
|
if(!priv->osd.backup) |
|
|
priv->osd.backup = gdk_pixmap_new(priv->pixmap, OSD_W+2, OSD_H+2, -1); |
|
|
|
|
|
gint x = OSD_X + EXTRA_BORDER + xoffset; |
|
|
gint y = OSD_Y + EXTRA_BORDER + yoffset; |
|
1668 |
|
|
1669 |
/* create backup of background */ |
/* first fill with transparency */ |
1670 |
gdk_draw_drawable(priv->osd.backup, |
cairo_t *cr = cairo_create(priv->osd.overlay); |
|
GTK_WIDGET(map)->style->fg_gc[GTK_WIDGET_STATE(GTK_WIDGET(map))], |
|
|
priv->pixmap, x-1, y-1, 0, 0, OSD_W+2, OSD_H+2); |
|
|
priv->osd.backup_x = x-1; |
|
|
priv->osd.backup_y = y-1; |
|
|
|
|
|
#if 0 |
|
|
/* create pixbuf for osd */ |
|
|
if(!priv->osd.pixbuf) |
|
|
priv->osd.pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, |
|
|
TRUE, 8, OSD_W, OSD_H); |
|
|
cairo_surface_t *surface = |
|
|
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, OSD_W, OSD_H); |
|
|
|
|
|
/* fill with transparency */ |
|
|
{ |
|
|
cairo_t *cr = cairo_create(surface); |
|
1671 |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
1672 |
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); |
1673 |
cairo_paint(cr); |
cairo_paint(cr); |
|
cairo_destroy(cr); |
|
|
} |
|
|
#endif |
|
|
|
|
1674 |
|
|
1675 |
#ifdef USE_CAIRO |
cairo_set_operator(cr, CAIRO_OPERATOR_OVER); |
|
// cairo_t *cr = cairo_create(surface); |
|
|
cairo_t *cr = gdk_cairo_create(priv->pixmap); |
|
1676 |
|
|
1677 |
/* --------- draw zoom and dpad shape shadow ----------- */ |
/* --------- draw zoom and dpad shape shadow ----------- */ |
1678 |
|
gint x = 0, y = 0; |
1679 |
|
|
1680 |
osm_gps_map_osd_zoom_shape(cr, x + OSD_SHADOW, y + OSD_SHADOW); |
osm_gps_map_osd_zoom_shape(cr, x + OSD_SHADOW, y + OSD_SHADOW); |
1681 |
osm_gps_map_osd_shape_shadow(cr); |
osm_gps_map_osd_shape_shadow(cr); |
1693 |
|
|
1694 |
osm_gps_map_osd_zoom_labels(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); |
osm_gps_map_osd_zoom_labels(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); |
1695 |
osm_gps_map_osd_dpad_labels(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); |
osm_gps_map_osd_dpad_labels(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); |
1696 |
osm_gps_map_osd_labels_shadow(cr, Z_RAD/3); |
osm_gps_map_osd_labels_shadow(cr, Z_RAD/3, TRUE); |
1697 |
osm_gps_map_osd_dpad_gps(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); |
osm_gps_map_osd_dpad_gps(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); |
1698 |
osm_gps_map_osd_labels_shadow(cr, Z_RAD/6); |
osm_gps_map_osd_labels_shadow(cr, Z_RAD/6, priv->osd.cb != NULL); |
1699 |
|
|
1700 |
osm_gps_map_osd_zoom_labels(cr, x, y); |
osm_gps_map_osd_zoom_labels(cr, x, y); |
1701 |
osm_gps_map_osd_dpad_labels(cr, x, y); |
osm_gps_map_osd_dpad_labels(cr, x, y); |
1702 |
osm_gps_map_osd_labels(cr, Z_RAD/3); |
osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE); |
1703 |
osm_gps_map_osd_dpad_gps(cr, x, y); |
osm_gps_map_osd_dpad_gps(cr, x, y); |
1704 |
osm_gps_map_osd_labels(cr, Z_RAD/6); |
osm_gps_map_osd_labels(cr, Z_RAD/6, priv->osd.cb != NULL); |
1705 |
|
|
1706 |
cairo_destroy(cr); |
cairo_destroy(cr); |
1707 |
|
} |
1708 |
|
|
1709 |
|
static void |
1710 |
|
osm_gps_map_osd_draw_controls (OsmGpsMap *map, gint xoffset, gint yoffset) |
1711 |
|
{ |
1712 |
|
OsmGpsMapPrivate *priv = map->priv; |
1713 |
|
|
1714 |
|
/* backup previous contents */ |
1715 |
|
if(!priv->osd.backup) |
1716 |
|
priv->osd.backup = gdk_pixmap_new(priv->pixmap, OSD_W+2, OSD_H+2, -1); |
1717 |
|
|
1718 |
|
gint x = OSD_X + EXTRA_BORDER + xoffset; |
1719 |
|
gint y = OSD_Y + EXTRA_BORDER + yoffset; |
1720 |
|
|
1721 |
|
/* create backup of background */ |
1722 |
|
gdk_draw_drawable(priv->osd.backup, |
1723 |
|
GTK_WIDGET(map)->style->fg_gc[GTK_WIDGET_STATE(GTK_WIDGET(map))], |
1724 |
|
priv->pixmap, x-1, y-1, 0, 0, OSD_W+2, OSD_H+2); |
1725 |
|
|
1726 |
|
priv->osd.backup_x = x-1; |
1727 |
|
priv->osd.backup_y = y-1; |
1728 |
|
|
1729 |
|
|
1730 |
|
#ifdef USE_CAIRO |
1731 |
|
/* OSD itself uses some off-screen rendering, so check if the */ |
1732 |
|
/* offscreen buffer is present and create it if not */ |
1733 |
|
if(!priv->osd.overlay) { |
1734 |
|
/* create overlay ... */ |
1735 |
|
priv->osd.overlay = |
1736 |
|
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, OSD_W, OSD_H); |
1737 |
|
/* ... and render it */ |
1738 |
|
osm_gps_map_osd_render(priv); |
1739 |
|
} |
1740 |
|
|
1741 |
|
// now draw this onto the original context |
1742 |
|
cairo_t *cr = gdk_cairo_create(priv->pixmap); |
1743 |
|
cairo_set_source_surface(cr, priv->osd.overlay, x, y); |
1744 |
|
cairo_paint(cr); |
1745 |
|
cairo_destroy(cr); |
1746 |
|
|
1747 |
#else |
#else |
1748 |
#warning "OSD control display lacks a non-cairo implementation!" |
#warning "OSD control display lacks a non-cairo implementation!" |
1749 |
#endif |
#endif |
1841 |
|
|
1842 |
#ifdef ENABLE_OSD |
#ifdef ENABLE_OSD |
1843 |
priv->osd.backup = NULL; |
priv->osd.backup = NULL; |
1844 |
|
priv->osd.overlay = NULL; |
1845 |
|
priv->osd.cb = NULL; |
1846 |
#endif |
#endif |
1847 |
|
|
1848 |
priv->tracks = NULL; |
priv->tracks = NULL; |
2011 |
#ifdef ENABLE_OSD |
#ifdef ENABLE_OSD |
2012 |
if (priv->osd.backup) |
if (priv->osd.backup) |
2013 |
g_object_unref(priv->osd.backup); |
g_object_unref(priv->osd.backup); |
2014 |
|
|
2015 |
|
if (priv->osd.overlay) |
2016 |
|
cairo_surface_destroy(priv->osd.overlay); |
2017 |
#endif |
#endif |
2018 |
|
|
2019 |
G_OBJECT_CLASS (osm_gps_map_parent_class)->dispose (object); |
G_OBJECT_CLASS (osm_gps_map_parent_class)->dispose (object); |
2243 |
#endif |
#endif |
2244 |
|
|
2245 |
#ifdef ENABLE_OSD |
#ifdef ENABLE_OSD |
2246 |
/* also don't drag on clicks into the control OSD */ |
#define SCROLL_STEP 10 |
|
if(osm_gps_map_osd_check(event->x, event->y) != OSD_NONE) |
|
|
{ |
|
|
priv->drag_counter = -1; |
|
|
return FALSE; |
|
|
} |
|
|
#endif |
|
|
|
|
|
priv->drag_counter = 0; |
|
|
priv->drag_start_mouse_x = (int) event->x; |
|
|
priv->drag_start_mouse_y = (int) event->y; |
|
|
priv->drag_start_map_x = priv->map_x; |
|
|
priv->drag_start_map_y = priv->map_y; |
|
2247 |
|
|
2248 |
return FALSE; |
/* pressed inside OSD control? */ |
|
} |
|
|
|
|
|
static gboolean |
|
|
osm_gps_map_button_release (GtkWidget *widget, GdkEventButton *event) |
|
|
{ |
|
|
OsmGpsMapPrivate *priv = OSM_GPS_MAP_PRIVATE(widget); |
|
|
|
|
|
#ifdef ENABLE_OSD |
|
|
/* released inside OSD control? */ |
|
2249 |
osd_button_t but = osm_gps_map_osd_check(event->x, event->y); |
osd_button_t but = osm_gps_map_osd_check(event->x, event->y); |
2250 |
if(but != OSD_NONE) |
if(but != OSD_NONE) |
2251 |
{ |
{ |
2252 |
|
priv->drag_counter = -1; |
2253 |
|
|
2254 |
switch(but) { |
switch(but) { |
2255 |
|
case OSD_GPS: |
2256 |
|
priv->osd.cb(priv->osd.data); |
2257 |
|
break; |
2258 |
|
|
2259 |
case OSD_UP: |
case OSD_UP: |
2260 |
priv->map_y -= GTK_WIDGET(widget)->allocation.height/4; |
priv->map_y -= GTK_WIDGET(widget)->allocation.height/SCROLL_STEP; |
2261 |
priv->center_coord_set = FALSE; |
priv->center_coord_set = FALSE; |
2262 |
break; |
break; |
2263 |
|
|
2264 |
case OSD_DOWN: |
case OSD_DOWN: |
2265 |
priv->map_y += GTK_WIDGET(widget)->allocation.height/4; |
priv->map_y += GTK_WIDGET(widget)->allocation.height/SCROLL_STEP; |
2266 |
priv->center_coord_set = FALSE; |
priv->center_coord_set = FALSE; |
2267 |
break; |
break; |
2268 |
|
|
2269 |
case OSD_LEFT: |
case OSD_LEFT: |
2270 |
priv->map_x -= GTK_WIDGET(widget)->allocation.width/4; |
priv->map_x -= GTK_WIDGET(widget)->allocation.width/SCROLL_STEP; |
2271 |
priv->center_coord_set = FALSE; |
priv->center_coord_set = FALSE; |
2272 |
break; |
break; |
2273 |
|
|
2274 |
case OSD_RIGHT: |
case OSD_RIGHT: |
2275 |
priv->map_x += GTK_WIDGET(widget)->allocation.width/4; |
priv->map_x += GTK_WIDGET(widget)->allocation.width/SCROLL_STEP; |
2276 |
priv->center_coord_set = FALSE; |
priv->center_coord_set = FALSE; |
2277 |
break; |
break; |
2278 |
|
|
2294 |
} |
} |
2295 |
#endif |
#endif |
2296 |
|
|
2297 |
|
priv->drag_counter = 0; |
2298 |
|
priv->drag_start_mouse_x = (int) event->x; |
2299 |
|
priv->drag_start_mouse_y = (int) event->y; |
2300 |
|
priv->drag_start_map_x = priv->map_x; |
2301 |
|
priv->drag_start_map_y = priv->map_y; |
2302 |
|
|
2303 |
|
return FALSE; |
2304 |
|
} |
2305 |
|
|
2306 |
|
static gboolean |
2307 |
|
osm_gps_map_button_release (GtkWidget *widget, GdkEventButton *event) |
2308 |
|
{ |
2309 |
|
OsmGpsMapPrivate *priv = OSM_GPS_MAP_PRIVATE(widget); |
2310 |
|
|
2311 |
#ifdef ENABLE_BALLOON |
#ifdef ENABLE_BALLOON |
2312 |
/* released inside the balloon? */ |
/* released inside the balloon? */ |
2313 |
if (osm_gps_map_in_balloon(priv, |
if (osm_gps_map_in_balloon(priv, |
2482 |
event->area.x, event->area.y, |
event->area.x, event->area.y, |
2483 |
event->area.width, event->area.height); |
event->area.width, event->area.height); |
2484 |
|
|
|
#ifdef ENABLE_OSD_OVL |
|
|
/* TODO: intersect with area */ |
|
|
if (priv->osd.pixbuf) |
|
|
{ |
|
|
// gdk_draw_drawable (widget->window, |
|
|
// widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
|
|
// priv->osd.pixbuf, 0, 0, |
|
|
// OSD_X, OSD_Y, OSD_W, OSD_H); |
|
|
} |
|
|
#endif |
|
|
|
|
2485 |
return FALSE; |
return FALSE; |
2486 |
} |
} |
2487 |
|
|
2667 |
"radius of the gps point inner circle", |
"radius of the gps point inner circle", |
2668 |
0, /* minimum property value */ |
0, /* minimum property value */ |
2669 |
G_MAXINT, /* maximum property value */ |
G_MAXINT, /* maximum property value */ |
2670 |
5, |
10, |
2671 |
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); |
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); |
2672 |
|
|
2673 |
g_object_class_install_property (object_class, |
g_object_class_install_property (object_class, |
3290 |
osm_gps_map_map_redraw_idle(map); |
osm_gps_map_map_redraw_idle(map); |
3291 |
} |
} |
3292 |
#endif |
#endif |
3293 |
|
|
3294 |
|
#ifdef ENABLE_OSD |
3295 |
|
void osm_gps_map_osd_enable_gps (OsmGpsMap *map, OsmGpsMapOsdGpsCallback cb, gpointer data) { |
3296 |
|
OsmGpsMapPrivate *priv; |
3297 |
|
|
3298 |
|
g_return_if_fail (OSM_IS_GPS_MAP (map)); |
3299 |
|
priv = map->priv; |
3300 |
|
|
3301 |
|
priv->osd.cb = cb; |
3302 |
|
priv->osd.data = data; |
3303 |
|
|
3304 |
|
/* this may have changed the state of the gps button */ |
3305 |
|
/* we thus re-render the overlay */ |
3306 |
|
osm_gps_map_osd_render(priv); |
3307 |
|
|
3308 |
|
osm_gps_map_map_redraw_idle(map); |
3309 |
|
} |
3310 |
|
#endif |