195 |
GdkPoint arrow[4]; |
GdkPoint arrow[4]; |
196 |
|
|
197 |
pos_t *pos = gps_get_pos(context->appdata); |
pos_t *pos = gps_get_pos(context->appdata); |
198 |
if(pos) { |
if(pos && !isnan(pos->lat) && !isnan(pos->lon)) { |
199 |
context->appdata->gps = *pos; /* save position */ |
context->appdata->gps = *pos; /* save position */ |
200 |
|
|
201 |
float arot = |
float arot = |
290 |
int i, x; |
int i, x; |
291 |
int swid = (width-SAT_SPACING*(sat->num-1))/sat->num; |
int swid = (width-SAT_SPACING*(sat->num-1))/sat->num; |
292 |
|
|
|
#if 0 |
|
|
int max_ss = 1; |
|
|
for(i=0;i<sat->num;i++) |
|
|
if(sat->ss[i] > max_ss) max_ss = sat->ss[i]; |
|
|
|
|
|
printf("max_ss = %d dB\n", max_ss); |
|
|
#else |
|
293 |
/* as of xgps, a ss of 40 and more is "plenty" */ |
/* as of xgps, a ss of 40 and more is "plenty" */ |
294 |
int max_ss = 40; |
int max_ss = 40; |
295 |
for(i=0;i<sat->num;i++) |
for(i=0;i<sat->num;i++) |
296 |
if(sat->ss[i] > max_ss) sat->ss[i] = max_ss; |
if(sat->ss[i] > max_ss) sat->ss[i] = max_ss; |
|
#endif |
|
297 |
|
|
298 |
if(swid > 40) { |
if(swid > 40) { |
299 |
swid = 40; |
swid = 40; |
314 |
|
|
315 |
int tw, th; |
int tw, th; |
316 |
pango_layout_get_pixel_size(layout, &tw, &th); |
pango_layout_get_pixel_size(layout, &tw, &th); |
317 |
gdk_draw_layout(context->gotoc.sat_pixmap, widget->style->black_gc, |
gdk_draw_layout(context->gotoc.sat_pixmap, |
318 |
|
widget->style->text_gc[GTK_STATE_NORMAL], |
319 |
x + swid/2 - tw/2, height - th, layout); |
x + swid/2 - tw/2, height - th, layout); |
320 |
|
|
321 |
g_object_unref(layout); |
g_object_unref(layout); |
323 |
int h = (height-th) * sat->ss[i] / max_ss; |
int h = (height-th) * sat->ss[i] / max_ss; |
324 |
|
|
325 |
gdk_draw_rectangle(context->gotoc.sat_pixmap, |
gdk_draw_rectangle(context->gotoc.sat_pixmap, |
326 |
sat->used[i]?used_gc:widget->style->black_gc, |
sat->used[i]?used_gc:widget->style->fg_gc[GTK_STATE_NORMAL], |
327 |
TRUE, |
TRUE, x, height-h-th, swid, h); |
|
x, height-h-th, swid, h); |
|
328 |
|
|
329 |
x += SAT_SPACING+swid; |
x += SAT_SPACING+swid; |
330 |
} |
} |
334 |
free(sat->ss); |
free(sat->ss); |
335 |
free(sat->used); |
free(sat->used); |
336 |
} else { |
} else { |
337 |
PangoLayout *layout = gtk_widget_create_pango_layout(widget, _("No SAT info")); |
PangoLayout *layout = |
338 |
|
gtk_widget_create_pango_layout(widget, _("No SAT info")); |
339 |
int tw, th; |
int tw, th; |
340 |
pango_layout_get_pixel_size(layout, &tw, &th); |
pango_layout_get_pixel_size(layout, &tw, &th); |
341 |
gdk_draw_layout(context->gotoc.sat_pixmap, widget->style->black_gc, |
gdk_draw_layout(context->gotoc.sat_pixmap, |
342 |
|
widget->style->text_gc[GTK_STATE_NORMAL], |
343 |
(width - tw)/2, (height - th)/2, layout); |
(width - tw)/2, (height - th)/2, layout); |
344 |
|
|
345 |
g_object_unref(layout); |
g_object_unref(layout); |
420 |
} |
} |
421 |
|
|
422 |
pos_t *pos = gps_get_pos(context->appdata); |
pos_t *pos = gps_get_pos(context->appdata); |
423 |
if(pos) { |
if(pos && !isnan(pos->lat) && !isnan(pos->lon) && |
424 |
|
!isnan(context->gotoc.pos.lat) && !isnan(context->gotoc.pos.lon)) { |
425 |
char str[16]; |
char str[16]; |
426 |
gpx_pos_get_distance_str(str, sizeof(str), |
gpx_pos_get_distance_str(str, sizeof(str), |
427 |
*pos, context->gotoc.pos, |
*pos, context->gotoc.pos, |
436 |
gtk_label_set_text(GTK_LABEL(context->gotoc.bearing_label), "-----"); |
gtk_label_set_text(GTK_LABEL(context->gotoc.bearing_label), "-----"); |
437 |
} |
} |
438 |
|
|
439 |
float epe = gps_get_epe(context->appdata); |
float eph = gps_get_eph(context->appdata); |
440 |
if(isnan(epe)) |
if(isnan(eph)) |
441 |
gtk_label_set_text(GTK_LABEL(context->gotoc.epe_label), "-----"); |
gtk_label_set_text(GTK_LABEL(context->gotoc.eph_label), "-----"); |
442 |
else { |
else { |
443 |
char str[16]; |
char str[16]; |
444 |
if(context->appdata->imperial) { |
/* distance needs to be given in km */ |
445 |
epe *= 3.2808; |
if(context->appdata->imperial) |
446 |
snprintf(str, sizeof(str), "%.1f ft", epe); |
eph /= (6371.0/3959.0); // km to miles |
|
} else |
|
|
snprintf(str, sizeof(str), "%.1f m", epe); |
|
447 |
|
|
448 |
gtk_label_set_text(GTK_LABEL(context->gotoc.epe_label), str); |
distance_str(str, sizeof(str), eph/1000.0, context->appdata->imperial); |
449 |
|
gtk_label_set_text(GTK_LABEL(context->gotoc.eph_label), str); |
450 |
} |
} |
451 |
|
|
452 |
return TRUE; // fire again |
return TRUE; // fire again |
552 |
return FALSE; |
return FALSE; |
553 |
} |
} |
554 |
|
|
555 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
556 |
static void on_mm_button_clicked(GtkButton *button, gpointer data) { |
static void on_mm_button_clicked(GtkButton *button, gpointer data) { |
557 |
cache_context_t *context = (cache_context_t*)data; |
cache_context_t *context = (cache_context_t*)data; |
558 |
|
|
635 |
gtk_signal_connect(GTK_OBJECT(radio), "clicked", |
gtk_signal_connect(GTK_OBJECT(radio), "clicked", |
636 |
(GtkSignalFunc)radio_changed_event, context); |
(GtkSignalFunc)radio_changed_event, context); |
637 |
|
|
638 |
context->gotoc.edit_but = gtk_button_new_with_label(_("Edit...")); |
context->gotoc.edit_but = gtk_button_new_with_label(_("Edit")); |
639 |
gtk_table_attach_defaults(GTK_TABLE(table), context->gotoc.edit_but, 1,2,1,2); |
gtk_table_attach_defaults(GTK_TABLE(table), context->gotoc.edit_but, 1,2,1,2); |
640 |
gtk_signal_connect(GTK_OBJECT(context->gotoc.edit_but), "clicked", |
gtk_signal_connect(GTK_OBJECT(context->gotoc.edit_but), "clicked", |
641 |
(GtkSignalFunc)on_posedit_clicked, context); |
(GtkSignalFunc)on_posedit_clicked, context); |
686 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
687 |
gtk_label_new(_("Est. error:")), 0,1,6,7); |
gtk_label_new(_("Est. error:")), 0,1,6,7); |
688 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
689 |
(context->gotoc.epe_label = gtk_label_new("-----")), 1,2,6,7); |
(context->gotoc.eph_label = gtk_label_new("-----")), 1,2,6,7); |
690 |
|
|
691 |
gtk_table_set_row_spacing(GTK_TABLE(table), 6, 16); |
gtk_table_set_row_spacing(GTK_TABLE(table), 6, 16); |
692 |
|
|
706 |
|
|
707 |
gtk_box_pack_start(GTK_BOX(ihbox), context->gotoc.sat_area, 1,0,0); |
gtk_box_pack_start(GTK_BOX(ihbox), context->gotoc.sat_area, 1,0,0); |
708 |
|
|
709 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
710 |
GtkWidget *mm_button = gtk_button_new(); |
GtkWidget *mm_button = gtk_button_new(); |
711 |
gtk_button_set_image(GTK_BUTTON(mm_button), icon_get_widget(ICON_MISC, 0)); |
gtk_button_set_image(GTK_BUTTON(mm_button), icon_get_widget(ICON_MISC, 0)); |
712 |
gtk_signal_connect(GTK_OBJECT(mm_button), "clicked", |
gtk_signal_connect(GTK_OBJECT(mm_button), "clicked", |