Showing 3 changed files with 26 additions and 7 deletions
+1 -1
Nasal/display.nas
... ...
@@ -691,7 +691,7 @@ var displayClass = {
691 691
             me.screenElements[sprintf("SoftKey%02i-text", i)]
692 692
                 .setText(path.texts[k]);
693 693
             me.setSoftKeyColor(i,
694
-                    contains(me.device.softkeys.colored, pathid ~ path.texts[k]),
694
+                    contains(me.device.softkeys.colored, pathid ~ path.texts[k]) and path.texts[k] != "",
695 695
                     contains(bindings, path.texts[k]) or (me.device.role == 'MFD' and path.texts[k] == 'BACK'));
696 696
         }
697 697
         # feeding the last boxes with empty string
+2
Nasal/maps/navaids.nas
... ...
@@ -389,6 +389,7 @@ var MapNavaids = {
389 389
             m.device.softkeys.colored.INSETNAVAIDSNDB = 1;
390 390
             m.device.softkeys.colored.INSETNAVAIDSDME = 1;
391 391
             m.device.softkeys.colored.INSETNAVAIDSAPT = 1;
392
+            m.device.softkeys.colored.INSETNAVAIDS = 1;
392 393
         }
393 394
         if (m.device.role == 'MFD') {
394 395
             m.device.softkeys.colored.MAPNAVAIDSALL = 1;
... ...
@@ -397,6 +398,7 @@ var MapNavaids = {
397 398
             m.device.softkeys.colored.MAPNAVAIDSNDB = 1;
398 399
             m.device.softkeys.colored.MAPNAVAIDSDME = 1;
399 400
             m.device.softkeys.colored.MAPNAVAIDSAPT = 1;
401
+            m.device.softkeys.colored.MAPNAVAIDS = 1;
400 402
         }
401 403
 
402 404
         return m;
+23 -6
Nasal/softkeys.nas
... ...
@@ -104,12 +104,16 @@ var softkeysClass = {
104 104
                 },
105 105
                 NAVAIDS: {
106 106
                     ALL: func (root_id = 'INSETNAVAIDS') {
107
-                        if (contains(me.colored, root_id ~ 'ALL'))
107
+                        if (contains(me.colored, root_id ~ 'ALL')) {
108 108
                             foreach (var n; [ 'ALL', 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
109 109
                                 delete(me.colored, root_id ~ n);
110
-                        else
110
+                            delete(me.colored, root_id);
111
+                        }
112
+                        else {
111 113
                             foreach (var n; [ 'ALL', 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
112 114
                                 me.colored[root_id ~ n] = 1;
115
+                            me.colored[root_id] = 1;
116
+                        }
113 117
                         me.device.display.updateSoftKeys();
114 118
                         foreach (var n; [ 'VOR', 'TACAN', 'NDB', 'DME' ])
115 119
                             me.device.map.layers.navaids._can[n]
... ...
@@ -133,15 +137,28 @@ var softkeysClass = {
133 137
                         call(me.bindings.PFD.INSET.NAVAIDS.declutter, ['INSETNAVAIDSAPT', 'airport', 6], me);
134 138
                     },
135 139
                     declutter: func (id, type) {
140
+                        var root_id = (me.device.role == 'PFD' ? 'INSET' : 'MAP') ~ 'NAVAIDS';
136 141
                         if (contains(me.colored, id)) {
137 142
                             delete(me.colored, id);
138
-                            if (me.device.role == 'PFD')
139
-                                delete(me.colored, 'INSETNAVAIDSALL');
140
-                            if (me.device.role == 'MFD')
141
-                                delete(me.colored, 'MAPNAVAIDSALL');
143
+                            delete(me.colored, root_id ~ 'ALL');
142 144
                         }
143 145
                         else
144 146
                             me.colored[id] = 1;
147
+
148
+                        var active_navaids = 0;
149
+                        foreach (var n; [ 'VOR', 'DME', 'NDB', 'TACAN', 'APT' ])
150
+                            active_navaids += contains(me.colored, root_id ~ n);
151
+
152
+                        if (active_navaids < 5)
153
+                            delete(me.colored, root_id ~ 'ALL');
154
+                        else
155
+                            me.colored[root_id ~ 'ALL'] = 1;
156
+
157
+                        if (active_navaids > 0)
158
+                            me.colored[root_id] = 1;
159
+                        else
160
+                            delete(me.colored, root_id);
161
+
145 162
                         me.device.display.updateSoftKeys();
146 163
                         me.device.map.layers.navaids._can[type]
147 164
                             .setVisible(contains(me.colored, id));