From: Dave Luff Date: Tue, 23 Nov 2010 12:21:25 +0000 (+0000) Subject: KLN89: Allow CLR to abort flightplan waypoint entry at the waypoint review page,... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c171c44653401e54349209c7203e0cb104764311;p=flightgear.git KLN89: Allow CLR to abort flightplan waypoint entry at the waypoint review page, as per the real-life unit --- diff --git a/src/Instrumentation/KLN89/kln89.cxx b/src/Instrumentation/KLN89/kln89.cxx index 48b69a043..aa7b734e4 100644 --- a/src/Instrumentation/KLN89/kln89.cxx +++ b/src/Instrumentation/KLN89/kln89.cxx @@ -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(); } diff --git a/src/Instrumentation/KLN89/kln89.hxx b/src/Instrumentation/KLN89/kln89.hxx index b0a879c25..c3542f4cb 100644 --- a/src/Instrumentation/KLN89/kln89.hxx +++ b/src/Instrumentation/KLN89/kln89.hxx @@ -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 diff --git a/src/Instrumentation/KLN89/kln89_page_fpl.cxx b/src/Instrumentation/KLN89/kln89_page_fpl.cxx index 289e7c509..0e77671e2 100644 --- a/src/Instrumentation/KLN89/kln89_page_fpl.cxx +++ b/src/Instrumentation/KLN89/kln89_page_fpl.cxx @@ -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;