struct graphics_gc *cursor_gc;
struct transformation *trans;
struct point cursor_pnt;
- struct callback_list *offscreen_cbl;
struct callback_list *update_cbl;
struct vehicle *v;
struct callback *vehicle_cb;
double *dir;
double *speed;
enum projection pro;
- int border=10;
if (v) {
pos=vehicle_pos_get(v);
this->pos=*pos;
this->pro=pro;
callback_list_call_1(this->update_cbl, this);
- if (!transform(this->trans, pro, &this->pos, &pnt) || !transform_within_border(this->trans, &pnt, border)) {
- callback_list_call_1(this->offscreen_cbl, this);
- transform(this->trans, this->pro, &this->pos, &pnt);
- }
+ transform(this->trans, pro, &this->pos, &pnt);
cursor_draw(this, &pnt, *dir-transform_get_angle(this->trans, 0), *speed > 2.5);
}
#if 0
{
dbg(2,"enter gra=%p v=%p c=%p t=%p\n", gra, v, c, t);
struct cursor *this=g_new(struct cursor,1);
+#if 0
this->offscreen_cbl=callback_list_new();
+#endif
this->update_cbl=callback_list_new();
this->gra=gra;
this->trans=t;
}
void
-cursor_add_callback(struct cursor *this, int offscreen, struct callback *cb)
+cursor_add_callback(struct cursor *this, struct callback *cb)
{
- if (offscreen)
- callback_list_add(this->offscreen_cbl, cb);
- else
- callback_list_add(this->update_cbl, cb);
+ callback_list_add(this->update_cbl, cb);
}
int cursor_get_dir(struct cursor *this);
int cursor_get_speed(struct cursor *this);
struct cursor *cursor_new(struct graphics *gra, struct vehicle *v, struct color *c, struct transformation *t);
-void cursor_add_callback(struct cursor *this, int offscreen, struct callback *cb);
+void cursor_add_callback(struct cursor *this, struct callback *cb);
/* end of prototypes */
#include "navigation.h"
#include "speech.h"
#include "track.h"
+#include "vehicle.h"
#define _(STRING) gettext(STRING)
struct menu *menu;
struct cursor *cursor;
struct vehicle *vehicle;
- struct callback *offscreen_cb;
struct callback *update_cb;
};
}
static void
-navit_cursor_offscreen(struct navit *this_, struct cursor *cursor)
-{
- if (!this_->cursor_flag || !this_->vehicle || this_->vehicle->cursor != cursor)
- return;
- navit_set_center(this_, cursor_pos_get(cursor));
-}
-
-static void
navit_cursor_update(struct navit *this_, struct cursor *cursor)
{
+ struct point pnt;
struct coord *cursor_c=cursor_pos_get(cursor);
int dir=cursor_get_dir(cursor);
int speed=cursor_get_speed(cursor);
+ enum projection pro;
+ int border=10;
if (!this_->vehicle || this_->vehicle->cursor != cursor)
return;
cursor_c=cursor_pos_get(cursor);
dir=cursor_get_dir(cursor);
speed=cursor_get_speed(cursor);
+ pro=vehicle_projection(this_->vehicle);
+
+ 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);
+ transform(this_->trans, pro, cursor_c, &pnt);
+ }
if (this_->pid && speed > 2)
kill(this_->pid, SIGWINCH);
nv->update_curr=nv->update=update;
nv->follow_curr=nv->follow=follow;
nv->cursor=cursor_new(this_->gra, v, c, this_->trans);
- nv->offscreen_cb=callback_new_1(callback_cast(navit_cursor_offscreen), this_);
- cursor_add_callback(nv->cursor, 1, nv->offscreen_cb);
nv->update_cb=callback_new_1(callback_cast(navit_cursor_update), this_);
- cursor_add_callback(nv->cursor, 0, nv->update_cb);
+ cursor_add_callback(nv->cursor, nv->update_cb);
this_->vehicles=g_list_append(this_->vehicles, nv);
return nv;
extern struct gui *main_loop_gui;
/* prototypes */
enum projection;
+enum item_type;
struct callback;
struct color;
struct coord;
void navit_add_menu_vehicle(struct navit *this_, struct menu *men);
void navit_speak(struct navit *this_);
void navit_window_roadbook_new(struct navit *this_);
+void navit_window_roadbook_destroy(struct navit *this_);
+struct navit_window_items * navit_window_items_new(char *name, int distance);
+void navit_window_items_add_item(struct navit_window_items *nwi, enum item_type type);
+void navit_add_window_items(struct navit *this_, struct navit_window_items *nwi);
+void navit_add_menu_windows_items(struct navit *this_, struct menu *men);
void navit_init(struct navit *this_);
void navit_set_center(struct navit *this_, struct coord *center);
void navit_set_center_screen(struct navit *this_, struct point *p);