Showing 1 changed files with 30 additions and 1 deletions
+30 -1
Nasal/display.nas
... ...
@@ -1,7 +1,8 @@
1
+# vim: set foldmethod=marker foldmarker="{{{,}}}"
1 2
 var displayClass = {
2 3
     new: func(node, role) {
3 4
         var m = { parents: [ displayClass ] };
4
-        
5
+
5 6
         m.display = canvas.new({
6 7
                 "name"      : role,
7 8
                 "size"      : [1024, 768],
... ...
@@ -47,6 +48,7 @@ var displayClass = {
47 48
     },
48 49
 
49 50
     _showInitProgress : func (p,t) {
51
+#{{{
50 52
         p.setText(t);
51 53
         if (zkv.getNode(me.role ~ 'init').getValue() != 0) {
52 54
             if (size(t) >= 10) t = '';
... ...
@@ -155,8 +157,10 @@ var displayClass = {
155 157
             zkv.removeChild(me.role ~ 'init');
156 158
         }
157 159
     },
160
+#}}}
158 161
 
159 162
     showInitProgress : func (role) {
163
+#{{{
160 164
         me.progress = me.display.createGroup();
161 165
         me.progress.show();
162 166
         me.progress.createChild("text", role ~ " title")
... ...
@@ -176,8 +180,10 @@ var displayClass = {
176 180
             .setFontSize(128, 1)
177 181
             .setColor(1,0,0), '.');
178 182
     },
183
+#}}}
179 184
 
180 185
     loadGroup : func (h) {
186
+#{{{
181 187
         if (typeof(h) != 'hash') {
182 188
             msg_dbg(sprintf("%s need a hash, but get a %s from %s",
183 189
                     caller(0)[0],
... ...
@@ -230,16 +236,20 @@ var displayClass = {
230 236
             }
231 237
         }
232 238
     },
239
+#}}}
233 240
 
234 241
     clips : {
242
+#{{{
235 243
         PitchScale   : "rect(70,664,370,256)",
236 244
         SpeedLint1   : "rect(252,226,318,204)",
237 245
         SpeedTape    : "rect(115,239,455,156)",
238 246
         LintAlt      : "rect(115,808,455,704)",
239 247
         AltLint00011 : "rect(252,804,318,771)",
240 248
     },
249
+#}}}
241 250
 
242 251
     texts : {
252
+#{{{
243 253
         VSIText : {
244 254
             alignment: "right-bottom", default : num('0'),
245 255
         },
... ...
@@ -262,8 +272,10 @@ var displayClass = {
262 272
             default: ''
263 273
         },
264 274
     },
275
+#}}}
265 276
 
266 277
     updateAI: func(roll,pitch){
278
+#{{{
267 279
         if (pitch > 80)
268 280
             pitch = 80;
269 281
         elsif (pitch < -80)
... ...
@@ -275,8 +287,10 @@ var displayClass = {
275 287
             .setRotation(-roll * D2R);
276 288
         settimer(func me.updateAI(getprop('/orientation/roll-deg'),getprop('orientation/pitch-deg')), 0.1);
277 289
     },
290
+#}}}
278 291
 
279 292
     updateVSI: func (vsi) {
293
+#{{{
280 294
         me.screenElements.VSIText
281 295
             .setText(num(math.round(vsi, 10)));
282 296
         if (vsi > 4500)
... ...
@@ -287,8 +301,10 @@ var displayClass = {
287 301
             .setTranslation(0, vsi * -0.03465);
288 302
         settimer(func me.updateVSI(getprop('/instrumentation/vertical-speed-indicator/indicated-speed-fpm')), 0.1);
289 303
     },
304
+#}}}
290 305
 
291 306
     updateIAS: func (ias) {
307
+#{{{
292 308
         if (ias >= 10)
293 309
             me.screenElements.Speed110
294 310
                 .setText(sprintf("% 2u",num(math.floor(ias/10))));
... ...
@@ -301,8 +317,10 @@ var displayClass = {
301 317
             .setTranslation(0,ias * 5.711);
302 318
         settimer(func me.updateIAS(getprop('/velocities/airspeed-kt')), 0.1);
303 319
     },
320
+#}}}
304 321
 
305 322
     updateALT: func (alt) {
323
+#{{{
306 324
         if (alt < 0)
307 325
             me.screenElements.Alt11100
308 326
                 .setText(sprintf("% 3i",math.ceil(alt/100)));
... ...
@@ -441,16 +459,20 @@ var displayClass = {
441 459
         }
442 460
         settimer(func me.updateALT(getprop('instrumentation/altimeter/indicated-altitude-ft')), 0.2);
443 461
     },
462
+#}}}
444 463
 
445 464
     updateHSI : func (hdg) {
465
+#{{{
446 466
         me.screenElements.Rose
447 467
             .setRotation(-hdg * D2R);
448 468
         me.screenElements['HDG-text']
449 469
             .setText(sprintf("%03u°", hdg));
450 470
         settimer(func me.updateHSI(getprop('orientation/heading-deg')), 0.1);
451 471
     },
472
+#}}}
452 473
 
453 474
     updateHDG : func (hdg) {
475
+#{{{
454 476
         if (me.role == 'MFD')
455 477
             return;
456 478
         me.screenElements['Heading-bug']
... ...
@@ -464,8 +486,10 @@ var displayClass = {
464 486
             .show();
465 487
         me.addTimer(3, ['SelectedHDG-text', 'SelectedHDG-bgtext', 'SelectedHDG-bg']);
466 488
     },
489
+#}}}
467 490
 
468 491
     _updateRadio: func {
492
+#{{{
469 493
         # arg[0]._r = <comm|nav>
470 494
         if (contains(arg[0], "active")) {
471 495
             if (arg[0]['active'] == 'none') {
... ...
@@ -516,8 +540,10 @@ var displayClass = {
516 540
             settimer(func me._updateRadio({auto: radio}), 2);
517 541
         }
518 542
     },
543
+#}}}
519 544
 
520 545
     updateNAV : func {
546
+#{{{
521 547
         # made active via menu
522 548
         if (contains(arg[0], "active")) {
523 549
             if (arg[0]['active'] == 'none') {
... ...
@@ -563,9 +589,12 @@ var displayClass = {
563 589
             me._updateRadio(arg[0]);
564 590
         }
565 591
     },
592
+#}}}
566 593
 
567 594
     updateCOMM: func {
595
+#{{{
568 596
         arg[0]._r = 'comm';
569 597
         me._updateRadio(arg[0]);
570 598
     },
599
+#}}}
571 600
 };