]> git.mxchange.org Git - flightgear.git/blob - src/ATCDCL/ATCDialog.hxx
Merge branch 'tat/framework'
[flightgear.git] / src / ATCDCL / 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 #ifndef ATC_DIALOG_HXX
22 #define ATC_DIALOG_HXX
23
24 #include <simgear/compiler.h>
25
26 #include <vector>
27 #include <map>
28
29 #include "ATC.hxx"
30
31 using std::vector;
32 using std::map;
33
34 class NewGUI;
35
36 // ATCMenuEntry - an encapsulation of an entry in the ATC dialog
37 struct ATCMenuEntry {
38
39   string  stationid;    // ID of transmitting station
40   //int     stationfr;  // ?
41   string  transmission; // Actual speech of transmission
42   string  menuentry;    // Shortened version for display in the dialog
43   int callback_code;    // This code is supplied by the registering station, and then
44                         // returned to the registering station if that option is chosen.
45                         // The actual value is only understood by the registering station - 
46                         // FGATCDialog only stores it and returns it if appropriate.
47
48   ATCMenuEntry();
49   ~ATCMenuEntry();
50 };
51
52 typedef vector < ATCMenuEntry > atcmentry_vec_type;
53 typedef atcmentry_vec_type::iterator atcmentry_vec_iterator;
54   
55 typedef map < string, atcmentry_vec_type > atcmentry_map_type;
56 typedef atcmentry_map_type::iterator atcmentry_map_iterator;
57
58 void atcUppercase(string &s);
59
60 //void ATCDialogInit();
61 //void ATCDoDialog(atc_type type);
62
63 class FGATCDialog {
64         
65 public:
66
67         FGATCDialog();
68         ~FGATCDialog();
69         
70         void Init();
71         
72         void Update(double dt);
73         
74         void PopupDialog();
75         
76         void PopupCallback(int);
77         
78         void add_entry( const string& station, const string& transmission, const string& menutext, atc_type type, int code);
79         
80         void remove_entry( const string &station, const string &trans, atc_type type );
81
82         void remove_entry( const string &station, int code, atc_type type );
83         
84         // query the database whether the transmission is already registered; 
85         bool trans_reg( const string &station, const string &trans, atc_type type );
86         
87         // query the database whether the transmission is already registered; 
88         bool trans_reg( const string &station, int code, atc_type type );
89         
90         // Display a frequency search dialog for nearby stations
91         void FreqDialog();
92         
93         // Display the comm ATC frequencies for airport ident
94         // where ident is a valid ICAO code.
95         void FreqDisplay(string& ident);
96
97 private:
98
99         atcmentry_map_type available_dialog[ATC_NUM_TYPES];
100   
101         int  freq;
102         bool reset;
103         
104         bool _callbackPending;
105         double _callbackTimer;
106         double _callbackWait;
107         FGATC* _callbackPtr;
108         int _callbackCode;
109
110         NewGUI *_gui;
111 };
112         
113 extern FGATCDialog *current_atcdialog;  
114
115 #endif  // ATC_DIALOG_HXX
116