Diff of /trunk/src/relation_edit.c

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

revision 218 by harbaum, Mon Jul 13 12:15:51 2009 UTC revision 239 by harbaum, Thu Jul 23 13:15:53 2009 UTC
# Line 47  static gboolean relation_add_item(GtkWid Line 47  static gboolean relation_add_item(GtkWid
47    role_chain_t *chain = NULL, **chainP = &chain;    role_chain_t *chain = NULL, **chainP = &chain;
48    
49    printf("add object of type %d to relation #" ITEM_ID_FORMAT "\n",    printf("add object of type %d to relation #" ITEM_ID_FORMAT "\n",
50           object->type, relation->id);           object->type, OSM_ID(relation));
51    
52    /* ask the user for the role of the new object in this relation */    /* ask the user for the role of the new object in this relation */
53    
# Line 88  static gboolean relation_add_item(GtkWid Line 88  static gboolean relation_add_item(GtkWid
88    char *info_str = NULL;    char *info_str = NULL;
89    if(type) info_str = g_strdup_printf(_("In relation of type: %s"), type);    if(type) info_str = g_strdup_printf(_("In relation of type: %s"), type);
90    else     info_str = g_strdup_printf(_("In relation #" ITEM_ID_FORMAT),    else     info_str = g_strdup_printf(_("In relation #" ITEM_ID_FORMAT),
91                                        relation->id);                                        OSM_ID(relation));
92    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),
93                                gtk_label_new(info_str));                                gtk_label_new(info_str));
94    g_free(info_str);    g_free(info_str);
# Line 159  static gboolean relation_add_item(GtkWid Line 159  static gboolean relation_add_item(GtkWid
159  static void relation_remove_item(relation_t *relation, object_t *object) {  static void relation_remove_item(relation_t *relation, object_t *object) {
160    
161    printf("remove object of type %d from relation #" ITEM_ID_FORMAT "\n",    printf("remove object of type %d from relation #" ITEM_ID_FORMAT "\n",
162           object->type, relation->id);           object->type, OSM_ID(relation));
163    
164    member_t **member = &relation->member;    member_t **member = &relation->member;
165    while(*member) {    while(*member) {
# Line 258  static void on_relation_item_edit(GtkWid Line 258  static void on_relation_item_edit(GtkWid
258    relation_t *sel = get_selection(context);    relation_t *sel = get_selection(context);
259    if(!sel) return;    if(!sel) return;
260    
261    printf("edit relation item #" ITEM_ID_FORMAT "\n", sel->id);    printf("edit relation item #" ITEM_ID_FORMAT "\n", OSM_ID(sel));
262    
263    if (!relation_info_dialog(context->dialog, context->appdata, sel))    if (!relation_info_dialog(context->dialog, context->appdata, sel))
264      return;      return;
# Line 294  static void on_relation_item_remove(GtkW Line 294  static void on_relation_item_remove(GtkW
294    relation_t *sel = get_selection(context);    relation_t *sel = get_selection(context);
295    if(!sel) return;    if(!sel) return;
296    
297    printf("remove relation #" ITEM_ID_FORMAT "\n", sel->id);    printf("remove relation #" ITEM_ID_FORMAT "\n", OSM_ID(sel));
298    
299    gint members = osm_relation_members_num(sel);    gint members = osm_relation_members_num(sel);
300    
# Line 469  void relation_add_dialog(GtkWidget *pare Line 469  void relation_add_dialog(GtkWidget *pare
469    switch(object->type) {    switch(object->type) {
470    case NODE:    case NODE:
471      str = g_strdup_printf(_("Relations for node #" ITEM_ID_FORMAT),      str = g_strdup_printf(_("Relations for node #" ITEM_ID_FORMAT),
472                            object->node->id);                            OBJECT_ID(*object));
473      break;      break;
474    case WAY:    case WAY:
475      str = g_strdup_printf(_("Relations for way #" ITEM_ID_FORMAT),      str = g_strdup_printf(_("Relations for way #" ITEM_ID_FORMAT),
476                            object->way->id);                            OBJECT_ID(*object));
477      break;      break;
478    default:    default:
479      g_assert((object->type == NODE) || (object->type == WAY));      g_assert((object->type == NODE) || (object->type == WAY));
# Line 706  void relation_show_members(GtkWidget *pa Line 706  void relation_show_members(GtkWidget *pa
706    if(!str) str = osm_tag_get_by_key(mcontext->relation->tag, "ref");    if(!str) str = osm_tag_get_by_key(mcontext->relation->tag, "ref");
707    if(!str)    if(!str)
708      str = g_strdup_printf(_("Members of relation #" ITEM_ID_FORMAT),      str = g_strdup_printf(_("Members of relation #" ITEM_ID_FORMAT),
709                            mcontext->relation->id);                            OSM_ID(mcontext->relation));
710    else    else
711      str = g_strdup_printf(_("Members of relation \"%s\""), str);      str = g_strdup_printf(_("Members of relation \"%s\""), str);
712    
# Line 761  static void on_relation_add(GtkWidget *b Line 761  static void on_relation_add(GtkWidget *b
761      GtkTreeIter iter;      GtkTreeIter iter;
762      gtk_list_store_append(context->store, &iter);      gtk_list_store_append(context->store, &iter);
763      gtk_list_store_set(context->store, &iter,      gtk_list_store_set(context->store, &iter,
764                         RELATION_COL_ID, relation->id,                         RELATION_COL_ID, OSM_ID(relation),
765                         RELATION_COL_TYPE,                         RELATION_COL_TYPE,
766                         osm_tag_get_by_key(relation->tag, "type"),                         osm_tag_get_by_key(relation->tag, "type"),
767                         RELATION_COL_NAME, name,                         RELATION_COL_NAME, name,
# Line 782  static void on_relation_edit(GtkWidget * Line 782  static void on_relation_edit(GtkWidget *
782    relation_t *sel = get_selected_relation(context);    relation_t *sel = get_selected_relation(context);
783    if(!sel) return;    if(!sel) return;
784    
785    printf("edit relation #" ITEM_ID_FORMAT "\n", sel->id);    printf("edit relation #" ITEM_ID_FORMAT "\n", OSM_ID(sel));
786    
787    if (!relation_info_dialog(context->dialog, context->appdata, sel))    if (!relation_info_dialog(context->dialog, context->appdata, sel))
788      return;      return;
# Line 805  static void on_relation_edit(GtkWidget * Line 805  static void on_relation_edit(GtkWidget *
805    
806    // Found it. Update all visible fields.    // Found it. Update all visible fields.
807    gtk_list_store_set(context->store, &iter,    gtk_list_store_set(context->store, &iter,
808      RELATION_COL_ID,      sel->id,      RELATION_COL_ID,      OSM_ID(sel),
809      RELATION_COL_TYPE,    osm_tag_get_by_key(sel->tag, "type"),      RELATION_COL_TYPE,    osm_tag_get_by_key(sel->tag, "type"),
810      RELATION_COL_NAME,    relation_get_descriptive_name(sel),      RELATION_COL_NAME,    relation_get_descriptive_name(sel),
811      RELATION_COL_MEMBERS, osm_relation_members_num(sel),      RELATION_COL_MEMBERS, osm_relation_members_num(sel),
# Line 821  static void on_relation_remove(GtkWidget Line 821  static void on_relation_remove(GtkWidget
821    relation_t *sel = get_selected_relation(context);    relation_t *sel = get_selected_relation(context);
822    if(!sel) return;    if(!sel) return;
823    
824    printf("remove relation #" ITEM_ID_FORMAT "\n", sel->id);    printf("remove relation #" ITEM_ID_FORMAT "\n", OSM_ID(sel));
825    
826    gint members = osm_relation_members_num(sel);    gint members = osm_relation_members_num(sel);
827    
# Line 887  static GtkWidget *relation_list_widget(r Line 887  static GtkWidget *relation_list_widget(r
887      /* Append a row and fill in some data */      /* Append a row and fill in some data */
888      gtk_list_store_append(context->store, &iter);      gtk_list_store_append(context->store, &iter);
889      gtk_list_store_set(context->store, &iter,      gtk_list_store_set(context->store, &iter,
890                         RELATION_COL_ID, rel->id,                         RELATION_COL_ID, OSM_ID(rel),
891                         RELATION_COL_TYPE,                         RELATION_COL_TYPE,
892                         osm_tag_get_by_key(rel->tag, "type"),                         osm_tag_get_by_key(rel->tag, "type"),
893                         RELATION_COL_NAME, name,                         RELATION_COL_NAME, name,

Legend:
Removed from v.218  
changed lines
  Added in v.239