]> git.mxchange.org Git - flightgear.git/blob - src/ATC/ATCDialog.cxx
a8529499f178a4d6795fa62f21aac50431e90472
[flightgear.git] / src / ATC / ATCDialog.cxx
1 // ATCDialog.cxx - Functions and classes to handle the pop-up ATC dialog
2 //
3 // Written by Alexander Kappes and David Luff, started February 2003.
4 //
5 // Copyright (C) 2003  Alexander Kappes and David Luff
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 #include <simgear/compiler.h>
22
23 #include <simgear/structure/commands.hxx>
24
25 #include <Main/globals.hxx>
26 #include <GUI/gui.h>
27
28 #include "ATCDialog.hxx"
29 #include "ATC.hxx"
30 #include "ATCmgr.hxx"
31 #include "commlist.hxx"
32 #include "ATCutils.hxx"
33 #include <Airports/simple.hxx>
34
35 #include <sstream>
36
37 SG_USING_STD(ostringstream);
38
39 static void atcUppercase(string &s) {
40         for(unsigned int i=0; i<s.size(); ++i) {
41                 s[i] = toupper(s[i]);
42         }
43 }
44
45 FGATCDialog *current_atcdialog;
46
47 // For the command manager - maybe eventually this should go in the built in command list
48 static bool do_ATC_dialog(const SGPropertyNode* arg) {
49         globals->get_ATC_mgr()->doPopupDialog();
50         return(true);
51 }
52
53 static bool do_ATC_freq_search(const SGPropertyNode* arg) {
54         current_atcdialog->FreqDialog();
55         return(true);
56 }
57
58 ATCMenuEntry::ATCMenuEntry() {
59   stationid    = "";
60   stationfr    = 0;
61   transmission = "";
62   menuentry    = "";
63 }
64
65 ATCMenuEntry::~ATCMenuEntry() {
66 }
67
68 static char* t0 = "No communication currently available";
69 //static char* t1 = "Request departure clearance";
70 //static char* t2 = "Report Runway vacated";
71 static char** towerOptions = new char*[2];
72
73 // ----------------------- DCL ------------------------------------------
74 // For the ATC dialog - copied from the Autopilot new heading dialog code!
75 static puDialogBox*             atcDialog;
76 static puFrame*                 atcDialogFrame;
77 static puText*                  atcDialogMessage;
78 //static puInput*                       atcDialogInput;
79 static puOneShot*               atcDialogOkButton;
80 static puOneShot*               atcDialogCancelButton;
81 static puButtonBox*             atcDialogCommunicationOptions;
82 // ----------------------------------------------------------------------
83
84 //////////////////////////////////////////////////////
85 //
86 //  STUFF FOR THE FREQUENCY SEARCH DIALOG
87 //
88 //////////////////////////////////////////////////////
89
90 static const int ATC_MAX_FREQ_DISPLAY = 20;             // Maximum number of frequencies that can be displayed for any one airport
91
92 static puDialogBox*     atcFreqDialog;
93 static puFrame*         atcFreqDialogFrame;
94 static puText*          atcFreqDialogMessage;
95 static puInput*         atcFreqDialogInput;
96 static puOneShot*       atcFreqDialogOkButton;
97 static puOneShot*       atcFreqDialogCancelButton;
98
99 static puDialogBox*     atcFreqDisplay;
100 static puFrame*         atcFreqDisplayFrame;
101 static puText*          atcFreqDisplayMessage;
102 static puOneShot*       atcFreqDisplayOkButton;
103 static puText*          atcFreqDisplayText[ATC_MAX_FREQ_DISPLAY];
104         
105 static void FreqDialogCancel(puObject*) {
106         FG_POP_PUI_DIALOG(atcFreqDialog);
107 }
108
109 static void FreqDialogOK(puObject*) {
110         string tmp = atcFreqDialogInput->getStringValue();
111         FG_POP_PUI_DIALOG(atcFreqDialog);
112         current_atcdialog->FreqDisplay(tmp);
113 }
114
115 static void FreqDisplayOK(puObject*) {
116         FG_POP_PUI_DIALOG(atcFreqDisplay);
117 }
118
119 ////////////// end freq search statics ///////////////
120
121 // ------------------------ AK ------------------------------------------
122 static puDialogBox  *ATCMenuBox = 0;
123 static puFrame      *ATCMenuFrame = 0;
124 static puText       *ATCMenuBoxMessage = 0;
125 static puButtonBox      *ATCOptionsList = 0;
126 // ----------------------------------------------------------------------
127
128 // AK
129 static void AKATCDialogOK(puObject *)
130 {
131         switch(ATCOptionsList->getValue()) {
132         case 0:
133                 //cout << "Option 0 chosen\n";
134                 fgSetBool("/sim/atc/opt0",true);
135                 break;
136         case 1:
137                 //cout << "Option 1 chosen\n";
138                 fgSetBool("/sim/atc/opt1",true);
139                 break;
140         case 2:
141                 //cout << "Option 2 chosen\n";
142                 fgSetBool("/sim/atc/opt2",true);
143                 break;
144         case 3:
145                 //cout << "Option 2 chosen\n";
146                 fgSetBool("/sim/atc/opt3",true);
147                 break;
148         default:
149                 break;
150         }
151         FG_POP_PUI_DIALOG( ATCMenuBox );
152 }
153
154 // AK
155 static void AKATCDialogCancel(puObject *)
156 {
157     FG_POP_PUI_DIALOG( ATCMenuBox );
158 }
159
160 // DCL
161 static void ATCDialogCancel(puObject *)
162 {
163     //ATCDialogInput->rejectInput();
164     FG_POP_PUI_DIALOG( atcDialog );
165 }
166
167 // DCL
168 static void ATCDialogOK (puObject *me)
169 {
170         // Note that currently the dialog is hardwired to comm1 only here.
171         switch(globals->get_ATC_mgr()->GetComm1ATCType()) {
172         case INVALID:
173                 break;
174         case ATIS:
175                 break;
176         case TOWER: {
177                 /*
178                 FGTower* twr = (FGTower*)globals->get_ATC_mgr()->GetComm1ATCPointer();
179                 switch(atcDialogCommunicationOptions->getValue()) {
180                 case 0:
181                         //cout << "Option 0 chosen\n";
182                         twr->RequestLandingClearance("charlie foxtrot sierra");
183                         break;
184                 case 1:
185                         //cout << "Option 1 chosen\n";
186                         twr->RequestDepartureClearance("charlie foxtrot sierra");
187                         break;
188                 case 2:
189                         //cout << "Option 2 chosen\n";
190                         twr->ReportRunwayVacated("charlie foxtrot sierra");
191                         break;
192                 default:
193                         break;
194                 }
195                 */
196                 break;
197         }
198         case GROUND:
199                 break;
200         case APPROACH:
201                 break;
202         default:
203                 break;
204         }
205
206     ATCDialogCancel(me);
207     //if(error) mkDialog(s.c_str());
208 }
209
210 // DCL
211 static void ATCDialog(puObject *cb)
212 {
213     FG_PUSH_PUI_DIALOG(atcDialog);
214 }
215
216 // DCL
217 void ATCDialogInit()
218 {
219         char defaultATCLabel[] = "Enter desired option to communicate with ATC:";
220         char *s;
221
222         // Option lists hardwired per ATC type  
223         towerOptions[0] = new char[strlen(t0)+1];
224         strcpy(towerOptions[0], t0);
225         //towerOptions[1] = new char[strlen(t1)+1];
226         //strcpy(towerOptions[1], t1);
227         //towerOptions[2] = new char[strlen(t2)+1];
228         //strcpy(towerOptions[2], t2);
229         towerOptions[1] = NULL;
230         
231         atcDialog = new puDialogBox (150, 50);
232         {
233                 atcDialogFrame   = new puFrame (0, 0, 500, 250);
234                 
235                 atcDialogMessage = new puText          (250, 220);
236                 atcDialogMessage    -> setDefaultValue (defaultATCLabel);
237                 atcDialogMessage    -> getDefaultValue (&s);
238                 atcDialogMessage    -> setLabel        (s);
239                 atcDialogMessage    -> setLabelPlace   (PUPLACE_TOP_CENTERED);
240
241                 atcDialogCommunicationOptions = new puButtonBox (50, 50, 450, 210, NULL, true);
242                 
243                 atcDialogOkButton     =  new puOneShot         (50, 10, 110, 50);
244                 atcDialogOkButton     ->     setLegend         (gui_msg_OK);
245                 atcDialogOkButton     ->     makeReturnDefault (TRUE);
246                 atcDialogOkButton     ->     setCallback       (ATCDialogOK);
247                 
248                 atcDialogCancelButton =  new puOneShot         (140, 10, 210, 50);
249                 atcDialogCancelButton ->     setLegend         (gui_msg_CANCEL);
250                 atcDialogCancelButton ->     setCallback       (ATCDialogCancel);
251                 
252         }
253         FG_FINALIZE_PUI_DIALOG(atcDialog);
254         
255         // Add ATC-dialog to the command list
256         globals->get_commands()->addCommand("ATC-dialog", do_ATC_dialog);
257 }
258
259 ///////////////////////////////////////////////////////////////////////
260 //
261 // ATCDoDialog is in a state of flux at the moment
262 // Stations other than approach are handled by DCL's simple code
263 // Approach is handled by AK's fancy dynamic-list code
264 // Hopefully all interactive stations should go to AK's code eventually
265 //
266 ///////////////////////////////////////////////////////////////////////
267 void ATCDoDialog(atc_type type) {
268         switch(type) {
269         case INVALID:
270                 atcDialogCommunicationOptions->newList(NULL);
271                 atcDialogMessage->setLabel("Not tuned in to any ATC service.");
272                 break;
273         case ATIS:
274                 atcDialogCommunicationOptions->newList(NULL);
275                 atcDialogMessage->setLabel("Tuned in to ATIS: no communication possible.");
276                 break;
277         case TOWER: 
278                 atcDialogCommunicationOptions->newList(towerOptions);
279                 atcDialogMessage->setLabel("Tuned in to Tower - select communication to transmit:");
280                 break;
281         case GROUND:
282                 atcDialogCommunicationOptions->newList(NULL);
283                 atcDialogMessage->setLabel("Tuned in to Ground - select communication to transmit:");
284                 break;
285         case APPROACH:
286                 current_atcdialog->DoDialog();
287                 break;
288         default:
289                 atcDialogCommunicationOptions->newList(NULL);
290                 atcDialogMessage->setLabel("Tuned in to unknown ATC service - enter transmission:");
291                 break;
292         }
293
294         // Third - display the dialog without pausing sim.
295         if(type != APPROACH) {  
296                 ATCDialog(NULL);
297         }
298 }
299
300 FGATCDialog::FGATCDialog() {
301 }
302
303 FGATCDialog::~FGATCDialog() {
304         if(atcFreqDialog) puDeleteObject(atcFreqDialog);
305         if(atcFreqDisplay) puDeleteObject(atcFreqDisplay);
306         if(ATCMenuBox) puDeleteObject(ATCMenuBox);
307 }
308
309 void FGATCDialog::Init() {
310         // Add ATC-freq-search to the command list
311         globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search);
312         
313         int w;
314         int h;
315         int x;
316         int y;
317         
318         // Init the freq-search dialog
319         w = 300;
320         h = 150;
321         x = (fgGetInt("/sim/startup/xsize") / 2) - (w / 2);
322         y = 50;
323         char *s;
324         atcFreqDialog = new puDialogBox (x, y);
325         {
326                 atcFreqDialogFrame = new puFrame (0, 0, w, h);
327                 atcFreqDialogMessage = new puText          (40, (h - 30));
328                 atcFreqDialogMessage->setDefaultValue ("Enter airport identifier:");
329                 atcFreqDialogMessage->getDefaultValue (&s);
330                 atcFreqDialogMessage->setLabel(s);
331         
332                 atcFreqDialogInput = new puInput (50, (h - 75), 150, (h - 45));
333                         
334                 atcFreqDialogOkButton     =  new puOneShot         (50, 10, 110, 50);
335                 atcFreqDialogOkButton     ->     setLegend         (gui_msg_OK);
336                 atcFreqDialogOkButton     ->     makeReturnDefault (TRUE);
337                 atcFreqDialogOkButton     ->     setCallback       (FreqDialogOK);
338                         
339                 atcFreqDialogCancelButton =  new puOneShot         (140, 10, 210, 50);
340                 atcFreqDialogCancelButton ->     setLegend         (gui_msg_CANCEL);
341                 atcFreqDialogCancelButton ->     setCallback       (FreqDialogCancel);
342                 
343                 atcFreqDialogInput->acceptInput();
344         }
345         
346         FG_FINALIZE_PUI_DIALOG(atcFreqDialog);
347         
348         // Init the freq-display dialog
349         w = 400;
350         h = 100;
351         x = (fgGetInt("/sim/startup/xsize") / 2) - (w / 2);
352         y = 50;
353         atcFreqDisplay = new puDialogBox (x, y);
354         {
355                 atcFreqDisplayFrame   = new puFrame (0, 0, w, h);
356                 
357                 atcFreqDisplayMessage = new puText          (40, (h - 30));
358                 atcFreqDisplayMessage    -> setDefaultValue ("No freqencies found");
359                 atcFreqDisplayMessage    -> getDefaultValue (&s);
360                 atcFreqDisplayMessage    -> setLabel        (s);
361                 
362                 for(int i=0; i<ATC_MAX_FREQ_DISPLAY; ++i) {
363                         atcFreqDisplayText[i] = new puText(40, h - 65 - (30 * i));
364                         atcFreqDisplayText[i]->setDefaultValue("");
365                         atcFreqDisplayText[i]-> getDefaultValue (&s);
366                         atcFreqDisplayText[i]-> setLabel        (s);
367                         atcFreqDisplayText[i]->hide();
368                 }
369                 
370                 atcFreqDisplayOkButton     =  new puOneShot         (50, 10, 110, 50);
371                 atcFreqDisplayOkButton     ->     setLegend         (gui_msg_OK);
372                 atcFreqDisplayOkButton     ->     makeReturnDefault (TRUE);
373                 atcFreqDisplayOkButton     ->     setCallback       (FreqDisplayOK);
374         }
375         FG_FINALIZE_PUI_DIALOG(atcFreqDisplay);
376         
377         // Init AK's interactive ATC menus
378         w = 500;
379         h = 110;
380         x = (fgGetInt("/sim/startup/xsize") / 2) - (w / 2);
381         //y = (fgGetInt("/sim/startup/ysize") / 2) - (h / 2);
382         y = 50;
383         ATCMenuBox = new puDialogBox (x, y);
384         {
385                 ATCMenuFrame = new puFrame (0,0,w,h);
386                 ATCMenuBoxMessage = new puText (w / 2, h - 30);
387                 ATCMenuBoxMessage -> setLabel( "No transmission available" );
388                 ATCMenuBoxMessage -> setLabelPlace(PUPLACE_TOP_CENTERED);
389                 ATCOptionsList = new puButtonBox (50, 60, 450, 50, NULL, true);
390                 ATCOptionsList -> hide();
391                 atcDialogOkButton     =  new puOneShot         ((w/2)-85, 10, (w/2)-25, 50);
392                 atcDialogOkButton     ->     setLegend         (gui_msg_OK);
393                 atcDialogOkButton     ->     makeReturnDefault (TRUE);
394                 atcDialogOkButton     ->     setCallback       (AKATCDialogOK);
395                 
396                 atcDialogCancelButton =  new puOneShot         ((w/2)+25, 10, (w/2)+85, 50);
397                 atcDialogCancelButton ->     setLegend         (gui_msg_CANCEL);
398                 atcDialogCancelButton ->     setCallback       (AKATCDialogCancel);
399         }
400         FG_FINALIZE_PUI_DIALOG(ATCMenuBox);
401 }
402
403 // AK
404 // Add an entry
405 void FGATCDialog::add_entry(string station, string transmission, string menutext ) {
406   
407   ATCMenuEntry a;
408
409   a.stationid = station;
410   a.transmission = transmission;
411   a.menuentry = menutext;
412
413   atcmentrylist_station[station.c_str()].push_back(a);
414
415 }
416
417 // AK
418 // query the database whether the transmission is already registered; 
419 bool FGATCDialog::trans_reg( const string &station, const string &trans ) {
420
421   atcmentry_list_type     atcmlist = atcmentrylist_station[station];
422   atcmentry_list_iterator current  = atcmlist.begin();
423   atcmentry_list_iterator last     = atcmlist.end();
424   
425   for ( ; current != last ; ++current ) {
426     if ( current->transmission == trans ) return true;
427   }
428   return false;
429 }
430
431 // AK
432 // ===================================================
433 // ===  Update ATC menue and look for keys pressed ===
434 // ===================================================
435 void FGATCDialog::DoDialog() {
436         
437         static string mentry[10];
438         static string mtrans[10];
439         char   buf[10];
440         TransPar TPar;
441         FGATC* atcptr = globals->get_ATC_mgr()->GetComm1ATCPointer();   // Hardwired to comm1 at the moment
442         
443         if(atcptr != NULL) {
444                 
445                 atcmentry_list_type     atcmlist = atcmentrylist_station[atcptr->get_ident()];
446                 //atcmentry_list_type     atcmlist = atcmentrylist_station["EGNX"];
447                 atcmentry_list_iterator current  = atcmlist.begin();
448                 atcmentry_list_iterator last     = atcmlist.end();
449                 
450                 // Set all opt flags to false before displaying box
451                 fgSetBool("/sim/atc/opt0",false);
452                 fgSetBool("/sim/atc/opt1",false);
453                 fgSetBool("/sim/atc/opt2",false);
454                 fgSetBool("/sim/atc/opt3",false);
455                 fgSetBool("/sim/atc/opt4",false);
456                 fgSetBool("/sim/atc/opt5",false);
457                 fgSetBool("/sim/atc/opt6",false);
458                 fgSetBool("/sim/atc/opt7",false);
459                 fgSetBool("/sim/atc/opt8",false);
460                 fgSetBool("/sim/atc/opt9",false);
461                 
462                 int w = 500;
463                 int k = atcmlist.size();
464                 int h = 110 + k * 25;
465                 //cout << "k = " << k << '\n';
466                 
467                 ATCMenuFrame->setSize(w, h); 
468                 
469                 if(k) { 
470                         // loop over all entries in atcmentrylist
471                         char** optList = new char*[k+1];
472                         int kk = 0;
473                         for ( ; current != last ; ++current ) {
474                                 string dum;
475                                 sprintf( buf, "%i", kk+1 );
476                                 buf[1] = '\0';
477                                 dum = buf;
478                                 mentry[kk] = dum + ". " + current->menuentry;
479                                 optList[kk] = new char[strlen(mentry[kk].c_str()) + 1];
480                                 strcpy(optList[kk], mentry[kk].c_str());
481                                 //cout << "optList[" << kk << "] = " << optList[kk] << endl; 
482                                 mtrans[kk] =              current->transmission;
483                                 ++kk;
484                         } 
485                         optList[k] = NULL;
486                         ATCOptionsList->newList(optList);
487                         ATCOptionsList->setSize(w-100, h-100);
488                         ATCOptionsList->reveal();
489                         ATCMenuBoxMessage -> setLabel( "ATC Menu" );
490                         ATCMenuBoxMessage -> setPosition(w / 2, h - 30);
491                 } else {
492                         ATCOptionsList->hide();
493                         ATCMenuBoxMessage ->     setLabel( "No transmission available" );
494                         ATCMenuBoxMessage -> setPosition(w / 2, h - 20);
495                 }
496                 
497                 FG_PUSH_PUI_DIALOG( ATCMenuBox );
498                 
499                 /*      
500                 if ( atckey != -1 && TransDisplayed && mtrans[atckey-1].c_str() != "" ) {
501                         cout << mtrans[atckey-1].c_str() << endl;
502                         TPar = current_transmissionlist->extract_transpar( mtrans[atckey-1].c_str() );
503                         current_atcmentrylist->reset = true;
504                         current_transparlist->add_entry( TPar );
505                         
506                         //    transpar_list_type test = current_transparlist;
507                         // transpar_list_iterator current = test.begin();
508                         //for ( ; current != test.end(); ++current ) {
509                                 // current->tpar.intention;
510                         //}
511                 }
512                 
513                 if ( current_atcmentrylist->freq != (int)(comm1_freq*100.0 + 0.5) ) {
514                         current_atcmentrylist->reset = true;
515                 }
516                 
517                 // reset (delete) ATCmenue list if reset is true
518                 if ( current_atcmentrylist->reset == true ) {
519                         delete ( current_atcmentrylist );
520                         current_atcmentrylist = new FGatcmentryList;
521                         current_atcmentrylist->init( (int)(comm1_freq*100.0 + 0.5) );
522                         if ( TransDisplayed ) {
523                                 FG_POP_PUI_DIALOG( ATCMenuBox ); 
524                                 TransDisplayed = false;
525                         }
526                 }
527                 */      
528         }
529 }
530
531
532
533 void FGATCDialog::FreqDialog() {
534
535         // Find the ATC stations within a reasonable range (about 40 miles?)
536         //comm_list_type atc_stations;
537         //comm_list_iterator atc_stat_itr;
538         
539         //double lon = fgGetDouble("/position/longitude-deg");
540         //double lat = fgGetDouble("/position/latitude-deg");
541         //double elev = fgGetDouble("/position/altitude-ft");
542         
543         /*
544         // search stations in range
545         int num_stat = current_commlist->FindByPos(lon, lat, elev, 40.0, &atc_stations);
546         if (num_stat != 0) {
547         } else {
548                 // Make up a message saying no things in range
549         }
550         */
551         
552         // TODO - it would be nice to display a drop-down list of airports within the general vicinity of the user
553         //        in addition to the general input box (started above).
554         
555         atcFreqDialogInput->setValue("");
556         atcFreqDialogInput->acceptInput();
557         FG_PUSH_PUI_DIALOG(atcFreqDialog);
558 }
559
560 void FGATCDialog::FreqDisplay(string ident) {
561
562         atcUppercase(ident);
563         
564         string label;
565         char *s;
566         
567         int n = 0;      // Number of ATC frequencies at this airport
568         string freqs[ATC_MAX_FREQ_DISPLAY];
569         char buf[8];
570
571     FGAirport a;
572     if ( dclFindAirportID( ident, &a ) ) {
573                 comm_list_type stations;
574                 int found = current_commlist->FindByPos(a.longitude, a.latitude, a.elevation, 20.0, &stations);
575                 if(found) {
576                         ostringstream ostr;
577                         comm_list_iterator itr = stations.begin();
578                         while(itr != stations.end()) {
579                                 if((*itr).ident == ident) {
580                                         if((*itr).type != INVALID) {
581                                                 ostr << (*itr).type;
582                                                 freqs[n] = ostr.str();
583                                                 freqs[n].append("     -     ");
584                                                 sprintf(buf, "%.2f", ((*itr).freq / 100.0));    // Convert from KHz to MHz
585                                                 // Hack alert!
586                                                 if(buf[5] == '3') buf[5] = '2';
587                                                 if(buf[5] == '8') buf[5] = '7';
588                                                 freqs[n] += buf;
589                                                 ostr.seekp(0);
590                                                 n++;
591                                         }
592                                 }
593                                 ++itr;
594                         }
595                 }
596                 if(n == 0) {
597                         label = "No frequencies found for airport ";
598                         label += ident;
599                 } else {
600                         label = "Frequencies for airport ";
601                         label += ident;
602                         label += ":";
603                 }
604     } else {
605                 label = "Airport ";
606                 label += ident;
607                 label += " not found in database.";
608         }
609
610         int hsize = 105 + (n * 30);
611         
612         atcFreqDisplayFrame->setSize(400, hsize);
613         
614         atcFreqDisplayMessage -> setPosition (40, (hsize - 30));
615         atcFreqDisplayMessage -> setValue    (label.c_str());
616         atcFreqDisplayMessage -> getValue    (&s);
617         atcFreqDisplayMessage -> setLabel    (s);
618         
619         for(int i=0; i<n; ++i) {
620                 atcFreqDisplayText[i] -> setPosition(40, hsize - 65 - (30 * i));
621                 atcFreqDisplayText[i] -> setValue(freqs[i].c_str());
622                 atcFreqDisplayText[i] -> getValue (&s);
623                 atcFreqDisplayText[i] -> setLabel (s);
624                 atcFreqDisplayText[i] -> reveal();
625         }
626         for(int j=n; j<ATC_MAX_FREQ_DISPLAY; ++j) {
627                 atcFreqDisplayText[j] -> hide();
628         }
629         
630         FG_PUSH_PUI_DIALOG(atcFreqDisplay);
631         
632 }
633