Changeset 1086 for trunk


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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1077 r1086  
    11                                                                  -*-*- END -*-*-
     2
     3 2001/11/16: Thomas Bretz
     4
     5   * mbase/MEvtLoop.cc:
     6     - removed clock.Print()
     7
     8   * mbase/MGList.[cc,h]:
     9     - added support for TGPictures
     10
     11   * mbase/MReadTree.[h,cc]:
     12     - set ReadyToSave-bit only if reading was successfull
     13     - made SetReadyToSave private
     14
     15   * mbase/MTaskList.cc:
     16     - corrected a small bug in the output
     17
     18   * mbase/MWriteRootFile.cc:
     19     - added a workaround in Print (don't know why it fails for me)
     20     - removed fTrees.SetOwner()
     21
     22   * mbase/MTask.cc:
     23     - removed include of TOrdCollection, TMethod
     24     - some changes to the output
     25
     26   * mbase/MParContainer.h:
     27     - removed old comments
     28
     29   * mmain/MAnalysis.cc, mmain/MCameraDisplay.cc, mmain/MDataCheck.cc,
     30     mmain/MEvtDisp.cc, mmain/MMonteCarlo.cc:
     31     - changed Widget IDs to root style enums
     32     - moved enumerations in the range below 0x100
     33
     34   * mmain/MBrowser.[h,cc]:
     35     - removed some of the member variables, accessed via MGList now
     36     - changed TList to MGList
     37     - added a file-filter combo-box
     38
     39   * mars.cc:
     40     - changed output
     41
     42
     43
     44 2001/11/15: Thomas Bretz
     45
     46   * mbase/MArray.cc, mbase/MArrayB.cc,mbase/MArrayS.cc,
     47     mbase/MClone.cc, mbase/MEvtLoop.cc, mbase/MFilter.cc,
     48     mbase/MFilterList.cc, mbase/MGGroupFrame.cc, mbase/MGList.cc,
     49     mbase/MGTask.cc, mbase/MInputStreamID.cc, mbase/MLog.cc,
     50     mbase/MLogManip.cc, mbase/MParContainer.cc, mbase/MParList.cc,
     51     mbase/MPrint.cc, mbase/MReadMarsFile.cc, mbase/MReadTree.cc,
     52     mbase/MTime.cc, mbase/MWriteAsciiFile.cc, mbase/MWriteFile.cc,
     53     mbase/MWriteRootFile.cc, manalysis/MCT1ReadAscii.cc,
     54     manalysis/MCerPhotCalc.cc, manalysis/MHillas.cc,
     55     manalysis/MHillasCalc.cc, manalysis/MMcPedestalCopy.cc,
     56     manalysis/MPedCalcPedRun.cc, manalysis/MPedestalCam.cc,
     57     manalysis/MPedestalPix.cc, manalysis/MCerPhotEvt.cc,
     58     manalysis/MCerPhotPix.cc, manalysis/MImgCleanStd.cc,
     59     manalysis/MImgCleanStd.cc, mdatacheck/MDumlEvtHeader.cc,
     60     mdatacheck/MGDisplayAdc.cc, meventdisp/MGCamDisplay.cc,
     61     meventdisp/MGEvtDisplay.cc, meventdisp/MGFadcDisp.cc,
     62     mfilter/MFTriggerLvl1.cc, mgui/MGeomCam.cc, mgui/MGeomCamMagic.cc,
     63     mgui/MGeomCamCT1.cc, mgui/MgeomPix.cc, mgui/Mhexagon.cc,
     64     hist/MFillH.cc, mhist/MH.cc, mhist/MHFadcCam.cc, mhist/MHFadcPix.cc,
     65     hist/MHHillas.cc, mhist/MHMcCollectionArea.cc, mhist/MHMcEnergy.cc,
     66     mhist/MHMcRate.cc, mhist/MHStarMap.cc, mmain/MAnalysis.cc,
     67     mmain/MBrowser.cc, mmain/MCameraDisplay.cc, mmain/MDataCheck.cc,
     68     mmain/MEvtDisp.cc, mmain/MMars.cc, mmain/MMonteCarlo.cc,
     69     mmontcarlo/MMcCollectionAreaCalc.cc, mmontecarlo/MMcThresholdCalc.cc,
     70     mmontecarlo/MMcTriggerRateCalc.cc, mraw/MrawCrateArray.cc,
     71     mraw/MRawCrateData.cc, mraw/MRawEvtData.cc, mraw/MRawEvtHeader.cc
     72     mraw/MRawEvtPixelIter.cc, mraw/MRawEvtFileRead.cc,
     73     mraw/MRawEvtFileWrite.cc, mraw/MRawEvtRunHeader.cc
     74     - changed mailing address of author according to THtml of root 3.02
     75
     76   * mbase/MClone.cc, mbase/MEvtLoop.cc, mbase/MFilterList.cc,
     77     mbase/MGTask.cc, mbase/MParContainer.cc, mbase/MParList.cc,
     78     mbase/MPrint.cc, mbase/MReadMarsFile.cc, mbase/MReadTree.cc,
     79     mbase/MWriteAsciiFile.cc, mbase/MWriteFile.cc,
     80     mbase/MWriteRootFile.cc, manalysis/MCerPhotEvt.cc,
     81     manalysis/MCerPhotPix.cc, manalysis/MImgCleanStd.cc,
     82     mgui/MGeomCam.cc, mgui/MGeomCamMagic.cc, mgui/MGeomCamCT1.cc,
     83     mgui/MgeomPix.cc, mgui/Mhexagon.cc, hist/MFillH.cc, mhist/MHMcEnergy.cc,
     84     mhist/MHMcRate.cc, mmontcarlo/MMcCollectionAreaCalc.cc,
     85     mmontecarlo/MMcThresholdCalc.cc, mmontecarlo/MMcTriggerRateCalc.cc
     86     mraw/MRawCrateData.cc, mraw/MRawEvtData.cc, mraw/MRawEvtHeader.cc
     87     mraw/MRawEvtPixelIter.cc, mraw/MRawEvtFileRead.cc,
     88     mraw/MRawEvtFileWrite.cc, mraw/MRawEvtRunHeader.cc
     89     - changed output to new style logging (verbosity level introduced)
     90
     91   * mbase/MGTask.h:
     92     - added default to CreateGui
     93
     94   * mbase/MLog.cc
     95     - chnaged comparision between output and debug level from >= to >
     96
     97   * mbase/MLogManip.h:
     98     - added defintions for debug levels
     99
     100   * mbase/MReadTree.[h,cc]:
     101      - added support for filters
     102      - SetReadyToSave added
     103      - Print added
     104
     105   * mbase/MTaskList.[h,cc], MTask.[h,cc]:
     106     - changed TOrCollection to TList, because TList can be stored in a
     107       root file.
     108
     109   * mbase/MTask.[h,cc]:
     110     - added GetFilter function (used in MReadTree)
     111
     112   * manalysis/MImgCleanStd.cc:
     113     - same changed to the GUI layout
     114     - added Print member function
     115
     116   * meventdisp/MGCamDisplay.cc:
     117     - added group frame around some gui elements
     118
     119   * mfilter/MFTriggerLvl1.cc:
     120     - fixed missing Init call
     121     - added missing AddToBranchList call
     122
     123   * mars.cc:
     124     - added command line option to set the verbosity level
     125
     126   * merpp.cc:
     127     - added setup for highest verbosity level
     128
     129
     130
    2131 2001/11/14: Thomas Bretz
    3132
  • trunk/MagicSoft/Mars/NEWS

    r1033 r1086  
    11                                                               -*-*- END -*-*-
    22
    3  *** Version 0.5
     3 *** Version 0.6
     4
     5   - Introduced verbosity levels
     6
     7   - Introduced a task (MReadMarsFile) which reads the RunHeader tree, too.
     8
     9   - Fixed several bugs in MFTriggerLvl1 which caused to filter not to
     10     work correctly (thanks to Abelardo)
     11
     12
     13
     14 *** Version 0.5 (2001/11/06)
    415
    516   - Added new GUI functionality (Analysis)
  • trunk/MagicSoft/Mars/mars.cc

    r1082 r1086  
    3232int main(int argc, char **argv )
    3333{
    34     gLog << all;
     34    gLog << all << endl;
    3535
    3636    //                1         2         3         4         5
    3737    //       12345678901234567890123456789012345678901234567890
    3838    gLog << "==================================================" << endl;
    39     gLog << "                    MARS v0.5                     " << endl;
     39    gLog << "                    MARS V0.6                     " << endl;
    4040    gLog << "    Magic Analysis and Reconstruction Software    " << endl;
    4141    gLog << "            Compiled on <" << __DATE__ << ">"       << endl;
     
    106106    app.Run();
    107107
     108    gLog << all << endl;
     109
    108110    return 0;
    109111}
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r1080 r1086  
    221221    *fLog << all << "Ready!" << endl << endl;
    222222
    223     clock.Print();
    224 
    225223    *fLog << dec << endl << "CPU  - "
    226224        << "Time: " << clock.CpuTime() << "s"
  • trunk/MagicSoft/Mars/mbase/MGList.cc

    r1080 r1086  
    3838
    3939#include <TClass.h>
     40#include <TGClient.h>
    4041#include <TGWidget.h>
     42#include <TGPicture.h>
    4143
    4244
    4345ClassImp(MGList);
     46
     47// --------------------------------------------------------------------------
     48//
     49//  Before destroying the list with all its contents free all TGPicture
     50//  objects in the list.
     51//
     52#include <TRefCnt.h>
     53
     54MGList::~MGList()
     55{
     56    TObject *obj;
     57    TIter Next(this);
     58    while ((obj=Next()))
     59    {
     60        if (!obj->InheritsFrom(TGPicture::Class()))
     61            continue;
     62
     63        //
     64        // Remove the object first. Otherwise we would remove
     65        // a non existing object...
     66        //
     67        Remove(obj);
     68        gClient->FreePicture((TGPicture*)obj);
     69    }
     70}
    4471
    4572// --------------------------------------------------------------------------
     
    137164// --------------------------------------------------------------------------
    138165//
     166//  Adds the picture physically to the list. The list takes care of that
     167//   - The picture is freed as often as it was retrieved from gClient
     168//
     169void MGList::AddPicture(const TGPicture *pic)
     170{
     171    //
     172    // Check whether the picture exists
     173    //
     174    if (!pic)
     175    {
     176        cout << "Warning: Requested picture not found... ignored." << endl;
     177        return;
     178    }
     179
     180    //
     181    // Add the picture to the list
     182    //
     183    TList::Add(const_cast<TGPicture*>(pic));
     184}
     185
     186// --------------------------------------------------------------------------
     187//
     188//  This gets a picture from the picture pool of the TGClient-object.
     189//  The pictures are freed automatically in the dstructor of the list.
     190//  The picture counts itself how often it got used, so that only
     191//  the first call to GetPicture will craete it and the last call to
     192//  FreePicture will destroy it. If you access the picture only via
     193//  MGList::GetPicture you don't have to care about.
     194//
     195//  Don't try to call FreePicture by yourself for a picture gotten by
     196//  GetPicture. This is independant of the kIsOwner bit.
     197//
     198const TGPicture *MGList::GetPicture(const char *name)
     199{
     200    const TGPicture *pic = gClient->GetPicture(name);
     201    AddPicture(pic);
     202    return pic;
     203}
     204
     205// --------------------------------------------------------------------------
     206//
     207//  This gets a picture from the picture pool of the TGClient-object.
     208//  The pictures are freed automatically in the dstructor of the list.
     209//  The picture counts itself how often it got used, so that only
     210//  the first call to GetPicture will craete it and the last call to
     211//  FreePicture will destroy it. If you access the picture only via
     212//  MGList::GetPicture you don't have to care about.
     213//
     214//  Don't try to call FreePicture by yourself for a picture gotten by
     215//  GetPicture. This is independant of the kIsOwner bit.
     216//
     217const TGPicture *MGList::GetPicture(const char *name, Int_t width, Int_t height)
     218{
     219    const TGPicture *pic = gClient->GetPicture(name, width, height);
     220    AddPicture(pic);
     221    return pic;
     222}
     223// --------------------------------------------------------------------------
     224//
    139225//  Search the list for a object derived from TGidget which has the given
    140226//  widget id. Returns a pointer to this object otherwise NULL.
  • trunk/MagicSoft/Mars/mbase/MGList.h

    r1076 r1086  
    77
    88class TGWidget;
     9class TGPicture;
    910
    1011class MGList : public TList
     
    1415    Bool_t    IsExisting(TObject *obj) const;
    1516
     17    void      AddPicture(const TGPicture *pic);
     18
    1619public:
    1720    MGList() : TList() {}
     21    virtual ~MGList();
    1822
    1923    void Add(TObject *obj);
    2024    void Add(TObject *obj, Option_t *opt);
    2125
     26    const TGPicture *GetPicture(const char *name);
     27    const TGPicture *GetPicture(const char *name, Int_t width, Int_t height);
    2228
    2329    TObject *FindWidget(Int_t id) const;
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r1077 r1086  
    2222class ofstream;
    2323class ifstream;
    24 /*
    25 class MParContainer : public TObject
    26 {
    27 private:
    28     void Init(const char *name, const char *title)
    29     {
    30         fName = new TString;
    31         (*fName) = name;
    32         fTitle = new TString;
    33         (*fTitle) = title;
    34 
    35         cout << " <***> " << flush;
    36     }
    37 
    38 protected:
    39     MLog    *fLog;         //! The general log facility for this object, initialized with the global object
    40 
    41     TString *fName;        //! parameter container identifier (name)
    42     TString *fTitle;       //! parameter container title
    43 
    44     Bool_t   fReadyToSave; //! should be set to true if the contents of the container is changed somehow
    45 
    46 public:
    47     MParContainer(const char *name="", const char *title="") : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
    48     MParContainer(const TString &name, const TString &title) : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
    49     MParContainer(const MParContainer &named);
    50     MParContainer& operator=(const MParContainer& rhs);
    51 
    52     void SetLogStream(MLog *lg) { fLog = lg; }
    53 
    54     virtual ~MParContainer() {
    55       //delete fName; delete fTitle;
    56     }
    57     virtual TObject *Clone(const char *newname) const;
    58     virtual Int_t    Compare(const TObject *obj) const;
    59     virtual void     Copy(TObject &named);
    60     virtual void     FillBuffer(char *&buffer);
    61     virtual const char  *GetName() const {return fName->Data();}
    62     virtual const char  *GetTitle() const {return fTitle->Data();}
    63     virtual ULong_t  Hash() { return fName->Hash(); }
    64     virtual Bool_t   IsSortable() const { return kTRUE; }
    65     virtual void     SetName(const char *name); // *MENU*
    66     virtual void     SetObject(const char *name, const char *title);
    67     virtual void     SetTitle(const char *title=""); // *MENU*
    68     virtual void     ls(Option_t *option="") const;
    69     virtual void     Print(Option_t *option="") const;
    70     virtual Int_t    Sizeof() const;
    71 
    72     virtual void     Reset() {};
    73 
    74     virtual Bool_t IsReadyToSave() { return fReadyToSave; }
    75     virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
    76 
    77     virtual void AsciiRead(ifstream &fin);
    78     virtual void AsciiWrite(ofstream &fout) const;
    79 
    80     ClassDef(MParContainer, 0)  //The basis for all parameter containers
    81 };
    82 */
    8324
    8425class MParContainer : public TObject
  • trunk/MagicSoft/Mars/mbase/MReadTree.h

    r1084 r1086  
    2424    TList  *fNotify;           // List of TObjects to notify when switching files
    2525
    26     TGProgressBar *fProgress;  // Possible display of status
     26    TGProgressBar  *fProgress; //! Possible display of status
    2727
    2828    void SetBranchStatus(const TList *list, Bool_t status);
     
    3232    void EnableBranches(MParList *plist);
    3333    void EnableBranchChoosing();
     34
     35    virtual void SetReadyToSave(Bool_t flag=kTRUE);
    3436
    3537    enum { kIsOwner = BIT(14) };
     
    5860    virtual void   AddNotify(TObject *obj);
    5961    virtual void   SetOwner(Bool_t flag=kTRUE);
    60     virtual void   SetReadyToSave(Bool_t flag=kTRUE);
    6162    virtual void   Print(Option_t *opt="") const;
    6263
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r1084 r1086  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2001
     
    6767#include "MTask.h"
    6868
    69 #include <TMethod.h>
    70 #include <TOrdCollection.h>
    71 
    7269#include "MLog.h"
    7370#include "MLogManip.h"
     
    227224void MTask::PrintStatistics(const Int_t lvl) const
    228225{
    229     *fLog << setw(lvl) << " " << GetDescriptor() << "\t";
     226    *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t";
    230227    *fLog << dec << fNumExecutions << endl;
    231228}
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1084 r1086  
    240240    }
    241241
    242     *fLog << endl;
     242    *fLog << all << endl;
    243243
    244244    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc

    r1080 r1086  
    7272    //
    7373    fBranches.SetOwner();
    74     fTrees.SetOwner();
     74
     75    //
     76    // Believing the root user guide, TTree instanced are owned by the
     77    // directory (file) in which they are. This means we don't have to
     78    // care about their destruction.
     79    //
     80    //fTrees.SetOwner();
    7581
    7682    //
     
    118124void MWriteRootFile::Print(Option_t *) const
    119125{
    120     cout << all << " File: " << GetFileName() << endl;
    121     cout << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl;
    122 
    123     TTree *t;
     126    *fLog << all << " File: " << GetFileName() << endl;
     127    *fLog << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl;
     128    *fLog << setfill(' '); // FIXME: not resetting setfill results in strange output???
     129
     130    TTree *t = NULL;
    124131    TIter Next(&fTrees);
    125132    while ((t=(TTree*)Next()))
    126         cout << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
     133        *fLog << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
    127134}
    128135
  • 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.