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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "kln89_page_dir.hxx"
26 KLN89DirPage::KLN89DirPage(KLN89* parent)
34 KLN89DirPage::~KLN89DirPage() {
37 void KLN89DirPage::Update(double dt) {
38 // TODO - this can apparently be "ACTIVATE:" under some circumstances
39 _kln89->DrawText("DIRECT TO:", 2, 2, 3);
41 if(_kln89->_mode == KLN89_MODE_CRSR) {
42 if(_DToWpDispMode == 0) {
44 while(s.size() < 5) s += ' ';
46 _kln89->DrawText(s, 2, 4, 1, false, 99);
47 _kln89->DrawEnt(1, 0, 1);
49 } else if(_DToWpDispMode == 1) {
52 _kln89->DrawEnt(1, 0, 1);
54 _kln89->Underline(2, 4, 1, 5);
56 if(!_kln89->_blink) _kln89->DrawText("_____", 2, 4, 1);
57 _kln89->Underline(2, 4, 1, 5);
60 _kln89->DrawText("_____", 2, 4, 1);
63 KLN89Page::Update(dt);
66 void KLN89DirPage::SetId(string s) {
69 // TODO - fill in lat, lon, type
70 // or just pass in waypoints (probably better!)
72 // TODO - this (above) should probably be dependent on whether s is a *valid* waypoint!
76 _saveMasterMode = _kln89->_mode;
77 _uLinePos = 1; // Needed to stop Leg flashing
80 void KLN89DirPage::ClrPressed() {
81 if(_kln89->_mode == KLN89_MODE_CRSR) {
82 if(_DToWpDispMode <= 1) {
86 // Restore the original master mode
87 _kln89->_mode = _saveMasterMode;
88 // Stop displaying dir page
89 _kln89->_activePage = _kln89->_pages[_kln89->_curPage];
96 void KLN89DirPage::EntPressed() {
97 //cout << "DTO ENT Pressed()\n";
101 _kln89->DtoInitiate(_id);