You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
1.4 KiB
82 lines
1.4 KiB
|
|
#include "osmroute.h"
|
|
#include "favorites.h"
|
|
#include "routing.h"
|
|
#include "gui.h"
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <stdlib.h>
|
|
|
|
struct appdata app;
|
|
|
|
int app_init (int argc, char **argv) {
|
|
app.status = APPSTATUS_nothing;
|
|
|
|
config_init ();
|
|
map_init ();
|
|
|
|
#ifdef SPOSMROUTE
|
|
draw_init ();
|
|
fav_load (fav_getfilename ());
|
|
#endif
|
|
return 0;
|
|
};
|
|
|
|
|
|
int app_shutdown () {
|
|
#ifdef SPOSMROUTE
|
|
cfg.last_lon = view_lon;
|
|
cfg.last_lat = view_lat;
|
|
cfg.last_scale = view_scale;
|
|
gps_stop ();
|
|
route_stop ();
|
|
#endif
|
|
|
|
config_save ();
|
|
map_save_all ();
|
|
|
|
return 0;
|
|
};
|
|
|
|
|
|
int app_loop () {
|
|
#ifdef SPOSMROUTE
|
|
struct gps_data *gpspos;
|
|
|
|
if (gps_isrunning () > 0) {
|
|
if ((gpspos = gps_loop ())) {
|
|
drawgps_set_pos (gpspos);
|
|
}
|
|
}
|
|
draw_mouseloop ();
|
|
#endif
|
|
return 0;
|
|
};
|
|
|
|
|
|
/******************************************************************************
|
|
* update stausbar
|
|
*/
|
|
void app_status (int status, char *text, float progress) {
|
|
static char oldtext[255];
|
|
|
|
if (text) strncpy (app.statusline_text, text, 255);
|
|
else strncpy (app.statusline_text, oldtext, 255);
|
|
|
|
if (status >= 0) app.status = status;
|
|
|
|
if (progress < 0.0) app.statusline_progress = 0.0;
|
|
else if (progress > 1.0) app.statusline_progress = 1.0;
|
|
else app.statusline_progress = progress;
|
|
|
|
#ifdef SPOSMROUTE
|
|
if (currentwin) currentwin->screen_changed = 1;
|
|
draw ();
|
|
#endif
|
|
};
|