38 |
#define SAT_WIDTH 330 |
#define SAT_WIDTH 330 |
39 |
#define SAT_HEIGHT 60 |
#define SAT_HEIGHT 60 |
40 |
|
|
41 |
/* http://www.gtk.org/tutorial1.2/gtk_tut-30.html */ |
#ifdef ESPEAK |
|
/* http://developer.gimp.org/api/2.0/gdk/gdk-Drawing-Primitives.html */ |
|
42 |
|
|
43 |
|
#endif |
44 |
|
|
45 |
static float rad2deg(float rad) { |
static float rad2deg(float rad) { |
46 |
return fmodf(360.0 + (180.0/M_PI) * rad, 360.0); |
return fmodf(360.0 + (180.0/M_PI) * rad, 360.0); |
88 |
/* draw the locked/unlocked icon */ |
/* draw the locked/unlocked icon */ |
89 |
gdk_draw_pixbuf(context->gotoc.compass_pixmap, |
gdk_draw_pixbuf(context->gotoc.compass_pixmap, |
90 |
widget->style->fg_gc[GTK_STATE_NORMAL], |
widget->style->fg_gc[GTK_STATE_NORMAL], |
91 |
icon_get(ICON_MISC, context->appdata->compass_locked?1:2), |
icon_get(ICON_MISC, context->appdata->compass_locked?0:1), |
92 |
0, 0, (width-diameter)/2 + diameter/32, |
0, 0, (width-diameter)/2 + diameter/32, |
93 |
(height+diameter)/2 - 16 - diameter/32 , 16, 16, |
(height+diameter)/2 - 16 - diameter/32 , 16, 16, |
94 |
GDK_RGB_DITHER_NONE,0,0); |
GDK_RGB_DITHER_NONE,0,0); |
452 |
return TRUE; // fire again |
return TRUE; // fire again |
453 |
} |
} |
454 |
|
|
|
#ifdef ENABLE_MAEMO_MAPPER |
|
|
static void on_mm_button_clicked(GtkButton *button, gpointer data) { |
|
|
cache_context_t *context = (cache_context_t*)data; |
|
|
|
|
|
dbus_mm_set_position(context->appdata, &context->gotoc.pos); |
|
|
} |
|
|
#endif |
|
|
|
|
455 |
static gboolean compass_clicked_event(GtkWidget *widget, GdkEventButton *event, |
static gboolean compass_clicked_event(GtkWidget *widget, GdkEventButton *event, |
456 |
gpointer user_data) { |
gpointer user_data) { |
457 |
cache_context_t *context = (cache_context_t*)user_data; |
cache_context_t *context = (cache_context_t*)user_data; |
481 |
goto_update(context); |
goto_update(context); |
482 |
} |
} |
483 |
|
|
484 |
|
#ifdef ESPEAK |
485 |
|
static void espeak_clicked(GtkWidget *widget, gpointer data) { |
486 |
|
appdata_t *appdata = (appdata_t*)data; |
487 |
|
|
488 |
|
GtkWidget *icon = gtk_button_get_image(GTK_BUTTON(widget)); |
489 |
|
gtk_widget_destroy(icon); |
490 |
|
appdata->espeak.enabled = !appdata->espeak.enabled; |
491 |
|
gtk_button_set_image(GTK_BUTTON(widget), icon_get_widget(ICON_MISC, |
492 |
|
appdata->espeak.enabled?6:7)); |
493 |
|
} |
494 |
|
#endif |
495 |
|
|
496 |
GtkWidget *goto_cache(cache_context_t *context) { |
GtkWidget *goto_cache(cache_context_t *context) { |
497 |
int i; |
int i; |
498 |
|
|
538 |
g_signal_connect(G_OBJECT(context->gotoc.lon_entry), "changed", |
g_signal_connect(G_OBJECT(context->gotoc.lon_entry), "changed", |
539 |
G_CALLBACK(pos_modified), context); |
G_CALLBACK(pos_modified), context); |
540 |
|
|
541 |
context->gotoc.coo_popup = preset_coordinate_picker(context->appdata, |
gtk_table_attach_defaults(GTK_TABLE(table), preset_coordinate_picker(context->appdata, |
542 |
context->gotoc.lat_entry, context->gotoc.lon_entry); |
context->gotoc.lat_entry, context->gotoc.lon_entry), 2,3,0,1); |
543 |
gtk_table_attach_defaults(GTK_TABLE(table), |
|
544 |
context->gotoc.coo_popup, 2,3,0,1); |
gtk_table_attach_defaults(GTK_TABLE(table), goto_coordinate(context->appdata, |
545 |
|
context->gotoc.lat_entry, context->gotoc.lon_entry), 2,3,1,2); |
546 |
|
|
547 |
gtk_table_set_row_spacing(GTK_TABLE(table), 1, 16); |
gtk_table_set_row_spacing(GTK_TABLE(table), 1, 16); |
548 |
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16); |
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 16); |
550 |
/* -------------- distance label ------------------------- */ |
/* -------------- distance label ------------------------- */ |
551 |
gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Distance:")), 0,1,2,3); |
gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Distance:")), 0,1,2,3); |
552 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
553 |
(context->gotoc.distance_label = left_label_new("-----")), 1,2,2,3); |
(context->gotoc.distance_label = gtk_label_new("-----")), 1,2,2,3); |
554 |
|
|
555 |
/* -------------- bearing label ------------------------- */ |
/* -------------- bearing label ------------------------- */ |
556 |
gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Bearing:")), 0,1,3,4); |
gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Bearing:")), 0,1,3,4); |
557 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
558 |
(context->gotoc.bearing_label = left_label_new("-----")), 1,2,3,4); |
(context->gotoc.bearing_label = gtk_label_new("-----")), 1,2,3,4); |
559 |
|
|
560 |
/* -------------- error label ------------------------- */ |
/* -------------- error label ------------------------- */ |
561 |
gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Est. error:")), 0,1,4,5); |
gtk_table_attach_defaults(GTK_TABLE(table), left_label_new(_("Est. error:")), 0,1,4,5); |
562 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
563 |
(context->gotoc.eph_label = left_label_new("-----")), 1,2,4,5); |
(context->gotoc.eph_label = gtk_label_new("-----")), 1,2,4,5); |
564 |
|
|
565 |
gtk_table_set_row_spacing(GTK_TABLE(table), 4, 16); |
gtk_table_set_row_spacing(GTK_TABLE(table), 4, 16); |
566 |
|
|
580 |
|
|
581 |
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); |
582 |
|
|
583 |
#ifdef ENABLE_MAEMO_MAPPER |
#ifdef ESPEAK |
584 |
GtkWidget *mm_button = gtk_button_new(); |
GtkWidget *ivbox = gtk_vbox_new(FALSE, 0); |
585 |
gtk_button_set_image(GTK_BUTTON(mm_button), icon_get_widget(ICON_MISC, 0)); |
GtkWidget *button = button_new(); |
586 |
gtk_signal_connect(GTK_OBJECT(mm_button), "clicked", |
gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_MISC, |
587 |
(GtkSignalFunc)on_mm_button_clicked, context); |
context->appdata->espeak.enabled?6:7)); |
588 |
gtk_box_pack_start(GTK_BOX(ihbox), mm_button, 1,0,0); |
gtk_signal_connect (GTK_OBJECT(button), "clicked", |
589 |
|
GTK_SIGNAL_FUNC(espeak_clicked), context->appdata); |
590 |
|
if(context->appdata->espeak.sample_rate < 0) |
591 |
|
gtk_widget_set_sensitive(button, FALSE); |
592 |
|
|
593 |
|
gtk_box_pack_start(GTK_BOX(ivbox), button, 1,0,0); |
594 |
|
gtk_box_pack_start(GTK_BOX(ihbox), ivbox, 1,0,0); |
595 |
#endif |
#endif |
596 |
|
|
597 |
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 0,3,5,6); |
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 0,3,5,6); |