From c30c18399923eed7545156d6cea3f78849b37c0d Mon Sep 17 00:00:00 2001 From: Dave Luff Date: Tue, 23 Nov 2010 10:15:10 +0000 Subject: [PATCH] KLN89: Fix some bugs in the flightplan page text entry. Basically, draw the text entry string instead of the dummy waypoint ID. --- src/Instrumentation/KLN89/kln89_page_fpl.cxx | 38 +++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Instrumentation/KLN89/kln89_page_fpl.cxx b/src/Instrumentation/KLN89/kln89_page_fpl.cxx index ec9161d4d..8497ece12 100644 --- a/src/Instrumentation/KLN89/kln89_page_fpl.cxx +++ b/src/Instrumentation/KLN89/kln89_page_fpl.cxx @@ -295,13 +295,13 @@ void KLN89FplPage::Update(double dt) { } } else if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos == i+4) { if(!_kln89->_blink) { - if(_wLinePos >= _entWp->id.size()) { - _kln89->DrawText(_entWp->id, 2, 4, 3-i); + if(_wLinePos >= _entWpStr.size()) { + _kln89->DrawText(_entWpStr, 2, 4, 3-i); _kln89->DrawChar(' ', 2, 4+_wLinePos, 3-i, false, true); } else { - _kln89->DrawText(_entWp->id.substr(0, _wLinePos), 2, 4, 3-i); - _kln89->DrawChar(_entWp->id[_wLinePos], 2, 4+_wLinePos, 3-i, false, true); - _kln89->DrawText(_entWp->id.substr(_wLinePos+1, _entWp->id.size()-_wLinePos-1), 2, 5+_wLinePos, 3-i); + _kln89->DrawText(_entWpStr.substr(0, _wLinePos), 2, 4, 3-i); + _kln89->DrawChar(_entWpStr[_wLinePos], 2, 4+_wLinePos, 3-i, false, true); + _kln89->DrawText(_entWpStr.substr(_wLinePos+1, _entWpStr.size()-_wLinePos-1), 2, 5+_wLinePos, 3-i); } } drawID = false; @@ -438,13 +438,13 @@ void KLN89FplPage::Update(double dt) { } } else if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos == i+4) { if(!_kln89->_blink) { - if(_wLinePos >= _entWp->id.size()) { - _kln89->DrawText(_entWp->id, 2, 4, 2-i); + if(_wLinePos >= _entWpStr.size()) { + _kln89->DrawText(_entWpStr, 2, 4, 2-i); _kln89->DrawChar(' ', 2, 4+_wLinePos, 2-i, false, true); } else { - _kln89->DrawText(_entWp->id.substr(0, _wLinePos), 2, 4, 2-i); - _kln89->DrawChar(_entWp->id[_wLinePos], 2, 4+_wLinePos, 2-i, false, true); - _kln89->DrawText(_entWp->id.substr(_wLinePos+1, _entWp->id.size()-_wLinePos-1), 2, 5+_wLinePos, 2-i); + _kln89->DrawText(_entWpStr.substr(0, _wLinePos), 2, 4, 2-i); + _kln89->DrawChar(_entWpStr[_wLinePos], 2, 4+_wLinePos, 2-i, false, true); + _kln89->DrawText(_entWpStr.substr(_wLinePos+1, _entWpStr.size()-_wLinePos-1), 2, 5+_wLinePos, 2-i); } } drawID = false; @@ -956,8 +956,15 @@ void KLN89FplPage::Knob2Left1() { GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1)); if(NULL == wp) { - // no-op + // No ID matches the partial ID entered so _entWpStr must be shortened to the cursor + // position if it was longer due to a match on the previous character. + if(_entWpStr.size() > _wLinePos+1) { + _entWpStr = _entWpStr.substr(0, _wLinePos+1); + } } else { + // There is a matching full ID to the entered partial ID, so copy the full ID + // into _entWpStr + _entWpStr = wp->id; if(_entWp) { *_entWp = *wp; // copy delete wp; @@ -1029,8 +1036,15 @@ void KLN89FplPage::Knob2Right1() { GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1)); if(NULL == wp) { - // no-op + // No ID matches the partial ID entered so _entWpStr must be shortened to the cursor + // position if it was longer due to a match on the previous character. + if(_entWpStr.size() > _wLinePos+1) { + _entWpStr = _entWpStr.substr(0, _wLinePos+1); + } } else { + // There is a matching full ID to the entered partial ID, so copy the full ID + // into _entWpStr + _entWpStr = wp->id; if(_entWp) { *_entWp = *wp; // copy delete wp; -- 2.39.5