1
0
Fork 0

Some further testing of the ATC Dialog infrastructure.

This commit is contained in:
Durk Talsma 2011-04-05 18:13:11 +02:00
parent 49677f512b
commit ff4004b261
4 changed files with 32 additions and 17 deletions

View file

@ -40,7 +40,10 @@ FGATCManager::~FGATCManager() {
void FGATCManager::init() {
SGSubsystem::init();
dialog.init();
currentATCDialog = new FGATCDialogNew;
currentATCDialog->init();
//dialog.init();
}
void FGATCManager::addController(FGATCController *controller) {

View file

@ -46,7 +46,7 @@ class FGATCManager : public SGSubsystem
{
private:
AtcVec activeStations;
FGATCDialogNew dialog;
//FGATCDialogNew dialog; // note that this variable should really replace the ugly global "currentATCDialog();
public:
FGATCManager();

View file

@ -32,11 +32,11 @@
#include "atcdialog.hxx"
FGATCDialogNew *currentATCDialog;
static bool doATCDialog(const SGPropertyNode* arg) {
cerr << "Running doATCDialog" << endl;
current_atcdialog->PopupDialog();
currentATCDialog->PopupDialog();
return(true);
}
@ -62,18 +62,30 @@ void FGATCDialogNew::init() {
//globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
}
// Display the ATC popup dialog box with options relevant to the users current situation.
//
// So, the first thing we need to do is check the frequency that our pilot's nav radio
// is currently tuned to. The dialog should always contain an option to to tune the
// to a particular frequency,
void FGATCDialogNew::PopupDialog() {
const char *dialog_name = "atc-dialog";
_gui = (NewGUI *)globals->get_subsystem("gui");
SGPropertyNode_ptr dlg = _gui->getDialogProperties(dialog_name);
if (!dlg)
return;
if (dialogVisible) {
_gui->closeDialog(dialog_name);
} else {
_gui->showDialog(dialog_name);
}
dialogVisible = !dialogVisible;
return;
double onBoardRadioFreq0 =
fgGetDouble("/instrumentation/comm[0]/frequencies/selected-mhz");
double onBoardRadioFreq1 =
fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
const char *dialog_name = "atc-dialog";
_gui = (NewGUI *)globals->get_subsystem("gui");
SGPropertyNode_ptr dlg = _gui->getDialogProperties(dialog_name);
if (!dlg)
return;
if (dialogVisible) {
_gui->closeDialog(dialog_name);
} else {
_gui->showDialog(dialog_name);
}
dialogVisible = !dialogVisible;
return;
}

View file

@ -58,6 +58,6 @@ public:
void PopupDialog();
};
extern FGATCDialogNew *current_atcdialog;
extern FGATCDialogNew *currentATCDialog;
#endif // _ATC_DIALOG_HXX_