]> git.mxchange.org Git - flightgear.git/commitdiff
Some further testing of the ATC Dialog infrastructure.
authorDurk Talsma <durk@localhost.(none)>
Tue, 5 Apr 2011 16:13:11 +0000 (18:13 +0200)
committerDurk Talsma <durk@localhost.(none)>
Tue, 5 Apr 2011 16:13:11 +0000 (18:13 +0200)
src/ATC/atc_mgr.cxx
src/ATC/atc_mgr.hxx
src/ATC/atcdialog.cxx
src/ATC/atcdialog.hxx

index 111816cab60eadb5bceebb358edccac92caf7e6c..ba71c608735255e169b91bee156eeb82283f28f9 100644 (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) {
index bef72695de5099eb2e4d0a826d9ee610fb71216c..c34c82446f03eb235a4d50d9c7c997d15199b703 100644 (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();
index 43bdd4049f024509361427d0f449e0f6c5b9bd2b..d77a20187395b5d239f2a2774a287681ef5432e9 100644 (file)
 
 #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;
 }
index 1a54debfbb7d8a6810d988c0c78dfbba0f1d75f2..2e0aa2f74ab6dc93025b07f2dfca446ecea1ee1a 100644 (file)
@@ -58,6 +58,6 @@ public:
     void PopupDialog();
 };
 
-extern FGATCDialogNew *current_atcdialog;
+extern FGATCDialogNew *currentATCDialog;
 
 #endif // _ATC_DIALOG_HXX_
\ No newline at end of file