static int open_data_file (void) { char *file_name; if (track_file) return 0; file_name = roadmap_path_join(roadmap_config_get(&RoadMapConfigMapPath), "track_data.bin"); track_file = roadmap_file_fopen(NULL, file_name, "a"); roadmap_path_free(file_name); if (track_file == NULL) { roadmap_messagebox("Error", "Can't open track_data"); return -1; } if (ftell(track_file) == 0) { unsigned char version[4] = {0, 10, 0, 1}; if (fwrite(version, sizeof(version), 1, track_file) != 1) { roadmap_messagebox("Error", "Can't write to track_data"); fclose(track_file); track_file = NULL; return -1; } } return 0; }
static BOOL twitter_button_handler( void ) { const char *username = ssd_dialog_get_value( "TwitterUserName" ); const char *password = ssd_dialog_get_value( "TwitterPassword" ); const char *tweet_signup = ssd_dialog_get_data( WELCOME_WIZ_DLG_TWITTER_SET_SIGNUP ); BOOL is_tweet_signup = !strcmp( tweet_signup, "yes" ); BOOL res = FALSE; if (!username || !*username){ roadmap_messagebox("Error", "Please enter a user name"); return FALSE; } if (!password || !*password){ roadmap_messagebox("Error", "Please enter password"); return FALSE; } roadmap_twitter_set_username( username ); roadmap_twitter_set_password( password ); roadmap_twitter_set_signup( is_tweet_signup ); roadmap_config_save(TRUE); res = Realtime_TwitterConnect( username, password, roadmap_twitter_is_signup_enabled() ); if ( res ) { roadmap_twitter_set_signup( FALSE ); } return TRUE; }
void editor_track_toggle_new_roads (void) { if ( Realtime_is_random_user() ){ roadmap_messagebox ("Error", "Sorry, only registered users can record new roads. Go to Settings > Profile to register."); return; } if (EditorAllowNewRoads) EditorAllowNewRoads = 0; else EditorAllowNewRoads = 1; ssd_dialog_hide_all(dec_close); if (EditorAllowNewRoads) { editor_track_set_fuzzy (); roadmap_messagebox ("New roads", "New Road Recording is ON. Please turn it off once you've finished recording a new road."); } else { if (editor_line_get_count () > 0) roadmap_messagebox ("New roads", "Road successfully recorded. A link to edit it will be sent to your email and to you Dashboard on www.waze.com. (May take 24 hrs.)"); else roadmap_messagebox ("New roads", "New Road Recording is now OFF"); roadmap_fuzzy_reset_cycle (); } if (NumUpdateToggles == MAX_UPDATE_TOGGLES) { NumUpdateToggles--; memmove (UpdateToggleTimes, UpdateToggleTimes + 1, NumUpdateToggles * sizeof (UpdateToggleTimes[0])); } UpdateToggleTimes[NumUpdateToggles++] = LastGpsUpdate; roadmap_screen_redraw (); }
static void roadmap_foursquare_login_failed(int status) { if (status == 701) roadmap_messagebox("Oops", "Updating your foursquare account details failed. Please ensure you entered the correct user name and password"); else roadmap_messagebox("Oops", "Could not connect with Foursquare. Try again later."); roadmap_foursquare_set_logged_in (FALSE); }
const char* roadmap_foursquare_response(int status, roadmap_result* rc, int NumParams, const char* pData){ roadmap_main_remove_periodic(request_time_out); ssd_progress_msg_dialog_hide(); if (status != 200){ switch (gsRequestType) { case ROADMAP_FOURSQUARE_LOGIN: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (login) - Command failed (status= %d)", status ); roadmap_foursquare_login_failed(status); break; case ROADMAP_FOURSQUARE_SEARCH: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (search) - Command failed (status= %d)", status ); roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later."); break; case ROADMAP_FOURSQUARE_CHECKIN: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (checkin) - Command failed (status= %d)", status ); roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later."); break; default: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (unknown) - Command failed (status= %d)", status ); } gsRequestType = ROADMAP_FOURSQUARE_NONE; return pData; } switch (gsRequestType) { case ROADMAP_FOURSQUARE_LOGIN: roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (login) - successful"); roadmap_foursquare_set_logged_in(TRUE); gsRequestType = ROADMAP_FOURSQUARE_NONE; if (gsCheckInOnLogin) roadmap_foursquare_checkin(); break; case ROADMAP_FOURSQUARE_SEARCH: roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (search) - successful"); gsRequestType = ROADMAP_FOURSQUARE_NONE; return parse_search_results(rc, NumParams, pData); break; case ROADMAP_FOURSQUARE_CHECKIN: roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (checkin) - successful"); gsRequestType = ROADMAP_FOURSQUARE_NONE; return parse_checkin_results(rc, NumParams, pData); break; default: roadmap_log( ROADMAP_DEBUG, "roadmap_foursquare_response (unknown) - - successful"); } return pData; }
void update_range_dialog(void) { RoadMapPosition from; RoadMapPosition to; PluginLine line; RoadMapNeighbour result; int direction; if (roadmap_navigate_get_current (&CurrentGpsPoint, &line, &direction) == -1) { roadmap_messagebox ("Error", "Can't find current street."); return; } roadmap_plugin_line_from (&line, &from); roadmap_plugin_line_to (&line, &to); if (!roadmap_plugin_get_distance ((RoadMapPosition *)&CurrentGpsPoint, &line, &result)) { roadmap_messagebox ("Error", "Can't find a road near point."); return; } CurrentFixedPosition = result.intersection; #ifndef SSD if (roadmap_dialog_activate ("Update house number", NULL, 1)) { roadmap_dialog_new_label ("Update", STREET_PREFIX); roadmap_dialog_new_label ("Update", CITY_PREFIX); roadmap_dialog_new_label ("Update", "Estimated"); roadmap_dialog_new_entry ("Update", UPDATE_LEFT, NULL); roadmap_dialog_new_entry ("Update", UPDATE_RIGHT, NULL); roadmap_dialog_add_button ("Cancel", update_range_cancel); roadmap_dialog_add_button ("OK", update_range_apply); roadmap_dialog_complete (roadmap_preferences_use_keyboard ()); } #else if (!ssd_dialog_activate ("Update house number", NULL)) { create_ssd_dialog(); ssd_dialog_activate ("Update house number", NULL); } #endif fill_dialog (&line, &CurrentFixedPosition, direction); }
static int roadmap_address_show (const char *city, const char *street_name, const char *street_number_image, RoadMapAddressDialog *context) { int i; int count; RoadMapGeocode *selections; char *state; const char *argv[4]; address_info ai; ai.state = NULL; ai.country = NULL; ai.city = city; ai.street = street_name; ai.house = street_number_image; state = "IL"; if (context->use_zip) { return 0; /* TBD: how to select by ZIP ? Need one more table in usdir. */ } ssd_dialog_hide_all(dec_close); count = roadmap_geocode_address (&selections, street_number_image, street_name, city, state); if (count <= 0) { roadmap_messagebox (roadmap_lang_get ("Warning"), roadmap_geocode_last_error_string()); free (selections); return 0; } argv[0] = street_number_image; argv[1] = street_name; argv[2] = city; argv[3] = state; roadmap_history_add ('A', argv); roadmap_history_save(); roadmap_address_done (selections, context, &ai); for (i = 0; i < count; ++i) { free (selections[i].name); selections[i].name = NULL; } free (selections); return 1; }
static int report_irrelevant(SsdWidget widget, const char *new_value, void *context){ char message[200]; PluginLine line; int direction; const char *str; RoadMapGpsPosition *CurrentGpsPoint; if (the_active_alert.active_alert_id == -1) return 1; CurrentGpsPoint = malloc(sizeof(*CurrentGpsPoint)); if (roadmap_navigate_get_current (CurrentGpsPoint, &line, &direction) == -1) { roadmap_messagebox ("Error", "Can't find current street."); return 0; } roadmap_trip_set_gps_position ("AlertSelection", "Selection", NULL, CurrentGpsPoint); str = (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_string)) (the_active_alert.active_alert_id); if (str != NULL){ const char *alertStr = roadmap_lang_get(str); sprintf(message,"%s\n%s",roadmap_lang_get("Please confirm that the following alert is not relevant:"), alertStr); ssd_confirm_dialog("Delete Alert", message,FALSE, delete_callback, (void *)NULL); } return 1; }
void RealtimeAltRoutes_OnRouteSegments (NavigateRouteRC rc, const NavigateRouteResult *res, const NavigateRouteSegments *segments){ char msg[128]; roadmap_log (ROADMAP_DEBUG,"RealtimeAltRoutes_OnRouteSegments"); if (cancelled){ roadmap_log (ROADMAP_DEBUG,"RealtimeAltRoutes_OnRouteSegments - Navigation cancelled"); return; } if (rc != route_succeeded) { switch (rc) { case route_server_error: // message already displayed break; case route_inconsistent: default: snprintf(msg, sizeof(msg), "%s.\n%s", roadmap_lang_get("The service failed to provide a valid route"), roadmap_lang_get("Please try again later")); roadmap_log (ROADMAP_ERROR, "The service failed to provide a valid route rc=%d", rc); roadmap_messagebox ("Oops", msg); } return; } navigate_main_on_route (res->flags, res->total_length, res->total_time, segments->segments, segments->num_segments, segments->num_instrumented, res->geometry.points, res->geometry.num_points, res->description, FALSE); }
int editor_db_open (int map_id) { char name[100]; const char *map_path; char *file_name; int do_read = 0; editor_log_push ("editor_db_open"); map_path = roadmap_db_map_path(); if (!map_path) { editor_log (ROADMAP_ERROR, "Can't find editor path"); editor_log_pop (); return -1; } snprintf (name, sizeof(name), "edt%05d.dat", map_id); file_name = roadmap_path_join(map_path, name); if (roadmap_file_exists (map_path, name)) { EditorDataFile = roadmap_file_open(file_name, "rw"); do_read = 1; } else { roadmap_path_create (map_path); EditorDataFile = roadmap_file_open(file_name, "w"); } #ifdef WIN32 roadmap_path_free(map_path); #endif do { if (!ROADMAP_FILE_IS_VALID(EditorDataFile)) { editor_log (ROADMAP_ERROR, "Can't open/create new database: %s/%s", map_path, name); roadmap_path_free(file_name); editor_log_pop (); return -1; } if (do_read) { do_read = 0; if (editor_db_read () == -1) { editor_db_free (); roadmap_messagebox("Error", "Offline data file is currupt: Re-Initializing data"); roadmap_file_close (EditorDataFile); roadmap_file_remove (NULL, file_name); EditorDataFile = roadmap_file_open(file_name, "w"); } } } while (do_read); roadmap_path_free(file_name); EditorActiveMap = map_id; editor_log_pop (); return 0; }
void exception_handler(NOPH_Exception_t exception, void *arg) { char msg[512]; NOPH_String_toCharPtr(NOPH_Throwable_toString(exception), msg, sizeof(msg)); roadmap_messagebox("Error", msg); NOPH_Throwable_printStackTrace(exception); NOPH_delete(exception); }
static int save_points(int end_track) { int error = 0; int i; roadmap_log(ROADMAP_INFO, "Saving points, end_track:%d", end_track); if (track_file == NULL) return -1; for (i=0; i<points_count; i++) { RoadMapGpsPosition *pos = &TrackPoints[i].gps_point; if (fwrite(&pos->longitude, sizeof(pos->longitude), 1, track_file) != 1) { error = 1; } if (fwrite(&pos->latitude, sizeof(pos->latitude), 1, track_file) != 1) { error = 1; } if (fwrite(&TrackPoints[i].time, sizeof(TrackPoints[i].time), 1, track_file) != 1) { error = 1; } fflush(track_file); if (error) { roadmap_log(ROADMAP_ERROR, "Error writing GPS data."); roadmap_messagebox("Error", "Error writing GPS data."); close_data_file(); return -1; } } if (end_track) { int null[3] = {0, 0, 0}; if (fwrite(null, sizeof(null), 1, track_file) != 1) { roadmap_messagebox("Error", "Error writing GPS data."); close_data_file(); return -1; } } points_count = 0; return 0; }
static int update_range_verify(int marker, unsigned char *flags, const char **note) { char field[255]; int found_update = 0; if (extract_field (*note, STREET_PREFIX, field, sizeof(field)) == -1) { roadmap_messagebox ("Error", "Can't find street name."); return -1; } if (extract_field (*note, CITY_PREFIX, field, sizeof(field)) == -1) { roadmap_messagebox ("Error", "Can't find city name."); return -1; } if (extract_field (*note, UPDATE_LEFT, field, sizeof(field)) != -1) { if (atoi(field) <= 0) { roadmap_messagebox ("Error", "Left range is invalid."); return -1; } found_update++; } if (extract_field (*note, UPDATE_RIGHT, field, sizeof(field)) != -1) { if (atoi(field) <= 0) { roadmap_messagebox ("Error", "Right range is invalid."); return -1; } found_update++; } if (!found_update) { roadmap_messagebox ("Error", "No range updates were found."); return -1; } return 0; }
int RealtimeBonus_CollectedPointsConfirmed(int iID, int iType, int iPoints, BOOL bHasGift, BOOL bIsBigPrize, const char *gift){ if (iType == BONUS_TYPE_POINTS){ if (iPoints != 0){ roadmap_log( ROADMAP_DEBUG, "RealtimeBonus_CollectedPointsRes() - (id =%d, points = %d)", iID, iPoints); editor_points_add_new_points (iPoints); editor_points_display_new_points_timed (iPoints, 6, bonus_points); } else{ roadmap_log( ROADMAP_ERROR, "RealtimeBonus_CollectedPointsRes() - Failed (id =%d, points = %d)", iID, iPoints); } } else if (iType == BONUS_TYPE_TREASURE){ if (!bHasGift){ // The chest box was empty roadmap_messagebox_timeout("", roadmap_lang_get ("Bummer, this treasure chest was emptied. Keep searching for other chests, some have valuable prizes in them."), 10); } else{ // We got a gift! char msg[250]; if (iPoints != 0){ snprintf(msg, sizeof(msg),roadmap_lang_get ("Huray! You just won %s and an extra %d points. Check your email for info."), roadmap_lang_get(gift), iPoints); roadmap_messagebox("",msg); editor_points_add_new_points (iPoints); editor_points_display_new_points_timed (iPoints, 6, bonus_points); } else{ if (bIsBigPrize){ snprintf(msg, sizeof(msg),roadmap_lang_get ("Huray!!! You won the big prize: %s . Check your email for info."), roadmap_lang_get(gift)); roadmap_messagebox("",msg); } else{ snprintf(msg, sizeof(msg),roadmap_lang_get ("Huray! You just won %s. Check your email for info."), roadmap_lang_get(gift)); roadmap_messagebox("",msg); } } } } else{ roadmap_log( ROADMAP_ERROR, "RealtimeBonus_CollectedPointsRes() - Unknown type = %d (ID=%d)", iType,iID); } return TRUE; }
void roadmap_geo_location_info_show(void){ if (initialized) { roadmap_geo_location_iphone(g_geo_info.metroplolitan, g_geo_info.state, g_geo_info.map_score, g_geo_info.traffic_score, g_geo_info.usage_score, g_geo_info.overall_score); //set_geo_location_displayed(); } else { roadmap_messagebox("", "Area support information not available, try again later"); } }
void roadmap_foursquare_request_failed (roadmap_result status) { roadmap_main_remove_periodic(request_time_out); ssd_progress_msg_dialog_hide(); switch (gsRequestType) { case ROADMAP_FOURSQUARE_LOGIN: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (login) - network failed (status= %d)", status ); roadmap_foursquare_login_failed(status); break; case ROADMAP_FOURSQUARE_SEARCH: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (search) - network failed failed (status= %d)", status ); roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later."); break; case ROADMAP_FOURSQUARE_CHECKIN: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (checkin) - network failed (status= %d)", status ); roadmap_messagebox ("Oops", "Could not connect with Foursquare. Try again later."); break; default: roadmap_log( ROADMAP_ERROR, "roadmap_foursquare_response (unknown) - network failed (status= %d)", status ); } gsRequestType = ROADMAP_FOURSQUARE_NONE; }
void editor_main_check_map (void) { int fips; fips = roadmap_locator_active (); if (fips < 0) { fips = 77001; } if (roadmap_locator_activate (fips) != ROADMAP_US_OK) { roadmap_messagebox ("Error.", "Can't load map data."); //return; } editor_db_activate (fips); }
static void on_search(void) { SsdWidget list_cont; SsdWidget edit; const char* text; roadmap_result rc; SsdWidget dlg = generic_search_dlg_get_search_dlg(search_local); if (!RealTimeLoginState()){ roadmap_messagebox( roadmap_lang_get( "Search location"), roadmap_lang_get( "Search requires internet connection." "Please make sure you are connected.")); return; } edit = generic_search_dlg_get_search_edit_box(search_local); s_searching = TRUE; roadmap_main_set_periodic( 100, search_progress_message_delayed ); text = ssd_text_get_text( edit ); list_cont= dlg->context; rc = local_search_resolve_address( list_cont, on_address_resolved, text ); if( succeeded == rc) { roadmap_main_set_cursor( ROADMAP_CURSOR_WAIT); roadmap_log(ROADMAP_DEBUG, "local_search_dlg::on_search() - Started Web-Service transaction: Resolve address"); } else { const char* err = roadmap_result_string( rc); s_searching = FALSE; roadmap_log(ROADMAP_ERROR, "local_search_dlg::on_search() - Resolve process transaction failed to start"); /* Close the progress message */ ssd_progress_msg_dialog_hide(); roadmap_messagebox_cb ( roadmap_lang_get( "Search location"), roadmap_lang_get( err ), on_search_error_message ); } }
static void softkey_callback(void) { char message[200]; PluginLine line; int direction; RoadMapGpsPosition *CurrentGpsPoint; CurrentGpsPoint = malloc(sizeof(*CurrentGpsPoint)); if (roadmap_navigate_get_current (CurrentGpsPoint, &line, &direction) == -1) { roadmap_messagebox ("Error", "Can't find current street."); return; } roadmap_trip_set_gps_position ("AlertSelection", "Selection", NULL, CurrentGpsPoint); sprintf(message,"%s\n%s",roadmap_lang_get("Please confirm that the following alert is not relevant:"), roadmap_lang_get((* (RoadMapAlertProvidors.providor[the_active_alert.alert_providor]->get_string)) (the_active_alert.active_alert_id) )); ssd_confirm_dialog("Delete Alert", message,FALSE, delete_callback, (void *)NULL); alert_should_be_visible = FALSE; }
void roadmap_geo_config_transaction_failed(void){ ssd_progress_msg_dialog_hide(); #ifdef J2ME roadmap_messagebox_cb ("Oops", "Network connection is not available. Please check your device's network settings.",roadmap_geo_config_failed_cb); #else roadmap_messagebox ("Oops", "Network connection is not available. Please check your device's network settings."); #endif clean_up(); //Remove timer roadmap_main_remove_periodic (GeoConfigTimer); roadmap_screen_refresh(); // on error, exit, don't continue. if (GeoConfigContext.callback) (*GeoConfigContext.callback)(); }
static int report_irrelevant(SsdWidget widget, const char *new_value, void *context){ PluginLine line; int direction; RoadMapGpsPosition *CurrentGpsPoint; BOOL success; if (the_active_alert.active_alert_id == -1) return 1; CurrentGpsPoint = malloc(sizeof(*CurrentGpsPoint)); if (roadmap_navigate_get_current (CurrentGpsPoint, &line, &direction) == -1) { roadmap_messagebox ("Error", "Can't find current street."); return 0; } success = (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->cancel))(the_active_alert.active_alert_id); alert_active = FALSE; the_active_alert.active_alert_id = -1; alert_should_be_visible = FALSE; return 1; }
static void foursquare_pw_empty(void){ roadmap_main_remove_periodic (foursquare_pw_empty); roadmap_messagebox("Error", "Foursquare password is empty. You are not logged in"); }
static void foursquare_network_error(void){ roadmap_main_remove_periodic (foursquare_network_error); roadmap_messagebox("Oops", roadmap_lang_get("There is no network connection. Updating your Foursquare account details failed.")); roadmap_foursquare_set_logged_in (FALSE); //roadmap_foursquare_login_dialog(); }
static void on_search(void) { SsdWidget list_cont; SsdWidget edit; const char* text; roadmap_result rc; const char* dl_prefix = roadmap_lang_get ("map:"); SsdWidget dlg = generic_search_dlg_get_search_dlg(search_address); edit = generic_search_dlg_get_search_edit_box(search_address); if ( !strcmp( DEBUG_LEVEL_SET_PATTERN, ssd_text_get_text( edit ) ) ) { roadmap_start_reset_debug_mode(); return; } if ( !strcmp( "##@il", ssd_text_get_text( edit ) ) ) { roadmap_geo_config_il(NULL); return; } if ( !strcmp( "##@usa", ssd_text_get_text( edit ) ) ) { roadmap_geo_config_usa(NULL); return; } if ( !strcmp( "##@heb", ssd_text_get_text( edit ) ) ) { roadmap_lang_set_system_lang("heb"); roadmap_messagebox("", "changed to hebrew, please restart wase"); return; } if ( !strcmp( "##@eng", ssd_text_get_text( edit ) ) ) { roadmap_messagebox("","changed to english, please restart wase"); roadmap_lang_set_system_lang("eng"); return; } if ( !strncmp( dl_prefix, ssd_text_get_text( edit ), strlen( dl_prefix ) ) ) { roadmap_map_download_region( ssd_text_get_text( edit ) + strlen( dl_prefix ), roadmap_locator_static_county() ); ssd_dialog_hide_all( dec_close); if (!roadmap_screen_refresh ()) roadmap_screen_redraw(); return; } s_searching = TRUE; roadmap_main_set_periodic( 100, search_progress_message_delayed ); text = ssd_text_get_text( edit ); list_cont= dlg->context; rc = address_search_resolve_address( list_cont, on_address_resolved, text ); if( succeeded == rc) { roadmap_main_set_cursor( ROADMAP_CURSOR_WAIT); roadmap_log(ROADMAP_DEBUG, "address_search_dlg::on_search() - Started Web-Service transaction: Resolve address"); } else { const char* err = roadmap_result_string( rc); s_searching = FALSE; roadmap_log(ROADMAP_ERROR, "address_search_dlg::on_search() - Resolve process transaction failed to start"); /* Close the progress message */ ssd_progress_msg_dialog_hide(); roadmap_messagebox_cb ( roadmap_lang_get( "Resolve Address"), roadmap_lang_get( err ), on_search_error_message ); } }
static void foursquare_un_empty(void){ roadmap_main_remove_periodic (foursquare_un_empty); roadmap_messagebox("Error", "Foursquare user name is empty. You are not logged in"); }
static void request_time_out (void){ roadmap_main_remove_periodic(request_time_out); ssd_progress_msg_dialog_hide(); roadmap_messagebox("Oops", "Could not connect with Foursquare. Try again later."); }
void roadmap_canvas_agg_configure (unsigned char *buf, int width, int height, int stride) { roadmap_log( ROADMAP_ERROR, "roadmap_canvas_agg_configure, height =%d width=%d",height, width); agg_rbuf.attach(buf, width, height, stride); agg_renb.attach(agg_pixf); agg_renb.reset_clipping(true); ras.clip_box(0, 0, agg_renb.width() - 1, agg_renb.height() - 1); agg::glyph_rendering gren = agg::glyph_ren_outline; agg::glyph_rendering image_gren = agg::glyph_ren_agg_gray8; roadmap_config_declare ("preferences", &RoadMapConfigFont, "font.ttf", NULL); roadmap_config_declare ("preferences", &RoadMapConfigFontNormal, "font_normal.ttf", NULL); char *font_file = roadmap_path_join(roadmap_path_user(), roadmap_config_get (&RoadMapConfigFont)); if ((width) && (height)) roadmap_screen_set_screen_type( width, height ); if (!RoadMapCanvasFontLoaded) { if(m_feng.load_font(font_file, 0, gren) && m_image_feng.load_font(font_file, 0, image_gren)) { m_feng.hinting(true); if ( roadmap_screen_is_hd_screen() ) { m_feng.height(22); m_feng.width(22); } else { #ifdef _WIN32 m_feng.height(12); m_feng.width(12); #else m_feng.height(15); m_feng.width(15); #endif } m_feng.flip_y(true); m_image_feng.hinting(true); m_image_feng.flip_y(true); RoadMapCanvasFontLoaded = 1; } else { RoadMapCanvasFontLoaded = -1; char message[300]; snprintf(message, sizeof(message), "Can't load font: %s\n", font_file); roadmap_messagebox("Error", message); } } RoadMapCanvasFontLoaded = 1; roadmap_path_free(font_file); font_file = roadmap_path_join(roadmap_path_user(), roadmap_config_get (&RoadMapConfigFontNormal)); if(m_feng_nor.load_font(font_file, 0, gren) && m_image_feng_nor.load_font(font_file, 0, image_gren)) { m_feng_nor.hinting(true); if ( roadmap_screen_is_hd_screen() ) { m_feng_nor.height(22); m_feng_nor.width(22); } else { #ifdef _WIN32 m_feng_nor.height(12); m_feng_nor.width(12); #else m_feng_nor.height(15); m_feng_nor.width(15); #endif } m_feng_nor.flip_y(true); m_image_feng_nor.hinting(true); m_image_feng_nor.flip_y(true); RoadMapCanvasNormalFontLoaded = 1; } }
int export_sync (void) { int i; int res; char *messages[MAX_MSGS]; int num_msgs = 0; int fips; if (!editor_is_enabled ()) { return 0; } res = roadmap_file_free_space (roadmap_path_user()); #if !defined(__SYMBIAN32__) || defined(QTMOBILITY) if ((res >= 0) && (res < MIN_FREE_SPACE)) { roadmap_messagebox ("Error", "Please free at least 5MB of space before synchronizing."); return -1; } #endif roadmap_download_progress (0); snprintf (SyncProgressLabel, sizeof(SyncProgressLabel), "%s", roadmap_lang_get ("Preparing export data...")); roadmap_warning_register (download_warning_fn, "edtsync"); roadmap_main_flush (); roadmap_download_progress (0); snprintf (SyncProgressLabel, sizeof(SyncProgressLabel), "%s", roadmap_lang_get ("Uploading data...")); roadmap_main_flush (); Realtime_OfflineClose (); #ifndef J2ME res = sync_do_upload (); #endif Realtime_OfflineOpen (editor_sync_get_export_path (), editor_sync_get_export_name ()); fips = roadmap_locator_active (); if (fips < 0) { fips = 77001; } #if 0 if (roadmap_locator_activate (fips) == ROADMAP_US_OK) { now_t = time (NULL); map_time_t = atoi(roadmap_metadata_get_attribute ("Version", "UnixTime")); if ((map_time_t + 3600*24) > now_t) { /* Map is less than 24 hours old. * A new version may still be available. */ now_tm = *gmtime(&now_t); map_time_tm = *gmtime(&map_time_t); if (now_tm.tm_mday == map_time_tm.tm_mday) { goto end_sync; } else { /* new day - only download if new maps were already generated. */ if (now_tm.tm_hour < 2) goto end_sync; } } } #endif //0 SyncProgressItems = 1; SyncProgressCurrentItem = 0; roadmap_download_progress (0); snprintf (SyncProgressLabel, sizeof(SyncProgressLabel), "%s", roadmap_lang_get ("Downloading new maps...")); roadmap_label_clear (-1); navigate_graph_clear (-1); roadmap_main_flush (); #ifndef J2ME res = editor_download_update_map (&SyncDownloadCallbackFunctions); if (res == -1) { roadmap_messagebox ("Download Error", roadmap_lang_get("Error downloading map update")); } #endif for (i=0; i<num_msgs; i++) { roadmap_messagebox ("Info", messages[i]); free (messages[i]); } roadmap_warning_unregister (download_warning_fn); return 0; }
static void on_search(void) { SsdWidget list_cont; SsdWidget edit; const char* text; roadmap_result rc; const char* dl_prefix = roadmap_lang_get ("map:"); SsdWidget dlg = generic_search_dlg_get_search_dlg(search_address); edit = generic_search_dlg_get_search_edit_box(search_address); if ( !strcmp( DEBUG_LEVEL_SET_PATTERN, ssd_text_get_text( edit ) ) ) { roadmap_start_reset_debug_mode(); return; } if ( !strcmp( "##@coord", ssd_text_get_text( edit ) ) ) { roadmap_gps_reset_show_coordinates(); return; } if ( !strcmp( "##@il", ssd_text_get_text( edit ) ) ) { roadmap_geo_config_il(NULL); return; } if ( !strcmp( "##@usa", ssd_text_get_text( edit ) ) ) { roadmap_geo_config_usa(NULL); return; } if ( !strcmp( "##@other", ssd_text_get_text( edit ) ) ) { roadmap_geo_config_other(NULL); return; } if ( !strcmp( "##@stg", ssd_text_get_text( edit ) ) ) { roadmap_geo_config_stg(NULL); return; } if ( !strcmp( "##@heb", ssd_text_get_text( edit ) ) ) { roadmap_lang_set_system_lang("heb", TRUE); roadmap_messagebox("", "Language changed to Hebrew, please restart waze"); return; } if ( !strcmp( "##@eng", ssd_text_get_text( edit ) ) ) { roadmap_lang_set_system_lang("eng", TRUE); roadmap_messagebox("","Language changed to English, please restart waze"); return; } if ( !strcmp( "cc@tts", ssd_text_get_text( edit ) ) ) { tts_clear_cache(); roadmap_messagebox("","TTS cache has been cleared!"); return; } if ( !strcmp( "##@tts", ssd_text_get_text( edit ) ) ) { tts_set_feature_enabled( !tts_feature_enabled() ); if ( tts_feature_enabled() ) { roadmap_messagebox("","TTS Feature is enabled!\nPlease restart WAZE."); } else { roadmap_messagebox("","TTS Feature is disabled!"); } navigate_main_override_nav_settings(); return; } if ( !strcmp( "dbg@tts", ssd_text_get_text( edit ) ) ) { if ( !strcmp( tts_was_provider_voices_set(), TTS_WAS_VOICES_SET_PRODUCTION ) ) { tts_was_provider_apply_voices_set( TTS_WAS_VOICES_SET_DEBUG ); roadmap_messagebox("","TTS Feature is running in debug mode!\nPlease restart WAZE."); } else { tts_was_provider_apply_voices_set( TTS_WAS_VOICES_SET_PRODUCTION ); roadmap_messagebox("","TTS Feature is running in production mode!\nPlease restart WAZE."); } return; } if ( !strncmp( dl_prefix, ssd_text_get_text( edit ), strlen( dl_prefix ) ) ) { roadmap_map_download_region( ssd_text_get_text( edit ) + strlen( dl_prefix ), roadmap_locator_static_county() ); ssd_dialog_hide_all( dec_close); if (!roadmap_screen_refresh ()) roadmap_screen_redraw(); return; } s_searching = TRUE; roadmap_main_set_periodic( 100, search_progress_message_delayed ); text = ssd_text_get_text( edit ); list_cont= dlg->context; rc = address_search_resolve_address( list_cont, on_address_resolved, text ); if( succeeded == rc) { roadmap_main_set_cursor( ROADMAP_CURSOR_WAIT); roadmap_log(ROADMAP_DEBUG, "address_search_dlg::on_search() - Started Web-Service transaction: Resolve address"); } else { const char* err = roadmap_result_string( rc); s_searching = FALSE; roadmap_log(ROADMAP_ERROR, "address_search_dlg::on_search() - Resolve process transaction failed to start"); /* Close the progress message */ ssd_progress_msg_dialog_hide(); roadmap_messagebox_cb ( roadmap_lang_get( "Resolve Address"), roadmap_lang_get( err ), on_search_error_message ); } }
static void update_range (const char *updated_left, const char *updated_right, const char *city, const char *street) { char note[500]; int fips; if (!*updated_left && !*updated_right) { return; } if (roadmap_county_by_position (&CurrentFixedPosition, &fips, 1) < 1) { roadmap_messagebox ("Error", "Can't locate county"); return; } if (editor_db_activate (fips) == -1) { editor_db_create (fips); if (editor_db_activate (fips) == -1) { roadmap_messagebox ("Error", "Can't update range"); return; } } snprintf(note, sizeof(note), "%s: %s%s", roadmap_lang_get (STREET_PREFIX), (char *)street, NEW_LINE); snprintf(note + strlen(note), sizeof(note) - strlen(note), "%s: %s%s", roadmap_lang_get (CITY_PREFIX), (char *)city, NEW_LINE); if (*updated_left) { snprintf(note + strlen(note), sizeof(note) - strlen(note), "%s: %s%s", roadmap_lang_get (UPDATE_LEFT), updated_left, NEW_LINE); } if (*updated_right) { snprintf(note + strlen(note), sizeof(note) - strlen(note), "%s: %s%s", roadmap_lang_get (UPDATE_RIGHT), updated_right, NEW_LINE); } if (editor_marker_add (CurrentFixedPosition.longitude, CurrentFixedPosition.latitude, CurrentGpsPoint.steering, time(NULL), UpdateRangeMarkerType, ED_MARKER_UPLOAD, note, NULL) == -1) { roadmap_messagebox ("Error", "Can't save marker."); } else { editor_report_markers (); } }