39 |
/* the offscreen representation of the OSD */ |
/* the offscreen representation of the OSD */ |
40 |
cairo_surface_t *overlay; |
cairo_surface_t *overlay; |
41 |
|
|
42 |
|
#ifdef OSD_SOURCE_SEL |
43 |
/* values to handle the "source" menu */ |
/* values to handle the "source" menu */ |
44 |
cairo_surface_t *map_source; |
cairo_surface_t *map_source; |
45 |
gboolean expanded; |
gboolean expanded; |
46 |
gint shift, dir, count; |
gint shift, dir, count; |
47 |
gint handler_id; |
gint handler_id; |
48 |
gint width, height; |
gint width, height; |
49 |
|
#endif |
50 |
|
|
51 |
} osd_priv_t; |
} osd_priv_t; |
52 |
|
|
260 |
return OSD_NONE; |
return OSD_NONE; |
261 |
} |
} |
262 |
|
|
263 |
|
#ifdef OSD_SOURCE_SEL |
264 |
|
|
265 |
/* place source selection at right border */ |
/* place source selection at right border */ |
266 |
#define OSD_S_RAD (Z_RAD) |
#define OSD_S_RAD (Z_RAD) |
267 |
#define OSD_S_X (-OSD_X) |
#define OSD_S_X (-OSD_X) |
285 |
#define OSD_TEXT_BORDER (OSD_FONT_SIZE/2) |
#define OSD_TEXT_BORDER (OSD_FONT_SIZE/2) |
286 |
#define OSD_TEXT_SKIP (OSD_FONT_SIZE/8) |
#define OSD_TEXT_SKIP (OSD_FONT_SIZE/8) |
287 |
|
|
288 |
|
/* draw the shape of the source selection OSD, either only the puller (not expanded) */ |
289 |
|
/* or the entire menu incl. the puller (expanded) */ |
290 |
static void |
static void |
291 |
osd_source_shape(osd_priv_t *priv, cairo_t *cr, gint x, gint y) { |
osd_source_shape(osd_priv_t *priv, cairo_t *cr, gint x, gint y) { |
292 |
if(!priv->expanded) { |
if(!priv->expanded) { |
579 |
return OSD_BG; |
return OSD_BG; |
580 |
} |
} |
581 |
} |
} |
582 |
|
|
583 |
|
/* check for clicks into data area */ |
584 |
|
if(priv->expanded) { |
585 |
|
if(x > OSD_S_PW && |
586 |
|
x < OSD_S_PW + OSD_S_EXP_W && |
587 |
|
y > 0 && |
588 |
|
y < OSD_S_EXP_H) { |
589 |
|
|
590 |
|
printf("in OSD source menu area\n"); |
591 |
|
|
592 |
|
return OSD_BG; |
593 |
|
} |
594 |
|
} |
595 |
|
|
596 |
return OSD_NONE; |
return OSD_NONE; |
597 |
} |
} |
598 |
|
#endif // OSD_SOURCE_SEL |
599 |
|
|
600 |
static osd_button_t |
static osd_button_t |
601 |
osd_check(osm_gps_map_osd_t *osd, gint x, gint y) { |
osd_check(osm_gps_map_osd_t *osd, gint x, gint y) { |
784 |
|
|
785 |
cairo_destroy(cr); |
cairo_destroy(cr); |
786 |
|
|
787 |
|
#ifdef OSD_SOURCE_SEL |
788 |
osd_render_source_sel(osd); |
osd_render_source_sel(osd); |
789 |
|
#endif |
790 |
} |
} |
791 |
|
|
792 |
static void |
static void |
801 |
priv->overlay = |
priv->overlay = |
802 |
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, OSD_W+2, OSD_H+2); |
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, OSD_W+2, OSD_H+2); |
803 |
|
|
804 |
|
#ifdef OSD_SOURCE_SEL |
805 |
/* the initial OSD state is alway not-expanded */ |
/* the initial OSD state is alway not-expanded */ |
806 |
priv->map_source = |
priv->map_source = |
807 |
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
808 |
OSD_S_W+2, OSD_S_H+2); |
OSD_S_W+2, OSD_S_H+2); |
809 |
|
#endif |
810 |
|
|
811 |
/* ... and render it */ |
/* ... and render it */ |
812 |
osd_render(osd); |
osd_render(osd); |
855 |
{ |
{ |
856 |
osd_priv_t *priv = (osd_priv_t *)(osd->priv); |
osd_priv_t *priv = (osd_priv_t *)(osd->priv); |
857 |
|
|
|
if(priv->handler_id) |
|
|
gtk_timeout_remove(priv->handler_id); |
|
|
|
|
858 |
if (priv->overlay) |
if (priv->overlay) |
859 |
cairo_surface_destroy(priv->overlay); |
cairo_surface_destroy(priv->overlay); |
860 |
|
|
861 |
|
#ifdef OSD_SOURCE_SEL |
862 |
|
if(priv->handler_id) |
863 |
|
gtk_timeout_remove(priv->handler_id); |
864 |
|
|
865 |
if (priv->map_source) |
if (priv->map_source) |
866 |
cairo_surface_destroy(priv->map_source); |
cairo_surface_destroy(priv->map_source); |
867 |
|
#endif |
868 |
|
|
869 |
g_free(priv); |
g_free(priv); |
870 |
} |
} |
871 |
|
|
|
/* this is the only function that's externally visible */ |
|
872 |
static gboolean |
static gboolean |
873 |
osd_busy(osm_gps_map_osd_t *osd) |
osd_busy(osm_gps_map_osd_t *osd) |
874 |
{ |
{ |
875 |
|
#ifdef OSD_SOURCE_SEL |
876 |
osd_priv_t *priv = (osd_priv_t *)(osd->priv); |
osd_priv_t *priv = (osd_priv_t *)(osd->priv); |
877 |
return (priv->handler_id != 0); |
return (priv->handler_id != 0); |
878 |
|
#else |
879 |
|
return FALSE; |
880 |
|
#endif |
881 |
} |
} |
882 |
|
|
883 |
static osm_gps_map_osd_t osd_classic = { |
static osm_gps_map_osd_t osd_classic = { |
884 |
|
.widget = NULL, |
885 |
|
|
886 |
.draw = osd_draw, |
.draw = osd_draw, |
887 |
.check = osd_check, |
.check = osd_check, |
888 |
.render = osd_render, |
.render = osd_render, |