}
} else {
_kln89->DrawText("IAP", 2, 11, 3);
- int check = 0;
bool selApp = false;
if(_kln89->_mode == KLN89_MODE_CRSR && _uLinePos > 4) {
selApp = true;
if(!_kln89->_blink) _kln89->DrawEnt();
}
- for(unsigned int i=0; i<_iaps.size(); ++i) { // TODO - do this properly when > 3 IAPs
- string s = GPSitoa(i+1);
- _kln89->DrawText(s, 2, 2 - s.size(), 2-i);
- if(!(selApp && _uLinePos == 5+i && _kln89->_blink)) {
- _kln89->DrawText(_iaps[i]->_ident, 2, 3, 2-i);
- _kln89->DrawText(_iaps[i]->_rwyStr, 2, 9, 2-i);
- }
- if(selApp && _uLinePos == 5+i && !_kln89->_blink) {
- _kln89->Underline(2, 3, 2-i, 9);
+ // _maxULine pos should be 4 + iaps.size() at this point.
+ // Draw a maximum of 3 IAPs.
+ // If there are more than 3 IAPs for this airport, then we need to offset the start
+ // of the list if _uLinePos is pointing at the 4th or later IAP.
+ unsigned int offset = 0;
+ unsigned int index;
+ if(_uLinePos > 7) {
+ offset = _uLinePos - 7;
+ }
+ for(unsigned int i=0; i<3; ++i) {
+ index = offset + i;
+ if(index < _iaps.size()) {
+ string s = GPSitoa(index+1);
+ _kln89->DrawText(s, 2, 2 - s.size(), 2-i);
+ if(!(selApp && _uLinePos == index+5 && _kln89->_blink)) {
+ _kln89->DrawText(_iaps[index]->_ident, 2, 3, 2-i);
+ _kln89->DrawText(_iaps[index]->_rwyStr, 2, 9, 2-i);
+ }
+ if(selApp && _uLinePos == index+5 && !_kln89->_blink) {
+ _kln89->Underline(2, 3, 2-i, 9);
+ }
+ } else {
+ break;
}
- check++;
- if(check > 2) break;
}
}
}
void KLN89AptPage::EntPressed() {
if(_entInvert) {
_entInvert = false;
- _last_apt_id = _apt_id;
- _apt_id = _save_apt_id;
+ if(_kln89->_dtoReview) {
+ _kln89->DtoInitiate(_apt_id);
+ } else {
+ _last_apt_id = _apt_id;
+ _apt_id = _save_apt_id;
+ }
} else if(_subPage == 7 && _kln89->_mode == KLN89_MODE_CRSR && _uLinePos > 0) {
// We are selecting an approach
if(_iafDialog) {
GPSWaypoint* wp = new GPSWaypoint;
*wp = *(_approachRoutes[_curIaf]->waypoints[0]); // Need to make copies here since we're going to alter ID and type sometimes
string iafid = wp->id;
- //wp->id += 'i';
_kln89->_approachFP->waypoints.push_back(wp);
for(unsigned int i=0; i<_IAP.size(); ++i) {
if(_IAP[i]->id != iafid) { // Don't duplicate waypoints that are part of the initial fix list and the approach procedure list.
_kln89->_approachFP->waypoints.push_back(wp);
}
}
- // Only add 1 missed approach procedure waypoint for now. I think this might be standard always anyway.
- wp = new GPSWaypoint;
- *wp = *_MAP[0];
- //wp->id += 'h';
- _kln89->_approachFP->waypoints.push_back(wp);
_iafDialog = false;
_addDialog = true;
_maxULinePos = _kln89->_approachFP->waypoints.size() + 1;
} else if(_uLinePos > 4) {
_approachRoutes.clear();
_IAP.clear();
- _MAP.clear();
_curIaf = 0;
_approachRoutes = ((FGNPIAP*)(_iaps[_uLinePos-5]))->_approachRoutes;
_IAP = ((FGNPIAP*)(_iaps[_uLinePos-5]))->_IAP;
- _MAP = ((FGNPIAP*)(_iaps[_uLinePos-5]))->_MAP;
_curIap = _uLinePos - 5; // TODO - handle the start of list ! no. 1, and the end of list not sequential!
_uLinePos = 1;
if(_approachRoutes.size() > 1) {
_kln89->_approachFP->waypoints.push_back(wp);
}
}
- // Only add 1 missed approach procedure waypoint for now. I think this might be standard always anyway.
- wp = new GPSWaypoint;
- *wp = *_MAP[0];
- //wp->id += 'h';
- _kln89->_approachFP->waypoints.push_back(wp);
-
_addDialog = true;
_maxULinePos = 1;
}
} else {
_curRwyPage--;
}
+ } else if(_subPage == 0) {
+ _subPage = 7;
+ // We have to set _uLinePos here even though the cursor isn't pressed, to
+ // ensure that the list displays properly.
+ if(_iaps.empty()) {
+ _uLinePos = 1;
+ } else {
+ _uLinePos = 5;
+ }
} else {
KLN89Page::Knob2Left1();
}
} else {
_curFreqPage++;
}
+ } else if(_subPage == 6) {
+ _subPage = 7;
+ // We have to set _uLinePos here even though the cursor isn't pressed, to
+ // ensure that the list displays properly.
+ if(_iaps.empty()) {
+ _uLinePos = 1;
+ } else {
+ _uLinePos = 5;
+ }
} else {
KLN89Page::Knob2Right1();
}