Changeset 8821 for trunk


Ignore:
Timestamp:
01/19/08 13:05:23 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/main/MStarguider.cc

    r8376 r8821  
    3434#include "MGStarg.h"
    3535#include "MGNumStars.h"
    36 #include "TGFrame.h"
    3736
    3837#include "MGImage.h"
     
    5352#include "MAstroCamera.h"
    5453
    55 #include "MGMenu.h"
    5654#include "MGCosy.h"
    5755
     
    148146{
    149147    fList = new MGList;
     148    fList->SetOwner();
    150149
    151150    const TGWindow *p=gClient->GetRoot();
    152151
    153     fChannel = new MGPopupMenu(p);
     152    fChannel = new TGPopupMenu(p);
    154153    fChannel->AddEntry("Starfield Camera", IDM_kChannel1);
    155154    fChannel->AddEntry("TPoint Camera",    IDM_kChannel2);
     
    162161    fList->Add(fChannel);
    163162
     163    fFileType = new TGPopupMenu(p);
     164    fFileType->AddEntry("PP&M", IDM_kPPM);
     165    fFileType->AddEntry("&PNG", IDM_kPNG);
     166    fFileType->CheckEntry(IDM_kPNG);
     167    fFileType->Associate(this);
     168    fList->Add(fFileType);
     169
     170    fWriteType = new TGPopupMenu(p);
     171    fWriteType->AddEntry("&Once",      IDM_kOnce);
     172    fWriteType->AddEntry("&Continous", IDM_kContinous);
     173    fWriteType->CheckEntry(IDM_kOnce);
     174    fWriteType->Associate(this);
     175    fList->Add(fWriteType);
     176
     177    fWriteRate = new TGPopupMenu(p);
     178    fWriteRate->AddEntry("25/s", IDM_kRate25ps);
     179    fWriteRate->AddEntry("5/s",  IDM_kRate5ps);
     180    fWriteRate->AddEntry("1s",   IDM_kRate1s);
     181    fWriteRate->AddEntry("5s",   IDM_kRate5s);
     182    fWriteRate->AddEntry("30s",  IDM_kRate30s);
     183    fWriteRate->AddEntry("1min", IDM_kRate1m);
     184    fWriteRate->AddEntry("5min", IDM_kRate5m);
     185    fWriteRate->CheckEntry(IDM_kRate1m);
     186    fWriteRate->Associate(this);
     187    fList->Add(fWriteRate);
     188
     189    fWrtRate = 25*60;
     190
     191    fLimMag = new TGPopupMenu(p);
     192    fLimMag->AddEntry("3", IDM_kLimMag3);
     193    fLimMag->AddEntry("4", IDM_kLimMag4);
     194    fLimMag->AddEntry("5", IDM_kLimMag5);
     195    fLimMag->AddEntry("6", IDM_kLimMag6);
     196    fLimMag->AddEntry("7", IDM_kLimMag7);
     197    fLimMag->AddEntry("8", IDM_kLimMag8);
     198    fLimMag->AddEntry("9", IDM_kLimMag9);
     199    fLimMag->CheckEntry(IDM_kLimMag9);
     200    fLimMag->Associate(this);
     201    fList->Add(fLimMag);
     202
     203    fSao->SetLimitMag(9.0);
     204
     205    fInterpol = new TGPopupMenu(p);
     206    fInterpol->AddEntry("250", IDM_kInterpol250);
     207    fInterpol->AddEntry("125", IDM_kInterpol125);
     208    fInterpol->AddEntry("50",  IDM_kInterpol50);
     209    fInterpol->AddEntry("25",  IDM_kInterpol25);
     210    fInterpol->AddEntry("10",  IDM_kInterpol10);
     211    fInterpol->AddEntry("5",   IDM_kInterpol5);
     212    fInterpol->AddEntry("2",   IDM_kInterpol2);
     213    fInterpol->AddEntry("Off", IDM_kInterpol1);
     214    fInterpol->Associate(this);
     215    fList->Add(fInterpol);
     216
     217    TString disp=gVirtualX->DisplayName();
     218    cout << "Display: " << disp << endl;
     219    if (disp.First(':')>=0)
     220        disp=disp(0, disp.First(':'));
     221
     222    if (disp.IsNull() || disp==(TString)"localhost")
     223    {
     224        fInterpol->CheckEntry(IDM_kInterpol5);
     225        fIntRate = 50;
     226    }
     227    else
     228    {
     229        fInterpol->CheckEntry(IDM_kInterpol125);
     230        fIntRate = 125;
     231    }
     232
     233    fCaosPrint = new TGPopupMenu(p);
     234    fCaosPrint->AddEntry("&Leds",  IDM_kCaosPrintLeds);
     235    fCaosPrint->AddEntry("&Rings", IDM_kCaosPrintRings);
     236    fCaosPrint->Associate(this);
     237    fList->Add(fCaosPrint);
     238
     239    fCaosWrite = new TGPopupMenu(p);
     240    fCaosWrite->AddEntry("&Start", IDM_kCaosWriteStart);
     241    fCaosWrite->AddEntry("Sto&p",  IDM_kCaosWriteStop);
     242    fCaosWrite->DisableEntry(IDM_kCaosWriteStop);
     243    fCaosWrite->Associate(this);
     244    fList->Add(fCaosWrite);
     245
     246    fCaosAnalyse = new TGPopupMenu(p);
     247    fCaosAnalyse->AddEntry("S&tart Analysis", IDM_kCaosAnalStart);
     248    fCaosAnalyse->AddEntry("St&op Analysis",  IDM_kCaosAnalStop);
     249    fCaosAnalyse->DisableEntry(IDM_kCaosAnalStop);
     250    //    fCaosAnalyse->AddEntry("&Reset Histograms", IDM_kResetHistograms);
     251    //    fCaosAnalyse->AddEntry("Reset &Graph", IDM_kResetGraph);
     252    fCaosAnalyse->Associate(this);
     253    fList->Add(fCaosAnalyse);
     254
     255    fMenu = new TGMenuBar(this, 0, 0, kHorizontalFrame);
     256    //fMenu->SetCleanup();
     257    //fMenu->AddPopup("&Display",    fDisplay,         NULL);
     258    //fMenu->AddPopup("&Mode",       fMode,            NULL);
     259    //fMenu->AddPopup("&WritePics",  fWritePictures,   NULL);
     260    //fMenu->AddPopup("&Setup",      fSetup,           NULL);
     261    //fMenu->AddPopup("&Operations", fOperations,      NULL);
     262    fDisplay       = fMenu->AddPopup("&Display");
     263    fMode          = fMenu->AddPopup("&Mode");
     264    fWritePictures = fMenu->AddPopup("&WritePics");
     265    fSetup         = fMenu->AddPopup("&Setup");
     266    fOperations    = fMenu->AddPopup("&Operations");
     267    fMenu->Resize(fMenu->GetDefaultSize());
     268    //fMenu->BindKeys(this);
     269    AddFrame(fMenu);
     270    //fList->Add(fMenu);
     271
    164272    //
    165273    // Create Menu for MStarguider Display
    166274    //
    167     fDisplay = new MGPopupMenu(p);
     275    //fDisplay = new MMGPopupMenu(p);
    168276    fDisplay->AddEntry("&Filter",               IDM_kFilter);
    169277    fDisplay->AddEntry("Stretch",               IDM_kStretch);
     
    182290    fDisplay->CheckEntry(IDM_kStretch);
    183291    fDisplay->Associate(this);
    184     fList->Add(fDisplay);
    185 
    186     fMode = new MGPopupMenu(p);
     292    //fList->Add(fDisplay);
     293
     294    //fMode = new MGPopupMenu(p);
    187295    fMode->AddEntry("Starguider", IDM_kStarguiderMode);
    188296    fMode->AddEntry("Tpoint",     IDM_kTpointMode);
    189297    fMode->Associate(this);
    190     fList->Add(fMode);
    191 
    192     fOperations = new MGPopupMenu(p);
    193     fOperations->AddEntry("Roque Lamp Analysis", IDM_kRoqueLampAna);
    194     fOperations->AddEntry("Starguider Analysis", IDM_kStargAnalysis);
    195     fOperations->DisableEntry(IDM_kStargAnalysis);
    196     fOperations->Associate(this);
    197     fList->Add(fOperations);
    198 
    199 
    200     fFileType = new MGPopupMenu(p);
    201     fFileType->AddEntry("PP&M", IDM_kPPM);
    202     fFileType->AddEntry("&PNG", IDM_kPNG);
    203     fFileType->CheckEntry(IDM_kPNG);
    204     fFileType->Associate(this);
    205     fList->Add(fFileType);
    206 
    207     fWriteType = new MGPopupMenu(p);
    208     fWriteType->AddEntry("&Once",      IDM_kOnce);
    209     fWriteType->AddEntry("&Continous", IDM_kContinous);
    210     fWriteType->CheckEntry(IDM_kOnce);
    211     fWriteType->Associate(this);
    212     fList->Add(fWriteType);
    213 
    214     fWriteRate = new MGPopupMenu(p);
    215     fWriteRate->AddEntry("25/s", IDM_kRate25ps);
    216     fWriteRate->AddEntry("5/s",  IDM_kRate5ps);
    217     fWriteRate->AddEntry("1s",   IDM_kRate1s);
    218     fWriteRate->AddEntry("5s",   IDM_kRate5s);
    219     fWriteRate->AddEntry("30s",  IDM_kRate30s);
    220     fWriteRate->AddEntry("1min", IDM_kRate1m);
    221     fWriteRate->AddEntry("5min", IDM_kRate5m);
    222     fWriteRate->CheckEntry(IDM_kRate1m);
    223     fWriteRate->Associate(this);
    224     fList->Add(fWriteRate);
    225 
    226     fWrtRate = 25*60;
    227 
    228     fWritePictures = new MGPopupMenu(p);
     298    //fList->Add(fMode);
     299
     300    //fWritePictures = new MGPopupMenu(p);
    229301    fWritePictures->AddEntry("&Start",      IDM_kStart);
    230302    fWritePictures->AddEntry("Sto&p",       IDM_kStop);
     
    235307    fWritePictures->DisableEntry(IDM_kStop);
    236308    fWritePictures->Associate(this);
    237     fList->Add(fWritePictures);
    238 
    239     fLimMag = new MGPopupMenu(p);
    240     fLimMag->AddEntry("3", IDM_kLimMag3);
    241     fLimMag->AddEntry("4", IDM_kLimMag4);
    242     fLimMag->AddEntry("5", IDM_kLimMag5);
    243     fLimMag->AddEntry("6", IDM_kLimMag6);
    244     fLimMag->AddEntry("7", IDM_kLimMag7);
    245     fLimMag->AddEntry("8", IDM_kLimMag8);
    246     fLimMag->AddEntry("9", IDM_kLimMag9);
    247     fLimMag->CheckEntry(IDM_kLimMag9);
    248     fLimMag->Associate(this);
    249     fList->Add(fLimMag);
    250 
    251     fSao->SetLimitMag(9.0);
    252 
    253     fInterpol = new MGPopupMenu(p);
    254     fInterpol->AddEntry("250", IDM_kInterpol250);
    255     fInterpol->AddEntry("125", IDM_kInterpol125);
    256     fInterpol->AddEntry("50",  IDM_kInterpol50);
    257     fInterpol->AddEntry("25",  IDM_kInterpol25);
    258     fInterpol->AddEntry("10",  IDM_kInterpol10);
    259     fInterpol->AddEntry("5",   IDM_kInterpol5);
    260     fInterpol->AddEntry("2",   IDM_kInterpol2);
    261     fInterpol->AddEntry("Off", IDM_kInterpol1);
    262     fInterpol->Associate(this);
    263     fList->Add(fInterpol);
    264 
    265     TString disp=gVirtualX->DisplayName();
    266     cout << "Display: " << disp << endl;
    267     if (disp.First(':')>=0)
    268         disp=disp(0, disp.First(':'));
    269 
    270     if (disp.IsNull() || disp==(TString)"localhost")
    271     {
    272         fInterpol->CheckEntry(IDM_kInterpol5);
    273         fIntRate = 50;
    274     }
    275     else
    276     {
    277         fInterpol->CheckEntry(IDM_kInterpol125);
    278         fIntRate = 125;
    279     }
    280 
    281     fSetup = new MGPopupMenu(p);
     309    //fList->Add(fWritePictures);
     310
     311    //fSetup = new MGPopupMenu(p);
    282312    fSetup->AddPopup("Lim. &Magnitude",      fLimMag);
    283313    fSetup->AddPopup("Disp. &Interpolation", fInterpol);
    284314    //fSetup->AddEntry("Use Ra/Dec from file", IDM_kUseFileRaDec);
    285315    fSetup->Associate(this);
    286     fList->Add(fSetup);
    287 
    288     fCaosPrint = new MGPopupMenu(p);
    289     fCaosPrint->AddEntry("&Leds",  IDM_kCaosPrintLeds);
    290     fCaosPrint->AddEntry("&Rings", IDM_kCaosPrintRings);
    291     fCaosPrint->Associate(this);
    292     fList->Add(fCaosPrint);
    293 
    294     fCaosWrite = new MGPopupMenu(p);
    295     fCaosWrite->AddEntry("&Start", IDM_kCaosWriteStart);
    296     fCaosWrite->AddEntry("Sto&p",  IDM_kCaosWriteStop);
    297     fCaosWrite->DisableEntry(IDM_kCaosWriteStop);
    298     fCaosWrite->Associate(this);
    299     fList->Add(fCaosWrite);
    300 
    301     fCaosAnalyse = new MGPopupMenu(p);
    302     fCaosAnalyse->AddEntry("S&tart Analysis", IDM_kCaosAnalStart);
    303     fCaosAnalyse->AddEntry("St&op Analysis",  IDM_kCaosAnalStop);
    304     fCaosAnalyse->DisableEntry(IDM_kCaosAnalStop);
    305     //    fCaosAnalyse->AddEntry("&Reset Histograms", IDM_kResetHistograms);
    306     //    fCaosAnalyse->AddEntry("Reset &Graph", IDM_kResetGraph);
    307     fCaosAnalyse->Associate(this);
    308     fList->Add(fCaosAnalyse);
    309 
    310     fMenu = new MGMenuBar(this, 0, 0, kHorizontalFrame);
    311     fMenu->AddPopup("&Display",    fDisplay,         NULL);
    312     fMenu->AddPopup("&Mode",       fMode,            NULL);
    313     fMenu->AddPopup("&WritePics",  fWritePictures,   NULL);
    314     fMenu->AddPopup("&Setup",      fSetup,           NULL);
    315     fMenu->AddPopup("&Operations", fOperations,      NULL);
    316 
    317     fMenu->Resize(fMenu->GetDefaultSize());
    318     fMenu->BindKeys(this);
    319     AddFrame(fMenu);
    320     fList->Add(fMenu);
    321 
    322     fCaOs = new MGPopupMenu(p);
     316    //fList->Add(fSetup);
     317
     318    //fOperations = new MGPopupMenu(p);
     319    fOperations->AddEntry("Roque Lamp Analysis", IDM_kRoqueLampAna);
     320    fOperations->AddEntry("Starguider Analysis", IDM_kStargAnalysis);
     321    fOperations->DisableEntry(IDM_kStargAnalysis);
     322    fOperations->Associate(this);
     323    //fList->Add(fOperations);
     324
     325    fCaOs = new TGPopupMenu(p);
    323326    fCaOs->AddPopup("&Write",   fCaosWrite);
    324327    fCaOs->AddPopup("&Print",   fCaosPrint);
    325328    fCaOs->AddPopup("&Analyse", fCaosAnalyse);
    326329    fCaOs->Associate(this);
    327     fCaOs->BindKeys(fMenu, this);
     330    //fCaOs->BindKeys(fMenu, this);
    328331    fList->Add(fCaOs);
    329 
     332/*
    330333    TGLayoutHints *hints2a =
    331334        new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|
    332                           kLHintsExpandX|kLHintsExpandY,1,1);
     335                          kLHintsExpandX|kLHintsExpandY,1,1);
    333336    fList->Add(hints2a);
    334 
     337 */
    335338    fGStarg = new MGStarg(this, 235);
    336339    fGStarg->DrawText("0.75'", "1.50'", "3.00'", "Mispointing [min]");
     
    343346    fCRaDec->Move(4, fMenu->GetDefaultHeight()+584);
    344347    AddFrame(fCRaDec);
    345     fList->Add(fCRaDec);
     348    //fList->Add(fCRaDec);
    346349
    347350    //telescope position
     
    349352    fCZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+597);
    350353    AddFrame(fCZdAz);
    351     fList->Add(fCZdAz);
     354    //fList->Add(fCZdAz);
    352355
    353356    //starguider position
     
    355358    fPZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+640);
    356359    AddFrame(fPZdAz);
    357     fList->Add(fPZdAz);
     360    //fList->Add(fPZdAz);
    358361
    359362    //mispointing
     
    361364    fDZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+683);
    362365    AddFrame(fDZdAz);
    363     fList->Add(fDZdAz);
     366    //fList->Add(fDZdAz);
    364367
    365368    fSZdAz = new MGCoordinates(this, kETypeZdAz, 2);
    366369    fSZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+795);
    367370    AddFrame(fSZdAz);
    368     fList->Add(fSZdAz);
     371    //fList->Add(fSZdAz);
    369372
    370373    fGNumStars = new MGNumStars(this, 235);
     
    377380    fTPoint->AllowStayDown(kTRUE);
    378381    AddFrame(fTPoint);
    379     fList->Add(fTPoint);
     382    //fList->Add(fTPoint);
    380383
    381384    fStargTPoint = new TGTextButton(this, "StargTPoint");
     
    383386    fStargTPoint->AllowStayDown(kTRUE);
    384387    AddFrame(fStargTPoint);
    385     fList->Add(fStargTPoint);
     388    //fList->Add(fStargTPoint);
    386389
    387390    fFps = new TGLabel(this, "---fps");
     
    389392    fFps->Move(650-495, fMenu->GetDefaultHeight()+714+23);
    390393    AddFrame(fFps);
    391     fList->Add(fFps);
     394    //fList->Add(fFps);
    392395
    393396    fPosZoom = new TGLabel(this, "(----, ----) ----.--d/----.--d");
     
    395398    fPosZoom->Move(4, fMenu->GetDefaultHeight()+765);
    396399    AddFrame(fPosZoom);
    397     fList->Add(fPosZoom);
     400    //fList->Add(fPosZoom);
    398401
    399402    fSkyBright = new TGLabel(this, "Sky Brightness: ---         ");
     
    401404    fSkyBright->Move(4, fMenu->GetDefaultHeight()+785);
    402405    AddFrame(fSkyBright);
    403     fList->Add(fSkyBright);
     406    //fList->Add(fSkyBright);
    404407
    405408    TGLabel *l = new TGLabel(this, "deg");
     
    407410    l->Move(606-412, fMenu->GetDefaultHeight()+669);
    408411    AddFrame(l);
    409     fList->Add(l);
     412    //fList->Add(l);
    410413
    411414    l = new TGLabel(this, "arcsec/pix");
     
    413416    l->Move(606-412, fMenu->GetDefaultHeight()+692);
    414417    AddFrame(l);
    415     fList->Add(l);
     418    //fList->Add(l);
    416419
    417420    l = new TGLabel(this, "sigma");
     
    419422    l->Move(606-412, fMenu->GetDefaultHeight()+715);
    420423    AddFrame(l);
    421     fList->Add(l);
     424    //fList->Add(l);
    422425
    423426    fCZdAzText = new TGLabel(this, "Zd/Az telescope pointing at");
     
    425428    fCZdAzText->Move(240+12+20+7, fMenu->GetDefaultHeight()+584-5);
    426429    AddFrame(fCZdAzText);
    427     fList->Add(fCZdAzText);
     430    //fList->Add(fCZdAzText);
    428431
    429432    fPZdAzText = new TGLabel(this, "Zd/Az starguider pointing at");
     
    431434    fPZdAzText->Move(240+12+20+7, fMenu->GetDefaultHeight()+630+20-5-23);
    432435    AddFrame(fPZdAzText);
    433     fList->Add(fPZdAzText);
     436    //fList->Add(fPZdAzText);
    434437
    435438    fDZdAzText = new TGLabel(this, "Zd/Az mispointing");
     
    437440    fDZdAzText->Move(240+12+20+7, fMenu->GetDefaultHeight()+676+2*20-5-46);
    438441    AddFrame(fDZdAzText);
    439     fList->Add(fDZdAzText);
     442    //fList->Add(fDZdAzText);
    440443
    441444#ifdef EXPERT
     
    444447    l->Move(240+12+20, fMenu->GetDefaultHeight()+722+3*20-5);
    445448    AddFrame(l);
    446     fList->Add(l);
     449    //fList->Add(l);
    447450#endif
    448451
     
    458461    fAngle->Move(547-410, fMenu->GetDefaultHeight()+667);
    459462    AddFrame(fAngle);
    460     fList->Add(fAngle);
     463    //fList->Add(fAngle);
    461464
    462465    // Set input box for pixel size
     
    472475    fPixSize->Move(547-410, fMenu->GetDefaultHeight()+690);
    473476    AddFrame(fPixSize);
    474     fList->Add(fPixSize);
     477    //fList->Add(fPixSize);
    475478
    476479    // Set input box for cleaning cut
     
    484487    fCut->Move(547-410, fMenu->GetDefaultHeight()+713);
    485488    AddFrame(fCut);
    486     fList->Add(fCut);
     489    //fList->Add(fCut);
    487490
    488491    // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
     
    497500    fZoomImage->Move(4, 700-kZOOM-2+85);
    498501    AddFrame(fZoomImage);
    499     fList->Add(fZoomImage);
     502    //fList->Add(fZoomImage);
    500503
    501504    fImage = new MGImage(this, 768, 576);
    502505    fImage->Move(0, fMenu->GetDefaultHeight());
    503506    AddFrame(fImage);
    504     fList->Add(fImage);
     507    //fList->Add(fImage);
    505508
    506509    const Int_t w = 768;
     
    542545MStarguider::MStarguider(MObservatory::LocationName_t obs, Int_t channel)
    543546    : TGMainFrame(gClient->GetRoot(), 768, 840),
    544       fCosy(NULL),
    545       fOutTp(0),
     547      fNumStarsDetected(0),
     548      fNumStarsCorrelated(0),
     549      fCosy(NULL),
     550      fOutTp(0),
    546551      fOutStargTp(0),
    547552      fOutRq(0),
    548       fDx((768-kZOOM)/2), 
    549       fDy((512-kZOOM)/2), 
     553      fDx((768-kZOOM)/2),
     554      fDy((512-kZOOM)/2),
    550555      fStatus(MDriveCom::kStandby)
    551556{
    552557    cout << " #### FIXME: Make MCaos Thread safe!" << endl;
     558
     559    // This means that all objects added with AddFrame are deleted
     560    // automatically, including all LayoutHints.
     561    SetCleanup();
    553562
    554563    fAmcSocket = new TSocket("amc", 7307);
     
    609618    delete fSao;
    610619    delete fRaDec;
    611     delete fTPoint;//
    612     delete fStargTPoint;//
    613620
    614621    if (fOutTp)
     
    663670}
    664671
    665 void MStarguider::SwitchOff(MGPopupMenu *p, UInt_t id)
     672void MStarguider::SwitchOff(TGPopupMenu *p, UInt_t id)
    666673{
    667674    p->UnCheckEntry(id);
     
    669676}
    670677
    671 void MStarguider::Toggle(MGPopupMenu *p, UInt_t id)
     678void MStarguider::SetChannel()
     679{
     680    if (fChannel->IsEntryChecked(IDM_kChannel3))
     681    {
     682        if (dynamic_cast<PngReader*>(fGetter)==0)
     683        {
     684            delete fGetter;
     685            fGetter=new PngReader(*this);
     686        }
     687    }
     688    else
     689    {
     690        const Int_t ch = fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1;
     691        if (dynamic_cast<Camera*>(fGetter)==0)
     692        {
     693            delete fGetter;
     694            fGetter = new Camera(*this, ch);
     695        }
     696        else
     697            fGetter->SetChannel(ch);
     698    }
     699}
     700
     701void MStarguider::Toggle(TGPopupMenu *p, UInt_t id)
    672702{
    673703    if (p->IsEntryChecked(id))
     
    736766        fGStarg->MapWindow();
    737767        fGNumStars->MapWindow();
    738 
    739         const Int_t ch0 =
    740             fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1;
    741         const Int_t ch1 = 0;
    742 
    743         if (ch0!=ch1)
    744         {
    745 //            fGetter->ExitLoop();
    746             delete fGetter;
    747             usleep(150000); // FIX: Device or resource busy.
    748             if (fChannel->IsEntryChecked(IDM_kChannel3))
    749                 fGetter=new PngReader(*this);
    750             else
    751             {
    752                 fGetter = new Camera(*this, ch1);
    753                 ((Camera*)fGetter)->Loop(0);
    754             }
    755         }
    756768
    757769        SwitchOff(fChannel, IDM_kChannel2);
     
    785797        fOperations->DisableEntry(IDM_kStargAnalysis);
    786798    }
     799
     800    SetChannel();
    787801    //gSystem->Unlink("tracking_error.txt");
    788802}
     
    9911005
    9921006                    //switch camera
    993                     const Int_t ch0 =
    994                         fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1;
    995                     const Int_t ch1 = 1;
    996 
    997                     if (ch0!=ch1)
    998                     {
    999 //                        fGetter->ExitLoop();
    1000                         delete fGetter;
    1001                         usleep(150000); // FIX: Device or resource busy.
    1002                         fGetter = new Camera(*this, ch1);
    1003                         ((Camera*)fGetter)->Loop(0);
    1004                     }
    1005 
    10061007                    SwitchOff(fChannel, IDM_kChannel1);
    10071008                    fChannel->CheckEntry(IDM_kChannel2);
     1009
     1010                    SetChannel();
    10081011
    10091012                    //checking needed items
     
    11821185                    fChannel->CheckEntry  (ch1==0?IDM_kChannel1:IDM_kChannel2);
    11831186                    fChannel->UnCheckEntry(ch1==1?IDM_kChannel1:IDM_kChannel2);
    1184 //                    fGetter->ExitLoop();
    1185                     delete fGetter;
    1186                     usleep(150000); // FIX: Device or resource busy.
    1187                     if (fChannel->IsEntryChecked(IDM_kChannel3))
    1188                         fGetter=new PngReader(*this);
    1189                     else
    1190                     {
    1191                         fGetter = new Camera(*this, ch1);
    1192                         ((Camera*)fGetter)->Loop(0);
    1193                     }
     1187
     1188                    SetChannel();
    11941189                }
    11951190                return kTRUE;
     
    18101805    FilterLed f(img,   768, 576, 2.5); // 2.5
    18111806    FilterLed f2(cimg, 768, 576); // former color 0xb0
    1812    
     1807
    18131808    if (fDisplay->IsEntryChecked(IDM_kStretch))
    18141809        f.Stretch();
    1815    
     1810
    18161811    if (!fWritePictures->IsEntryEnabled(IDM_kStart) &&
    18171812        (!(n%fWrtRate) || fWriteType->IsEntryChecked(IDM_kOnce)))
    18181813    {     
    1819  
     1814
    18201815        if (fFileType->IsEntryChecked(IDM_kPNG))
    18211816            Writer::Png("pix/file", img, tm, fCRaDec->GetCoordinates());
     
    18271822            ProcessMessage(MK_MSG(kC_COMMAND, kCM_MENU), IDM_kStop, 0);
    18281823    }
    1829    
     1824
    18301825    // Visual Filter, whole FOV
    18311826    if (fDisplay->IsEntryChecked(IDM_kFilter))
    18321827        f.Execute();
    1833    
     1828
    18341829    // Find Center of Camera for Caos and Tpoints
    18351830    Ring center(768/2, 576/2);
  • trunk/MagicSoft/Cosy/main/MStarguider.h

    r8377 r8821  
    44#include "PixClient.h"
    55#include "MGImage.h"
    6 #include "coord.h"
     6
     7#include "MPointing.h"
    78
    89#ifndef MARS_MObservatory
     
    2425class TTimer;
    2526
    26 class MGMenuBar;
    27 class MGPopupMenu;
     27class TGMenuBar;
     28class TGPopupMenu;
    2829class TGTextEntry;
    2930
     
    5354    MGList        *fList;
    5455
    55     MGMenuBar     *fMenu;
     56    TGMenuBar     *fMenu;
    5657    MGImage       *fImage;
    5758    MGImage       *fZoomImage;
     
    6061    MGNumStars    *fGNumStars;
    6162
    62     MGPopupMenu   *fDisplay;
    63     MGPopupMenu   *fMode;
    64     MGPopupMenu   *fWritePictures;
    65     MGPopupMenu   *fFileType;
    66     MGPopupMenu   *fWriteType;
    67     MGPopupMenu   *fWriteRate;
    68     MGPopupMenu   *fInterpol;
    69     MGPopupMenu   *fSetup;
    70     MGPopupMenu   *fLimMag;
    71     MGPopupMenu   *fChannel;
    72 
    73     MGPopupMenu   *fOperations;
    74 
    75     MGPopupMenu   *fCaosWrite;
    76     MGPopupMenu   *fCaosPrint;
    77     MGPopupMenu   *fCaosAnalyse;
    78     MGPopupMenu   *fCaOs;
     63    TGPopupMenu   *fDisplay;
     64    TGPopupMenu   *fMode;
     65    TGPopupMenu   *fWritePictures;
     66    TGPopupMenu   *fSetup;
     67    TGPopupMenu   *fOperations;
     68
     69    TGPopupMenu   *fFileType;
     70    TGPopupMenu   *fWriteType;
     71    TGPopupMenu   *fWriteRate;
     72    TGPopupMenu   *fInterpol;
     73    TGPopupMenu   *fLimMag;
     74    TGPopupMenu   *fChannel;
     75
     76    TGPopupMenu   *fCaosWrite;
     77    TGPopupMenu   *fCaosPrint;
     78    TGPopupMenu   *fCaosAnalyse;
     79    TGPopupMenu   *fCaOs;
    7980
    8081    MGCoordinates *fCRaDec;
     
    133134
    134135    void SetPixSize(const double pixsize);
    135     void Toggle(MGPopupMenu *p, UInt_t id);
    136     void SwitchOff(MGPopupMenu *p, UInt_t id);
     136    void Toggle(TGPopupMenu *p, UInt_t id);
     137    void SwitchOff(TGPopupMenu *p, UInt_t id);
    137138    void ToggleStargAnalysis();
    138139    void ToggleFindStar();
    139140    void ToggleStarguider();
    140141    void ToggleCaosFilter();
     142    void SetChannel();
    141143    //void GetCoordinates();
    142144    Int_t CalcTrackingError(Leds &, MStarList &, ZdAz &, MTime &, double &bright, Int_t &num);
     
    145147    bool Interpolate(const unsigned long n, byte *img) const;
    146148
    147     XY FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t, 
    148                      Double_t cut, Int_t box, XY SearchCenter);
     149    XY FindRoqueLamp(FilterLed &f, FilterLed &f2, Ring &CameraCenter, MTime &t,
     150                     Double_t cut, Int_t box, XY SearchCenter);
    149151
    150152    ZdAz FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t,
Note: See TracChangeset for help on using the changeset viewer.