X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FATC%2Fatcdialog.cxx;h=d2aad836e25e78c93be1381d191f77fb938d160a;hb=ed30b0c9a3818d5b8a306827184ac3525a1d8bdf;hp=c59bf959b6b40a07e0764cbd1ba1e83230fa6763;hpb=348ff2ec23298db4db3b3f2b12d301dec73ec8e1;p=flightgear.git diff --git a/src/ATC/atcdialog.cxx b/src/ATC/atcdialog.cxx index c59bf959b..d2aad836e 100644 --- a/src/ATC/atcdialog.cxx +++ b/src/ATC/atcdialog.cxx @@ -35,15 +35,16 @@ FGATCDialogNew *currentATCDialog; -static bool doATCDialog(const SGPropertyNode* arg) { - cerr << "Running doATCDialog" << endl; +/*static bool doATCDialog(const SGPropertyNode* arg) { + //cerr << "Running doATCDialog" << endl; currentATCDialog->PopupDialog(); return(true); -} +}*/ +FGATCDialogNew * FGATCDialogNew::_instance = NULL; FGATCDialogNew::FGATCDialogNew() { - dialogVisible = false; + dialogVisible = true; } FGATCDialogNew::~FGATCDialogNew() @@ -54,7 +55,7 @@ FGATCDialogNew::~FGATCDialogNew() void FGATCDialogNew::init() { // Add ATC-dialog to the command list - globals->get_commands()->addCommand("ATC-dialog", doATCDialog); + globals->get_commands()->addCommand("ATC-dialog", FGATCDialogNew::popup ); // Add ATC-freq-search to the command list //globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search); @@ -89,6 +90,7 @@ static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name) { void FGATCDialogNew::addEntry(int nr, string txt) { commands.clear(); commands.push_back(txt); + commands.push_back(string("Toggle ground network visibility")); } void FGATCDialogNew::removeEntry(int nr) { @@ -98,49 +100,6 @@ void FGATCDialogNew::removeEntry(int nr) { void FGATCDialogNew::PopupDialog() { - /*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; - - _gui->closeDialog(dialog_name); - SGPropertyNode_ptr button_group = getNamedNode(dlg, "transmission-choice"); - button_group->removeChildren("button", false); - - const int bufsize = 32; - char buf[bufsize]; - int commandNr = 0; - // loop over all entries that should fill up the dialog; use 10 items for now... - for (StringVecIterator i = commands.begin(); i != commands.end(); i++) { - snprintf(buf, bufsize, "/sim/atc/opt[%d]", commandNr); - fgSetBool(buf, false); - SGPropertyNode *entry = button_group->getNode("button", commandNr, true); - copyProperties(button_group->getNode("button-template", true), entry); - entry->removeChildren("enabled", true); - entry->setStringValue("property", buf); - entry->setIntValue("keynum", '1' + commandNr); - if (commandNr == 0) - entry->setBoolValue("default", true); - - snprintf(buf, bufsize, "%d", 1 + commandNr); - string legend = string(buf) + (*i); //"; // + current->menuentry; - entry->setStringValue("legend", legend.c_str()); - entry->setIntValue("binding/value", commandNr); - commandNr++; - //current++; - } -*/ - //if (dialogVisible) { - // _gui->closeDialog(dialog_name); - //} else { - // _gui->showDialog(dialog_name); - //} dialogVisible = !dialogVisible; return; }