Some further testing of the ATC Dialog infrastructure.
This commit is contained in:
parent
49677f512b
commit
ff4004b261
4 changed files with 32 additions and 17 deletions
|
@ -40,7 +40,10 @@ FGATCManager::~FGATCManager() {
|
||||||
|
|
||||||
void FGATCManager::init() {
|
void FGATCManager::init() {
|
||||||
SGSubsystem::init();
|
SGSubsystem::init();
|
||||||
dialog.init();
|
currentATCDialog = new FGATCDialogNew;
|
||||||
|
currentATCDialog->init();
|
||||||
|
|
||||||
|
//dialog.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGATCManager::addController(FGATCController *controller) {
|
void FGATCManager::addController(FGATCController *controller) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ class FGATCManager : public SGSubsystem
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
AtcVec activeStations;
|
AtcVec activeStations;
|
||||||
FGATCDialogNew dialog;
|
//FGATCDialogNew dialog; // note that this variable should really replace the ugly global "currentATCDialog();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGATCManager();
|
FGATCManager();
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
|
|
||||||
#include "atcdialog.hxx"
|
#include "atcdialog.hxx"
|
||||||
|
|
||||||
|
FGATCDialogNew *currentATCDialog;
|
||||||
|
|
||||||
static bool doATCDialog(const SGPropertyNode* arg) {
|
static bool doATCDialog(const SGPropertyNode* arg) {
|
||||||
cerr << "Running doATCDialog" << endl;
|
cerr << "Running doATCDialog" << endl;
|
||||||
current_atcdialog->PopupDialog();
|
currentATCDialog->PopupDialog();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,18 +62,30 @@ void FGATCDialogNew::init() {
|
||||||
//globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
|
//globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Display the ATC popup dialog box with options relevant to the users current situation.
|
// 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() {
|
void FGATCDialogNew::PopupDialog() {
|
||||||
const char *dialog_name = "atc-dialog";
|
double onBoardRadioFreq0 =
|
||||||
_gui = (NewGUI *)globals->get_subsystem("gui");
|
fgGetDouble("/instrumentation/comm[0]/frequencies/selected-mhz");
|
||||||
SGPropertyNode_ptr dlg = _gui->getDialogProperties(dialog_name);
|
double onBoardRadioFreq1 =
|
||||||
if (!dlg)
|
fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
|
||||||
return;
|
|
||||||
if (dialogVisible) {
|
const char *dialog_name = "atc-dialog";
|
||||||
_gui->closeDialog(dialog_name);
|
_gui = (NewGUI *)globals->get_subsystem("gui");
|
||||||
} else {
|
SGPropertyNode_ptr dlg = _gui->getDialogProperties(dialog_name);
|
||||||
_gui->showDialog(dialog_name);
|
if (!dlg)
|
||||||
}
|
return;
|
||||||
dialogVisible = !dialogVisible;
|
|
||||||
return;
|
if (dialogVisible) {
|
||||||
|
_gui->closeDialog(dialog_name);
|
||||||
|
} else {
|
||||||
|
_gui->showDialog(dialog_name);
|
||||||
|
}
|
||||||
|
dialogVisible = !dialogVisible;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,6 @@ public:
|
||||||
void PopupDialog();
|
void PopupDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FGATCDialogNew *current_atcdialog;
|
extern FGATCDialogNew *currentATCDialog;
|
||||||
|
|
||||||
#endif // _ATC_DIALOG_HXX_
|
#endif // _ATC_DIALOG_HXX_
|
Loading…
Add table
Reference in a new issue