From 7eb1bbf26ed51b71f65572ebec58a6be1fbb969f Mon Sep 17 00:00:00 2001 From: horwitz Date: Sat, 11 Aug 2007 14:38:17 +0000 Subject: [PATCH] Reenable orient north button and improve placement map reposistioning 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 | 10 +--------- navit/src/navit.c | 15 +++++++++++++-- navit/src/navit.h | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/navit/src/gui/gtk/gui_gtk_action.c b/navit/src/gui/gtk/gui_gtk_action.c index 7932d40..b2684da 100644 --- a/navit/src/gui/gtk/gui_gtk_action.c +++ b/navit/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/navit/src/navit.c b/navit/src/navit.c index aa2450f..ed6b2b2 100644 --- a/navit/src/navit.c +++ b/navit/src/navit.c @@ -5,6 +5,7 @@ #include #include #include +#include #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/navit/src/navit.h b/navit/src/navit.h index 48399e6..9a3094e 100644 --- a/navit/src/navit.h +++ b/navit/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); -- 2.7.4