Showing 1 changed files with 53 additions and 1 deletions
+53 -1
Nasal/buttons.nas
... ...
@@ -259,8 +259,60 @@ var buttonsClass = {
259 259
         }
260 260
     },
261 261
 
262
+    FPL : func (a) {
263
+        if (a or data.fpSize == 0 or me.device.windows.selected != '')
264
+            return;
265
+        var windowId = 'FLIGHTPLAN LIST';
266
+        var flightplan = props.globals.getNode('/autopilot/route-manager');
267
+        var route = flightplan.getNode('route');
268
+        var obj_infos = [];
269
+        var firstEntry = 1;
270
+        var current = flightplan.getValue('current-wp');
271
+        for (var i = current; i <= data.fpSize; i += 1) {
272
+            var wp = route.getChild('wp', i);
273
+            append(obj_infos, {
274
+                type: (firstEntry ? 'selected' : 'editable'),
275
+                text: sprintf('#%2d %-10s', data.fpSize - i, wp.getValue('id')),
276
+                scrollgroup: i - current,
277
+                dto: {
278
+                    lon: wp.getValue('lon'),
279
+                    lat: wp.getValue('lat'),
280
+                    id:  wp.getValue('id')
281
+                },
282
+            });
283
+            append(obj_infos, {
284
+                type: 'normal|end-of-line',
285
+                scrollgroup: i - current,
286
+                text: sprintf(' %3dNM %3d°',
287
+                              math.round(wp.getValue('leg-distance-nm')),
288
+                              math.round(wp.getValue('leg-bearing-true-deg')))
289
+            });
290
+            firstEntry = 0;
291
+        }
292
+        me.device.windows.draw(windowId, obj_infos, {lines: 6, columns: 2});
293
+        me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
294
+        me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
295
+        me.device.buttons.ENT = func;
296
+        me.device.buttons.MENU = func;
297
+        me.device.buttons.CLR = func {
298
+            me.device.windows.del(windowId);
299
+            if (me.device.role == 'PFD') {
300
+                me.device.knobs.FmsOuter = func;
301
+                me.device.knobs.FmsInner = func;
302
+                me.device.buttons.MENU   = me.device.buttons.GlobalParams;
303
+            }
304
+            else {
305
+                me.device.knobs.FmsInner = func;
306
+                me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
307
+                me.device.buttons.MENU   = me.device.buttons.MapMenu;
308
+            }
309
+            foreach (var b; ['ENT', 'CLR'])
310
+                me.device.buttons[b] = func;
311
+        }
312
+        me.device.buttons.MENU = me.device.buttons.CLR;
313
+    },
314
+
262 315
     MENU : void,
263
-    FPL : void,
264 316
     PROC : void,
265 317
     CLR : void,
266 318
     ENT : void,