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, |