struct navit_vehicle *vehicle;
struct callback_list *vehicle_cbl;
struct callback_list *init_cbl;
+ struct callback_list *attr_cbl;
int pid;
struct callback *nav_speech_cb;
struct callback *roadbook_callback;
this_->self.u.navit=this_;
this_->vehicle_cbl=callback_list_new();
this_->init_cbl=callback_list_new();
+ this_->attr_cbl=callback_list_new();
f=popen("pidof /usr/bin/ipaq-sleep","r");
if (f) {
int
navit_set_attr(struct navit *this_, struct attr *attr)
{
- int dir=0, orient_old=0;
+ int dir=0, orient_old=0, attr_updated=0;
switch (attr->type) {
case attr_cursor:
- this_->cursor_flag=!!attr->u.num;
+ if (this_->cursor_flag != !!attr->u.num) {
+ this_->cursor_flag=!!attr->u.num;
+ attr_updated=1;
+ }
break;
case attr_tracking:
- this_->tracking_flag=!!attr->u.num;
+ if (this_->tracking_flag != !!attr->u.num) {
+ this_->tracking_flag=!!attr->u.num;
+ attr_updated=1;
+ }
break;
case attr_orientation:
orient_old=this_->orient_north_flag;
transform_set_angle(this_->trans, dir);
if (orient_old != this_->orient_north_flag) {
navit_draw(this_);
+ attr_updated=1;
}
break;
default:
return 0;
}
+ if (attr_updated) {
+ callback_list_call_attr(this_->attr_cbl, attr->type, 1, &attr);
+ }
return 1;
}
return 1;
}
+void
+navit_add_attr_cb(struct navit *this_, struct callback *cb)
+{
+ callback_list_add(this_->attr_cbl, cb);
+}
+
+void
+navit_remove_attr_cb(struct navit *this_, struct callback *cb)
+{
+ callback_list_remove(this_->attr_cbl, cb);
+}
+
/**
* Toggle the cursor update : refresh the map each time the cursor has moved (instead of only when it reaches a border)
*
void navit_set_center_screen(struct navit *this_, struct point *p);
int navit_set_attr(struct navit *this_, struct attr *attr);
int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr);
+void navit_add_attr_cb(struct navit *this_, struct callback *cb);
+void navit_remove_attr_cb(struct navit *this_, struct callback *cb);
void navit_set_position(struct navit *this_, struct pcoord *c);
struct navit_vehicle *navit_add_vehicle(struct navit *this_, struct vehicle *v, struct attr **attrs);
void navit_add_vehicle_cb(struct navit *this_, struct callback *cb);