// Draw the warning on the screen void roadmap_alerter_display(void) { const char * iconName; int alertId; char AlertStr[200]; RoadMapGuiPoint AlertIconLocation; int opacity; char distance_str[100]; // RoadMapGpsPosition pos; RoadMapImage theIcon; BOOL is_cancelable; AlertStr[0] = 0; if (alert_should_be_visible) { if (!alert_active && the_active_alert.alert_type == ALERT) { roadmap_alerter_audio(); } alertId = roadmap_alerter_get_active_alert_id(); is_cancelable = (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->is_cancelable)) (alertId); if (!alert_active && is_cancelable) set_softkey(); // alert_active = TRUE; // // if (the_active_alert.alert_type == ALERT){ // iconName = (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_alert_icon)) (alertId); // } // else { // iconName = (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_warning_icon)) (alertId); // } // // snprintf(AlertStr + strlen(AlertStr), sizeof(AlertStr) // - strlen(AlertStr), "<b1>%s%s\n",roadmap_lang_get("Approaching"), roadmap_lang_get((* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_string)) (alertId) )); // // snprintf(AlertStr + strlen(AlertStr), sizeof(AlertStr) // - strlen(AlertStr), roadmap_lang_get("%s: %d %s\n"),roadmap_lang_get("In"), the_active_alert.distance_to_alert, roadmap_lang_get(roadmap_math_distance_unit())); // // roadmap_navigate_get_current (&pos, NULL, NULL); // snprintf(AlertStr + strlen(AlertStr), sizeof(AlertStr) // - strlen(AlertStr), roadmap_lang_get("%d %s"),roadmap_math_to_speed_unit(pos.speed), roadmap_lang_get(roadmap_math_speed_unit())); // // roadmap_display_pop_up("Approach Alert", iconName , NULL, AlertStr); alertId = roadmap_alerter_get_active_alert_id(); if (the_active_alert.alert_type == ALERT) { iconName = (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_alert_icon)) (alertId); if (iconName == NULL) { return; } theIcon = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, iconName ); if (theIcon == NULL) { roadmap_log( ROADMAP_ERROR, "Alerts - Icon Not found (%s)", iconName); return; } alert_active = TRUE; } else { iconName = (* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_warning_icon)) (alertId); theIcon = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, iconName); if (theIcon == NULL) { roadmap_log( ROADMAP_ERROR, "Alerts - Icon Not found (%s)", iconName); return; } alert_active = TRUE; } AlertIconLocation.x = roadmap_canvas_width () - roadmap_canvas_image_width(theIcon); AlertIconLocation.y = roadmap_canvas_height ()/2 - roadmap_canvas_image_height(theIcon)/2 ; opacity = 0; sprintf(distance_str, "%d %s", the_active_alert.distance_to_alert, roadmap_math_distance_unit()); roadmap_display_text("Distance To Alert", distance_str); roadmap_canvas_draw_image (theIcon, &AlertIconLocation,opacity, IMAGE_NORMAL); } else { if (alert_active && !alert_should_be_visible) { alert_active = FALSE; if ((* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->is_cancelable)) (roadmap_alerter_get_active_alert_id())) remove_softkey(); the_active_alert.active_alert_id = -1; roadmap_display_hide("Distance To Alert"); } } }
static int editor_download_map (RoadMapDownloadCallbacks *callbacks) { static int *fips = NULL; static int ProtocolInitialized = 0; RoadMapPosition center; int count; int i; if (! ProtocolInitialized) { /* PLUGINS NOT SUPPORTED YET. * roadmap_plugin_load_all * ("download", roadmap_download_subscribe_protocol); */ roadmap_httpcopy_init (roadmap_download_subscribe_protocol); ProtocolInitialized = 1; } roadmap_screen_get_center (¢er); count = roadmap_locator_by_position (¢er, &fips); #if defined(__SYMBIAN32__) && !defined(QTMOBILITY) fips[0] = 77001; count = 1; #else if (count == 0) { if (callbacks) { fips[0] = 77001; count = 1; } else { roadmap_display_text("Info", "No map available"); return -1; } } #endif #if 0 for (i = count-1; i >= 0; --i) { if (!editor_export_empty (fips[i])) { if (!callbacks) { roadmap_messagebox("Info", "You must first export your data."); } return -1; } } #endif roadmap_screen_freeze (); editor_main_set (0); roadmap_download_subscribe_when_done (download_map_done); roadmap_download_unblock_all (); for (i = count-1; i >= 0; --i) { int res; editor_db_close (fips[i]); editor_db_delete (fips[i]); res = roadmap_download_get_county (fips[i], 0, callbacks); if (res != 0) return -1; } return 0; }