if (!pcoord_get_from_message(message, &iter, &pc))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- navit_set_center(navit, &pc);
+ navit_set_center(navit, &pc, 0);
return empty_reply(connection, message);
}
if (!point_get_from_message(message, &iter, &p))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- navit_set_center_screen(navit, &p);
+ navit_set_center_screen(navit, &p, 0);
return empty_reply(connection, message);
}
PyObject *pcoord;
if (!PyArg_ParseTuple(args, "O!", &pcoord_Type, &pcoord))
return NULL;
- navit_set_center(self->navit, pcoord_py_get(pcoord));
+ navit_set_center(self->navit, pcoord_py_get(pcoord), 0);
Py_RETURN_NONE;
}
return;
gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
if (c) {
- navit_set_center(search->nav, c);
+ navit_set_center(search->nav, c, 1);
}
}
case KEY_UP:
p.x=w/2;
p.y=0;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case KEY_DOWN:
p.x=w/2;
p.y=h;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case KEY_LEFT:
p.x=0;
p.y=h/2;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case KEY_RIGHT:
p.x=w;
p.y=h/2;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case KEY_ZOOM_IN:
navit_zoom_in(this->nav, 2, NULL);
p->x+=50*sin(transform_get_yaw(t)*M_PI/180);
pc.x=p->x;
pc.y=p->y;
- navit_set_center(this->nav, &pc);
+ navit_set_center(this->nav, &pc, 1);
}
break;
case 'g':
p->x-=50*sin(transform_get_yaw(t)*M_PI/180);
pc.x=p->x;
pc.y=p->y;
- navit_set_center(this->nav, &pc);
+ navit_set_center(this->nav, &pc, 1);
}
break;
#ifdef USE_HILDON
graphics_clear_selection(this->gra, NULL);
graphics_add_selection(this->gra, &w->item, NULL);
}
- navit_set_center(this->nav, &w->c);
+ navit_set_center(this->nav, &w->c, 1);
gui_internal_prune_menu(this, NULL);
}
case NAVIT_KEY_UP:
p.x=w/2;
p.y=0;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case NAVIT_KEY_DOWN:
p.x=w/2;
p.y=h;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case NAVIT_KEY_LEFT:
p.x=0;
p.y=h/2;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case NAVIT_KEY_RIGHT:
p.x=w;
p.y=h/2;
- navit_set_center_screen(this->nav, &p);
+ navit_set_center_screen(this->nav, &p, 1);
break;
case NAVIT_KEY_ZOOM_IN:
navit_zoom_in(this->nav, 2, NULL);
if (wParam == VK_LEFT || wParam == '4') {
p.x=0;
p.y=h/2;
- navit_set_center_screen(gui->nav, &p);
+ navit_set_center_screen(gui->nav, &p, 1);
} else if (wParam == VK_RIGHT || wParam == '6') {
p.x=w;
p.y=h/2;
- navit_set_center_screen(gui->nav, &p);
+ navit_set_center_screen(gui->nav, &p, 1);
} else if (wParam == VK_UP || wParam == '2') {
p.x=w/2;
p.y=0;
- navit_set_center_screen(gui->nav, &p);
+ navit_set_center_screen(gui->nav, &p, 1);
} else if (wParam == VK_DOWN || wParam == '8') {
p.x=w/2;
p.y=h;
- navit_set_center_screen(gui->nav, &p);
+ navit_set_center_screen(gui->nav, &p, 1);
} else if (wParam == '1') {
navit_zoom_in(gui->nav, 2, NULL);
} else if (wParam == '3') {
transform_set_center(tr, &c);
}
+static void
+navit_set_timeout(struct navit *this_)
+{
+ struct attr follow;
+ follow.type=attr_follow;
+ follow.u.num=this_->center_timeout;
+}
+
int
navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback)
{
this_->button_timeout=event_add_timeout(500, 0, popup_callback);
}
if (button == 2)
- navit_set_center_screen(this_, p);
+ navit_set_center_screen(this_, p, 1);
if (button == 3)
popup(this_, button, p);
if (button == 4 && this_->use_mousewheel) {
navit_zoom_out(this_, 2, p);
}
} else {
- struct attr follow;
- follow.type=attr_follow;
- follow.u.num=this_->center_timeout;
this_->button_pressed=0;
if (this_->button_timeout) {
event_remove_timeout(this_->button_timeout);
this_->button_timeout=NULL;
if (! this_->moved && ! transform_within_border(this_->trans, p, border)) {
- if (!this_->zoomed)
- navit_set_attr(this_, &follow);
- navit_set_center_screen(this_, p);
+ navit_set_center_screen(this_, p, !this_->zoomed);
}
}
if (this_->motion_timeout) {
graphics_draw_drag(this_->gra, NULL);
graphics_overlay_disable(this_->gra, 0);
if (!this_->zoomed)
- navit_set_attr(this_, &follow);
+ navit_set_timeout(this_);
navit_draw(this_);
} else
return 1;
navit_zoom_to_route(this, 0);
}
+
/**
* Change the current zoom level
*
* @returns nothing
*/
void
-navit_set_center(struct navit *this_, struct pcoord *center)
+navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout)
{
struct coord *c=transform_center(this_->trans);
struct coord c1,c2;
c2.y = center->y;
}
*c=c2;
+ if (set_timeout)
+ navit_set_timeout(this_);
if (this_->ready == 3)
navit_draw(this_);
}
static void
-navit_set_center_coord_screen(struct navit *this_, struct coord *c, struct point *p)
+navit_set_center_coord_screen(struct navit *this_, struct coord *c, struct point *p, int set_timeout)
{
int width, height;
struct point po;
po.x=width/2;
po.y=height/2;
update_transformation(this_->trans, &po, p, NULL);
+ if (set_timeout)
+ navit_set_timeout(this_);
}
static int
struct navit_vehicle *nv=this_->vehicle;
navit_get_cursor_pnt(this_, &pn, &dir);
transform_set_yaw(this_->trans, dir);
- navit_set_center_coord_screen(this_, &nv->coord, &pn);
+ navit_set_center_coord_screen(this_, &nv->coord, &pn, 0);
navit_autozoom(this_, &nv->coord, nv->speed, 0);
if (this_->ready == 3)
navit_draw_async(this_, 1);
}
void
-navit_set_center_screen(struct navit *this_, struct point *p)
+navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout)
{
struct coord c;
struct pcoord pc;
pc.x = c.x;
pc.y = c.y;
pc.pro = transform_get_projection(this_->trans);
- navit_set_center(this_, &pc);
+ navit_set_center(this_, &pc, set_timeout);
}
#if 0
void navit_window_roadbook_new(struct navit *this_);
void navit_init(struct navit *this_);
void navit_zoom_to_route(struct navit *this_, int orientation);
-void navit_set_center(struct navit *this_, struct pcoord *center);
-void navit_set_center_screen(struct navit *this_, struct point *p);
+void navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout);
+void navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout);
int navit_set_attr(struct navit *this_, struct attr *attr);
int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
int navit_add_attr(struct navit *this_, struct attr *attr);