1 // kln89_page_*.[ch]xx - this file is one of the "pages" that
2 // are used in the KLN89 GPS unit simulation.
4 // Written by David Luff, started 2005.
6 // Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #include "kln89_page_dir.hxx"
30 KLN89DirPage::KLN89DirPage(KLN89* parent)
38 KLN89DirPage::~KLN89DirPage() {
41 void KLN89DirPage::Update(double dt) {
42 // TODO - this can apparently be "ACTIVATE:" under some circumstances
43 _kln89->DrawText("DIRECT TO:", 2, 2, 3);
45 if(_kln89->_mode == KLN89_MODE_CRSR) {
46 if(_DToWpDispMode == 0) {
48 while(s.size() < 5) s += ' ';
50 _kln89->DrawText(s, 2, 4, 1, false, 99);
51 _kln89->DrawEnt(1, 0, 1);
53 } else if(_DToWpDispMode == 1) {
56 _kln89->DrawEnt(1, 0, 1);
58 _kln89->Underline(2, 4, 1, 5);
60 if(!_kln89->_blink) _kln89->DrawText("_____", 2, 4, 1);
61 _kln89->Underline(2, 4, 1, 5);
64 _kln89->DrawText("_____", 2, 4, 1);
67 KLN89Page::Update(dt);
70 void KLN89DirPage::SetId(const string& s) {
73 // TODO - fill in lat, lon, type
74 // or just pass in waypoints (probably better!)
76 // TODO - this (above) should probably be dependent on whether s is a *valid* waypoint!
80 _saveMasterMode = _kln89->_mode;
81 _uLinePos = 1; // Needed to stop Leg flashing
84 void KLN89DirPage::ClrPressed() {
85 if(_kln89->_mode == KLN89_MODE_CRSR) {
86 if(_DToWpDispMode <= 1) {
90 // Restore the original master mode
91 _kln89->_mode = _saveMasterMode;
92 // Stop displaying dir page
93 _kln89->_activePage = _kln89->_pages[_kln89->_curPage];
100 void KLN89DirPage::EntPressed() {
101 //cout << "DTO ENT Pressed()\n";
105 _kln89->DtoInitiate(_id);