#include "map.h"
#include "latlon.h"
#include "route.h"
+#include "track.h"
#include "settings.h"
#include "mapper-types.h"
#include "map-download.h"
GtkWidget *chk_overwrite;
GtkWidget *rad_by_area;
GtkWidget *rad_by_route;
+ GtkWidget *rad_by_track;
GtkWidget *num_route_radius;
+ GtkWidget *num_track_radius;
/* The "Area" tab. */
GtkWidget *txt_topleft_lat;
}
static gboolean
-mapman_by_route(MapmanInfo * mapman_info, gboolean is_deleting, gboolean is_overwriting)
+mapman_by_path(Path *path, MapmanInfo *mapman_info, guint radius, gboolean is_deleting, gboolean is_overwriting)
{
GtkWidget *confirm;
guint prev_tilex, prev_tiley, num_maps = 0, i;
Point *curr;
gchar buffer[80];
-guint radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info->num_route_radius));
/* First, get the number of maps to download. */
for (i = 0; i < MAX_ZOOM; i++) {
prev_tilex = 0;
prev_tiley = 0;
- for (curr = _route->head - 1; curr++ != _route->tail;) {
+ for (curr = path->head - 1; curr++ != path->tail;) {
if (curr->unity) {
guint tilex = unit2ztile(curr->unitx, i);
guint tiley = unit2ztile(curr->unity, i);
if (is_deleting) {
g_snprintf(buffer, sizeof(buffer), "%s %s %d %s",
- _("Confirm DELETION of"), _("about"),
- num_maps, _("maps "));
+ _("Confirm DELETION of"), _("about"), num_maps, _("maps "));
} else {
g_snprintf(buffer, sizeof(buffer),
"%s %s %d %s\n(%s %.2f MB)\n",
prev_tilex = 0;
prev_tiley = 0;
- for (curr = _route->head - 1; curr++ != _route->tail;) {
+ for (curr = path->head - 1; curr++ != path->tail;) {
if (curr->unity) {
guint tilex = unit2ztile(curr->unitx, i);
guint tiley = unit2ztile(curr->unity, i);
}
}
}
-_route_dl_radius = radius;
gtk_widget_destroy(confirm);
return TRUE;
}
static void
mapman_update_state(GtkWidget * widget, MapmanInfo * mapman_info)
{
-gtk_widget_set_sensitive(mapman_info->chk_overwrite,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info->rad_download)));
-
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON(mapman_info->rad_by_area)))
- gtk_widget_show(mapman_info->tbl_area);
- else if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(mapman_info->notebook))
- == 3)
- gtk_widget_hide(mapman_info->tbl_area);
-
- gtk_widget_set_sensitive(mapman_info->num_route_radius,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
- (mapman_info->rad_by_route)));
+gtk_widget_set_sensitive(mapman_info->chk_overwrite, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info->rad_download)));
+
+if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info->rad_by_area)))
+ gtk_widget_show(mapman_info->tbl_area);
+else if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(mapman_info->notebook)) == 3)
+ gtk_widget_hide(mapman_info->tbl_area);
+
+gtk_widget_set_sensitive(mapman_info->num_route_radius, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info->rad_by_route)));
+gtk_widget_set_sensitive(mapman_info->num_track_radius, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info->rad_by_track)));
}
gboolean menu_cb_mapman(GtkAction * action)
guint i;
mapman_info.dialog = dialog = gtk_dialog_new_with_buttons(_("Manage Maps"), GTK_WINDOW(_window),
- GTK_DIALOG_MODAL, GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT, NULL);
+ GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
help_dialog_help_enable(GTK_DIALOG(mapman_info.dialog), HELP_ID_MAPMAN);
/* Clear button. */
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
button = gtk_button_new_with_label(_("Clear")));
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(mapman_clear), &mapman_info);
+ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(mapman_clear), &mapman_info);
/* Cancel button. */
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
- mapman_info.notebook = gtk_notebook_new(), TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), mapman_info.notebook = gtk_notebook_new(), TRUE, TRUE, 0);
/* Setup page. */
- gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook),
- vbox = gtk_vbox_new(FALSE, 2),
- label = gtk_label_new(_("Setup")));
- gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook),
- vbox, FALSE, FALSE, GTK_PACK_START);
-
- gtk_box_pack_start(GTK_BOX(vbox),
- hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox),
- mapman_info.rad_download = gtk_radio_button_new_with_label(NULL, _("Download Maps")), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), label =
- gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), FALSE, FALSE,
- 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook), vbox = gtk_vbox_new(FALSE, 2), label = gtk_label_new(_("Setup")));
+ gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook), vbox, FALSE, FALSE, GTK_PACK_START);
+
+ gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_download = gtk_radio_button_new_with_label(NULL, _("Download Maps")), FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), label = gtk_alignment_new(0.f, 0.5f, 0.f, 0.f), FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(label), mapman_info.chk_overwrite =
gtk_check_button_new_with_label(_("Overwrite"))),
gtk_box_pack_start(GTK_BOX(vbox), mapman_info.rad_delete =
- gtk_radio_button_new_with_label_from_widget
- (GTK_RADIO_BUTTON(mapman_info.rad_download),
- _("Delete Maps")), FALSE, FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(vbox),
- gtk_hseparator_new(), FALSE, FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(vbox),
- mapman_info.rad_by_area
- = gtk_radio_button_new_with_label(NULL, _("By Area (see tab)")), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), hbox =
- gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_route =
- gtk_radio_button_new_with_label_from_widget
- (GTK_RADIO_BUTTON(mapman_info.rad_by_area),
- _("Along Route - Radius (tiles):")), FALSE, FALSE,
- 0);
- gtk_widget_set_sensitive(mapman_info.rad_by_route,
- _route->head != _route->tail);
- gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_route_radius =
- hildon_number_editor_new(0, 100), FALSE, FALSE, 0);
- hildon_number_editor_set_value(HILDON_NUMBER_EDITOR
- (mapman_info.num_route_radius),
- _route_dl_radius);
+ gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mapman_info.rad_download), _("Delete Maps")), FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(vbox), mapman_info.rad_by_area = gtk_radio_button_new_with_label(NULL, _("By Area (see tab)")), FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0);
+
+ /* Route */
+ gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_route = gtk_radio_button_new_with_label_from_widget
+ (GTK_RADIO_BUTTON(mapman_info.rad_by_area), _("Along Route - Radius (tiles):")), FALSE, FALSE, 0);
+ gtk_widget_set_sensitive(mapman_info.rad_by_route, _route->head != _route->tail);
+ gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_route_radius = hildon_number_editor_new(0, 100), FALSE, FALSE, 0);
+ hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(mapman_info.num_route_radius), _route_dl_radius);
+
+ /* Track */
+ gtk_box_pack_start(GTK_BOX(vbox), hbox = gtk_hbox_new(FALSE, 4), FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), mapman_info.rad_by_track = gtk_radio_button_new_with_label_from_widget
+ (GTK_RADIO_BUTTON(mapman_info.rad_by_area), _("Along Track - Radius (tiles):")), FALSE, FALSE, 0);
+ gtk_widget_set_sensitive(mapman_info.rad_by_track, _track->head != _track->tail);
+ gtk_box_pack_start(GTK_BOX(hbox), mapman_info.num_track_radius = hildon_number_editor_new(0, 100), FALSE, FALSE, 0);
+ hildon_number_editor_set_value(HILDON_NUMBER_EDITOR(mapman_info.num_track_radius), _track_dl_radius);
/* Zoom page. */
gtk_notebook_append_page(GTK_NOTEBOOK(mapman_info.notebook),
table = gtk_table_new(5, 5, FALSE),
label = gtk_label_new(_("Zoom")));
- gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook),
- table, FALSE, FALSE, GTK_PACK_START);
+ gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(mapman_info.notebook), table, FALSE, FALSE, GTK_PACK_START);
gtk_table_attach(GTK_TABLE(table), label =
- gtk_label_new(_
- ("Zoom Levels to Download: (0 = most detail)")),
+ gtk_label_new(_("Zoom Levels to Download: (0 = most detail)")),
0, 4, 0, 1, GTK_FILL, 0, 4, 0);
gtk_misc_set_alignment(GTK_MISC(label), 0.f, 0.5f);
for (i = 0; i < MAX_ZOOM; i++) {
g_signal_connect(G_OBJECT(mapman_info.rad_delete), "clicked", G_CALLBACK(mapman_update_state), &mapman_info);
g_signal_connect(G_OBJECT(mapman_info.rad_by_area), "clicked", G_CALLBACK(mapman_update_state), &mapman_info);
g_signal_connect(G_OBJECT(mapman_info.rad_by_route), "clicked", G_CALLBACK(mapman_update_state), &mapman_info);
+ g_signal_connect(G_OBJECT(mapman_info.rad_by_track), "clicked", G_CALLBACK(mapman_update_state), &mapman_info);
while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
gboolean is_deleting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_delete));
gboolean is_overwriting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.chk_overwrite));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_route))) {
- if (mapman_by_route(&mapman_info, is_deleting, is_overwriting))
+ _route_dl_radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info.num_route_radius));
+ if (mapman_by_path(_route, &mapman_info, _route_dl_radius, is_deleting, is_overwriting))
+ break;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mapman_info.rad_by_track))) {
+ _track_dl_radius = hildon_number_editor_get_value(HILDON_NUMBER_EDITOR(mapman_info.num_track_radius));
+ if (mapman_by_path(_track, &mapman_info, _track_dl_radius, is_deleting, is_overwriting))
break;
} else {
const gchar *text;