Showing 3 changed files with 131 additions and 1 deletions
+110
Nasal/display.nas
... ...
@@ -213,6 +213,101 @@ var displayClass = {
213 213
                 me.MFDMapNavDisplay.showMap();
214 214
                 me.MFDMapTiles.initialize_grid();
215 215
                 me.MFDMapTiles.update_timer.start();
216
+                me['page selected'] = 0;
217
+                me.device.data['page selection'] = [
218
+                    {
219
+                        name: 'MAP',
220
+                        objects: [
221
+                            {text: 'NAVIGATION MAP'},
222
+                            {text: 'TRAFFIC MAP'},
223
+                            {text: 'STORMSCOPE'},
224
+                            {text: 'WEATHER DATA LINK'},
225
+                            {text: 'TAWS-B'},
226
+                        ],
227
+                    },
228
+                    {
229
+                        name: 'WPT',
230
+                        objects: [
231
+                            {text: 'AIRPORT INFORMATION'},
232
+                            {text: 'AIRPORT DIRECTORY'},
233
+                            {text: 'DEPARTURE INFORMATION'},
234
+                            {text: 'ARRIVAL INFORMATION'},
235
+                            {text: 'APPROACH INFORMATION'},
236
+                            {text: 'WEATHER INFORMATION'},
237
+                            {text: 'INTERSECTION INFORMATION'},
238
+                            {text: 'NDB INFORMATION'},
239
+                            {text: 'VOR INFORMATION'},
240
+                            {text: 'USER WAYPOINT INFORMATION'},
241
+                        ],
242
+                    },
243
+                    {
244
+                        name: 'AUX',
245
+                        objects: [
246
+                            {text: 'TRIP PLANNING'},
247
+                            {text: 'UTILITY'},
248
+                            {text: 'GPS STATUS'},
249
+                            {text: 'SYSTEM SETUP'},
250
+                        ],
251
+                    },
252
+                    {
253
+                        name: 'FPL',
254
+                        objects: [
255
+                            {text: 'ACTIVE FLIGHT PLAN'},
256
+                            {text: 'WIDE VIEW, NARROW VIEW'},
257
+                            {text: 'FLIGHT PLAN CATALOG'},
258
+                        ],
259
+                    },
260
+                    {
261
+                        name: 'PROC',
262
+                        objects: [
263
+                            {text: 'DEPARTURE LOADING'},
264
+                            {text: 'ARRIVAL LOADING'},
265
+                            {text: 'APPROACH LOADING'},
266
+                        ],
267
+                    },
268
+                    {
269
+                        name: 'NRST',
270
+                        objects: [
271
+                            {text: 'NEAREST AIRPORTS'},
272
+                            {text: 'NEAREST INTERSECTIONS'},
273
+                            {text: 'NEAREST NDB'},
274
+                            {text: 'NEAREST VOR'},
275
+                            {text: 'NEAREST USER WAYPOINTS'},
276
+                            {text: 'NEAREST FREQUENCIES'},
277
+                            {text: 'NEAREST AIRSPACES'},
278
+                        ],
279
+                    },
280
+#                    {
281
+#                        name: 'EIS',
282
+#                        objects: [
283
+#                            {text: ''},
284
+#                        ],
285
+#                    },
286
+                ];
287
+                foreach (var g; me.device.data['page selection']) {
288
+                    var obj_s = size(g.objects);
289
+                    # build specific geometry per page, depending of number of sub-pages
290
+                    g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1};
291
+                    # complete the hash with reccurrent elements type and callback
292
+                    foreach (var o; g.objects) {
293
+                        o.type = 'editable|end-of-line';
294
+                        o.callback = me.MFD_page_wrapper;
295
+                    }
296
+                    g.objects[0].type = 'selected|end-of-line';
297
+                }
298
+                # build the available groups line, at the bottom
299
+                forindex (var g; me.device.data['page selection']) {
300
+                    append(me.device.data['page selection'][g].objects, {type: 'separator'});
301
+                    for (var i = 0; i < g; i+=1)
302
+                        append(me.device.data['page selection'][g].objects,
303
+                            {text: me.device.data['page selection'][i].name, type: 'normal'});
304
+                    append(me.device.data['page selection'][g].objects,
305
+                        {text: me.device.data['page selection'][i].name, type: 'highlighted'});
306
+                    for (var i = g+1; i < size(me.device.data['page selection']); i+=1)
307
+                        append(me.device.data['page selection'][g].objects,
308
+                            {text: me.device.data['page selection'][i].name, type: 'normal'});
309
+                }
310
+                me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
216 311
             }
217 312
             me.updateNAV({auto:'nav', tune: radios.getNode('nav-tune').getValue()});
218 313
             me.updateCOMM({auto:'comm', tune: radios.getNode('comm-tune').getValue()});
... ...
@@ -1164,6 +1259,21 @@ var displayClass = {
1164 1259
         'inner':  {t: 'I', bg: [1,1,0]},
1165 1260
     },
1166 1261
 #}}}
1262
+
1263
+    MFD_page_wrapper : func (id, selected) {
1264
+        var page = me.device.data[id][me.device.display['page selected']].name
1265
+            ~ '/'
1266
+            ~ me.device.data[id][me.device.display['page selected']].objects[selected].text;
1267
+        if (contains(me, 'show' ~ page))
1268
+            me['show' ~ page]();
1269
+        else
1270
+            msg(page ~ ' not yet implemented');
1271
+        foreach (var k; keys(me.device.windows.window))
1272
+            if (find(id, k) == 0)
1273
+                me.device.windows.del(k);
1274
+        me.device.buttons.ENT = func;
1275
+        me.device.knobs.FmsInner = func;
1276
+    },
1167 1277
 };
1168 1278
 
1169 1279
 var keyMap = {
+20
Nasal/knobs.nas
... ...
@@ -184,6 +184,26 @@ var knobsClass = {
184 184
         }
185 185
     },
186 186
 
187
+    MFD_select_page_group : func (d) {
188
+        if (contains(me.device.windows.state, 'page selection')) {
189
+            if (me.device.display['page selected'] + d < size(me.device.data['page selection'])
190
+            and me.device.display['page selected'] + d >= 0) {
191
+                foreach (var k; keys(me.device.windows.window))
192
+                    if (find('page selection', k) == 0)
193
+                        me.device.windows.del(k);
194
+                me.device.display['page selected'] += d;
195
+            }
196
+            else
197
+                return;
198
+        }
199
+        me.device.windows.draw('page selection',
200
+                me.device.data['page selection'][me.device.display['page selected']].geometry,
201
+                me.device.data['page selection'][me.device.display['page selected']].objects,
202
+            );
203
+        me.FmsInner = me.NavigateMenu;
204
+        me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
205
+    },
206
+
187 207
     FmsInner : void,
188 208
     FmsOuter : void
189 209
 };
+1 -1
README.md
... ...
@@ -88,6 +88,7 @@ Please report bug at <seb.marque@free.fr>.
88 88
   * use of [maketimer()](http://wiki.flightgear.org/Nasal_library#maketimer.28.29) instead of [settimer()](http://wiki.flightgear.org/Nasal_library#settimer.28.29) when possible
89 89
 * ![][30%]
90 90
 * ![][20%]
91
+  * Setting pages (MFD): pages/sub-pages selection via FMS knob ![][done], pages content implementation ![][ongoing]
91 92
 * ![][10%]
92 93
   * multikey for every part of the device (actually only power on)
93 94
 * ![][0%] (TODO list, unsorted)
... ...
@@ -96,7 +97,6 @@ Please report bug at <seb.marque@free.fr>.
96 97
   * angle of attack display
97 98
   * Alerts
98 99
   * Flight planning (MFD)
99
-  * Setting pages (MFD)
100 100
   * Inset Map (PFD)
101 101
   * PFD settings
102 102
   * texture for some MFD buttons