]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/KLN89/kln89_page.hxx
Make hardcoded error values configurable.
[flightgear.git] / src / Instrumentation / KLN89 / kln89_page.hxx
1 // kln89_page.hxx - base class for 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 #ifndef _KLN89_PAGE_HXX
25 #define _KLN89_PAGE_HXX
26
27 #include <Instrumentation/dclgps.hxx>
28 #include "kln89.hxx"
29
30 class KLN89;
31
32 class KLN89Page : public GPSPage {
33
34 public:
35         KLN89Page(KLN89* parent);
36         virtual ~KLN89Page();
37         virtual void Update(double dt);
38         virtual void Knob1Left1();
39         virtual void Knob1Right1();
40         virtual void Knob2Left1();
41         virtual void Knob2Right1();
42         virtual void CrsrPressed();
43         virtual void EntPressed();
44         virtual void ClrPressed();
45         // Even though some/all of the buttons below aren't processed directly by the current page,
46         // the current page often needs to save or change some state when they are pressed, and 
47         // hence should provide a function to handle them.
48         virtual void DtoPressed();
49         virtual void NrstPressed();
50         virtual void AltPressed();
51         virtual void OBSPressed();
52         virtual void MsgPressed();
53         
54         // See base class comments for this.
55         virtual void CleanUp();
56         
57         // ditto
58         virtual void LooseFocus();
59         
60         inline void SetEntInvert(bool b) { _entInvert = b; }
61         
62         // Get / Set a waypoint id, NOT the page name!
63         virtual void SetId(const string& s);
64         virtual const string& GetId();
65         
66 protected:
67         KLN89* _kln89;
68         
69         // Underline position in cursor mode is not persistant when subpage is changed - hence we only need one variable per page for it.
70         // Note that pos 0 is special - this is the leg pos in field 1, so pos will normally be set to 1 when crsr is pressed.
71         // Also note that in general it doesn't seem to wrap.
72         unsigned int _uLinePos;
73         unsigned int _maxULinePos;
74         
75         // This is NOT the main gps to/from flag - derived page classes can use this flag
76         // for any purpose, typically whether a radial bearing should be displayed to or from.
77         bool _to_flag;  // true for TO, false for FROM
78         
79         // Invert ID and display ENT in field 1
80         bool _entInvert;
81         
82         string _id;             // The ID of the waypoint that the page is displaying.
83                                         // Doesn't make sense for all pages, but does for all the data pages.
84                                         
85         void ShowScratchpadMessage(const string& line1, const string& line2);
86                                         
87         bool _scratchpadMsg;            // Set true when there is a scratchpad message to display
88         double _scratchpadTimer;        // Used for displaying the scratchpad messages for the right amount of time.
89         string _scratchpadLine1;
90         string _scratchpadLine2;
91 };
92
93 #endif  // _KLN89_PAGE_HXX