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_act.hxx"
29 #include "kln89_page_apt.hxx"
30 #include "kln89_page_vor.hxx"
31 #include "kln89_page_ndb.hxx"
32 #include "kln89_page_int.hxx"
33 #include "kln89_page_usr.hxx"
35 KLN89ActPage::KLN89ActPage(KLN89* parent)
44 _aptPage = new KLN89AptPage(parent);
45 _vorPage = new KLN89VorPage(parent);
46 _ndbPage = new KLN89NDBPage(parent);
47 _intPage = new KLN89IntPage(parent);
48 _usrPage = new KLN89UsrPage(parent);
51 KLN89ActPage::~KLN89ActPage() {
59 void KLN89ActPage::Update(double dt) {
61 _actWp = _kln89->GetActiveWaypoint();
62 _actWpId = _kln89->GetActiveWaypointIndex();
65 switch(_actWp->type) {
66 case GPS_WP_APT: _actPage = _aptPage; break;
67 case GPS_WP_VOR: _actPage = _vorPage; break;
68 case GPS_WP_NDB: _actPage = _ndbPage; break;
69 case GPS_WP_INT: _actPage = _intPage; break;
70 case GPS_WP_USR: _actPage = _usrPage; break;
73 // ASSERT(0); // ie. we shouldn't ever get here.
79 _actPage->SetId(_actWp->id);
82 KLN89Page::Update(dt);
86 void KLN89ActPage::CrsrPressed() {
88 _actPage->CrsrPressed();
90 KLN89Page::CrsrPressed();
94 void KLN89ActPage::EntPressed() {
96 _actPage->EntPressed();
98 KLN89Page::EntPressed();
102 void KLN89ActPage::ClrPressed() {
104 _actPage->ClrPressed();
106 KLN89Page::ClrPressed();
110 void KLN89ActPage::Knob1Left1() {
112 _actPage->Knob1Left1();
116 void KLN89ActPage::Knob1Right1() {
118 _actPage->Knob1Right1();
122 void KLN89ActPage::Knob2Left1() {
123 if((_kln89->_mode != KLN89_MODE_CRSR) && (_actPage)) {
124 _actPage->Knob2Left1();
128 void KLN89ActPage::Knob2Right1() {
129 if((_kln89->_mode != KLN89_MODE_CRSR) && (_actPage)) {
130 _actPage->Knob2Right1();
134 void KLN89ActPage::LooseFocus() {
135 // Setting to NULL and -1 is better than resetting to
136 // active waypoint and index since we can't guarantee that
137 // the fpl active waypoint won't change behind our backs
138 // when we don't have focus.