620 430 false 1); if (size(searchResults) < 1) { scratchValid.setBoolValue(0); return; } updateScratch(); } var updateScratch = func { var result = searchResults[dlg.getNode("scratch-index").getValue()]; if (result == nil) { scratchValid.setBoolValue(0); return; } var ty = result.type; scratchValid.setBoolValue(1); scratch.getNode("type", 1).setValue(ty); scratch.getNode("latitude-deg", 1).setValue(result.lat); scratch.getNode("longitude-deg", 1).setValue(result.lon); scratch.getNode("altitude-ft", 1).setValue(result.elevation); scratch.getNode("ident", 1).setValue(result.id); scratch.getNode("name", 1).setValue(result.name); if (ty == 'vor') { scratch.getNode("frequency-mhz", 1).setValue(result.frequency); } elsif (ty == 'ndb') { scratch.getNode("frequency-khz", 1).setValue(result.frequency); } var cd = positioned.courseAndDistance(result); scratch.getNode("mag-bearing-deg", 1).setValue(cd[0] + magvar()); scratch.getNode("distance-nm", 1).setValue(cd[1]); gui.dialog_update("gps"); } var doSearch = func() { var ty = dlg.getNode("search-type").getValue(); var query = dlg.getNode("search-query").getValue(); searchResults = positioned.sortByRange(positioned.findByIdent(query, ty)); updateSearchResults(); } var doSearchNames = func { var ty = dlg.getNode("search-type").getValue(); var query = dlg.getNode("search-query").getValue(); searchResults = positioned.sortByRange(positioned.findByName(query, ty)); updateSearchResults(); } var doSearchNearest = func { var ty = dlg.getNode("search-type").getValue(); searchResults = positioned.findWithinRange(200.0, ty); updateSearchResults(); } var doLoadRouteWaypoint = func { var fp = flightplan(); searchResults = []; for (var i=0; i < fp.getPlanSize(); i+=1) { append(searchResults, fp.getWP(i)); } updateSearchResults(); } var doScratchPrevious = func { var index = dlg.getNode("scratch-index").getValue(); if (index == 0) return; dlg.getNode("scratch-index").setValue(index - 1); dlg.getNode("scratch-has-next", 1).setValue(size(searchResults) > 1); updateScratch(); } var doScratchNext = func { var index = dlg.getNode("scratch-index").getValue(); var lastIndex = size(searchResults) - 1; if (index == lastIndex) return; dlg.getNode("scratch-has-next", 1).setValue((index + 1) < lastIndex); dlg.getNode("scratch-index").setValue(index + 1); updateScratch(); } var searchResults = []; updateSearchResults(); var slaved = props.globals.getNode("/instrumentation/nav[0]/slaved-to-gps", 1); ]]> gps vbox hbox 1 1 table 0 0 Mode: %s /instrumentation/gps/mode true /instrumentation/gps/mode leg 0 1 Current Route Wp: %03d /autopilot/route-manager/current-wp true /instrumentation/gps/mode leg 0 1 Desired Course: %5.1f* /instrumentation/gps/desired-course-deg true 0 2 Xtrack: %5.2fnm /instrumentation/gps/wp/wp[1]/course-error-nm true 1 0 Longitude: %6.3f /instrumentation/gps/indicated-longitude-deg true 1 1 Latitude: %6.3f /instrumentation/gps/indicated-latitude-deg true 1 2 Altitude: %6.0fft /instrumentation/gps/indicated-altitude-ft true 2 0 Groundspeed: %4.0fkts /instrumentation/gps/indicated-ground-speed-kt true 2 1 Track: %3.0f* /instrumentation/gps/indicated-track-magnetic-deg true 2 2 VS: %4.0ffpm /instrumentation/gps/indicated-vertical-speed true 3 0 Odometer: %4.1fnm /instrumentation/gps/odometer true 3 1 RAIM: %3.2f /instrumentation/gps/raim true 4 0 Ident: %s /instrumentation/gps/wp/wp[1]/ID true 4 1 2 Name: %s /instrumentation/gps/wp/wp[1]/name true 5 0 Longitude: %6.3f /instrumentation/gps/wp/wp[1]/longitude-deg true 5 1 Latitude: %6.3f /instrumentation/gps/wp/wp[1]/latitude-deg true 5 2 Altitude: %6.0fft /instrumentation/gps/wp/wp[1]/altitude-ft true 6 0 Bearing: %3.0f /instrumentation/gps/wp/wp[1]/bearing-mag-deg true 6 1 Distance: %5.2fnm /instrumentation/gps/wp/wp[1]/distance-nm true 6 2 TTW: %s /instrumentation/gps/wp/wp[1]/TTW true /instrumentation/gps/mode leg 7 0 Leg Course: %3.0f /instrumentation/gps/wp/leg-mag-course-deg true /instrumentation/gps/mode leg 7 1 Leg Distance: %5.1fnm /instrumentation/gps/wp/leg-distance-nm true /instrumentation/gps/mode obs /instrumentation/gps/to-flag 7 0 /instrumentation/gps/mode obs /instrumentation/gps/from-flag 7 0 hbox fill vbox hbox fill 80 searchType /sim/gui/dialogs/gps/search-type any airport vor ndb fix wpt true dialog-apply hbox fill 80 search-query fill true 150 true /sim/gui/dialogs/gps/search-query dialog-apply hbox fill true /instrumentation/gps/scratch/valid table 0 0 Ident: %s /instrumentation/gps/scratch/ident true 0 1 2 Name: %s /instrumentation/gps/scratch/name true 1 0 Lon: %6.3f /instrumentation/gps/scratch/longitude-deg true 1 1 Lat: %6.3f /instrumentation/gps/scratch/latitude-deg true 1 2 Alt: %6.0fft /instrumentation/gps/scratch/altitude-ft true 2 0 Bearing: %3.0f /instrumentation/gps/scratch/mag-bearing-deg true 2 1 Distance: %5.1fnm /instrumentation/gps/scratch/distance-nm true /instrumentation/gps/scratch/type vor 3 0 Frequency: %5.1fMhz /instrumentation/gps/scratch/frequency-mhz true /instrumentation/gps/scratch/type ndb 3 0 Frequency: %5.1fKhz /instrumentation/gps/scratch/frequency-khz true hbox fill 6 /instrumentation/gps/mode obs 100 Selected Course: %03d* /instrumentation/gps/selected-course-deg true /instrumentation/gps/mode obs 30 30 true 0 359 true /instrumentation/gps/selected-course-deg dialog-apply true left /instrumentation/nav[0]/slaved-to-gps dialog-apply