| 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 - daveluff AT ntlworld.com |
| 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_FPL_HXX |
| 25 | #define _KLN89_PAGE_FPL_HXX |
| 26 | |
| 27 | #include "kln89.hxx" |
| 28 | |
| 29 | class KLN89FplPage : public KLN89Page { |
| 30 | |
| 31 | public: |
| 32 | KLN89FplPage(KLN89* parent); |
| 33 | ~KLN89FplPage(); |
| 34 | |
| 35 | void Update(double dt); |
| 36 | |
| 37 | void CrsrPressed(); |
| 38 | void EntPressed(); |
| 39 | void ClrPressed(); |
| 40 | void Knob1Left1(); |
| 41 | void Knob1Right1(); |
| 42 | void Knob2Left1(); |
| 43 | void Knob2Right1(); |
| 44 | |
| 45 | void CleanUp(); |
| 46 | void LooseFocus(); |
| 47 | |
| 48 | // Override the base class GetId function to return the waypoint ID under the cursor |
| 49 | // on FPL0 page, if there is one and the cursor is on. |
| 50 | // Otherwise return an empty string. |
| 51 | inline const std::string& GetId() { return(_fp0SelWpId); } |
| 52 | |
| 53 | private: |
| 54 | int _fpMode; // 0 = Dis, 1 = Dtk |
| 55 | int _actFpMode; // 0 = Dis, 1 = ETE, 2 = ETA, 3 = Dtk/OBS |
| 56 | |
| 57 | bool _bEntWp; // set true when a waypoint is being entered |
| 58 | bool _bEntExp; // Set true when ent is expected to set the currently entered waypoint as entered. |
| 59 | std::string _entWpStr; // The currently entered wp ID (need not be valid) |
| 60 | GPSWaypoint* _entWp; // Waypoint being currently entered |
| 61 | |
| 62 | // The position of the cursor in a waypoint being entered |
| 63 | unsigned int _wLinePos; |
| 64 | |
| 65 | unsigned int _fplPos; // The position of the start of the FP (NOT the active one) (zero-based). |
| 66 | // since this is reset when subpage changes we only need 1, not an array of 25! |
| 67 | bool _resetFplPos0; // Set true when a recalculation of _fplPos for the active flightplan page is required. |
| 68 | |
| 69 | int _hdrPos; |
| 70 | int _fencePos; |
| 71 | |
| 72 | // Get the waypoint (returned thru the pointer) at the zero-based position (pos) |
| 73 | // in the waypoint display of the current page. |
| 74 | // Returns 0 if no waypoint, 1 if sucessfull, 2 if appr header, 3 if approach fence. |
| 75 | //int GetFPWaypoint(GPSWaypoint* wp, int pos); |
| 76 | |
| 77 | bool _delFP; // Set true when the delete FP? dialogue is being displayed |
| 78 | bool _delWp; // The position of the waypoint to delete is given by _uLinePos |
| 79 | bool _delAppr; // Set true when the delete approach dialogue is being displayed |
| 80 | bool _changeAppr; |
| 81 | |
| 82 | void DrawFpMode(int ypos); |
| 83 | void Calc(); |
| 84 | |
| 85 | // The ID of the waypoint under the cursor in fpl0, if those conditions exist! |
| 86 | std::string _fp0SelWpId; |
| 87 | |
| 88 | std::vector<std::string> _params; |
| 89 | }; |
| 90 | |
| 91 | #endif // _KLN89_PAGE_FPL_HXX |