]> git.mxchange.org Git - flightgear.git/blob - src/ATC/ATCDialog.hxx
Various mods to allow querying for nearest airport (with optional ability to
[flightgear.git] / src / ATC / ATCDialog.hxx
1 // ATCDialog.hxx - Functions and classes to handle the pop-up ATC dialog
2 //
3 // Written by Alexander Kappes and David Luff, started February 2003.
4 //
5 // Copyright (C) 2003  Alexander Kappes and David Luff
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 #ifndef ATC_DIALOG_HXX
22 #define ATC_DIALOG_HXX
23
24 #include <simgear/compiler.h>
25
26 #include "ATC.hxx"
27
28 // ATCMenuEntry - an encapsulation of an entry in the ATC dialog
29 struct ATCMenuEntry {
30
31   string  stationid;    // ID of transmitting station
32   //int     stationfr;  // ?
33   string  transmission; // Actual speech of transmission
34   string  menuentry;    // Shortened version for display in the dialog
35   int callback_code;    // This code is supplied by the registering station, and then
36                         // returned to the registering station if that option is chosen.
37                         // The actual value is only understood by the registering station - 
38                         // FGATCDialog only stores it and returns it if appropriate.
39
40   ATCMenuEntry();
41   ~ATCMenuEntry();
42 };
43
44 typedef vector < ATCMenuEntry > atcmentry_vec_type;
45 typedef atcmentry_vec_type::iterator atcmentry_vec_iterator;
46   
47 typedef map < string, atcmentry_vec_type > atcmentry_map_type;
48 typedef atcmentry_map_type::iterator atcmentry_map_iterator;
49
50 //void ATCDialogInit();
51
52 //void ATCDoDialog(atc_type type);
53
54 class FGATCDialog {
55         
56 public:
57
58         FGATCDialog();
59         ~FGATCDialog();
60         
61         void Init();
62         
63         void Update(double dt);
64         
65         void PopupDialog();
66         
67         void PopupCallback();
68         
69         void add_entry( string station, string transmission, string menutext, atc_type type, int code);
70         
71         void remove_entry( const string &station, const string &trans, atc_type type );
72         
73         void remove_entry( const string &station, int code, atc_type type );
74         
75         // query the database whether the transmission is already registered; 
76         bool trans_reg( const string &station, const string &trans, atc_type type );
77         
78         // query the database whether the transmission is already registered; 
79         bool trans_reg( const string &station, int code, atc_type type );
80         
81         // Display a frequency search dialog for nearby stations
82         void FreqDialog();
83         
84         // Display the comm ATC frequencies for airport ident
85         // where ident is a valid ICAO code.
86         void FreqDisplay(string ident);
87
88 private:
89
90         atcmentry_map_type available_dialog[ATC_NUM_TYPES];
91   
92         int  freq;
93         bool reset;
94         
95         bool _callbackPending;
96         double _callbackTimer;
97         double _callbackWait;
98         FGATC* _callbackPtr;
99         int _callbackCode;
100 };
101         
102 extern FGATCDialog *current_atcdialog;  
103
104 #endif  // ATC_DIALOG_HXX
105