Diff of /trunk/src/map.c

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

revision 173 by harbaum, Sat May 2 21:36:51 2009 UTC revision 234 by harbaum, Mon Jul 20 20:15:10 2009 UTC
# Line 55  static void map_statusbar(map_t *map, ma Line 55  static void map_statusbar(map_t *map, ma
55    
56    gboolean collision = FALSE;    gboolean collision = FALSE;
57    tag_t *tags = tag;    tag_t *tags = tag;
58      while(tag) {
59    if(id == ID_ILLEGAL)      if(!collision && info_tag_key_collision(tags, tag))
60      str = g_strdup_printf(_("Unknown item"));        collision = TRUE;
61    else {      tag = tag->next;
     str = g_strdup_printf("%s #" ITEM_ID_FORMAT, item_str, id);  
   
     /* add some tags ... */  
     /*  
      *  XXX Should we just try to present only the name or the ref (or the  
      *  alt_name, old_name, whatever) here?  Hurling a load of tags in the  
      *  user's face in some unpredictable, uninformative order isn't very  
      *  friendly.  
      *  
      *  Actually, a tag_short_desc() function would be useful in dialogs  
      *  nd user messages too.  
      */  
     while(tag) {  
       if(!collision && info_tag_key_collision(tags, tag))  
         collision = TRUE;  
   
       /* we don't have much space, so ignore created_by tag */  
       if(!osm_is_creator_tag(tag)) {  
         char *old = str;  
         str = g_strdup_printf("%s, %s=%s", old, tag->key, tag->value);  
         g_free(old);  
       }  
       tag = tag->next;  
     }  
62    }    }
63    
64      str = osm_object_get_speaking_name(&map_item->object);
65    statusbar_set(map->appdata, str, collision);    statusbar_set(map->appdata, str, collision);
66    g_free(str);    g_free(str);
67  }  }
# Line 402  void map_item_deselect(appdata_t *appdat Line 379  void map_item_deselect(appdata_t *appdat
379        osm_tags_free(appdata->map->last_node_tags);        osm_tags_free(appdata->map->last_node_tags);
380    
381      appdata->map->last_node_tags =      appdata->map->last_node_tags =
382        osm_tags_copy(appdata->map->selected.object.node->tag, FALSE);        osm_tags_copy(appdata->map->selected.object.node->tag);
383    } else if(appdata->map->selected.object.type == WAY) {    } else if(appdata->map->selected.object.type == WAY) {
384      if(appdata->map->last_way_tags)      if(appdata->map->last_way_tags)
385        osm_tags_free(appdata->map->last_way_tags);        osm_tags_free(appdata->map->last_way_tags);
386    
387      appdata->map->last_way_tags =      appdata->map->last_way_tags =
388        osm_tags_copy(appdata->map->selected.object.way->tag, FALSE);        osm_tags_copy(appdata->map->selected.object.way->tag);
389    }    }
390    
391    /* remove statusbar message */    /* remove statusbar message */
# Line 685  static void map_item_init(style_t *style Line 662  static void map_item_init(style_t *style
662  void map_item_redraw(appdata_t *appdata, map_item_t *map_item) {  void map_item_redraw(appdata_t *appdata, map_item_t *map_item) {
663    map_item_t item = *map_item;    map_item_t item = *map_item;
664    
665      /* a relation cannot be redraws as it doesn't have a visual */
666      /* representation */
667      if(map_item->object.type == RELATION)
668        return;
669    
670    /* check if the item to be redrawn is the selected one */    /* check if the item to be redrawn is the selected one */
671    gboolean is_selected = FALSE;    gboolean is_selected = FALSE;
672    if(map_item->object.ptr == appdata->map->selected.object.ptr) {    if(map_item->object.ptr == appdata->map->selected.object.ptr) {
# Line 1015  static gboolean map_limit_zoom(map_t *ma Line 997  static gboolean map_limit_zoom(map_t *ma
997          }          }
998      }      }
999      if (*zoom != oldzoom) {      if (*zoom != oldzoom) {
1000          printf("Can't zoom further out\n");          printf("Can't zoom further out (%f)\n", *zoom);
1001          return 1;          return 1;
1002      }      }
1003      return 0;      return 0;
# Line 1374  static void map_touchnode_update(appdata Line 1356  static void map_touchnode_update(appdata
1356      /* don't highlight the dragged node itself and don't highlight */      /* don't highlight the dragged node itself and don't highlight */
1357      /* deleted ones */      /* deleted ones */
1358      if((node != cur_node) && (!(node->flags & OSM_FLAG_DELETED))) {      if((node != cur_node) && (!(node->flags & OSM_FLAG_DELETED))) {
1359        gint nx = x - node->lpos.x;        gint nx = abs(x - node->lpos.x);
1360        gint ny = y - node->lpos.y;        gint ny = abs(y - node->lpos.y);
1361    
1362        if((nx < map->style->node.radius) && (ny < map->style->node.radius) &&        if((nx < map->style->node.radius) && (ny < map->style->node.radius) &&
1363           (nx*nx + ny*ny < map->style->node.radius * map->style->node.radius))           (nx*nx + ny*ny < map->style->node.radius * map->style->node.radius))
# Line 1389  static void map_touchnode_update(appdata Line 1371  static void map_touchnode_update(appdata
1371    if(!map->touchnode && map->action.way) {    if(!map->touchnode && map->action.way) {
1372      node_chain_t *chain = map->action.way->node_chain;      node_chain_t *chain = map->action.way->node_chain;
1373      while(!map->touchnode && chain && chain->next) {      while(!map->touchnode && chain && chain->next) {
1374        gint nx = x - chain->node->lpos.x;        gint nx = abs(x - chain->node->lpos.x);
1375        gint ny = y - chain->node->lpos.y;        gint ny = abs(y - chain->node->lpos.y);
1376    
1377        if((nx < map->style->node.radius) && (ny < map->style->node.radius) &&        if((nx < map->style->node.radius) && (ny < map->style->node.radius) &&
1378           (nx*nx + ny*ny < map->style->node.radius * map->style->node.radius))           (nx*nx + ny*ny < map->style->node.radius * map->style->node.radius))
# Line 1790  GtkWidget *map_new(appdata_t *appdata) { Line 1772  GtkWidget *map_new(appdata_t *appdata) {
1772    map->appdata = appdata;    map->appdata = appdata;
1773    map->action.type = MAP_ACTION_IDLE;    map->action.type = MAP_ACTION_IDLE;
1774    
1775    map->canvas = canvas_new(map->style->background.color);    map->canvas = canvas_new();
   canvas_set_antialias(map->canvas, !appdata->settings->no_antialias);  
1776    
1777    GtkWidget *canvas_widget = canvas_get_widget(map->canvas);    GtkWidget *canvas_widget = canvas_get_widget(map->canvas);
1778    
# Line 1820  GtkWidget *map_new(appdata_t *appdata) { Line 1801  GtkWidget *map_new(appdata_t *appdata) {
1801  void map_init(appdata_t *appdata) {  void map_init(appdata_t *appdata) {
1802    map_t *map = appdata->map;    map_t *map = appdata->map;
1803    
1804      /* update canvas background color */
1805      canvas_set_background(map->canvas, map->style->background.color);
1806    
1807    /* set initial zoom */    /* set initial zoom */
1808    map_set_zoom(map, map->state->zoom, FALSE);    map_set_zoom(map, map->state->zoom, FALSE);
1809    josm_elemstyles_colorize_world(map->style, appdata->osm);    josm_elemstyles_colorize_world(map->style, appdata->osm);
# Line 1859  void map_clear(appdata_t *appdata, gint Line 1843  void map_clear(appdata_t *appdata, gint
1843  void map_paint(appdata_t *appdata) {  void map_paint(appdata_t *appdata) {
1844    map_t *map = appdata->map;    map_t *map = appdata->map;
1845    
   /* user may have changed antialias settings */  
   canvas_set_antialias(map->canvas, !appdata->settings->no_antialias);  
   
1846    josm_elemstyles_colorize_world(map->style, appdata->osm);    josm_elemstyles_colorize_world(map->style, appdata->osm);
1847    map_draw(map, appdata->osm);    map_draw(map, appdata->osm);
1848  }  }
# Line 1969  void map_action_ok(appdata_t *appdata) { Line 1950  void map_action_ok(appdata_t *appdata) {
1950      /* save changes to bg_offset in project */      /* save changes to bg_offset in project */
1951      appdata->project->wms_offset.x = map->bg.offset.x;      appdata->project->wms_offset.x = map->bg.offset.x;
1952      appdata->project->wms_offset.y = map->bg.offset.y;      appdata->project->wms_offset.y = map->bg.offset.y;
     appdata->project->dirty = TRUE;  
1953      break;      break;
1954    
1955    default:    default:
# Line 2406  static void map_detail_change(map_t *map Line 2386  static void map_detail_change(map_t *map
2386    map->state->detail = detail;    map->state->detail = detail;
2387    printf("changing detail factor to %f\n", map->state->detail);    printf("changing detail factor to %f\n", map->state->detail);
2388    
2389    banner_busy_start(appdata, 1, "Redrawing...");    banner_busy_start(appdata, 1, _("Redrawing"));
2390    map_clear(appdata, MAP_LAYER_OBJECTS_ONLY);    map_clear(appdata, MAP_LAYER_OBJECTS_ONLY);
2391    map_paint(appdata);    map_paint(appdata);
2392    banner_busy_stop(appdata);    banner_busy_stop(appdata);

Legend:
Removed from v.173  
changed lines
  Added in v.234