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

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

revision 152 by harbaum, Mon Nov 2 10:53:01 2009 UTC revision 201 by harbaum, Fri Nov 20 20:16:04 2009 UTC
# Line 1015  osd_source_check(osm_gps_map_osd_t *osd, Line 1015  osd_source_check(osm_gps_map_osd_t *osd,
1015  }  }
1016  #endif // OSD_SOURCE_SEL  #endif // OSD_SOURCE_SEL
1017    
 static osd_button_t  
 osd_check_int(osm_gps_map_osd_t *osd, gboolean click, gboolean down, gint x, gint y) {  
     FIN;  
     osd_button_t but = OSD_NONE;  
   
 #ifdef OSD_BALLOON  
     if(down) {  
         /* needed to handle balloons that are created at click */  
         osd_priv_t *priv = (osd_priv_t*)osd->priv;  
         priv->balloon.just_created = FALSE;  
     }  
 #endif  
   
 #ifdef OSD_SOURCE_SEL  
     /* the source selection area is handles internally */  
     but = osd_source_check(osd, down, x, y);  
 #endif  
   
     if(but == OSD_NONE) {  
         gint mx = x - OSD_X;  
         gint my = y - OSD_Y;  
   
         if(OSD_X < 0)  
             mx -= (osd->widget->allocation.width - OSD_W);  
   
         if(OSD_Y < 0)  
             my -= (osd->widget->allocation.height - OSD_H);  
   
         /* first do a rough test for the OSD area. */  
         /* this is just to avoid an unnecessary detailed test */  
         if(mx > 0 && mx < OSD_W && my > 0 && my < OSD_H) {  
 #ifndef OSD_NO_DPAD  
             but = osd_check_dpad(mx, my);  
 #endif  
         }  
   
         if(but == OSD_NONE)  
             but = osd_check_zoom(mx, my);  
     }  
   
 #ifdef OSD_BALLOON  
     if(but == OSD_NONE) {  
         /* check if user clicked into balloon */  
         if(osd_balloon_check(osd, click, down, x, y))  
             but = OSD_BG;  
     }  
 #endif  
   
     FOUT;  
     return but;  
 }  
   
1018  #ifndef OSD_NO_DPAD  #ifndef OSD_NO_DPAD
1019  static void  static void
1020  osd_dpad_labels(cairo_t *cr, gint x, gint y) {  osd_dpad_labels(cairo_t *cr, gint x, gint y) {
# Line 1440  osd_render_nav(osm_gps_map_osd_t *osd) Line 1388  osd_render_nav(osm_gps_map_osd_t *osd)
1388      FOUT;      FOUT;
1389  }  }
1390    
1391    /* check if the user clicked inside the source selection area */
1392    static osd_button_t
1393    osd_nav_check(osm_gps_map_osd_t *osd, gboolean down, gint x, gint y) {
1394        FIN;
1395        osd_priv_t *priv = (osd_priv_t*)osd->priv;
1396    
1397        if(!priv->nav.surface || down)
1398            return OSD_NONE;
1399    
1400        x -= OSD_X;
1401        if(OSD_X < 0)
1402            x -= (osd->widget->allocation.width - OSD_NAV_W);
1403    
1404        y -= (osd->widget->allocation.height - OSD_NAV_H)/2;
1405    
1406        if(x >= 0 && y >= 0 && x <= OSD_NAV_W && y <= OSD_NAV_H) {
1407            printf("***************************\n");
1408            printf("clicked inside nav: %d %d\n", x, y);
1409            printf("***************************\n");
1410        }
1411    
1412        return OSD_NONE;
1413    }
1414    
1415  void osm_gps_map_osd_clear_nav (OsmGpsMap *map) {  void osm_gps_map_osd_clear_nav (OsmGpsMap *map) {
1416      FIN;      FIN;
1417      g_return_if_fail (OSM_IS_GPS_MAP (map));      g_return_if_fail (OSM_IS_GPS_MAP (map));
# Line 1493  osm_gps_map_osd_draw_nav (OsmGpsMap *map Line 1465  osm_gps_map_osd_draw_nav (OsmGpsMap *map
1465    
1466  #endif // OSD_NAV  #endif // OSD_NAV
1467    
1468    static osd_button_t
1469    osd_check_int(osm_gps_map_osd_t *osd, gboolean click, gboolean down, gint x, gint y) {
1470        FIN;
1471        osd_button_t but = OSD_NONE;
1472    
1473    #ifdef OSD_BALLOON
1474        if(down) {
1475            /* needed to handle balloons that are created at click */
1476            osd_priv_t *priv = (osd_priv_t*)osd->priv;
1477            priv->balloon.just_created = FALSE;
1478        }
1479    #endif
1480    
1481    #ifdef OSD_SOURCE_SEL
1482        /* the source selection area is handles internally */
1483        but = osd_source_check(osd, down, x, y);
1484    #endif
1485    
1486    #ifdef OSD_NAV
1487        if(but == OSD_NONE) {
1488            /* the source selection area is handles internally */
1489            but = osd_nav_check(osd, down, x, y);
1490        }
1491    #endif
1492    
1493        if(but == OSD_NONE) {
1494            gint mx = x - OSD_X;
1495            gint my = y - OSD_Y;
1496    
1497            if(OSD_X < 0)
1498                mx -= (osd->widget->allocation.width - OSD_W);
1499    
1500            if(OSD_Y < 0)
1501                my -= (osd->widget->allocation.height - OSD_H);
1502    
1503            /* first do a rough test for the OSD area. */
1504            /* this is just to avoid an unnecessary detailed test */
1505            if(mx > 0 && mx < OSD_W && my > 0 && my < OSD_H) {
1506    #ifndef OSD_NO_DPAD
1507                but = osd_check_dpad(mx, my);
1508    #endif
1509            }
1510    
1511            if(but == OSD_NONE)
1512                but = osd_check_zoom(mx, my);
1513        }
1514    
1515    #ifdef OSD_BALLOON
1516        if(but == OSD_NONE) {
1517            /* check if user clicked into balloon */
1518            if(osd_balloon_check(osd, click, down, x, y))
1519                but = OSD_BG;
1520        }
1521    #endif
1522    
1523        FOUT;
1524        return but;
1525    }
1526    
1527    
1528  #ifdef OSD_CROSSHAIR  #ifdef OSD_CROSSHAIR
1529    

Legend:
Removed from v.152  
changed lines
  Added in v.201