// ---------------------------------------------------------------------------
// 
// -----------
bool bToolLength::set_key(int k){
bool	b=false;
	switch(k){
		case kEnterCharCode:
		case kReturnCharCode:
			action(0);
			(void)bStdToolNav::set_key(k);
			clearTempPathContext(true);
			validTempPathContext();
			k=0;
			WriteMessage(_gapp,"");
			b=true;
			break;
		case kEscapeCharCode:
			(void)bStdToolNav::set_key(k);
			clearTempPathContext(true);
			validTempPathContext();
			k=0;			
			WriteMessage(_gapp,"");
			b=true;
			break;
		case kBackspaceCharCode:
			if(get_locs()->count()<2){
				break;
			}
			(void)bStdToolNav::set_key(k);
			clearTempPathContext(true);
			track_draw();
			validTempPathContext();
			k=0;
			calc_len();
			report_len();
			break;
	}
	(void)bStdToolNav::set_key(k);
	return(b);
}
Example #2
0
static void refresh_display(void)
{
    struct xy pos;
    int i;

    do_refresh = 0;

    draw_clear();

    draw_activity(1);

    switch (visual) {
    case VIEW_SATS:
	draw_sats(&gps_state);
	break;

    case VIEW_MAP:
	/* show map scale */
	if (show_scale)
	    draw_scale();

	/* show gps coordinates */
	if (show_gpscoords)
	    draw_gpscoords();

	vfdlib_setClipArea(0, 0, VFD_WIDTH - VFD_HEIGHT, VFD_HEIGHT);

	/* draw tracklog */
	if (show_track)
	    track_draw();

	/* draw route we're following */
	route_draw(&gps_coord.xy);

	/* highlight waypoints */
	i = 0;
	while (route_getwp(i, &pos, NULL, NULL)) {
	    draw_point(&pos, VFDSHADE_BRIGHT);
	    if (i++ != nextwp) continue;

	    /* add focus to next waypoint */
	    draw_mark(&pos, -1, VFDSHADE_MEDIUM);
	}

	/* draw our own location */
	draw_mark(&gps_coord.xy, gps_bearing, VFDSHADE_BRIGHT);

	vfdlib_setClipArea(0, 0, VFD_WIDTH, VFD_HEIGHT);
	draw_info();
	break;

    case VIEW_ROUTE:
	draw_wpstext();
	break;
    }

    if (load_route)
	routes_list();
    else if (menu) 
	draw_msg(menu_msg[menu_pos]);

    else if (lastmenu) {
	char *msg=NULL;
	lastmenu--;
	switch(menu_pos) {
	case 2: switch (show_popups) {
		case 0: msg = "No Popups"; break;
		case 1: msg = "Popups"; break;
		case 2: msg = "Permanent Popups"; break;
		}
		break;
	case 3: msg = (show_metric?"Meters":"Miles"); break;
	case 4: msg = (show_gpscoords?"Coordinates":"No Coordinates"); break;
	case 5: msg = (show_time?"Time":"Distance"); break;
	case 6: msg = (show_track?"Track":"No Track"); break;
	case 7: switch (coord_format) {
		case 0: msg = "DDD Coords"; break;
		case 1: msg = "DMM Coords"; break;
		case 2: msg = "DMS Coords"; break;
		}
		break;
	}
	if (msg)
	    draw_msg(msg);
    }

    draw_display();

#ifndef __arm__
    {
	extern int stats_toTM;
	extern int stats_distance;
	extern int stats_bearing;

	fprintf(stderr, "conv stats: GPS>TM %d DIST %d HDG %d\n",
		stats_toTM, stats_distance, stats_bearing);
	stats_toTM = stats_distance = stats_bearing = 0;
    }
#endif
}