Ignore:
Timestamp:
11/16/01 15:59:05 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mmain
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mmain/MAnalysis.cc

    r1082 r1086  
    3131#include <TGTextEntry.h>   // TGNumberEntry
    3232
     33#include "MGList.h"
    3334#include "MImgCleanStd.h"  // MImgCleanStd
    3435
     
    3637
    3738enum {
    38     kButHillas
     39    kButHillas = 0x100
    3940};
    4041
  • trunk/MagicSoft/Mars/mmain/MBrowser.cc

    r1082 r1086  
    2626#include "MBrowser.h"
    2727
     28#include <iostream.h>
     29#include <sys/stat.h>       // S_ISDIR
     30
    2831#include <TSystem.h>        // gSystem
    2932
    3033#include <TGTab.h>          // TGTab
    3134#include <TGMenu.h>         // TGPopupMenu
     35#include <TG3DLine.h>       // TGHorizontal3DLine
    3236#include <TGButton.h>       // TGTextButton
    3337#include <TGMsgBox.h>       // TGMsgBox
    3438#include <TBrowser.h>       // TBrowser
    35 #include <TGListBox.h>      // TGListBox
    3639#include <TGTextEntry.h>    // TGTextEntry
    3740#include <TGFSComboBox.h>   // TGFSComboBox, TGFSLboxEntry
     
    3942#include <TGFSContainer.h>  // TGFileContainer
    4043
    41 #include <TG3DLine.h>       // TGHorizontal3DLine
    42                             // use TGSplitter.h for root<3.00
    43 
    44 #include <sys/stat.h>       // S_ISDIR
    45 
    46 #include <iostream.h>
     44#include "MGList.h"
    4745
    4846ClassImp(MBrowser);
     
    5553    kButDetailMode,
    5654    kCBDirectory,
     55    kCBFilter,
    5756    kTEFileName
    5857};
     
    116115    // Create Dir-Listbox and buttons in first frame
    117116    //
    118     fDir = new TGFSComboBox(frame, kCBDirectory);
    119     fDir->Resize(350, 20);
     117    TGFSComboBox *dir = new TGFSComboBox(frame, kCBDirectory);
     118    dir->SetHeight(fEntry->GetHeight());
    120119
    121120    //
    122121    // Get the three picturs from the system (must be deleted by FreePicture)
    123122    //
    124     fPic1 = fClient->GetPicture("tb_uplevel.xpm");
    125     fPic2 = fClient->GetPicture("tb_list.xpm");
    126     fPic3 = fClient->GetPicture("tb_details.xpm");
     123    const TGPicture *pic1 = fList->GetPicture("tb_uplevel.xpm");
     124    const TGPicture *pic2 = fList->GetPicture("tb_list.xpm");
     125    const TGPicture *pic3 = fList->GetPicture("tb_details.xpm");
    127126
    128127    //
    129128    // Create the corresponding picture buttons
    130129    //
    131     fCdup     = new TGPictureButton(frame, fPic1, kButDirUp);
    132     fListMode = new TGPictureButton(frame, fPic2, kButListMode);
    133     fDetail   = new TGPictureButton(frame, fPic3, kButDetailMode);
     130    TGPictureButton *cdup   = new TGPictureButton(frame, pic1, kButDirUp);
     131    TGPictureButton *list   = new TGPictureButton(frame, pic2, kButListMode);
     132    TGPictureButton *detail = new TGPictureButton(frame, pic3, kButDetailMode);
    134133
    135134    //
    136135    // setup the buttons
    137136    //
    138     fCdup    ->SetToolTipText("One Level up!");
    139     fListMode->SetToolTipText("List Mode");
    140     fDetail  ->SetToolTipText("Details Mode");
    141 
    142     fListMode->SetState(kButtonUp);
    143     fDetail  ->SetState(kButtonEngaged);
    144 
    145     fListMode->AllowStayDown(kTRUE);
    146     fDetail  ->AllowStayDown(kTRUE);
     137    cdup  ->SetToolTipText("One Level up!");
     138    list  ->SetToolTipText("List Mode");
     139    detail->SetToolTipText("Details Mode");
     140
     141    list  ->SetState(kButtonUp);
     142    detail->SetState(kButtonEngaged);
     143
     144    list  ->AllowStayDown(kTRUE);
     145    detail->AllowStayDown(kTRUE);
    147146
    148147    //
    149148    // send messages to 'this' object
    150149    //
    151     fDir     ->Associate(this);
    152     fCdup    ->Associate(this);
    153     fDetail  ->Associate(this);
    154     fListMode->Associate(this);
     150    dir   ->Associate(this);
     151    cdup  ->Associate(this);
     152    detail->Associate(this);
     153    list  ->Associate(this);
    155154
    156155    //
    157156    // Add to list for 'automatic' deletion
    158157    //
    159     fList->Add(fDir);
    160     fList->Add(fCdup);
    161     fList->Add(fListMode);
    162     fList->Add(fDetail);
     158    fList->Add(dir);
     159    fList->Add(cdup);
     160    fList->Add(list);
     161    fList->Add(detail);
    163162
    164163    //
     
    175174    fList->Add(layout);
    176175
    177     frame->AddFrame(fDir,      laydir);
    178     frame->AddFrame(fListMode, layout);
    179     frame->AddFrame(fDetail,  layout);
    180     frame->AddFrame(fCdup,     layout);
     176    frame->AddFrame(dir,    laydir);
     177    frame->AddFrame(list,  layout);
     178    frame->AddFrame(detail, layout);
     179    frame->AddFrame(cdup,   layout);
    181180}
    182181
     
    198197    fFileView->SetViewMode(kLVDetails);
    199198
    200     fFileCont->SetFilter("*");
     199    fFileCont->SetFilter("*.root");
    201200    fFileCont->Associate(this);
    202201    fFileCont->Sort(kSortByName);
     
    210209void MBrowser::CreateTab1()
    211210{
     211    static const char *filters[] =
     212    {
     213        "*.root <root-files>",
     214        "*      <All Files>",
     215        NULL
     216    };
     217
    212218    TGCompositeFrame *frame = CreateNewTab("Input File");
    213219
     
    215221    // Create three frames for the first tab
    216222    //
    217     TGHorizontalFrame *tab1a = new TGHorizontalFrame(frame, 100, 100);
    218     TGHorizontalFrame *tab1b = new TGHorizontalFrame(frame, 100, 100);
    219     TGVerticalFrame   *tab2  = new TGVerticalFrame  (frame, 100, 100);
    220 
    221     TGLayoutHints *laytab1  = new TGLayoutHints(kLHintsNormal|kLHintsExpandX,  10, 10, 10);
    222     TGLayoutHints *laytab2  = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10);
    223     TGLayoutHints *layentry = new TGLayoutHints(kLHintsNormal|kLHintsExpandX); //,  5, 5, 5);
    224 
    225     frame->AddFrame(tab1a, laytab1);
    226     frame->AddFrame(tab1b, laytab1);
    227     frame->AddFrame(tab2,  laytab2);
    228 
    229     fEntry = new TGTextEntry(tab1a, "", kTEFileName);
    230     fEntry->Resize(350, 20);
     223    TGHorizontalFrame *tab1 = new TGHorizontalFrame(frame, 100, 100);
     224    TGVerticalFrame   *tab2 = new TGVerticalFrame  (frame, 100, 100);
     225
     226    TGLayoutHints *laytab1   = new TGLayoutHints(kLHintsNormal|kLHintsExpandX,  10, 10, 10);
     227    TGLayoutHints *laytab2   = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 10, 10, 10, 10);
     228    TGLayoutHints *layfilter = new TGLayoutHints(kLHintsNormal|kLHintsExpandX,  10, 10, 10);
     229
     230    fEntry = new TGTextEntry(frame, "", kTEFileName);
    231231    fEntry->Associate(this);
    232     tab1a->AddFrame(fEntry, layentry);
    233 
    234     CreateDirListMenu(tab1b);
     232
     233    TGComboBox *filter = new TGComboBox(frame, kCBFilter);
     234    filter->SetHeight(fEntry->GetHeight());
     235    filter->Associate(this);
     236    for (int i=0; filters[i]; i++)
     237        filter->AddEntry(filters[i], i);
     238    filter->Select(0);
     239
     240    frame->AddFrame(fEntry, laytab1);
     241    frame->AddFrame(tab1,   laytab1);
     242    frame->AddFrame(filter, layfilter);
     243    frame->AddFrame(tab2,   laytab2);
     244
     245    CreateDirListMenu(tab1);
    235246    CreateDirListBox(tab2);
    236247
    237248    fList->Add(laytab1);
    238249    fList->Add(laytab2);
    239     fList->Add(tab1a);
    240     fList->Add(tab1b);
     250    fList->Add(tab1);
    241251    fList->Add(tab2);
    242     fList->Add(layentry);
     252    fList->Add(layfilter);
    243253    fList->Add(fEntry);
     254    fList->Add(filter);
    244255}
    245256
     
    279290    fInputFile[0] = '\0';
    280291
    281     fList = new TList;
     292    fList = new MGList;
    282293    fList->SetOwner();
    283294
     
    331342MBrowser::~MBrowser()
    332343{
    333     fClient->FreePicture(fPic1);
    334     fClient->FreePicture(fPic2);
    335     fClient->FreePicture(fPic3);
    336 
    337344    delete fList;
    338345}
     
    412419
    413420    const char *dir = fFileCont->GetDirectory();
    414     fDir->Update(dir);
     421
     422    TGFSComboBox *cbox = (TGFSComboBox*)fList->FindWidget(kCBDirectory);
     423    if (cbox)
     424        cbox->Update(dir);
    415425}
    416426
     
    454464    *slash = '\0';
    455465    ChangeDir(fname);
     466}
     467
     468void MBrowser::SetDir()
     469{
     470    TGFSComboBox *cbox = (TGFSComboBox*)fList->FindWidget(kCBDirectory);
     471    if(!cbox)
     472        return;
     473
     474    const TGTreeLBEntry *entry = (TGTreeLBEntry*)cbox->GetSelectedEntry();
     475
     476    ChangeDir(entry->GetPath()->GetString());
     477}
     478
     479void MBrowser::SetFilter()
     480{
     481    //
     482    // Try to get widget from list
     483    //
     484    TGComboBox *filter = (TGComboBox*)fList->FindWidget(kCBFilter);
     485    if (!filter)
     486        return;
     487
     488    //
     489    // Get the selected text from the list box
     490    //
     491    const TGTextLBEntry *selected = (TGTextLBEntry*)filter->GetListBox()->GetSelectedEntry();
     492
     493    const char *txt = StrDup(selected->GetText()->GetString());
     494
     495    //
     496    // find filter and remove leading spaces
     497    //
     498    char *lt = strchr(txt, '<');
     499    if (lt)
     500    {
     501        do *lt-- = '\0';
     502        while (lt>txt && *lt==' ');
     503
     504        //
     505        // Set new filter and refresh the file container
     506        //
     507        fFileCont->SetFilter(txt);
     508        fFileCont->DisplayDirectory();
     509    }
     510
     511    delete [] txt;
     512}
     513
     514void MBrowser::SetViewMode(const Int_t mode)
     515{
     516    fFileView->SetViewMode(mode ? kLVList : kLVDetails);
     517
     518    TGButton *but = (TGButton*)fList->FindWidget(mode);
     519    if(!but)
     520        return;
     521
     522    but->SetState(kButtonUp);
    456523}
    457524
     
    498565
    499566            case kButListMode:
    500                 fFileView->SetViewMode(kLVList);
    501                 fDetail->SetState(kButtonUp);
    502                 return kTRUE;
    503 
    504567            case kButDetailMode:
    505                 fFileView->SetViewMode(kLVDetails);
    506                 fListMode->SetState(kButtonUp);
     568                SetViewMode(parm1);
    507569                return kTRUE;
    508570            }
     
    510572
    511573        case kCM_COMBOBOX:
    512             if (parm1 != kCBDirectory)
    513                 return kTRUE;
    514 
    515             ChangeDir(((TGTreeLBEntry*)fDir->GetSelectedEntry())->GetPath()->GetString());
     574            switch (parm1)
     575            {
     576            case kCBDirectory:
     577                SetDir();
     578                return kTRUE;
     579            case kCBFilter:
     580                SetFilter();
     581                return kTRUE;
     582            }
    516583            return kTRUE;
    517584        }
  • trunk/MagicSoft/Mars/mmain/MBrowser.h

    r1050 r1086  
    1010#endif
    1111
    12 class TList;
     12class MGList;
    1313class TGTab;
    1414class TGListView;
     
    2424    TGTab            *fTabs;
    2525
    26     TGFSComboBox     *fDir;
    2726    TGTextEntry      *fEntry;
    28 
    29     TGPictureButton  *fCdup;
    30     TGPictureButton  *fListMode;
    31     TGPictureButton  *fDetail;
    3227
    3328    TGFileContainer  *fFileCont;
    3429    TGListView       *fFileView;
    35 
    36     const TGPicture  *fPic1;
    37     const TGPicture  *fPic2;
    38     const TGPicture  *fPic3;
    3930
    4031    void CreateMenuBar();
     
    4738    void SetFileName(const char *name);
    4839
     40    void SetFilter();
     41    void SetDir();
     42    void SetViewMode(const Int_t mode);
     43
    4944protected:
    50     TList  *fList;
     45    MGList *fList;
    5146    Char_t  fInputFile[256];
    5247
  • trunk/MagicSoft/Mars/mmain/MCameraDisplay.cc

    r1082 r1086  
    2828#include <TGButton.h>  // TGTextButton
    2929
     30#include "MGList.h"
    3031#include "MGCamDisplay.h"
    3132
     
    3334
    3435enum {
    35     M_BUTTON_DISP
     36    kButDisplay = 0x100
    3637};
    3738
     
    4647: MBrowser(main, p, w, h)
    4748{
    48     TGTextButton *disp = new TGTextButton(fTop2, "Display Events", M_BUTTON_DISP);
     49    TGTextButton *disp = new TGTextButton(fTop2, "Display Events", kButDisplay);
    4950    fList->Add(disp);
    5051
     
    7980    switch (parm1)
    8081    {
    81     case M_BUTTON_DISP:
     82    case kButDisplay:
    8283        if (!InputFileSelected())
    8384        {
     
    8889        switch (parm1)
    8990        {
    90         case M_BUTTON_DISP:
     91        case kButDisplay:
    9192            new MGCamDisplay(fInputFile,
    9293                             fClient->GetRoot(), this, 600, 500);
  • trunk/MagicSoft/Mars/mmain/MDataCheck.cc

    r1082 r1086  
    2828#include <TGButton.h>  // TGTextButton
    2929
     30#include "MGList.h"
     31#include "MFillH.h"
    3032#include "MParList.h"
    3133#include "MTaskList.h"
    3234#include "MEvtLoop.h"
    3335#include "MReadTree.h"
    34 #include "MFillH.h"
    3536#include "MGDisplayAdc.h"
    3637
     
    4041
    4142enum {
    42     kButPedAdc,
    43     kButEvtAdc,
    44     kButPedTdc,
    45     kButEvtTdc
     43    kButPedAdc = 0x100,
     44    kButEvtAdc = 0x101,
     45    kButPedTdc = 0x102,
     46    kButEvtTdc = 0x103
    4647};
    4748
  • trunk/MagicSoft/Mars/mmain/MEvtDisp.cc

    r1082 r1086  
    2828#include <TGButton.h>       // TGTextButton
    2929
     30#include "MGList.h"
    3031#include "MGFadcDisp.h"
    3132
     
    3334
    3435enum {
    35   M_BUT_DISP1_EVT,
    36   M_BUT_DISP1_PED,
    37   M_BUT_DISP1_CAL
     36  kButDispEvt          = 0x100,
     37  kButDispPedestal     = 0x101,
     38  kButDispCalibration  = 0x102
    3839};
    3940
     
    4243: MBrowser(main, p, w, h)
    4344{
    44     TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events",  M_BUT_DISP1_EVT);
    45     TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", M_BUT_DISP1_PED);
    46     TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", M_BUT_DISP1_CAL);
     45    TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events",  kButDispEvt);
     46    TGTextButton *fadcped = new TGTextButton(fTop1, "FADC Disp for PedEvts", kButDispPedestal);
     47    TGTextButton *fadccal = new TGTextButton(fTop1, "FADC Disp for CalEvts", kButDispCalibration);
    4748
    4849    fadcevt->Associate(this);
     
    8283    switch (parm1)
    8384    {
    84     case M_BUT_DISP1_EVT:
    85     case M_BUT_DISP1_PED:
    86     case M_BUT_DISP1_CAL:
     85    case kButDispEvt:
     86    case kButDispPedestal:
     87    case kButDispCalibration:
    8788        if (!InputFileSelected())
    8889        {       
     
    9394        switch (parm1)
    9495        {
    95         case M_BUT_DISP1_EVT:
     96        case kButDispEvt:
    9697            new MGFadcDisp(fInputFile, "Events",
    9798                           fClient->GetRoot(), this, 600, 500);
    9899            return kTRUE;
    99100
    100         case M_BUT_DISP1_PED:
     101        case kButDispPedestal:
    101102            new MGFadcDisp(fInputFile , "PedEvts",
    102103                           fClient->GetRoot(), this, 600, 500);
    103104            return kTRUE;
    104105
    105         case M_BUT_DISP1_CAL:
     106        case kButDispCalibration:
    106107            new MGFadcDisp(fInputFile , "CalEvts",
    107108                           fClient->GetRoot(), this, 600, 500);
  • trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc

    r1082 r1086  
    3535#include <TGButtonGroup.h>  // TGVButtonGroup
    3636
     37#include "MGList.h"
     38
    3739ClassImp(MMonteCarlo)
    3840
    3941enum {
    40     M_BUTTON_COLAREA,
    41     M_BUTTON_RATE,
    42     M_BUTTON_THRESHOLD
     42    kButCollArea  = 0x100,
     43    kButTrigRate  = 0x101,
     44    kButThreshold = 0x102
    4345};
    4446
    4547void MMonteCarlo::AddButtons()
    4648{
    47     TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", M_BUTTON_COLAREA);
    48     TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate",    M_BUTTON_RATE);
    49     TGTextButton *thold = new TGTextButton(fTop2, "Threshold",       M_BUTTON_THRESHOLD);
     49    TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", kButCollArea);
     50    TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate",    kButTrigRate);
     51    TGTextButton *thold = new TGTextButton(fTop2, "Threshold",       kButThreshold);
    5052
    5153    fList->Add(carea);
     
    492494        switch (parm1)
    493495        {
    494         case M_BUTTON_COLAREA:
     496        case kButCollArea:
    495497            CalculateCollectionArea();
    496498            return kTRUE;
    497499
    498         case M_BUTTON_RATE:
     500        case kButTrigRate:
    499501            CalculateTriggerRate();
    500502            return kTRUE;
    501503
    502         case M_BUTTON_THRESHOLD:
     504        case kButThreshold:
    503505            CalculateThreshold();
    504506            return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.