static void track_rec_point (time_t gps_time, const RoadMapGpsPrecision *dilution, const RoadMapGpsPosition* gps_position) { static struct GPSFilter *filter; static time_t last_gps_time; const RoadMapGpsPosition *filtered_gps_point; RoadMapPosition context_save_pos; int context_save_zoom; int res; if (filter == NULL) { filter = editor_track_filter_new (roadmap_math_distance_convert ("1000m", NULL), 600, /* 10 minutes */ 60, /* 1 minute */ roadmap_math_distance_convert ("10m", NULL)); } if (points_count == 0) last_gps_time = 0; roadmap_math_get_context (&context_save_pos, &context_save_zoom); roadmap_math_set_context ((RoadMapPosition *)gps_position, 20); res = editor_track_filter_add (filter, gps_time, dilution, gps_position); if (res == ED_TRACK_END) { /* The current point is too far from the previous point, or * the time from the previous point is too long. * This is probably a new GPS track. */ track_end (); goto restore; } if (last_gps_time && (last_gps_time + GPS_TIME_GAP < gps_time)) { track_end (); } last_gps_time = gps_time; while ((filtered_gps_point = editor_track_filter_get (filter)) != NULL) { TrackLastPosition = *filtered_gps_point; add_point (&TrackLastPosition, gps_time); } restore: roadmap_math_set_context (&context_save_pos, context_save_zoom); }
static void track_rec_upload (void) { char *file_name; if (RecordGpsData) { track_end (); RecordGpsData = 0; close_data_file(); } file_name = roadmap_path_join(roadmap_config_get(&RoadMapConfigMapPath), "track_data.bin"); NOPH_try(exception_handler, NULL) { editor_upload_file (file_name, 1); } NOPH_catch();
void EditBoxCollection::Dispatcher(KeyInfo& k, int iMode) { lock(); track_beg(); if((k.skey & 0x00FF) == kbEnter && !(k.skey & (shAlt | shCtrl | shShift))) k.skey &= ~shIsCtrl; keydef_pair* pre_key = (iMode) ? keys.GetDef("kbBeforeKey"):0; keydef_pair* post_key = (iMode) ? keys.GetDef("kbAfterKey"):0; if(pre_key) { pre_key = keydef_pair::copy(pre_key); //create a copy of the def play_macro(pre_key->prog); track_recording(pre_key, 0); } if(k.skey & shIsCtrl) { keydef_pair* prog = keys.GetDef(k.KeyName); if(prog) { prog = keydef_pair::copy(prog); //create a copy of the def play_macro(prog->prog); track_recording(prog, 0); } } else { track_recording(0, (char)k.key); usual_key(k); doFlashBracket(*this, 0); } if(post_key) { post_key = keydef_pair::copy(post_key); //create a copy of the def play_macro(post_key->prog); track_recording(post_key, 0); } track_end(); unlock(); }