Diff of /trunk/src/osm-gps-map-osd-classic.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 87 by harbaum, Mon Aug 31 12:01:28 2009 UTC revision 88 by harbaum, Mon Aug 31 14:22:28 2009 UTC
# Line 39  typedef struct { Line 39  typedef struct {
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    
# Line 258  osd_check_zoom(gint x, gint y) { Line 260  osd_check_zoom(gint x, gint y) {
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)
# Line 281  osd_check_zoom(gint x, gint y) { Line 285  osd_check_zoom(gint x, gint y) {
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) {
# Line 573  osd_source_check(osm_gps_map_osd_t *osd, Line 579  osd_source_check(osm_gps_map_osd_t *osd,
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) {
# Line 763  osd_render(osm_gps_map_osd_t *osd) { Line 784  osd_render(osm_gps_map_osd_t *osd) {
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
# Line 778  osd_draw(osm_gps_map_osd_t *osd, GdkDraw Line 801  osd_draw(osm_gps_map_osd_t *osd, GdkDraw
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);
# Line 830  osd_free(osm_gps_map_osd_t *osd) Line 855  osd_free(osm_gps_map_osd_t *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,

Legend:
Removed from v.87  
changed lines
  Added in v.88