1 // atcdialog.cxx - classes to manage user interactions with AI traffic
2 // Written by Durk Talsma, started April 3, 2011
3 // Based on earlier code written by Alexander Kappes and David Luff
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <Main/fg_commands.hxx>
22 #include <Main/globals.hxx>
24 #include <simgear/constants.h>
25 #include <simgear/structure/commands.hxx>
26 #include <simgear/compiler.h>
27 #include <simgear/props/props.hxx>
28 #include <simgear/misc/sgstream.hxx>
29 #include <simgear/math/sg_geodesy.hxx>
30 #include <simgear/debug/logstream.hxx>
31 #include <simgear/structure/SGSharedPtr.hxx>
33 #include "atcdialog.hxx"
37 static bool doATCDialog(const SGPropertyNode* arg) {
38 cerr << "Running doATCDialog" << endl;
39 current_atcdialog->PopupDialog();
43 FGATCDialogNew::FGATCDialogNew()
45 dialogVisible = false;
48 FGATCDialogNew::~FGATCDialogNew()
54 void FGATCDialogNew::init() {
55 // Add ATC-dialog to the command list
56 globals->get_commands()->addCommand("ATC-dialog", doATCDialog);
57 // Add ATC-freq-search to the command list
58 //globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search);
60 // initialize properties polled in Update()
61 //globals->get_props()->setStringValue("/sim/atc/freq-airport", "");
62 //globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
65 // Display the ATC popup dialog box with options relevant to the users current situation.
66 void FGATCDialogNew::PopupDialog() {
67 const char *dialog_name = "atc-dialog";
68 _gui = (NewGUI *)globals->get_subsystem("gui");
69 SGPropertyNode_ptr dlg = _gui->getDialogProperties(dialog_name);
73 _gui->closeDialog(dialog_name);
75 _gui->showDialog(dialog_name);
77 dialogVisible = !dialogVisible;