--- trunk/src/osm-gps-map-osd-classic.c 2009/08/24 12:57:15 75 +++ trunk/src/osm-gps-map-osd-classic.c 2009/08/24 19:21:46 76 @@ -93,12 +93,14 @@ cairo_arc (cr, x+Z_LEFT, y+Z_MID, Z_RAD, M_PI/2, -M_PI/2); } +#ifndef OSD_NO_DPAD /* create the cairo shape used for the dpad */ static void osm_gps_map_osd_dpad_shape(cairo_t *cr, gint x, gint y) { cairo_arc (cr, x+D_RAD, y+D_RAD, D_RAD, 0, 2 * M_PI); } +#endif static gboolean osm_gps_map_in_circle(gint x, gint y, gint cx, gint cy, gint rad) @@ -106,6 +108,7 @@ return( pow(cx - x, 2) + pow(cy - y, 2) < rad * rad); } +#ifndef OSD_NO_DPAD /* check whether x/y is within the dpad */ static osd_button_t osm_gps_map_osd_check_dpad(gint x, gint y) @@ -117,9 +120,11 @@ x -= (OSD_X + D_RAD); y -= (OSD_Y + D_RAD); +#ifdef OSD_GPS_BUTTON /* check for dpad center goes here! */ if( osm_gps_map_in_circle(x, y, 0, 0, D_RAD/3)) return OSD_GPS; +#endif if( y < 0 && abs(x) < abs(y)) return OSD_UP; @@ -137,6 +142,7 @@ } return OSD_NONE; } +#endif /* check whether x/y is within the zoom pads */ static osd_button_t @@ -171,7 +177,9 @@ /* this is just to avoid an unnecessary detailed test */ if(x > OSD_X && x < OSD_X + OSD_W && y > OSD_Y && y < OSD_Y + OSD_H) { +#ifndef OSD_NO_DPAD but = osm_gps_map_osd_check_dpad(x, y); +#endif if(but == OSD_NONE) but = osm_gps_map_osd_check_zoom(x, y); @@ -210,6 +218,7 @@ } #endif +#ifndef OSD_NO_DPAD static void osm_gps_map_osd_dpad_labels(cairo_t *cr, gint x, gint y) { /* move reference to dpad center */ @@ -234,8 +243,10 @@ cairo_rel_line_to (cr, offset[i][2][0], offset[i][2][1]); } } +#endif -/* draw the sattelite dish icon in the center of the dpad */ +#ifdef OSD_GPS_BUTTON +/* draw the satellite dish icon in the center of the dpad */ #define GPS_V0 (D_RAD/8) #define GPS_V1 (D_RAD/10) #define GPS_V2 (D_RAD/5) @@ -260,6 +271,7 @@ cairo_move_to (cr, x, y-GPS_V2); cairo_rel_line_to (cr, +GPS_V1, -GPS_V1); } +#endif #define Z_LEN (2*Z_RAD/3) @@ -321,9 +333,11 @@ #ifdef OSD_SHADOW_ENABLE osm_gps_map_osd_zoom_shape(cr, x + OSD_SHADOW, y + OSD_SHADOW); osm_gps_map_osd_shape_shadow(cr); +#ifndef OSD_NO_DPAD osm_gps_map_osd_dpad_shape(cr, x + OSD_SHADOW, y + OSD_SHADOW); osm_gps_map_osd_shape_shadow(cr); #endif +#endif /* --------- draw zoom and dpad shape ----------- */ @@ -333,36 +347,46 @@ #else osm_gps_map_osd_shape(cr); #endif +#ifndef OSD_NO_DPAD osm_gps_map_osd_dpad_shape(cr, x, y); #ifndef OSD_COLOR osm_gps_map_osd_shape(cr, &priv->bg, &priv->fg); #else osm_gps_map_osd_shape(cr); #endif +#endif /* --------- draw zoom and dpad labels --------- */ #ifdef OSD_SHADOW_ENABLE osm_gps_map_osd_zoom_labels(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); +#ifndef OSD_NO_DPAD osm_gps_map_osd_dpad_labels(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); +#endif osm_gps_map_osd_labels_shadow(cr, Z_RAD/3, TRUE); +#ifdef OSD_GPS_BUTTON osm_gps_map_osd_dpad_gps(cr, x + OSD_LBL_SHADOW, y + OSD_LBL_SHADOW); osm_gps_map_osd_labels_shadow(cr, Z_RAD/6, osd->cb != NULL); #endif +#endif osm_gps_map_osd_zoom_labels(cr, x, y); +#ifndef OSD_NO_DPAD osm_gps_map_osd_dpad_labels(cr, x, y); +#endif #ifndef OSD_COLOR osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE, &priv->fg, &priv->da); #else osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE); #endif +#ifdef OSD_GPS_BUTTON osm_gps_map_osd_dpad_gps(cr, x, y); #ifndef OSD_COLOR osm_gps_map_osd_labels(cr, Z_RAD/6, osd->cb != NULL, &priv->fg, &priv->da); #else osm_gps_map_osd_labels(cr, Z_RAD/6, osd->cb != NULL); #endif +#endif cairo_destroy(cr); } @@ -428,10 +452,11 @@ osm_gps_map_register_osd(map, &osd_classic); } - +#ifdef OSD_GPS_BUTTON /* below are osd specific functions which aren't used by osm-gps-map */ /* but instead are to be used by the main application */ -void osm_gps_map_osd_enable_gps (OsmGpsMap *map, OsmGpsMapOsdCallback cb, gpointer data) { +void osm_gps_map_osd_enable_gps (OsmGpsMap *map, OsmGpsMapOsdCallback cb, + gpointer data) { osm_gps_map_osd_t *osd = osm_gps_map_osd_get(map); g_return_if_fail (osd); @@ -445,3 +470,4 @@ osm_gps_map_redraw(map); } +#endif