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