From 2ce4fcbf319445407e79553bb46374b574abac7e Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 2 Oct 2013 22:53:56 +0100 Subject: [PATCH] Make GPS dialog remember search results. Restore pre-2.12 functionality where GPS search was persistent across opening and closing the GPS dialog. Since the state is now in Nasal we need to ensure a couple of variables outlive the dialog itself. --- gui/dialogs/gps.xml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/gui/dialogs/gps.xml b/gui/dialogs/gps.xml index 1a95b2453..7e8edc0bf 100644 --- a/gui/dialogs/gps.xml +++ b/gui/dialogs/gps.xml @@ -6,6 +6,10 @@ 1); + dlg.getNode("scratch-has-next", 1).setValue(size(globals._gps_dialog_search_results) > 1); updateScratch(); } var doScratchNext = func { var index = dlg.getNode("scratch-index").getValue(); - var lastIndex = size(searchResults) - 1; + var lastIndex = size(globals._gps_dialog_search_results) - 1; if (index == lastIndex) return; dlg.getNode("scratch-has-next", 1).setValue((index + 1) < lastIndex); @@ -130,8 +136,8 @@ updateScratch(); } - var searchResults = []; - updateSearchResults(0); + # restore state from previous time the dialog was open + updateSearchResults(0, dlg.getNode("scratch-index", 1).getValue()); var slaved = props.globals.getNode("/instrumentation/nav[0]/slaved-to-gps", 1); ]]>