]> git.mxchange.org Git - flightgear.git/commitdiff
KLN89: Allow CLR to abort flightplan waypoint entry at the waypoint review page,...
authorDave Luff <daveluff@ntlworld.com>
Tue, 23 Nov 2010 12:21:25 +0000 (12:21 +0000)
committerDave Luff <daveluff@ntlworld.com>
Tue, 23 Nov 2010 12:21:25 +0000 (12:21 +0000)
src/Instrumentation/KLN89/kln89.cxx
src/Instrumentation/KLN89/kln89.hxx
src/Instrumentation/KLN89/kln89_page_fpl.cxx

index 48b69a0431caa558835c07ff5022587bcaddd5bb..aa7b734e4356429be2e6b837613b365fa478bf31 100644 (file)
@@ -206,9 +206,8 @@ KLN89::KLN89(RenderArea2D* instrument)
        }
        _activeFP = _flightPlans[0];
        
-       // Hackish
-       _entJump = -1;
-       _entRestoreCrsr = false;
+       _entJump = _clrJump = -1;
+       _jumpRestoreCrsr = false;
        
        _dispMsg = false;
        
@@ -490,8 +489,8 @@ void KLN89::CrsrPressed() {
                _pages[(unsigned int)_cleanUpPage]->CleanUp();
                _cleanUpPage = -1;
        }
-       _entRestoreCrsr = false;
-       _entJump = -1;
+       _jumpRestoreCrsr = false;
+       _entJump = _clrJump = -1;
        ((KLN89Page*)_activePage)->SetEntInvert(false);
        if(_mode == KLN89_MODE_DISP) {
                _mode = KLN89_MODE_CRSR;
@@ -512,8 +511,8 @@ void KLN89::EntPressed() {
                }
                _curPage = _entJump;
                _activePage = _pages[(unsigned int)_entJump];
-               if(_entRestoreCrsr) _mode = KLN89_MODE_CRSR;
-               _entJump = -1;
+               if(_jumpRestoreCrsr) _mode = KLN89_MODE_CRSR;
+               _entJump = _clrJump = -1;
        }
        if(_activePage == _dir_page) {
                _dir_page->EntPressed();
@@ -525,6 +524,12 @@ void KLN89::EntPressed() {
 }
 
 void KLN89::ClrPressed() {
+       if(_clrJump >= 0) {
+               _curPage = _clrJump;
+               _activePage = _pages[(unsigned int)_clrJump];
+               if(_jumpRestoreCrsr) _mode = KLN89_MODE_CRSR;
+               _entJump = _clrJump = -1;
+       }
        _activePage->ClrPressed();
 }
 
index b0a879c25c4ec393799b37c2d827eca6b9ff82fa..c3542f4cbe3b08a0a2f2b714c9143b19a69a30e5 100644 (file)
@@ -213,9 +213,12 @@ private:
        // And a facility to save the immediately preceeding active page
        KLN89Page* _lastActivePage;
        
-       // Hackish
-       int _entJump;   // The page to jump back to if ent is pressed.  -1 indicates no jump
-       bool _entRestoreCrsr;   // Indicates that pressing ENT at this point should restore cursor mode
+       // Ugly hack.  Housekeeping to allow us to temporarily display one page, while remembering which
+       // other page to "jump" back to.  Used when the waypoint pages are used to review waypoint entry
+       // from the flightplan page.
+       int _entJump;   // The page to jump back to if ENT is pressed.  -1 indicates no jump.
+       int _clrJump;   // The page to jump back to if CLR is pressed.  -1 indicates no jump.
+       bool _jumpRestoreCrsr;  // Indicates that jump back at this point should restore cursor mode.
        
        // Misc pages that aren't in the cyclic list.
        // Direct To
index 289e7c509dae69ff677f1d1d2a989f9343f601bb..0e77671e2a6471b765e077eaea924ebaf68eaf2e 100644 (file)
@@ -618,6 +618,8 @@ void KLN89FplPage::ClrPressed() {
                     _entWp = NULL;
                     _entWpStr.clear();
                     _wLinePos = 0;
+                    // We can also get here from the waypoint review page, so clear _bEntExp as well
+                    _bEntExp = false;
                     // Do we need to re-calc _fplPos here?                    
                 } else {
                     // First check that we're not trying to delete an approach waypoint.  Note that we can delete the approach by deleting the header though.
@@ -751,9 +753,9 @@ void KLN89FplPage::EntPressed() {
                 SG_LOG(SG_GENERAL, SG_ALERT, "Error - unknown waypoint type found in KLN89::FplPage::EntPressed()\n");
             }
             _kln89->_activePage->SetId(_entWp->id);
-            _kln89->_entJump = 7;
+            _kln89->_entJump = _kln89->_clrJump = 7;
             _kln89->_cleanUpPage = 7;
-            _kln89->_entRestoreCrsr = true;
+            _kln89->_jumpRestoreCrsr = true;
             _kln89->_mode = KLN89_MODE_DISP;
         }
         _bEntExp = true;