Ticket #1100: visit_before_in_gtk.diff

File visit_before_in_gtk.diff, 2.0 KB (added by me.yahoo.com/a/_ij44v97roulszbeztrzcqzaaiyvlg--#9d14a, 7 years ago)

Visit before in gtk subversion patch

  • navit/popup.c

     
    134134        navit_set_destination(nav, pc, buffer, 1);
    135135}
    136136
     137
    137138static void
     139popup_set_visitbefore(struct navit *nav, struct pcoord *pc,int visitbefore)
     140{
     141        struct pcoord *dst;
     142        char buffer[1024];
     143        int i, dstcount;
     144        sprintf(buffer, _("Waypoint %d"), visitbefore+1);
     145        dstcount=navit_get_destination_count(nav)+1;
     146        dst=g_alloca(dstcount*sizeof(struct pcoord));
     147        dstcount=navit_get_destinations(nav,dst,dstcount);
     148        for (i=dstcount;i>visitbefore;i--){
     149                dst[i]=dst[i-1];
     150        }
     151        dst[visitbefore]=*pc;
     152        navit_add_destination_description(nav,pc,buffer);
     153        navit_set_destinations(nav, dst, dstcount+1, buffer, 1);
     154}
     155
     156
     157
     158static void
    138159popup_set_bookmark(struct navit *nav, struct pcoord *pc)
    139160{
    140161    struct attr attr;
     
    219240        return ret;
    220241}
    221242
     243
     244
    222245static void
     246popup_show_visitbefore(struct navit *nav,struct pcoord *pc, void *menu)
     247{
     248        void *menuvisitbefore;
     249        char buffer[100];
     250        int i, dstcount;
     251        dstcount=navit_get_destination_count(nav);
     252        if (dstcount>=1){
     253                menuvisitbefore=popup_printf(menu, menu_type_submenu, _("Visit before..."));
     254                for (i=0;i<dstcount;i++){
     255                        sprintf(buffer,_("Waypoint %d"),i+1);
     256                        popup_printf_cb(menuvisitbefore, menu_type_menu, callback_new_3(callback_cast(popup_set_visitbefore), nav, pc,i), buffer);
     257                }
     258        }
     259}
     260
     261static void
    223262popup_show_attr_val(struct map *map, void *menu, struct attr *attr)
    224263{
    225264        char *attr_name=attr_to_name(attr->type);
     
    393432        c.y = co.y;
    394433        popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_position), nav, &c), _("Set as position"));
    395434        popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_destination), nav, &c), _("Set as destination"));
     435        popup_show_visitbefore(nav,&c,men);
    396436        popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_bookmark), nav, &c), _("Add as bookmark"));
    397437        popup_display(nav, popup, p);
    398438        menu_popup(popup);