Add:Core:Support for FRA FRA NLS Setting
[navit-package] / navit / navit.c
index 73975b4..eb92e8b 100644 (file)
@@ -137,6 +137,7 @@ struct navit {
        int follow_cursor;
        int prevTs;
        int graphics_flags;
+       int zoom_min, zoom_max;
 };
 
 struct gui *main_loop_gui;
@@ -350,6 +351,7 @@ navit_handle_button(struct navit *this_, int pressed, int button, struct point *
 {
        int border=16;
 
+       dbg(1,"enter %d %d (ignore %d)\n",pressed,button,this_->ignore_button);
        callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, GINT_TO_POINTER(pressed), GINT_TO_POINTER(button), p);
        if (this_->ignore_button) {
                this_->ignore_button=0;
@@ -416,6 +418,7 @@ static void
 navit_button(void *data, int pressed, int button, struct point *p)
 {
        struct navit *this=data;
+       dbg(1,"enter %d %d ignore %d\n",pressed,button,this->ignore_graphics_events);
        if (!this->ignore_graphics_events) {
                if (! this->popup_callback)
                        this->popup_callback=callback_new_1(callback_cast(navit_popup), this);
@@ -477,6 +480,7 @@ navit_handle_motion(struct navit *this_, struct point *p)
                dx=(p->x-this_->pressed.x);
                dy=(p->y-this_->pressed.y);
                if (dx < -8 || dx > 8 || dy < -8 || dy > 8) {
+                       this_->moved=1;
                        if (this_->button_timeout) {
                                event_remove_timeout(this_->button_timeout);
                                this_->button_timeout=NULL;
@@ -502,6 +506,10 @@ static void
 navit_scale(struct navit *this_, long scale, struct point *p, int draw)
 {
        struct coord c1, c2, *center;
+       if (scale < this_->zoom_min)
+               scale=this_->zoom_min;
+       if (scale > this_->zoom_max)
+               scale=this_->zoom_max;
        if (p)
                transform_reverse(this_->trans, p, &c1);
        transform_set_scale(this_->trans, scale);
@@ -661,6 +669,8 @@ navit_new(struct attr *parent, struct attr **attrs)
        this_->autozoom_secs = 10;
        this_->autozoom_min = 7;
        this_->autozoom_active = 0;
+       this_->zoom_min = 1;
+       this_->zoom_max = 2097152;
        this_->follow_cursor = 1;
 
        this_->trans = transform_new();
@@ -1768,6 +1778,14 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
                if (attr_updated && !init) 
                        navit_draw(this_);
                break;
+       case attr_zoom_min:
+               attr_updated=(attr->u.num != this_->zoom_min);
+               this_->zoom_min=attr->u.num;
+               break;
+       case attr_zoom_max:
+               attr_updated=(attr->u.num != this_->zoom_max);
+               this_->zoom_max=attr->u.num;
+               break;
        case attr_message:
                navit_add_message(this_, attr->u.str);
                break;
@@ -1841,6 +1859,11 @@ navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, stru
        case attr_displaylist:
                attr->u.displaylist=this_->displaylist;
                return (attr->u.displaylist != NULL);
+       case attr_follow:
+               if (!this_->vehicle)
+                       return 0;
+               attr->u.num=this_->vehicle->follow_curr;
+               break;
        case attr_former_destination_map:
                attr->u.map=this_->former_destination;
                break;
@@ -2304,6 +2327,8 @@ navit_layout_switch(struct navit *n)
     if (navit_get_attr(n,attr_layout,&layout_attr,NULL)!=1) {
        return; //No layout - nothing to switch
     }
+    if (!n->vehicle)
+       return;
     l=layout_attr.u.layout;
     
     if (l->dayname || l->nightname) {