]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/KLN89/kln89.cxx
Merge branch 'maint2' into next
[flightgear.git] / src / Instrumentation / KLN89 / kln89.cxx
index b491bcc3170acf7a2f973e3e733225c9be3cfbbf..6ee1c21ac40f60df68db2c24ec6c96f9e1969020 100644 (file)
@@ -21,7 +21,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 #include "kln89_symbols.hxx"
 #include <iostream>
 
-#include <ATC/ATCProjection.hxx>
+#include <ATCDCL/ATCProjection.hxx>
 #include <Main/fg_props.hxx>
 #include <simgear/math/point3d.hxx>
+#include "Airports/simple.hxx"
 
-SG_USING_STD(cout);
+using std::cout;
 
 KLN89::KLN89(RenderArea2D* instrument) 
 : DCLGPS(instrument) {
@@ -379,7 +380,10 @@ void KLN89::Knob2Right1() {
 
 void KLN89::CrsrPressed() {
        _dispMsg = false;
-       if(_activePage == _nrst_page) return;   // CRSR cannot be switched off on nrst page.
+       // CRSR cannot be switched off on nrst page.
+       if(_activePage == _nrst_page) { return; }
+       // CRSR is always off when inner-knob is out on nav4 page.
+       if(_curPage == 6 && _activePage->GetSubPage() == 3 && fgGetBool("/instrumentation/kln89/scan-pull")) { return; }
        if(_cleanUpPage >= 0) {
                _pages[(unsigned int)_cleanUpPage]->CleanUp();
                _cleanUpPage = -1;
@@ -432,10 +436,9 @@ void KLN89::DtoPressed() {
                        } else {
                                _dir_page->SetId(_activeWaypoint.id);
                        }
-               // } else if(_curPage == 6 && _nav_page->GetSubPage() == 3 && 0) {
+               } else if(_curPage == 6 && _activePage->GetSubPage() == 3 && fgGetBool("/instrumentation/kln89/scan-pull") && _activeFP->waypoints.size()) {
                        // NAV 4
-                       // TODO
-                       // The && 0 should be && outer knob is out.
+                       _dir_page->SetId(((KLN89NavPage*)_activePage)->GetNav4WpId());
                } else if(_curPage == 7 && _activePage->GetSubPage() == 0 && _mode == KLN89_MODE_CRSR) {
                        //cout << "Checking the fpl page!\n";
                        // FPL 0
@@ -449,7 +452,7 @@ void KLN89::DtoPressed() {
                } else {
                        _dir_page->SetId(_activeWaypoint.id);
                }
-               // This need to come after the bit before otherwise the FPL page clears it's current ID when it looses focus.
+               // This need to come after the bit before otherwise the FPL or NAV4 page clears their current ID when it looses focus.
                _activePage->LooseFocus();
                _activePage = _dir_page;
                _mode = KLN89_MODE_CRSR;
@@ -574,7 +577,6 @@ void KLN89::DrawMap(bool draw_avs) {
        // Annotation then gets drawn by Nav page, NOT this function.
 
        if(_drawApt && draw_avs) {
-               airport_list apt;
                /*
                bool have_apt = _overlays->FindArpByRegion(&apt, bottomLeft.lat(), bottomLeft.lon(), topRight.lat(), topRight.lon());
                //cout << "Vors enclosed are: ";