]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/KLN89/kln89_page_nrst.cxx
Merge branch 'maint2' into next
[flightgear.git] / src / Instrumentation / KLN89 / kln89_page_nrst.cxx
1 // kln89_page_*.[ch]xx - this file is one of the "pages" that
2 //                       are used in the KLN89 GPS unit simulation. 
3 //
4 // Written by David Luff, started 2005.
5 //
6 // Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
7 //
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.
12 //
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.
17 //
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.
21 //
22 // $Id$
23
24 #ifdef HAVE_CONFIG_H
25 #  include "config.h"
26 #endif
27
28 #include "kln89_page_nrst.hxx"
29
30 KLN89NrstPage::KLN89NrstPage(KLN89* parent) 
31 : KLN89Page(parent) {
32         _nSubPages = 2;
33         _subPage = 0;
34         _name = "NRST";
35         _uLinePos = 1;
36         _maxULinePos = 8;
37 }
38
39 KLN89NrstPage::~KLN89NrstPage() {
40 }
41
42 void KLN89NrstPage::Update(double dt) {
43         // crsr is always on on nearest page
44         bool blink = _kln89->_blink;
45         
46         _kln89->DrawText("NEAREST", 2, 3, 3);
47         if(!(_uLinePos == 1 && blink)) _kln89->DrawText("APT?", 2, 0, 2);
48         if(!(_uLinePos == 2 && blink)) _kln89->DrawText("VOR?", 2, 5, 2);
49         if(!(_uLinePos == 3 && blink)) _kln89->DrawText("NDB?", 2, 10, 2);
50         if(!(_uLinePos == 4 && blink)) _kln89->DrawText("INT?", 2, 0, 1);
51         if(!(_uLinePos == 5 && blink)) _kln89->DrawText("USR?", 2, 5, 1);
52         if(!(_uLinePos == 6 && blink)) _kln89->DrawText("SUA?", 2, 10, 1);
53         if(!(_uLinePos == 7 && blink)) _kln89->DrawText("FSS?", 2, 0, 0);
54         if(!(_uLinePos == 8 && blink)) _kln89->DrawText("CTR?", 2, 5, 0);
55                 
56         switch(_uLinePos) {
57         case 1: _kln89->Underline(2, 0, 2, 4); break;
58         case 2: _kln89->Underline(2, 5, 2, 4); break;
59         case 3: _kln89->Underline(2, 10, 2, 4); break;
60         case 4: _kln89->Underline(2, 0, 1, 4); break;
61         case 5: _kln89->Underline(2, 5, 1, 4); break;
62         case 6: _kln89->Underline(2, 10, 1, 4); break;
63         case 7: _kln89->Underline(2, 0, 0, 4); break;
64         case 8: _kln89->Underline(2, 5, 0, 4); break;
65         }
66         
67         // Actually, the kln89 sim from Bendix-King dosn't draw the 'ENT'
68         // for 'APT?' if it was on 'Leg' (pos 0) immediately previously, but does if
69         // it was not on 'Leg' immediately previously.  I think we can desist from
70         // reproducing this probable bug.
71         if(_uLinePos > 0) {
72                 if(!blink) _kln89->DrawEnt();
73         }
74         
75         KLN89Page::Update(dt);
76 }
77
78 void KLN89NrstPage::CrsrPressed() {
79 }
80
81 void KLN89NrstPage::EntPressed() {
82         if(_uLinePos > 4) {
83                 ShowScratchpadMessage("  No  ", " Nrst ");
84         }
85 }
86
87 void KLN89NrstPage::LooseFocus() {
88         _uLinePos = 1;
89         _scratchpadMsg = false;
90 }