X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FATC%2Fatcdialog.cxx;h=c59bf959b6b40a07e0764cbd1ba1e83230fa6763;hb=f8a8805e2dde01e0c0a962c283880fa60fa23f0f;hp=a4c75a6113ebd89323af00ac7c7308447e6d84e7;hpb=fa842a42b6e0b312049fff5c653675ad4ae69753;p=flightgear.git diff --git a/src/ATC/atcdialog.cxx b/src/ATC/atcdialog.cxx index a4c75a611..c59bf959b 100644 --- a/src/ATC/atcdialog.cxx +++ b/src/ATC/atcdialog.cxx @@ -91,9 +91,62 @@ void FGATCDialogNew::addEntry(int nr, string txt) { commands.push_back(txt); } +void FGATCDialogNew::removeEntry(int nr) { + commands.clear(); +} + + void FGATCDialogNew::PopupDialog() { - double onBoardRadioFreq0 = + /*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; +} + +void FGATCDialogNew::update(double dt) { + double onBoardRadioFreq0 = fgGetDouble("/instrumentation/comm[0]/frequencies/selected-mhz"); double onBoardRadioFreq1 = fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz"); @@ -136,11 +189,8 @@ void FGATCDialogNew::PopupDialog() { } else { _gui->showDialog(dialog_name); } - dialogVisible = !dialogVisible; + //dialogVisible = !dialogVisible; return; -} - -void FGATCDialogNew::update(double dt) { /* static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true); int n = trans_num->getIntValue();