Reenable orient north button and improve placement map reposistioning
authorhorwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 11 Aug 2007 14:38:17 +0000 (14:38 +0000)
committerhorwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 11 Aug 2007 14:38:17 +0000 (14:38 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@383 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/src/gui/gtk/gui_gtk_action.c
navit/src/navit.c
navit/src/navit.h

index 7932d40..b2684da 100644 (file)
@@ -55,26 +55,18 @@ static void
 cursor_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
 {
        navit_toggle_cursor(gui->nav);
-#if 0
-       ac->gui->co->flags->track=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
-#endif
 }
 
 static void
 tracking_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
 {
        navit_toggle_tracking(gui->nav);
-#if 0
-       ac->gui->co->flags->track=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
-#endif
 }
 
 static void
 orient_north_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
 {
-#if 0
-       ac->gui->co->flags->orient_north=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
-#endif
+       navit_toggle_orient_north(gui->nav);
 }
 
 static void
index aa2450f..ed6b2b2 100644 (file)
@@ -5,6 +5,7 @@
 #include <fcntl.h>
 #include <glib.h>
 #include <libintl.h>
+#include <math.h>
 #include "debug.h"
 #include "navit.h"
 #include "callback.h"
@@ -66,6 +67,7 @@ struct navit {
        struct displaylist *displaylist;
        int cursor_flag;
        int tracking_flag;
+       int orient_north_flag;
        GList *vehicles;
        GList *windows_items;
        struct navit_vehicle *vehicle;
@@ -855,6 +857,12 @@ navit_toggle_tracking(struct navit *this_)
        this_->tracking_flag=1-this_->tracking_flag;
 }
 
+void
+navit_toggle_orient_north(struct navit *this_)
+{
+       this_->orient_north_flag=1-this_->orient_north_flag;
+}
+
 static void
 navit_cursor_update(struct navit *this_, struct cursor *cursor)
 {
@@ -863,7 +871,7 @@ navit_cursor_update(struct navit *this_, struct cursor *cursor)
        int dir=cursor_get_dir(cursor);
        int speed=cursor_get_speed(cursor);
        enum projection pro;
-       int border=10;
+       int border=30;
 
        if (!this_->vehicle || this_->vehicle->cursor != cursor)
                return;
@@ -876,7 +884,10 @@ navit_cursor_update(struct navit *this_, struct cursor *cursor)
        if (!transform(this_->trans, pro, cursor_c, &pnt) || !transform_within_border(this_->trans, &pnt, border)) {
                if (!this_->cursor_flag)
                        return;
-               navit_set_center(this_, cursor_c);
+               if(this_->orient_north_flag)
+                       navit_set_center_cursor(this_, cursor_c, 0, 50 - 30.*sin(M_PI*dir/180.), 50 + 30.*cos(M_PI*dir/180.));
+               else
+                       navit_set_center_cursor(this_, cursor_c, dir, 50, 80);
                transform(this_->trans, pro, cursor_c, &pnt);
        }
 
index 48399e6..9a3094e 100644 (file)
@@ -53,6 +53,7 @@ void navit_set_center(struct navit *this_, struct coord *center);
 void navit_set_center_screen(struct navit *this_, struct point *p);
 void navit_toggle_cursor(struct navit *this_);
 void navit_toggle_tracking(struct navit *this_);
+void navit_toggle_orient_north(struct navit *this_);
 void navit_set_position(struct navit *this_, struct coord *c);
 struct navit_vehicle *navit_add_vehicle(struct navit *this_, struct vehicle *v, const char *name, struct color *c, int update, int follow);
 void navit_add_vehicle_cb(struct navit *this_, struct callback *cb);