diff options
author | horwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2007-08-11 14:38:17 +0000 |
---|---|---|
committer | horwitz <horwitz@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2007-08-11 14:38:17 +0000 |
commit | d272d7431e4dbd89b1f7f6e60e9b37eb8aa5013c (patch) | |
tree | 5d7d1c4fedf03034c93f2ca40e4bab02215254ff | |
parent | 4b45d88d33de927309e10ed3d02c7815bdc08ffd (diff) | |
download | navit-svn-d272d7431e4dbd89b1f7f6e60e9b37eb8aa5013c.tar.gz |
Reenable orient north button and improve placement map reposistioning
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@383 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | src/gui/gtk/gui_gtk_action.c | 10 | ||||
-rw-r--r-- | src/navit.c | 15 | ||||
-rw-r--r-- | src/navit.h | 1 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/gui/gtk/gui_gtk_action.c b/src/gui/gtk/gui_gtk_action.c index 7932d400..b2684da9 100644 --- a/src/gui/gtk/gui_gtk_action.c +++ b/src/gui/gtk/gui_gtk_action.c @@ -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 diff --git a/src/navit.c b/src/navit.c index aa2450fe..ed6b2b24 100644 --- a/src/navit.c +++ b/src/navit.c @@ -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); } diff --git a/src/navit.h b/src/navit.h index 48399e68..9a3094e9 100644 --- a/src/navit.h +++ b/src/navit.h @@ -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); |