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_act.hxx"
25 #include "kln89_page_apt.hxx"
26 #include "kln89_page_vor.hxx"
27 #include "kln89_page_ndb.hxx"
28 #include "kln89_page_int.hxx"
29 #include "kln89_page_usr.hxx"
31 KLN89ActPage::KLN89ActPage(KLN89* parent)
40 _aptPage = new KLN89AptPage(parent);
41 _vorPage = new KLN89VorPage(parent);
42 _ndbPage = new KLN89NDBPage(parent);
43 _intPage = new KLN89IntPage(parent);
44 _usrPage = new KLN89UsrPage(parent);
47 KLN89ActPage::~KLN89ActPage() {
55 void KLN89ActPage::Update(double dt) {
57 _actWp = _kln89->GetActiveWaypoint();
58 _actWpId = _kln89->GetActiveWaypointIndex();
61 switch(_actWp->type) {
62 case GPS_WP_APT: _actPage = _aptPage; break;
63 case GPS_WP_VOR: _actPage = _vorPage; break;
64 case GPS_WP_NDB: _actPage = _ndbPage; break;
65 case GPS_WP_INT: _actPage = _intPage; break;
66 case GPS_WP_USR: _actPage = _usrPage; break;
69 // ASSERT(0); // ie. we shouldn't ever get here.
75 _actPage->SetId(_actWp->id);
78 KLN89Page::Update(dt);
82 void KLN89ActPage::CrsrPressed() {
84 _actPage->CrsrPressed();
86 KLN89Page::CrsrPressed();
90 void KLN89ActPage::EntPressed() {
92 _actPage->EntPressed();
94 KLN89Page::EntPressed();
98 void KLN89ActPage::ClrPressed() {
100 _actPage->ClrPressed();
102 KLN89Page::ClrPressed();
106 void KLN89ActPage::Knob2Left1() {
107 if((_kln89->_mode != KLN89_MODE_CRSR) && (_actPage)) {
108 _actPage->Knob2Left1();
112 void KLN89ActPage::Knob2Right1() {
113 if((_kln89->_mode != KLN89_MODE_CRSR) && (_actPage)) {
114 _actPage->Knob2Right1();
118 void KLN89ActPage::LooseFocus() {
119 // Setting to NULL and -1 is better than resetting to
120 // active waypoint and index since we can't guarantee that
121 // the fpl active waypoint won't change behind our backs
122 // when we don't have focus.