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

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

revision 75 by harbaum, Mon Aug 24 12:57:15 2009 UTC revision 76 by harbaum, Mon Aug 24 19:21:46 2009 UTC
# Line 93  osm_gps_map_osd_zoom_shape(cairo_t *cr, Line 93  osm_gps_map_osd_zoom_shape(cairo_t *cr,
93      cairo_arc     (cr, x+Z_LEFT,    y+Z_MID, Z_RAD,  M_PI/2, -M_PI/2);      cairo_arc     (cr, x+Z_LEFT,    y+Z_MID, Z_RAD,  M_PI/2, -M_PI/2);
94  }  }
95    
96    #ifndef OSD_NO_DPAD
97  /* create the cairo shape used for the dpad */  /* create the cairo shape used for the dpad */
98  static void  static void
99  osm_gps_map_osd_dpad_shape(cairo_t *cr, gint x, gint y)  osm_gps_map_osd_dpad_shape(cairo_t *cr, gint x, gint y)
100  {  {
101      cairo_arc (cr, x+D_RAD, y+D_RAD, D_RAD, 0, 2 * M_PI);      cairo_arc (cr, x+D_RAD, y+D_RAD, D_RAD, 0, 2 * M_PI);
102  }  }
103    #endif
104    
105  static gboolean  static gboolean
106  osm_gps_map_in_circle(gint x, gint y, gint cx, gint cy, gint rad)  osm_gps_map_in_circle(gint x, gint y, gint cx, gint cy, gint rad)
# Line 106  osm_gps_map_in_circle(gint x, gint y, gi Line 108  osm_gps_map_in_circle(gint x, gint y, gi
108      return( pow(cx - x, 2) + pow(cy - y, 2) < rad * rad);      return( pow(cx - x, 2) + pow(cy - y, 2) < rad * rad);
109  }  }
110    
111    #ifndef OSD_NO_DPAD
112  /* check whether x/y is within the dpad */  /* check whether x/y is within the dpad */
113  static osd_button_t  static osd_button_t
114  osm_gps_map_osd_check_dpad(gint x, gint y)  osm_gps_map_osd_check_dpad(gint x, gint y)
# Line 117  osm_gps_map_osd_check_dpad(gint x, gint Line 120  osm_gps_map_osd_check_dpad(gint x, gint
120          x -= (OSD_X + D_RAD);          x -= (OSD_X + D_RAD);
121          y -= (OSD_Y + D_RAD);          y -= (OSD_Y + D_RAD);
122    
123    #ifdef OSD_GPS_BUTTON
124          /* check for dpad center goes here! */          /* check for dpad center goes here! */
125          if( osm_gps_map_in_circle(x, y, 0, 0, D_RAD/3))          if( osm_gps_map_in_circle(x, y, 0, 0, D_RAD/3))
126              return OSD_GPS;              return OSD_GPS;
127    #endif
128    
129          if( y < 0 && abs(x) < abs(y))          if( y < 0 && abs(x) < abs(y))
130              return OSD_UP;              return OSD_UP;
# Line 137  osm_gps_map_osd_check_dpad(gint x, gint Line 142  osm_gps_map_osd_check_dpad(gint x, gint
142      }      }
143      return OSD_NONE;      return OSD_NONE;
144  }  }
145    #endif
146    
147  /* check whether x/y is within the zoom pads */  /* check whether x/y is within the zoom pads */
148  static osd_button_t  static osd_button_t
# Line 171  osm_gps_map_osd_check(gint x, gint y) { Line 177  osm_gps_map_osd_check(gint x, gint y) {
177      /* this is just to avoid an unnecessary detailed test */      /* this is just to avoid an unnecessary detailed test */
178      if(x > OSD_X && x < OSD_X + OSD_W &&      if(x > OSD_X && x < OSD_X + OSD_W &&
179         y > OSD_Y && y < OSD_Y + OSD_H) {         y > OSD_Y && y < OSD_Y + OSD_H) {
180    #ifndef OSD_NO_DPAD
181          but = osm_gps_map_osd_check_dpad(x, y);          but = osm_gps_map_osd_check_dpad(x, y);
182    #endif
183    
184          if(but == OSD_NONE)          if(but == OSD_NONE)
185              but = osm_gps_map_osd_check_zoom(x, y);              but = osm_gps_map_osd_check_zoom(x, y);
# Line 210  osm_gps_map_osd_shape(cairo_t *cr) { Line 218  osm_gps_map_osd_shape(cairo_t *cr) {
218  }  }
219  #endif  #endif
220    
221    #ifndef OSD_NO_DPAD
222  static void  static void
223  osm_gps_map_osd_dpad_labels(cairo_t *cr, gint x, gint y) {  osm_gps_map_osd_dpad_labels(cairo_t *cr, gint x, gint y) {
224      /* move reference to dpad center */      /* move reference to dpad center */
# Line 234  osm_gps_map_osd_dpad_labels(cairo_t *cr, Line 243  osm_gps_map_osd_dpad_labels(cairo_t *cr,
243          cairo_rel_line_to (cr, offset[i][2][0], offset[i][2][1]);          cairo_rel_line_to (cr, offset[i][2][0], offset[i][2][1]);
244      }      }
245  }  }
246    #endif
247    
248  /* draw the sattelite dish icon in the center of the dpad */  #ifdef OSD_GPS_BUTTON
249    /* draw the satellite dish icon in the center of the dpad */
250  #define GPS_V0  (D_RAD/8)  #define GPS_V0  (D_RAD/8)
251  #define GPS_V1  (D_RAD/10)  #define GPS_V1  (D_RAD/10)
252  #define GPS_V2  (D_RAD/5)  #define GPS_V2  (D_RAD/5)
# Line 260  osm_gps_map_osd_dpad_gps(cairo_t *cr, gi Line 271  osm_gps_map_osd_dpad_gps(cairo_t *cr, gi
271      cairo_move_to (cr, x, y-GPS_V2);      cairo_move_to (cr, x, y-GPS_V2);
272      cairo_rel_line_to (cr, +GPS_V1, -GPS_V1);      cairo_rel_line_to (cr, +GPS_V1, -GPS_V1);
273  }  }
274    #endif
275    
276  #define Z_LEN  (2*Z_RAD/3)  #define Z_LEN  (2*Z_RAD/3)
277    
# Line 321  osm_gps_map_osd_render(osm_gps_map_osd_t Line 333  osm_gps_map_osd_render(osm_gps_map_osd_t
333  #ifdef OSD_SHADOW_ENABLE  #ifdef OSD_SHADOW_ENABLE
334      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);
335      osm_gps_map_osd_shape_shadow(cr);      osm_gps_map_osd_shape_shadow(cr);
336    #ifndef OSD_NO_DPAD
337      osm_gps_map_osd_dpad_shape(cr, x + OSD_SHADOW, y + OSD_SHADOW);      osm_gps_map_osd_dpad_shape(cr, x + OSD_SHADOW, y + OSD_SHADOW);
338      osm_gps_map_osd_shape_shadow(cr);      osm_gps_map_osd_shape_shadow(cr);
339  #endif  #endif
340    #endif
341    
342      /* --------- draw zoom and dpad shape ----------- */      /* --------- draw zoom and dpad shape ----------- */
343    
# Line 333  osm_gps_map_osd_render(osm_gps_map_osd_t Line 347  osm_gps_map_osd_render(osm_gps_map_osd_t
347  #else  #else
348      osm_gps_map_osd_shape(cr);      osm_gps_map_osd_shape(cr);
349  #endif  #endif
350    #ifndef OSD_NO_DPAD
351      osm_gps_map_osd_dpad_shape(cr, x, y);      osm_gps_map_osd_dpad_shape(cr, x, y);
352  #ifndef OSD_COLOR  #ifndef OSD_COLOR
353      osm_gps_map_osd_shape(cr, &priv->bg, &priv->fg);      osm_gps_map_osd_shape(cr, &priv->bg, &priv->fg);
354  #else  #else
355      osm_gps_map_osd_shape(cr);      osm_gps_map_osd_shape(cr);
356  #endif  #endif
357    #endif
358    
359      /* --------- draw zoom and dpad labels --------- */      /* --------- draw zoom and dpad labels --------- */
360    
361  #ifdef OSD_SHADOW_ENABLE  #ifdef OSD_SHADOW_ENABLE
362      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);
363    #ifndef OSD_NO_DPAD
364      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);
365    #endif
366      osm_gps_map_osd_labels_shadow(cr, Z_RAD/3, TRUE);      osm_gps_map_osd_labels_shadow(cr, Z_RAD/3, TRUE);
367    #ifdef OSD_GPS_BUTTON
368      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);
369      osm_gps_map_osd_labels_shadow(cr, Z_RAD/6, osd->cb != NULL);      osm_gps_map_osd_labels_shadow(cr, Z_RAD/6, osd->cb != NULL);
370  #endif  #endif
371    #endif
372    
373      osm_gps_map_osd_zoom_labels(cr, x, y);      osm_gps_map_osd_zoom_labels(cr, x, y);
374    #ifndef OSD_NO_DPAD
375      osm_gps_map_osd_dpad_labels(cr, x, y);      osm_gps_map_osd_dpad_labels(cr, x, y);
376    #endif
377  #ifndef OSD_COLOR  #ifndef OSD_COLOR
378      osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE, &priv->fg, &priv->da);      osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE, &priv->fg, &priv->da);
379  #else  #else
380      osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE);      osm_gps_map_osd_labels(cr, Z_RAD/3, TRUE);
381  #endif  #endif
382    #ifdef OSD_GPS_BUTTON
383      osm_gps_map_osd_dpad_gps(cr, x, y);      osm_gps_map_osd_dpad_gps(cr, x, y);
384  #ifndef OSD_COLOR  #ifndef OSD_COLOR
385      osm_gps_map_osd_labels(cr, Z_RAD/6, osd->cb != NULL, &priv->fg, &priv->da);      osm_gps_map_osd_labels(cr, Z_RAD/6, osd->cb != NULL, &priv->fg, &priv->da);
386  #else  #else
387      osm_gps_map_osd_labels(cr, Z_RAD/6, osd->cb != NULL);      osm_gps_map_osd_labels(cr, Z_RAD/6, osd->cb != NULL);
388  #endif  #endif
389    #endif
390    
391      cairo_destroy(cr);      cairo_destroy(cr);
392  }  }
# Line 428  osm_gps_map_osd_classic_init(OsmGpsMap * Line 452  osm_gps_map_osd_classic_init(OsmGpsMap *
452      osm_gps_map_register_osd(map, &osd_classic);      osm_gps_map_register_osd(map, &osd_classic);
453  }  }
454    
455    #ifdef OSD_GPS_BUTTON
456  /* below are osd specific functions which aren't used by osm-gps-map */  /* below are osd specific functions which aren't used by osm-gps-map */
457  /* but instead are to be used by the main application */  /* but instead are to be used by the main application */
458  void osm_gps_map_osd_enable_gps (OsmGpsMap *map, OsmGpsMapOsdCallback cb, gpointer data) {  void osm_gps_map_osd_enable_gps (OsmGpsMap *map, OsmGpsMapOsdCallback cb,
459                                     gpointer data) {
460      osm_gps_map_osd_t *osd = osm_gps_map_osd_get(map);      osm_gps_map_osd_t *osd = osm_gps_map_osd_get(map);
461    
462      g_return_if_fail (osd);      g_return_if_fail (osd);
# Line 445  void osm_gps_map_osd_enable_gps (OsmGpsM Line 470  void osm_gps_map_osd_enable_gps (OsmGpsM
470    
471      osm_gps_map_redraw(map);      osm_gps_map_redraw(map);
472  }  }
473    #endif

Legend:
Removed from v.75  
changed lines
  Added in v.76