Ignore:
Timestamp:
11/14/01 10:03:20 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc

    r1049 r1076  
    258258    return kTRUE;
    259259}
    260    
     260
     261
    261262// --------------------------------------------------------------------------
    262263//
     
    272273}
    273274
     275#include <stdlib.h>       // atof
     276
     277#include <TGFrame.h>      // TGFrame
     278#include <TGLabel.h>      // TGLabel
     279#include <TGTextEntry.h>  // TGTextEntry
     280
     281#include "MGGroupFrame.h" // MGGroupFrame
     282
     283enum {
     284    kImgCleanLvl1,
     285    kImgCleanLvl2
     286};
     287
     288void MImgCleanStd::CreateGuiElements(MGGroupFrame *f)
     289{
     290    //
     291    // Create a frame for line 3 and 4 to be able
     292    // to align entry field and label in one line
     293    //
     294    TGHorizontalFrame *f1 = new TGHorizontalFrame(f, 0, 0);
     295    TGHorizontalFrame *f2 = new TGHorizontalFrame(f, 0, 0);
     296
     297    /*
     298     * --> use with root >=3.02 <--
     299     *
     300
     301     TGNumberEntry *fNumEntry1 = new TGNumberEntry(frame, 3.0, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
     302     TGNumberEntry *fNumEntry2 = new TGNumberEntry(frame, 2.5, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
     303
     304     */
     305    TGTextEntry *entry1 = new TGTextEntry(f1, "****", kImgCleanLvl1);
     306    TGTextEntry *entry2 = new TGTextEntry(f2, "****", kImgCleanLvl2);
     307
     308    // --- doesn't work like expected (until root 3.02?) --- fNumEntry1->SetAlignment(kTextRight);
     309    // --- doesn't work like expected (until root 3.02?) --- fNumEntry2->SetAlignment(kTextRight);
     310
     311    entry1->SetText("3.0");
     312    entry2->SetText("2.5");
     313
     314    entry1->Associate(f);
     315    entry2->Associate(f);
     316
     317    TGLabel *l1 = new TGLabel(f1, "Cleaning Level 1 for standard image cleaning.");
     318    TGLabel *l2 = new TGLabel(f2, "Cleaning Level 2 for standard image cleaning.");
     319
     320    l1->SetTextJustify(kTextLeft);
     321    l2->SetTextJustify(kTextLeft);
     322
     323    //
     324    // Align the text of the label centered, left in the row
     325    // with a left padding of 10
     326    //
     327    TGLayoutHints *laylabel = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10);
     328    TGLayoutHints *layframe = new TGLayoutHints(kLHintsCenterY|kLHintsLeft,  5, 0, 10);
     329
     330    //
     331    // Add one entry field and the corresponding label to each line
     332    //
     333    f1->AddFrame(entry1);
     334    f2->AddFrame(entry2);
     335
     336    f1->AddFrame(l1, laylabel);
     337    f2->AddFrame(l2, laylabel);
     338
     339    f->AddFrame(f1, layframe);
     340    f->AddFrame(f2, layframe);
     341
     342    f->AddToList(entry1);
     343    f->AddToList(entry2);
     344    f->AddToList(l1);
     345    f->AddToList(l2);
     346    f->AddToList(laylabel);
     347    f->AddToList(layframe);
     348}
     349
     350Bool_t MImgCleanStd::ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2)
     351{
     352    if (msg!=kC_TEXTENTRY || submsg!=kTE_ENTER)
     353        return kTRUE;
     354
     355    TGTextEntry *txt = (TGTextEntry*)FindWidget(param1);
     356
     357    if (!txt)
     358        return kTRUE;
     359
     360    Float_t lvl = atof(txt->GetText());
     361
     362    switch (param1)
     363    {
     364    case kImgCleanLvl1:
     365        fCleanLvl1 = lvl;
     366        *fLog << "Cleaning level 1 set to " << lvl << " sigma." << endl;
     367        return kTRUE;
     368
     369    case kImgCleanLvl2:
     370        fCleanLvl2 = lvl;
     371        *fLog << "Cleaning level 2 set to " << lvl << " sigma." << endl;
     372        return kTRUE;
     373    }
     374
     375    return kTRUE;
     376}
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h

    r1014 r1076  
    22#define MARS_MImgCleanStd
    33
    4 #ifndef MARS_MTask
    5 #include "MTask.h"
     4#ifndef MARS_MGTask
     5#include "MGTask.h"
    66#endif
    77
     
    99class MCerPhotEvt;
    1010
    11 class MImgCleanStd : public MTask
     11class MGGroupFrame;
     12
     13class MImgCleanStd : public MGTask
    1214{
    1315private:
    14     const MGeomCam *fCam;
    15           MCerPhotEvt *fEvt;
     16    const MGeomCam    *fCam;  //!
     17          MCerPhotEvt *fEvt;  //!
    1618
    1719    Float_t fCleanLvl1;
    1820    Float_t fCleanLvl2;
     21
     22    void CreateGuiElements(MGGroupFrame *f);
    1923
    2024public:
     
    2630    void CleanStep3();
    2731
    28     Bool_t PreProcess (MParList *pList);
     32    Bool_t PreProcess(MParList *pList);
    2933    Bool_t Process();
     34
     35    Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
    3036
    3137    ClassDef(MImgCleanStd, 0)    // task doing a standard image cleaning
Note: See TracChangeset for help on using the changeset viewer.