From d2886ffe2073d6fa5b5dc10b4fff5b9081d8e9d3 Mon Sep 17 00:00:00 2001 From: Richard Senior Date: Thu, 18 Feb 2016 12:02:47 +0000 Subject: [PATCH] Route manager: Support list of waypoint specifications in dialog input Allow multiple, space-separated waypoint specifications to be added to a route, rather than having to type each one and press the add button each time. If no waypoint is selected as the insertion point, show a message and leave the waypoint input intact, rather than just clearing it. Update the help label to reflect the change and include a note of how to create offset waypoints using a radial and distance. --- gui/dialogs/route-manager.xml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/gui/dialogs/route-manager.xml b/gui/dialogs/route-manager.xml index 257d1a1ae..c99faae34 100644 --- a/gui/dialogs/route-manager.xml +++ b/gui/dialogs/route-manager.xml @@ -44,18 +44,26 @@ command interface /autopilot/route-manager/input: var insert = func { var insertIndex = sel_index(); - if (insertIndex >= 0) { - # when selection index is valid, insert *after* the waypoint - insertIndex = insertIndex + 1; + if (insertIndex < 0) { + var msg = "Select the waypoint after which new waypoints should be added"; + setprop("sim/messages/copilot", msg); + return; + } + + # Input is a list of space-separated waypoint specifications + var argv = split(" ", input.getValue()); + foreach (var arg; argv) { + # When argument is not empty (caused by multiple space + # separators) insert *after* waypoint + if (size(arg) > 0) { + insertIndex += 1; + cmd.setValue("@insert" ~ insertIndex ~ ":" ~ arg); + } } - cmd.setValue("@insert" ~ insertIndex ~ ":" ~ input.getValue()); input.setValue(""); - - if (insertIndex >= 0) { - selection.setValue(insertIndex); - gui.dialog_update("route-manager"); - } + selection.setValue(insertIndex); + gui.dialog_update("route-manager"); } var remove = func { @@ -645,7 +653,7 @@ command interface /autopilot/route-manager/input: 1 - + 0.7 0.7